@worm-vue3-print/canvas 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),he=require("@worm-vue3-print/core"),E=require("@worm-vue3-print/core/designer"),se=require("lucide-vue-next"),He=require("@worm-vue3-print/core/browser"),At=require("jsbarcode"),Pt=require("qrcode"),jt=require("dompurify"),Rt=Symbol("selected-ids"),Lt=Symbol("preview-ids");function Xt(t){const r=e.ref(new Set),o=e.ref(new Set),s=e.computed(()=>t.value.filter(g=>r.value.has(g.id))),n=e.computed(()=>r.value.size>0);function l(g,h=!1){if(h){const R=new Set(r.value);R.has(g)?R.delete(g):R.add(g),r.value=R}else r.value=new Set([g])}function a(){r.value=new Set}function i(g){r.value=new Set(g)}function d(g){o.value=new Set(g)}function m(){o.value=new Set}function c(){r.value=new Set(o.value),o.value=new Set}function f(){const g=s.value;if(g.length===0)return null;let h=1/0,R=1/0,w=-1/0,v=-1/0;return g.forEach(p=>{h=Math.min(h,p.options.left),R=Math.min(R,p.options.top),w=Math.max(w,p.options.left+p.options.width),v=Math.max(v,p.options.top+p.options.height)}),{left:h,top:R,width:w-h,height:v-R}}return{selectedIds:r,selectedElements:s,hasSelection:n,select:l,clearSelection:a,selectAll:i,getSelectionBounds:f,previewIds:o,setPreview:d,clearPreview:m,commitPreview:c}}function Zt(){const t=e.ref(null);function r(n){t.value=n.map(l=>({options:{...l.options},printElementType:{...l.printElementType}}))}function o(n=10){if(!t.value)return null;const l=new Map;for(const i of t.value){const d=i.options.groupId;d&&l.set(d,(l.get(d)??0)+1)}const a=new Map;for(const[i,d]of l)a.set(i,d>=2?E.generateGroupId():void 0);return t.value.map(i=>({id:E.generateId(),options:{...i.options,left:i.options.left+n,top:i.options.top+n,groupId:i.options.groupId?a.get(i.options.groupId):void 0},printElementType:{...i.printElementType}}))}function s(){return t.value!==null&&t.value.length>0}return{clipboard:t,copy:r,paste:o,hasData:s}}function Jt(t){const o=e.ref([]),s=e.ref([]),n=e.ref(!1),l=e.ref(!1);function a(){n.value=o.value.length>0,l.value=s.value.length>0}function i(h){const R={elements:JSON.parse(JSON.stringify(h?.elements??[])),templateData:JSON.parse(JSON.stringify(h?.templateData??{}))};return h?.pages&&(R.pages=JSON.parse(JSON.stringify(h.pages)),h.activePageIndex!==void 0&&(R.activePageIndex=h.activePageIndex)),R}function d(h){return i(h)}function m(h){o.value.push(d(h)),s.value=[],o.value.length>50&&o.value.shift(),a()}function c(h){if(o.value.length===0)return null;const R=o.value.pop();return s.value.push(h?d(h):i(R)),a(),o.value.length>0?i(o.value[o.value.length-1]):null}function f(h){if(s.value.length===0)return null;const R=s.value.pop();return o.value.push(h?d(h):i(R)),a(),i(R)}function g(){o.value=[],s.value=[],a()}return{push:m,undo:c,redo:f,canUndo:n,canRedo:l,clear:g}}const mt="开启拼版后只能有一个设计页面";function Ue(){return{paperSize:"A4",orientation:"portrait",unit:"mm",margins:{top:10,right:10,bottom:10,left:10},header:{height:10,elements:[]},footer:{height:10,elements:[]},firstPageOverlay:{height:0,elements:[]},elements:[],watermark:{}}}function Ze(t){const r=(o,s)=>(o??[]).map(n=>{const l={...n.options};return(n.printElementType?.type??n.type)==="table"&&E.syncTableElementSize(l),{id:n.id||E.generateId(),zone:s,options:l,printElementType:{...n.printElementType}}});return{...t,margins:{...t.margins},header:{height:t.header?.height??10,elements:[]},footer:{height:t.footer?.height??10,elements:[]},firstPageOverlay:{height:t.firstPageOverlay?.height??0,elements:[...t.firstPageOverlay?.elements??[]]},guides:[...t.guides??[]],elements:[...r(t.elements??[],"content"),...r(t.header?.elements??[],"header"),...r(t.footer?.elements??[],"footer")]}}function kt(t){const r=(s,n)=>{const l=Ze(E.normalizeTemplateUnits(s));return l.name||(l.name=`页面 ${n+1}`),l};if(!t)return[r(Ue(),0)];const o=Array.isArray(t.pages)?t.pages:[t];return o.length?o.map(r):[r(Ue(),0)]}function Vt(t){const r=t.elements,o=s=>r.filter(n=>(n.zone||"content")===s).map(n=>({id:n.id,type:n.printElementType.type,options:{...n.options},printElementType:{...n.printElementType}}));return{unit:"mm",...t,header:{...t.header,elements:o("header")},footer:{...t.footer,elements:o("footer")},firstPageOverlay:{...t.firstPageOverlay,elements:(t.firstPageOverlay?.elements??[]).map(s=>({id:s.id||E.generateId(),type:s.printElementType?.type||"text",options:{...s.options},printElementType:{...s.printElementType}}))},elements:o("content"),guides:[...t.guides??[]]}}function Qt(t={}){const r=e.ref(100),o=e.ref(!0),s=e.ref(!0),n=e.ref(!1),l=e.ref(!0),a=e.ref(kt(t.initialTemplate)),i=e.ref(0),d=e.ref(a.value[0]??Ze(Ue())),m=e.computed(()=>a.value.some(I=>I.tiling?.enabled===!0));function c(){return m.value?(alert(mt),!0):!1}function f(){a.value[i.value]=d.value}function g(I){I<0||I>=a.value.length||(f(),i.value=I,d.value=a.value[I],me())}const h=e.computed({get:()=>d.value.elements,set:I=>{d.value.elements=I}}),R=e.ref(t.initialFields||[]),{selectedIds:w,selectedElements:v,select:p,clearSelection:B,selectAll:Q,previewIds:ae,setPreview:K,clearPreview:Z,commitPreview:y}=Xt(h),{group:W,ungroup:X,getGroupedIds:U}=E.useGroup(),{copy:k,paste:D,hasData:N}=Zt(),{align:F}=E.useAlign(),{push:A,undo:V,redo:T,canUndo:u,canRedo:S}=Jt(),Y=e.computed(()=>{if(w.value.size===0)return null;const I=w.value.values().next().value;return h.value.find(le=>le.id===I)||null}),Ee=e.ref(null);function fe(I){Ee.value=I}function me(){B(),fe(null)}function ge(){return{elements:h.value.map(I=>({id:I.id,zone:I.zone,options:JSON.parse(JSON.stringify(I.options)),printElementType:{...I.printElementType}})),templateData:{paperSize:d.value.paperSize,orientation:d.value.orientation,outputRotation:d.value.outputRotation,margins:{...d.value.margins},header:{height:d.value.header.height,elements:[]},footer:{height:d.value.footer.height,elements:[]},firstPageOverlay:{height:d.value.firstPageOverlay.height,elements:[]},elements:[],customWidth:d.value.customWidth,customHeight:d.value.customHeight,watermark:d.value.watermark?{...d.value.watermark}:void 0,guides:[...d.value.guides??[]]},pages:JSON.parse(JSON.stringify(a.value)),activePageIndex:i.value}}function L(){A(ge())}function x(I){return I.pages?.[I.activePageIndex??0]?.elements??I.elements}function $(){const I=V(ge());I?.pages?(a.value=I.pages,i.value=I.activePageIndex??0,d.value=a.value[i.value]??a.value[0],me()):I?.templateData&&(d.value={...I.templateData,elements:I.elements})}function G(){const I=T(ge());I?.pages?(a.value=I.pages,i.value=I.activePageIndex??0,d.value=a.value[i.value]??a.value[0],me()):I?.templateData&&(d.value={...I.templateData,elements:I.elements})}function b(){k(v.value)}function C(){k(v.value),te()}function M(){const I=D();I&&I.length>0&&(h.value.push(...I),L())}function ee(){k(v.value);const I=D();I&&I.length>0&&(I.forEach(le=>{le.options.left+=5,le.options.top+=5}),h.value.push(...I),p(I[0].id,!1),L())}function oe(){r.value=100}const ie=e.computed(()=>N());let ve=!1,P=null;const H=300;function j(I,le){const re=v.value.filter(Ne=>!Ne.options.locked);re.length!==0&&(re.forEach(Ne=>{Ne.options.left+=I,Ne.options.top+=le}),ve||(ve=!0,L()),P&&clearTimeout(P),P=setTimeout(()=>{ve=!1,P=null},H))}function ne(){Q(h.value.map(I=>I.id))}function _(I){F(v.value,I),L()}function be(I,le=!1){if(le){p(I,!0);return}w.value=new Set(U(h.value,I))}function O(){h.value=W(h.value,w.value),L()}function z(){h.value=X(h.value,w.value),L()}function te(){w.value.size!==0&&(h.value=h.value.filter(I=>!w.value.has(I.id)),B(),L())}const{setup:pe,cleanup:ke}=E.useKeyboard({onMove:j,onDelete:te,onCopy:b,onPaste:M,onSelectAll:ne,onUndo:$,onRedo:G,onDuplicate:ee,onResetZoom:oe,onAlignLeft:()=>_("left"),onAlignRight:()=>_("right"),onAlignCenterH:()=>_("vertical"),onAlignTop:()=>_("top"),onAlignBottom:()=>_("bottom"),onGroup:O,onUngroup:z});let Ve=null;function De(){Ve=ge()}function _e(){if(!Ve)return;const I=new Map(Ve.elements.map(ye=>[ye.id,ye]));let le=!1;for(const ye of h.value){const Be=I.get(ye.id);if(!Be)continue;(Be.options.left!==ye.options.left||Be.options.top!==ye.options.top||Be.options.width!==ye.options.width||Be.options.height!==ye.options.height)&&E.finalizeElementZone(ye,d.value).rejected&&(le=!0)}le&&alert("该元素类型不能放入页眉/页脚");const re=ye=>`${ye.id}:${ye.zone||"content"}:${ye.options.left},${ye.options.top},${ye.options.width},${ye.options.height}`,Ne=x(Ve).map(re).join("|"),xe=x(ge()).map(re).join("|");Ve=null,Ne!==xe&&L()}function Ke(I,le){const re=E.zoneFromPaperPoint(d.value,le.x,le.y);if(re!=="content"&&!E.ZONE_ALLOWED_TYPES.includes(I.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const Ne=E.getZoneRects(d.value)[re];return I.zone=re,I.options.left=le.x-Ne.left,I.options.top=le.y-Ne.top,re!=="content"&&E.clampToZone(I,Ne),!0}function et(I,le){const re=E.createRuntimeElement(I);le&&!Ke(re,le)||(h.value.push(re),p(re.id,!1),L())}function tt(I,le){const re=E.createFieldElement(I);le&&!Ke(re,le)||(h.value.push(re),p(re.id,!1),L())}function ot(I){if(w.value.size===0)return;const le=w.value.values().next().value,re=h.value.find(Re=>Re.id===le);if(!re)return;const Ne=re.options.zIndex??0,xe=h.value.map(Re=>Re.options.zIndex??0),ye=Math.max(...xe,0),Be=Math.min(...xe,0);switch(I){case"top":re.options.zIndex=ye+1;break;case"bottom":re.options.zIndex=Be-1;break;case"up":re.options.zIndex=Ne+1;break;case"down":re.options.zIndex=Ne-1;break}L()}function nt(I,le){const{width:re,height:Ne}=E.getPaperDimensions(d.value),xe=96/25.4;r.value=E.computeFitScale(I,le,re*xe,Ne*xe)}function lt(I){if(d.value={...I},a.value[i.value]=d.value,a.value.length>1){const le={paperSize:I.paperSize,orientation:I.orientation,outputRotation:I.outputRotation,customWidth:I.customWidth,customHeight:I.customHeight};for(const re of a.value)Object.assign(re,le)}L()}function Ie(){return f(),a.value.length<=1?Vt(a.value[0]):{version:1,pages:a.value.map(Vt)}}function Ae(I,le){a.value=kt(I),i.value=0,d.value=a.value[0],le&&(d.value={...d.value,elements:le.map(re=>({...re,id:re.id||E.generateId(),zone:re.zone||"content",options:{...re.options},printElementType:{...re.printElementType}}))},a.value[i.value]=d.value),A(ge())}function ze(){const I=new Set(a.value.map(re=>re.name));let le=a.value.length+1;for(;I.has(`页面 ${le}`);)le++;return`页面 ${le}`}function Pe(){if(c())return;f();const I=a.value[i.value]??Ue(),le=Ze({...Ue(),paperSize:I.paperSize,orientation:I.orientation,customWidth:I.customWidth,customHeight:I.customHeight,name:ze()});a.value.push(le),i.value=a.value.length-1,d.value=le,me(),L()}function at(){if(c())return;f();const I=a.value[i.value],le=JSON.parse(JSON.stringify(I));le.name=`${I.name??`页面 ${i.value+1}`} 副本`,le.elements=le.elements.map(re=>({...re,id:E.generateId()})),le.firstPageOverlay={...le.firstPageOverlay,elements:(le.firstPageOverlay?.elements??[]).map(re=>({...re,id:E.generateId()}))},a.value.splice(i.value+1,0,le),g(i.value+1),L()}function it(I){a.value.length<=1||(f(),a.value.splice(I,1),I<i.value?i.value--:I===i.value&&i.value>=a.value.length&&(i.value=a.value.length-1),d.value=a.value[i.value],me(),L())}function qe(I,le){a.value[I]&&(a.value[I].name=le)}function rt(I,le){if(I===le)return;f();const[re]=a.value.splice(I,1);a.value.splice(le,0,re),i.value=le,d.value=re,me(),L()}return A(ge()),e.onMounted(()=>pe()),e.onUnmounted(()=>{ke(),P&&(clearTimeout(P),P=null)}),{scale:r,showRuler:o,showGrid:s,snapToGrid:n,showTableGhostBorder:l,templateData:d,elements:h,fields:R,tilingEnabled:m,pages:a,activePageIndex:i,switchPage:g,addPage:Pe,duplicatePage:at,deletePage:it,renamePage:qe,movePage:rt,selectedIds:w,selectedElements:v,selectedElement:Y,select:p,selectElement:be,clearSelection:B,selectAll:ne,previewIds:ae,setPreview:K,clearPreview:Z,commitPreview:y,hasClipboard:ie,copy:b,paste:M,cutSelected:C,tableSelection:Ee,setTableSelection:fe,canUndo:u,canRedo:S,undo:$,redo:G,recordHistory:L,alignSelected:_,groupSelected:O,ungroupSelected:z,deleteSelected:te,duplicateSelected:ee,resetZoom:oe,dragStart:De,dragStop:_e,addElement:et,addFieldElement:tt,moveLayer:ot,fitToWindow:nt,updateTemplateData:lt,getTemplateJson:Ie,loadTemplate:Ae}}const Se=Symbol("mixed"),pt=new Set(["text","longText"]);function _t(t){const{elements:r,selectedIds:o,tableSelection:s,recordHistory:n}=t,l=e.computed(()=>r.value.filter(N=>o.value.has(N.id)&&!N.options.locked)),a=e.computed(()=>{const N=s.value;return N?r.value.find(F=>F.id===N.elementId)??null:null}),i=e.computed(()=>s.value&&a.value?"cells":l.value.length>0||o.value.size>0?"elements":"none"),d=e.computed(()=>{const N=s.value,F=a.value?.options.tableRows;if(!N||!F)return[];const A=[];for(let V=N.r1;V<=N.r2;V++)for(let T=N.c1;T<=N.c2;T++){const u=F[V]?.cells[T];u&&!u.merged&&A.push(u)}return A}),m=e.computed(()=>l.value.filter(N=>pt.has(N.printElementType.type))),c=e.computed(()=>i.value==="cells"?d.value.length>0:i.value!=="elements"?!1:l.value.length>0&&m.value.length===l.value.length),f=e.computed(()=>i.value==="cells"?d.value:m.value.map(N=>N.options));function g(N){if(!N.length)return;const F=N[0];return N.every(A=>A===F)?F:Se}const h=(N,F)=>(N??"").split(/\s+/).includes(F),R=e.computed(()=>{const N=f.value;if(!N.length)return{fontFamily:void 0,fontSize:void 0,color:void 0,backgroundColor:void 0,textAlign:void 0,verticalAlign:void 0,bold:!1,underline:!1,strike:!1};const F=N.map(V=>V.fontWeight==="bold"||V.fontWeight==="bolder"),A=N.map(V=>V.textDecoration);return{fontFamily:g(N.map(V=>V.fontFamily)),fontSize:g(N.map(V=>V.fontSize)),color:g(N.map(V=>V.color)),backgroundColor:g(N.map(V=>V.backgroundColor)),textAlign:g(N.map(V=>i.value==="cells"?V.align:V.textAlign)),verticalAlign:g(N.map(V=>i.value==="cells"?V.valign:V.verticalAlign)),bold:F.every(Boolean)?!0:F.some(Boolean)?Se:!1,underline:A.map(V=>h(V,"underline")).every(Boolean)?!0:A.some(V=>h(V,"underline"))?Se:!1,strike:A.map(V=>h(V,"line-through")).every(Boolean)?!0:A.some(V=>h(V,"line-through"))?Se:!1}});function w(N){const F=d.value;F.length&&(F.forEach(N),n())}function v(N){if(i.value==="cells"){w(S=>{"fontFamily"in N&&(S.fontFamily=N.fontFamily),"fontSize"in N&&(S.fontSize=N.fontSize),"color"in N&&(S.color=N.color),"backgroundColor"in N&&(S.backgroundColor=N.backgroundColor),"textAlign"in N&&(S.align=N.textAlign),"verticalAlign"in N&&(S.valign=N.verticalAlign)});return}const F=m.value,A=l.value,T=["fontFamily","fontSize","color","textAlign","verticalAlign"].some(S=>S in N),u="backgroundColor"in N;!(F.length&&T)&&!(A.length&&u)||(F.forEach(S=>{const Y=S.options;"fontFamily"in N&&(Y.fontFamily=N.fontFamily),"fontSize"in N&&(Y.fontSize=N.fontSize),"color"in N&&(Y.color=N.color),"textAlign"in N&&(Y.textAlign=N.textAlign),"verticalAlign"in N&&(Y.verticalAlign=N.verticalAlign)}),u&&A.forEach(S=>{S.options.backgroundColor=N.backgroundColor}),n())}function p(){if(i.value==="cells"){const A=R.value.bold!==!0;w(V=>{V.fontWeight=A?"bold":void 0});return}const N=R.value.bold!==!0,F=m.value;F.length&&(F.forEach(A=>{A.options.fontWeight=N?"bold":"normal"}),n())}function B(N){if(i.value==="cells")return;const F=m.value;if(!F.length)return;const A=R.value[N==="underline"?"underline":"strike"]!==!0;F.forEach(V=>{const T=(V.options.textDecoration??"").split(/\s+/).filter(Boolean),u=T.indexOf(N);A&&u<0&&T.push(N),!A&&u>=0&&T.splice(u,1),V.options.textDecoration=T.length?T.join(" "):void 0}),n()}const Q=()=>B("underline"),ae=()=>B("line-through");function K(N,F){const A=l.value;A.length&&(A.forEach(V=>{V.options.borders=void 0,N==="none"?V.options.borderWidth=0:(V.options.borderWidth=F.width,V.options.borderStyle=F.style,V.options.borderColor=F.color)}),n())}function Z(N,F){const A=s.value,V=a.value?.options.tableRows;!A||!V||(E.applyBorderPreset(V,{r1:A.r1,c1:A.c1,r2:A.r2,c2:A.c2},N,F),n())}function y(N,F,A){w(V=>{const T={...V.borders??{}};for(const u of N)A?T[u]={...F}:delete T[u];V.borders=T})}const W=["top","right","bottom","left"],X=e.computed(()=>{if(i.value!=="cells")return null;const N=d.value;if(!N.length)return null;const F={};for(const A of W){const V=N.map(T=>!!T.borders?.[A]);F[A]=V.every(Boolean)?!0:V.some(Boolean)?Se:!1}return F});function U(N,F){const A=X.value?.[N]!==!0;y([N],F,A)}const k=e.computed(()=>{if(i.value!=="elements")return null;const N=l.value;if(!N.length)return null;const F={};for(const A of W){const V=N.map(T=>!!T.options.borders?.[A]);F[A]=V.every(Boolean)?!0:V.some(Boolean)?Se:!1}return F});function D(N,F){const A=l.value;if(!A.length)return;const V=k.value?.[N]!==!0;A.forEach(T=>{const u={...T.options.borders??{}};V?u[N]={width:F.width,style:F.style,color:F.color}:delete u[N],T.options.borders=u}),n()}return{context:i,fontEditable:c,values:R,applyStyle:v,toggleBold:p,toggleUnderline:Q,toggleStrike:ae,applyElementBorder:K,applyCellBorderPreset:Z,applyCellBorderEdges:y,cellEdges:X,toggleCellEdge:U,elementEdges:k,toggleElementEdge:D}}const eo=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];function to(t){const{elements:r,selectedIds:o,recordHistory:s}=t,n=e.ref(!1),l=e.ref(!1),a=e.ref(null);let i=null;const d=e.computed(()=>r.value.filter(w=>o.value.has(w.id)&&!w.options.locked)),m=e.computed(()=>d.value.length===1);function c(w){if(!w)return;const v={};for(const p of E.ELEMENT_BORDER_SIDES){const B=w[p];B&&(v[p]={...B})}return v}function f(w=!1){const v=d.value[0];if(!v)return!1;const p=v.options,B=v.printElementType.type;return i={text:pt.has(B)?Object.fromEntries(eo.map(Q=>[Q,p[Q]])):null,backgroundColor:p.backgroundColor,border:E.acceptsElementBorder(B)?{borderWidth:p.borderWidth,borderStyle:p.borderStyle,borderColor:p.borderColor,borders:c(p.borders)}:null},a.value=v.id,n.value=!0,l.value=w,!0}function g(){n.value=!1,l.value=!1,a.value=null,i=null}function h(w){const v=i;if(!v||w.options.locked||w.id===a.value)return!1;const p=w.options,B=w.printElementType.type;return v.text&&pt.has(B)&&Object.assign(p,v.text),p.backgroundColor=v.backgroundColor,v.border&&E.acceptsElementBorder(B)&&(p.borderWidth=v.border.borderWidth,p.borderStyle=v.border.borderStyle,p.borderColor=v.border.borderColor,p.borders=c(v.border.borders)),!0}e.watch(o,()=>{if(!n.value||!i)return;const w=d.value;if(!w.length){g();return}let v=!1;w.forEach(p=>{v=h(p)||v}),v&&(s(),l.value||g())});function R(w){if(w.key!=="Escape"||!n.value)return;const v=w.target?.tagName;v==="INPUT"||v==="TEXTAREA"||v==="SELECT"||g()}return document.addEventListener("keydown",R),e.onScopeDispose(()=>document.removeEventListener("keydown",R)),{active:n,locked:l,sourceId:a,capturable:m,capture:f,cancel:g}}let Nt=0;function oo(){return Nt+=1,`guide-${Nt}`}function no(t,r){const o=e.computed(()=>t.value.guides??[]);function s(d){t.value={...t.value,guides:d([...t.value.guides??[]])},r()}function n(d,m){s(c=>(c.push({type:d,position:m,id:oo()}),c))}function l(d,m){s(c=>c.map(f=>f.id===d?{...f,position:m}:f))}function a(d){s(m=>m.filter(c=>c.id!==d))}function i(){const d=[],m=[];for(const c of o.value)c.type==="vertical"?d.push(c.position):m.push(c.position);return{vertical:d,horizontal:m}}return{guides:o,addGuide:n,moveGuide:l,removeGuide:a,getGuidePositions:i}}const Ge=Symbol("table-edit"),vt=Symbol("print-upload-image"),ft=Symbol("print-upload-design-background"),gt=Symbol("print-font-catalog"),lo=e.computed(()=>[]);function ao(t){return{catalog:e.computed(()=>{const o=[],s=new Set;for(const n of e.toValue(t)??[]){const l=n?.family?.trim();if(!l)continue;const a=l.toLowerCase();if(s.has(a))continue;s.add(a);const i=n.label?.trim();o.push(i?{family:l,label:i}:{family:l})}return o})}}function io(){return e.inject(gt,lo)}function wt(t,r){const o=r?.trim().toLowerCase();if(o)return t.find(s=>s.family.trim().toLowerCase()===o)}function Ct(t){return t.label?`${t.label}(${t.family})`:t.family}function We(t){return t.toLowerCase().replace(/\s+/g,"")}function St(t,r){if(t===r)return 0;if(t.startsWith(r))return 1;if(t.includes(r))return 2;let o=0;for(const s of t)if(s===r[o]&&o++,o===r.length)return 3;return-1}function ro(t,r){const o=We(r.trim());return o?t.map((s,n)=>({font:s,index:n,rank:so(s,o)})).filter(s=>s.rank>=0).sort((s,n)=>s.rank-n.rank||s.index-n.index).map(s=>s.font):[...t]}function so(t,r){const o=St(We(t.family),r);if(!t.label)return o;const s=St(We(t.label),r);return o<0?s:s<0?o:Math.min(o,s)}const co="print-designer-font-face";function uo(t){const r=`${co}-${e.useId()}`;let o;e.watchEffect(()=>{const s=e.toValue(t);if(!s){o?.remove(),o=void 0;return}o||(o=document.createElement("style"),o.id=r,document.head.appendChild(o)),o.textContent=s}),e.onUnmounted(()=>{o?.remove(),o=void 0})}const mo=e.defineComponent({__name:"HelpButton",emits:["click"],setup(t){return(r,o)=>(e.openBlock(),e.createElementBlock("button",{class:"help-button",title:"帮助文档",onClick:o[0]||(o[0]=s=>r.$emit("click"))},[...o[1]||(o[1]=[e.createElementVNode("span",{class:"help-icon"},"?",-1)])]))}}),ce=(t,r)=>{const o=t.__vccOpts||t;for(const[s,n]of r)o[s]=n;return o},po=ce(mo,[["__scopeId","data-v-80ccab03"]]),vo=["disabled","data-test","data-tip"],fo=e.defineComponent({__name:"ToolbarDropdown",props:{disabled:{type:Boolean,default:!1},testId:{default:"dd-trigger"},tip:{},panelClass:{}},setup(t){const r=t,o=e.ref(!1),s=e.ref(null);function n(l){o.value&&(s.value?.contains(l.target)||(o.value=!1))}return e.watch(()=>r.disabled,l=>{l&&(o.value=!1)}),e.onMounted(()=>document.addEventListener("pointerdown",n)),e.onUnmounted(()=>document.removeEventListener("pointerdown",n)),(l,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapRef",ref:s,class:"tb-dd"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["tb-dd-trigger",{on:o.value}]),disabled:t.disabled,"data-test":t.testId,"data-tip":t.tip,onClick:a[0]||(a[0]=i=>o.value=!o.value)},[e.renderSlot(l.$slots,"trigger",{},void 0,!0),e.createVNode(e.unref(se.ChevronDown),{size:12,class:e.normalizeClass(["tb-dd-arrow",{up:o.value}])},null,8,["class"])],10,vo),o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["tb-dd-panel",t.panelClass])},[e.renderSlot(l.$slots,"default",{},void 0,!0)],2)):e.createCommentVNode("",!0)],512))}}),Je=ce(fo,[["__scopeId","data-v-74fd00c6"]]),go={class:"designer-toolbar"},bo={class:"tb-group"},ho={class:"tb-title"},Eo={class:"tb-title-name"},yo={class:"tb-group"},ko=["disabled"],Vo=["disabled"],No={class:"tb-group"},wo={class:"tb-menu","data-test":"arrange-panel"},Co={class:"tb-menu-grid"},So=["disabled"],xo=["disabled"],$o=["disabled"],Bo=["disabled"],Do=["disabled"],To=["disabled"],Mo=["disabled"],zo=["disabled"],Ao={class:"tb-menu-grid"},Po=["disabled"],Ro=["disabled"],Lo=["disabled"],Uo=["disabled"],Io={class:"tb-menu-grid"},Fo=["disabled"],Oo=["disabled"],Ho={class:"tb-menu tb-menu-rows","data-test":"view-panel"},Wo={class:"tb-group"},Go={class:"tb-zoom"},Ko={class:"tb-group"},qo=["disabled","data-tip"],Yo=["disabled","data-tip"],jo=["disabled","data-tip"],Xo={key:0,class:"tb-group"},Zo={class:"tb-group"},Jo=e.defineComponent({__name:"DesignerToolbar",props:e.mergeModels({isEdit:{type:Boolean},canUndo:{type:Boolean},canRedo:{type:Boolean},hasMultiSelection:{type:Boolean},hasSelection:{type:Boolean},showRuler:{type:Boolean,default:!0},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},selectedElementHasGroup:{type:Boolean},overlayVisible:{type:Boolean},showHelp:{type:Boolean,default:!0},clipboardDisabled:{type:Boolean,default:!0},hasClipboard:{type:Boolean,default:!1}},{scale:{default:100},scaleModifiers:{}}),emits:e.mergeModels(["preview","save","undo","redo","align","move-layer","toggle-ruler","toggle-grid","toggle-snap","toggle-table-ghost-border","toggle-overlay","group","ungroup","add-overlay-element","fit-window","zoom","help","copy","paste","delete"],["update:scale"]),setup(t){const r=e.useModel(t,"scale"),o=t,s=e.computed(()=>o.clipboardDisabled?"粘贴 (Ctrl+V),需选中元素":o.hasClipboard?"粘贴 (Ctrl+V)":"粘贴 (Ctrl+V),剪贴板为空");return(n,l)=>(e.openBlock(),e.createElementBlock("div",go,[e.createElementVNode("div",bo,[l[32]||(l[32]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-37d71dfb><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-37d71dfb><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-37d71dfb></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-37d71dfb></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-37d71dfb></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-37d71dfb></line></svg></span>',1)),e.createElementVNode("div",ho,[e.createElementVNode("span",Eo,e.toDisplayString(t.isEdit?"编辑模板":"新建模板"),1),l[31]||(l[31]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",yo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canUndo,onClick:l[0]||(l[0]=a=>n.$emit("undo")),"data-tip":"撤销"},[e.createVNode(e.unref(se.Undo2),{size:15})],8,ko),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canRedo,onClick:l[1]||(l[1]=a=>n.$emit("redo")),"data-tip":"重做"},[e.createVNode(e.unref(se.Redo2),{size:15})],8,Vo)]),e.renderSlot(n.$slots,"default",{},void 0,!0),e.createElementVNode("div",No,[e.createVNode(Je,{"test-id":"arrange-dd",tip:"排列"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(se.Layers),{size:15}),l[33]||(l[33]=e.createElementVNode("span",{class:"tb-btn-text"},"排列",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",wo,[l[34]||(l[34]=e.createElementVNode("div",{class:"tb-menu-label"},"对齐 / 分布",-1)),e.createElementVNode("div",Co,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[2]||(l[2]=a=>n.$emit("align","left")),"data-tip":"左对齐"},[e.createVNode(e.unref(se.AlignStartVertical),{size:15})],8,So),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[3]||(l[3]=a=>n.$emit("align","right")),"data-tip":"右对齐"},[e.createVNode(e.unref(se.AlignEndVertical),{size:15})],8,xo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[4]||(l[4]=a=>n.$emit("align","top")),"data-tip":"顶对齐"},[e.createVNode(e.unref(se.AlignStartHorizontal),{size:15})],8,$o),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[5]||(l[5]=a=>n.$emit("align","bottom")),"data-tip":"底对齐"},[e.createVNode(e.unref(se.AlignEndHorizontal),{size:15})],8,Bo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[6]||(l[6]=a=>n.$emit("align","vertical")),"data-tip":"水平居中"},[e.createVNode(e.unref(se.AlignCenterVertical),{size:15})],8,Do),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[7]||(l[7]=a=>n.$emit("align","horizontal")),"data-tip":"垂直居中"},[e.createVNode(e.unref(se.AlignCenterHorizontal),{size:15})],8,To),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[8]||(l[8]=a=>n.$emit("align","distributeHor")),"data-tip":"水平分布"},[e.createVNode(e.unref(se.AlignHorizontalSpaceBetween),{size:15})],8,Mo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[9]||(l[9]=a=>n.$emit("align","distributeVer")),"data-tip":"垂直分布"},[e.createVNode(e.unref(se.AlignVerticalSpaceBetween),{size:15})],8,zo)]),l[35]||(l[35]=e.createElementVNode("div",{class:"tb-menu-label"},"层级",-1)),e.createElementVNode("div",Ao,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:l[10]||(l[10]=a=>n.$emit("move-layer","top")),"data-tip":"置顶"},[e.createVNode(e.unref(se.ArrowUpToLine),{size:15})],8,Po),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:l[11]||(l[11]=a=>n.$emit("move-layer","up")),"data-tip":"上移一层"},[e.createVNode(e.unref(se.ArrowUp),{size:15})],8,Ro),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:l[12]||(l[12]=a=>n.$emit("move-layer","down")),"data-tip":"下移一层"},[e.createVNode(e.unref(se.ArrowDown),{size:15})],8,Lo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:l[13]||(l[13]=a=>n.$emit("move-layer","bottom")),"data-tip":"置底"},[e.createVNode(e.unref(se.ArrowDownToLine),{size:15})],8,Uo)]),l[36]||(l[36]=e.createElementVNode("div",{class:"tb-menu-label"},"组合",-1)),e.createElementVNode("div",Io,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[14]||(l[14]=a=>n.$emit("group")),"data-tip":"组合 (Ctrl+G)"},[e.createVNode(e.unref(se.Group),{size:15})],8,Fo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.selectedElementHasGroup,onClick:l[15]||(l[15]=a=>n.$emit("ungroup")),"data-tip":"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(se.Ungroup),{size:15})],8,Oo)])])]),_:1}),e.createVNode(Je,{"test-id":"view-dd",tip:"视图"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(se.Eye),{size:15}),l[37]||(l[37]=e.createElementVNode("span",{class:"tb-btn-text"},"视图",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Ho,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.showRuler}]),"data-tip":"显示/隐藏标尺",onClick:l[16]||(l[16]=a=>n.$emit("toggle-ruler"))},[...l[38]||(l[38]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 标尺 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.showGrid}]),"data-tip":"显示/隐藏网格背景",onClick:l[17]||(l[17]=a=>n.$emit("toggle-grid"))},[...l[39]||(l[39]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.showTableGhostBorder}]),"data-tip":"显示/隐藏无边框表格的虚拟虚线",onClick:l[18]||(l[18]=a=>n.$emit("toggle-table-ghost-border"))},[...l[40]||(l[40]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.snapToGrid}]),"data-tip":"开启/关闭元素吸附到网格",onClick:l[19]||(l[19]=a=>n.$emit("toggle-snap"))},[...l[41]||(l[41]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2),l[42]||(l[42]=e.createElementVNode("span",{class:"tb-menu-sep"},null,-1)),e.createElementVNode("button",{class:"tb-btn tb-menu-row","data-tip":"添加一个仅在首页叠加显示的页眉/页脚元素",onClick:l[20]||(l[20]=a=>n.$emit("add-overlay-element"))},"首页专属"),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{warn:t.overlayVisible}]),"data-tip":"叠加显示渲染截图,与设计稿对比效果",onClick:l[21]||(l[21]=a=>n.$emit("toggle-overlay"))},"叠层对比",2)])]),_:1})]),e.createElementVNode("div",Wo,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[22]||(l[22]=a=>n.$emit("fit-window")),"data-tip":"适应窗口"},[e.createVNode(e.unref(se.Maximize),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[23]||(l[23]=a=>n.$emit("zoom",-10)),"data-tip":"缩小"},[e.createVNode(e.unref(se.ZoomOut),{size:15})]),e.createElementVNode("span",Go,e.toDisplayString(r.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[24]||(l[24]=a=>n.$emit("zoom",10)),"data-tip":"放大"},[e.createVNode(e.unref(se.ZoomIn),{size:15})])]),e.createElementVNode("div",Ko,[e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"copy",disabled:t.clipboardDisabled,onClick:l[25]||(l[25]=a=>n.$emit("copy")),"data-tip":t.clipboardDisabled?"复制 (Ctrl+C),需选中元素":"复制 (Ctrl+C)"},[e.createVNode(e.unref(se.Copy),{size:15})],8,qo),e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"paste",disabled:t.clipboardDisabled||!t.hasClipboard,onClick:l[26]||(l[26]=a=>n.$emit("paste")),"data-tip":s.value},[e.createVNode(e.unref(se.ClipboardPaste),{size:15})],8,Yo),e.createElementVNode("button",{class:"tb-btn tb-icon danger","data-test":"delete",disabled:t.clipboardDisabled,onClick:l[27]||(l[27]=a=>n.$emit("delete")),"data-tip":t.clipboardDisabled?"删除 (Delete),需选中元素":"删除 (Delete)"},[e.createVNode(e.unref(se.Trash2),{size:15})],8,jo)]),l[43]||(l[43]=e.createElementVNode("div",{class:"tb-spacer"},null,-1)),t.showHelp?(e.openBlock(),e.createElementBlock("div",Xo,[e.createVNode(po,{onClick:l[28]||(l[28]=a=>n.$emit("help"))})])):e.createCommentVNode("",!0),e.createElementVNode("div",Zo,[e.createElementVNode("button",{class:"btn-secondary","data-tip":"预览模板打印效果",onClick:l[29]||(l[29]=a=>n.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary","data-tip":"保存模板",onClick:l[30]||(l[30]=a=>n.$emit("save"))},"保存")])]))}}),Qo=ce(Jo,[["__scopeId","data-v-37d71dfb"]]),_o={class:"font-select"},en=["placeholder","disabled","aria-expanded","aria-activedescendant","onKeydown"],tn=["id","aria-selected","onMousedown"],on=e.defineComponent({__name:"FontSelect",props:{modelValue:{},placeholder:{default:"默认"},disabled:{type:Boolean,default:!1}},emits:["update:model-value"],setup(t,{emit:r}){const o=t,s=r,n=io(),l=`font-select-list-${e.useId()}`,a=e.ref(null),i=e.ref(R(o.modelValue)),d=e.ref(""),m=e.ref(!1),c=e.ref(-1),f=e.computed(()=>{const X=o.modelValue?.trim();return X?wt(n.value,X)?"":X:""}),g=e.computed(()=>{const X=(o.modelValue??"").trim(),U=(N,F,A,V)=>({kind:N,key:F,label:A,value:V,selected:(V??"")===X}),k=d.value.trim();if(!k){const N=[U("clear","__clear__",o.placeholder)];f.value&&N.push(U("unknown","__unknown__",`${f.value}(未知)`,f.value));for(const F of n.value)N.push(U("font",F.family,Ct(F),F.family));return N}const D=ro(n.value,k).map(N=>U("font",N.family,Ct(N),N.family));if(!D.length){const N=h(k);D.push(U("free","__free__",`使用「${N}」`,N))}return D});function h(X){const U=We(X);return n.value.find(D=>D.label&&We(D.label)===U)?.family??X}function R(X){const U=X?.trim();return U?wt(n.value,U)?.label??U:""}const w=e.computed(()=>m.value&&c.value>=0?`${l}-${c.value}`:void 0);function v(){const X=(o.modelValue??"").trim();return g.value.findIndex(U=>(U.value??"")===X)}function p(){m.value||(m.value=!0,d.value="",c.value=v())}function B(){m.value=!0}function Q(){m.value=!0,d.value=i.value,c.value=g.value.length?0:-1}function ae(X){if(!m.value){p();return}const U=g.value.length-1;U<0||(c.value=Math.min(Math.max(c.value+X,0),U),K())}function K(){e.nextTick(()=>{a.value?.children[c.value]?.scrollIntoView?.({block:"nearest"})})}function Z(){if(!m.value)return;const X=g.value[c.value];if(X){y(X);return}const U=d.value.trim();if(U){const k=h(U);y({value:k})}}function y(X){i.value=R(X.value),d.value="",m.value=!1,c.value=-1,s("update:model-value",X.value)}function W(){m.value=!1,d.value="",c.value=-1,i.value=R(o.modelValue)}return e.watch(()=>o.modelValue,X=>{i.value=R(X)}),(X,U)=>(e.openBlock(),e.createElementBlock("div",_o,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":U[0]||(U[0]=k=>i.value=k),class:"pd-input font-select-input",type:"text",role:"combobox","aria-autocomplete":"list",autocomplete:"off",placeholder:t.placeholder,disabled:t.disabled,"aria-expanded":m.value,"aria-controls":l,"aria-activedescendant":w.value,onFocus:p,onClick:B,onInput:Q,onKeydown:[U[1]||(U[1]=e.withKeys(e.withModifiers(k=>ae(1),["prevent"]),["down"])),U[2]||(U[2]=e.withKeys(e.withModifiers(k=>ae(-1),["prevent"]),["up"])),e.withKeys(e.withModifiers(Z,["prevent"]),["enter"]),e.withKeys(e.withModifiers(W,["prevent"]),["esc"])],onBlur:W},null,40,en),[[e.vModelText,i.value]]),m.value?(e.openBlock(),e.createElementBlock("ul",{key:0,id:l,ref_key:"listRef",ref:a,class:"font-select-list",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(k,D)=>(e.openBlock(),e.createElementBlock("li",{id:`${l}-${D}`,key:k.key,class:e.normalizeClass(["font-select-option",{"is-active":D===c.value,"is-muted":k.kind==="unknown"||k.kind==="free"}]),role:"option","aria-selected":k.selected,onMousedown:e.withModifiers(N=>y(k),["prevent"])},e.toDisplayString(k.label),43,tn))),128))],512)):e.createCommentVNode("",!0)]))}}),bt=ce(on,[["__scopeId","data-v-f1aae453"]]),nn={class:"pd-stepper"},ln=["disabled"],an=["value","placeholder","min","max","step","disabled"],rn=["disabled"],sn=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=e.computed(()=>{const w=String(o.step),v=w.indexOf(".");return v===-1?0:w.length-v-1});function l(w){return Number.isFinite(w)?Number(w.toFixed(n.value)):0}const a=e.computed(()=>{const w=o.modelValue;if(!(w==null||!Number.isFinite(w)))return l(w)}),i=e.ref(a.value===void 0?"":String(a.value));e.watch(a,w=>{i.value=w===void 0?"":String(w)});const d=e.computed(()=>a.value!==void 0?a.value:o.min!==void 0?o.min:0),m=e.computed(()=>o.min!==void 0&&d.value<=o.min),c=e.computed(()=>o.max!==void 0&&d.value>=o.max);function f(w){let v=l(w);return o.min!==void 0&&v<o.min&&(v=o.min),o.max!==void 0&&v>o.max&&(v=o.max),v}function g(w){if(w<0&&m.value||w>0&&c.value)return;const v=f(d.value+w*o.step);i.value=String(v),s("update:modelValue",v)}function h(w){i.value=w.target.value}function R(){const w=i.value.trim();if(w===""){a.value!==void 0&&(i.value=String(a.value));return}const v=Number(w);if(!Number.isFinite(v)){i.value=a.value===void 0?"":String(a.value);return}const p=f(v);i.value=String(p),p!==a.value&&s("update:modelValue",p)}return(w,v)=>(e.openBlock(),e.createElementBlock("div",nn,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:m.value||t.disabled,title:"减小","aria-label":"减小",onClick:v[0]||(v[0]=p=>g(-1))},"−",8,ln),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:i.value,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,disabled:t.disabled,onInput:h,onChange:R,onBlur:R,onKeydown:v[1]||(v[1]=e.withKeys(e.withModifiers(p=>p.target.blur(),["prevent"]),["enter"]))},null,40,an),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:c.value||t.disabled,title:"增大","aria-label":"增大",onClick:v[2]||(v[2]=p=>g(1))},"+",8,rn)]))}}),de=ce(sn,[["__scopeId","data-v-627f09cb"]]),dn=["aria-expanded","title"],cn={class:"picker-preview"},un={class:"picker-heading"},mn=["disabled"],pn={class:"preset-color-grid"},vn=["title","aria-label","onClick"],fn=e.defineComponent({__name:"PresetColorPicker",props:{modelValue:{},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(!1),l=e.ref(),a=e.ref(),i=e.ref(),d=e.ref({}),m=e.ref(0),c=e.ref(0),f=e.ref(0),g=e.ref("#000000"),h=e.ref(!1),R=e.computed(()=>o.modelValue||"#000000"),w=e.computed(()=>o.modelValue?{background:o.modelValue}:{background:"transparent"}),v=e.computed(()=>Y(fe(m.value,c.value,f.value))),p=e.computed({get:()=>Math.round(m.value),set:L=>Z(me(L),c.value,f.value)});e.watch(()=>o.modelValue,L=>{if(!L){g.value="";return}K(L)},{immediate:!0});function B(L){g.value=L.toUpperCase(),K(L),s("update:modelValue",L)}function Q(){o.clearable&&s("update:modelValue","")}function ae(L){const $=L.target.value.trim();if(!$){o.clearable&&s("update:modelValue","");return}u($)&&(K($),s("update:modelValue",S($)))}function K(L){const x=u(L);if(!x)return;const $=Ee(x.r,x.g,x.b);m.value=$.h,c.value=$.s,f.value=$.v,g.value=S(L).toUpperCase()}function Z(L,x,$){m.value=me(L),c.value=ge(x),f.value=ge($),g.value=v.value.toUpperCase(),s("update:modelValue",v.value)}function y(L){L.currentTarget.setPointerCapture(L.pointerId),h.value=!0,U(L)}function W(L){h.value&&U(L)}function X(L){h.value=!1;const x=L.currentTarget;x.hasPointerCapture(L.pointerId)&&x.releasePointerCapture(L.pointerId)}function U(L){const x=i.value;if(!x)return;const $=x.getBoundingClientRect(),G=ge((L.clientX-$.left)/$.width),b=ge(1-(L.clientY-$.top)/$.height);Z(m.value,G,b)}function k(L){const x=L.shiftKey?.1:.02;let $=!0;L.key==="ArrowLeft"?Z(m.value,c.value-x,f.value):L.key==="ArrowRight"?Z(m.value,c.value+x,f.value):L.key==="ArrowUp"?Z(m.value,c.value,f.value+x):L.key==="ArrowDown"?Z(m.value,c.value,f.value-x):$=!1,$&&L.preventDefault()}function D(){n.value?F():N()}async function N(){const L=l.value;if(!L)return;o.modelValue&&K(R.value),n.value=!0,await e.nextTick();const x=L.getBoundingClientRect(),$=190,G=a.value?.offsetHeight??216,b=8,C=Math.min(x.left,window.innerWidth-$-b),M=x.bottom+6,ee=M+G>window.innerHeight-b?Math.max(b,x.top-G-6):M;d.value={left:`${Math.max(b,C)}px`,top:`${ee}px`}}function F(){n.value=!1}function A(L){const x=L.target;l.value?.contains(x)||a.value?.contains(x)||F()}function V(){n.value&&F()}function T(L){L.key==="Escape"&&n.value&&F()}function u(L){const x=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(L.trim());if(!x)return null;const $=x[1],G=$.length===3?$.split("").map(b=>b+b).join(""):$;return{r:Number.parseInt(G.slice(0,2),16),g:Number.parseInt(G.slice(2,4),16),b:Number.parseInt(G.slice(4,6),16)}}function S(L){const x=u(L);return x?Y(x):"#000000"}function Y({r:L,g:x,b:$}){return`#${[L,x,$].map(G=>Math.round(ge(G/255)*255).toString(16).padStart(2,"0")).join("")}`}function Ee(L,x,$){const G=L/255,b=x/255,C=$/255,M=Math.max(G,b,C),ee=Math.min(G,b,C),oe=M-ee;let ie=0;return oe!==0&&(M===G?ie=(b-C)/oe%6:M===b?ie=(C-G)/oe+2:ie=(G-b)/oe+4,ie*=60,ie<0&&(ie+=360)),{h:ie,s:M===0?0:oe/M,v:M}}function fe(L,x,$){const G=$*x,b=(L%360+360)%360/60,C=G*(1-Math.abs(b%2-1)),[M,ee,oe]=b<1?[G,C,0]:b<2?[C,G,0]:b<3?[0,G,C]:b<4?[0,C,G]:b<5?[C,0,G]:[G,0,C],ie=$-G;return{r:(M+ie)*255,g:(ee+ie)*255,b:(oe+ie)*255}}function me(L){return((Number.isFinite(L)?L:0)%360+360)%360}function ge(L){return Math.min(1,Math.max(0,Number.isFinite(L)?L:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",A,!0),window.addEventListener("scroll",V,!0),window.addEventListener("resize",V),document.addEventListener("keydown",T)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",A,!0),window.removeEventListener("scroll",V,!0),window.removeEventListener("resize",V),document.removeEventListener("keydown",T)}),(L,x)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{ref_key:"triggerRef",ref:l,type:"button",class:"preset-color-trigger","aria-expanded":n.value,"aria-haspopup":"dialog",title:t.modelValue||"自动",onClick:D},[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle(w.value)},null,4)],8,dn),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:a,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(d.value),onPointerdown:x[2]||(x[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",cn,[e.createElementVNode("span",{class:e.normalizeClass(["picker-current",{"is-empty":!t.modelValue}]),style:e.normalizeStyle(t.modelValue?{background:v.value}:void 0)},null,6),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":x[0]||(x[0]=$=>g.value=$),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:ae},null,544),[[e.vModelText,g.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:i,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(m.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:y,onPointermove:W,onPointerup:X,onPointercancel:X,onKeydown:k},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${c.value*100}%`,top:`${(1-f.value)*100}%`,background:v.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":x[1]||(x[1]=$=>p.value=$),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,p.value,void 0,{number:!0}]]),e.createElementVNode("div",un,[x[4]||(x[4]=e.createElementVNode("span",null,"常用颜色",-1)),t.clearable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"picker-clear",disabled:!t.modelValue,title:"清除选中的颜色",onClick:Q},[...x[3]||(x[3]=[e.createElementVNode("svg",{viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":"true"},[e.createElementVNode("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",fill:"none"})],-1),e.createTextVNode(" 清除 ",-1)])],8,mn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E.PRESET_COLORS),$=>(e.openBlock(),e.createElementBlock("button",{key:$,type:"button",class:e.normalizeClass(["preset-color-item",{active:!!t.modelValue&&$.toLowerCase()===t.modelValue.toLowerCase()}]),style:e.normalizeStyle({background:$}),title:$,"aria-label":$,onClick:G=>B($)},null,14,vn))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),Ce=ce(fn,[["__scopeId","data-v-12290e7e"]]),gn={class:"format-toolbar"},bn={class:"ft-group"},hn=["disabled","data-tip"],En={class:"ft-group"},yn={class:"ft-font"},kn={class:"ft-size","data-test":"font-size"},Vn={class:"ft-group"},Nn=["disabled","data-tip"],wn=["disabled","data-tip"],Cn=["disabled","data-tip"],Sn={class:"ft-group"},xn=["title"],$n={class:"ft-glyph"},Bn={class:"ft-group"},Dn={class:"ft-align-panel","data-test":"align-panel"},Tn={class:"ft-align-row"},Mn={class:"ft-align-row"},zn={class:"ft-group"},An={class:"ft-border-panel","data-test":"border-panel"},Pn={class:"ft-border-grid"},Rn=["disabled","data-tip"],Ln={class:"ft-style-row"},Un=["data-test","data-tip","onClick"],In={class:"ft-border-style-row"},Fn={class:"ft-line-width"},On={class:"ft-border-style-row"},Hn=e.defineComponent({__name:"FormatToolbar",props:{format:{},painter:{}},setup(t){const r=t,o=e.computed(()=>r.format.values.value),s=e.computed(()=>!r.format.fontEditable.value),n=e.computed(()=>s.value||r.format.context.value==="cells"),l=e.computed(()=>r.format.context.value==="none"),a=e.computed(()=>r.painter?.active.value===!0),i=e.computed(()=>!r.painter||!a.value&&(r.format.context.value==="none"||r.format.context.value==="cells"||!r.painter.capturable.value)),d=e.computed(()=>a.value?"退出格式刷(Esc)":r.painter?r.format.context.value==="cells"?"格式刷(表格单元格暂不支持)":r.format.context.value==="none"?"格式刷(需选中元素)":r.painter.capturable.value?"格式刷:单击刷一次,双击连续刷":"格式刷(请仅选中一个源元素)":"格式刷");function m(){const A=r.painter;if(A){if(A.active.value){A.cancel();return}A.capture(!1)}}function c(){r.painter?.capture(!0)}const f=e.computed(()=>o.value.fontFamily===Se?void 0:o.value.fontFamily),g=e.computed(()=>o.value.fontFamily===Se?"混合":"默认"),h=e.computed(()=>o.value.fontSize===Se?void 0:o.value.fontSize),R=e.computed(()=>o.value.fontSize===Se?"混合":"默认"),w=e.computed(()=>o.value.bold===!0),v=e.computed(()=>o.value.color===Se?void 0:o.value.color),p=e.computed(()=>o.value.backgroundColor===Se?void 0:o.value.backgroundColor),B=e.computed(()=>o.value.textAlign==="center"?se.TextAlignCenter:o.value.textAlign==="right"?se.TextAlignEnd:se.TextAlignStart),Q=e.computed(()=>s.value?"对齐(需选中文本元素或单元格)":"对齐"),ae=e.computed(()=>l.value?"边框(需选中元素)":"边框");function K(A){return s.value?`${A}(需选中文本元素)`:r.format.context.value==="cells"?`${A}(单元格不支持)`:A}const Z=e.ref("solid"),y=e.ref(.75),W=e.ref("#333333"),X=e.computed(()=>r.format.context.value==="cells"),U=[{key:"solid",label:"实线",preview:"2px solid currentColor"},{key:"dashed",label:"虚线",preview:"2px dashed currentColor"},{key:"dotted",label:"点线",preview:"2px dotted currentColor"},{key:"double",label:"双线",preview:"3px double currentColor"}];function k(){return{width:y.value,style:Z.value,color:W.value}}function D(A){X.value?r.format.applyCellBorderPreset(A,k()):r.format.applyElementBorder(A==="none"?"none":"all",k())}function N(A){return(X.value?r.format.cellEdges.value:r.format.elementEdges.value)?.[A]===!0}function F(A){X.value?r.format.toggleCellEdge(A,k()):r.format.toggleElementEdge(A,k())}return(A,V)=>(e.openBlock(),e.createElementBlock("div",gn,[e.createElementVNode("div",bn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:a.value}]),"data-test":"format-painter",disabled:i.value,"data-tip":d.value,onClick:m,onDblclick:c},[e.createVNode(e.unref(se.Paintbrush),{size:15})],42,hn)]),e.createElementVNode("div",En,[e.createElementVNode("div",yn,[e.createVNode(bt,{"model-value":f.value,placeholder:g.value,disabled:s.value,"onUpdate:modelValue":V[0]||(V[0]=T=>t.format.applyStyle({fontFamily:T}))},null,8,["model-value","placeholder","disabled"])]),e.createElementVNode("div",kn,[e.createVNode(de,{"model-value":h.value,min:5,max:72,placeholder:R.value,disabled:s.value,"onUpdate:modelValue":V[1]||(V[1]=T=>t.format.applyStyle({fontSize:T}))},null,8,["model-value","placeholder","disabled"])])]),e.createElementVNode("div",Vn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:w.value}]),"data-test":"bold",disabled:s.value,"data-tip":s.value?"加粗(需选中文本元素或单元格)":"加粗",onClick:V[2]||(V[2]=T=>t.format.toggleBold())},[e.createVNode(e.unref(se.Bold),{size:15})],10,Nn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:o.value.underline===!0}]),"data-test":"underline",disabled:n.value,"data-tip":K("下划线"),onClick:V[3]||(V[3]=T=>t.format.toggleUnderline())},[e.createVNode(e.unref(se.Underline),{size:15})],10,wn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:o.value.strike===!0}]),"data-test":"strike",disabled:n.value,"data-tip":K("删除线"),onClick:V[4]||(V[4]=T=>t.format.toggleStrike())},[e.createVNode(e.unref(se.Strikethrough),{size:15})],10,Cn)]),e.createElementVNode("div",Sn,[e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:s.value}]),title:`字体颜色${s.value?"(需选中或混选文本元素)":""}`},[e.createVNode(Ce,{"model-value":v.value,"onUpdate:modelValue":V[5]||(V[5]=T=>t.format.applyStyle({color:T}))},null,8,["model-value"]),V[23]||(V[23]=e.createElementVNode("span",{class:"ft-glyph"},"A",-1))],10,xn),e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:l.value}]),title:"背景色"},[e.createVNode(Ce,{"model-value":p.value,"onUpdate:modelValue":V[6]||(V[6]=T=>t.format.applyStyle({backgroundColor:T}))},null,8,["model-value"]),e.createElementVNode("span",$n,[e.createVNode(e.unref(se.PaintBucket),{size:14})])],2)]),e.createElementVNode("div",Bn,[e.createVNode(Je,{"test-id":"align-dd",tip:Q.value,disabled:s.value},{trigger:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(B.value),{size:15})),V[24]||(V[24]=e.createElementVNode("span",{class:"ft-btn-text"},"对齐",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Dn,[e.createElementVNode("div",Tn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.textAlign==="left"}]),"data-test":"align-left","data-tip":"左对齐",onClick:V[7]||(V[7]=T=>t.format.applyStyle({textAlign:"left"}))},[e.createVNode(e.unref(se.TextAlignStart),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.textAlign==="center"}]),"data-test":"align-center","data-tip":"水平居中",onClick:V[8]||(V[8]=T=>t.format.applyStyle({textAlign:"center"}))},[e.createVNode(e.unref(se.TextAlignCenter),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.textAlign==="right"}]),"data-test":"align-right","data-tip":"右对齐",onClick:V[9]||(V[9]=T=>t.format.applyStyle({textAlign:"right"}))},[e.createVNode(e.unref(se.TextAlignEnd),{size:15})],2)]),e.createElementVNode("div",Mn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.verticalAlign==="top"}]),"data-test":"valign-top","data-tip":"顶端对齐",onClick:V[10]||(V[10]=T=>t.format.applyStyle({verticalAlign:"top"}))},[e.createVNode(e.unref(se.ArrowUpToLine),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.verticalAlign==="middle"}]),"data-test":"valign-middle","data-tip":"垂直居中",onClick:V[11]||(V[11]=T=>t.format.applyStyle({verticalAlign:"middle"}))},[e.createVNode(e.unref(se.ChevronsUpDown),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.verticalAlign==="bottom"}]),"data-test":"valign-bottom","data-tip":"底端对齐",onClick:V[12]||(V[12]=T=>t.format.applyStyle({verticalAlign:"bottom"}))},[e.createVNode(e.unref(se.ArrowDownToLine),{size:15})],2)])])]),_:1},8,["tip","disabled"])]),e.createElementVNode("div",zn,[e.createVNode(Je,{"test-id":"border",tip:ae.value,disabled:l.value},{trigger:e.withCtx(()=>[e.createVNode(e.unref(se.Grid3x3),{size:15}),V[25]||(V[25]=e.createElementVNode("span",{class:"ft-btn-text"},"边框",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",An,[e.createElementVNode("div",Pn,[e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-none","data-tip":"无边框",onClick:V[13]||(V[13]=T=>D("none"))},[...V[26]||(V[26]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"4",y1:"14",x2:"14",y2:"4"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-all","data-tip":"所有边框",onClick:V[14]||(V[14]=T=>D("all"))},[...V[27]||(V[27]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-outer","data-tip":"外侧边框",onClick:V[15]||(V[15]=T=>D("outer"))},[...V[28]||(V[28]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-inner",disabled:!X.value,"data-tip":X.value?"内部边框":"内部边框(仅表格单元格可用)",onClick:V[16]||(V[16]=T=>D("inner"))},[...V[29]||(V[29]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])],8,Rn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("top")}]),"data-test":"edge-top","data-tip":"上边框",onClick:V[17]||(V[17]=T=>F("top"))},[...V[30]||(V[30]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"3",x2:"16",y2:"3"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("bottom")}]),"data-test":"edge-bottom","data-tip":"下边框",onClick:V[18]||(V[18]=T=>F("bottom"))},[...V[31]||(V[31]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"15",x2:"16",y2:"15"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("left")}]),"data-test":"edge-left","data-tip":"左边框",onClick:V[19]||(V[19]=T=>F("left"))},[...V[32]||(V[32]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"2",x2:"3",y2:"16"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("right")}]),"data-test":"edge-right","data-tip":"右边框",onClick:V[20]||(V[20]=T=>F("right"))},[...V[33]||(V[33]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"15",y1:"2",x2:"15",y2:"16"})],-1)])],2)]),e.createElementVNode("div",Ln,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(U,T=>e.createElementVNode("button",{key:T.key,type:"button",class:e.normalizeClass(["ft-style-btn",{on:Z.value===T.key}]),"data-test":`style-${T.key}`,"data-tip":T.label,onClick:u=>Z.value=T.key},[e.createElementVNode("span",{class:"ft-style-line",style:e.normalizeStyle({borderTop:T.preview})},null,4)],10,Un)),64))]),e.createElementVNode("div",In,[V[34]||(V[34]=e.createElementVNode("span",{class:"ft-edge-label"},"粗细",-1)),e.createElementVNode("div",Fn,[e.createVNode(de,{modelValue:y.value,"onUpdate:modelValue":V[21]||(V[21]=T=>y.value=T),min:.25,max:5,step:.25},null,8,["modelValue"])])]),e.createElementVNode("div",On,[V[35]||(V[35]=e.createElementVNode("span",{class:"ft-edge-label"},"颜色",-1)),e.createVNode(Ce,{modelValue:W.value,"onUpdate:modelValue":V[22]||(V[22]=T=>W.value=T),clearable:!1},null,8,["modelValue"])])])]),_:1},8,["tip","disabled"])])]))}}),Wn=ce(Hn,[["__scopeId","data-v-83fd8dc4"]]),Gn={class:"layer-panel"},Kn=["onClick"],qn={class:"layer-icon"},Yn={class:"layer-name"},jn={key:0,class:"layer-zone"},Xn={class:"layer-zindex"},Zn={key:0,class:"layer-actions"},Jn={key:1,class:"layer-actions"},Qn=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer","group","ungroup"],setup(t){const r=t,o=e.computed(()=>r.elements.filter(c=>r.selectedIds.has(c.id))),s=e.computed(()=>o.value.length>=2),n=e.computed(()=>o.value.some(c=>!!c.options.groupId)),l=e.computed(()=>[...r.elements].sort((c,f)=>(f.options.zIndex??0)-(c.options.zIndex??0))),a={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function i(c){return a[c.printElementType.type]||"?"}function d(c){return c.options.title||c.printElementType.title||c.printElementType.type}function m(c){return c.zone==="header"?"页眉":c.zone==="footer"?"页脚":""}return(c,f)=>(e.openBlock(),e.createElementBlock("div",Gn,[f[6]||(f[6]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:e.normalizeClass(["layer-item",{active:t.selectedIds.has(g.id)}]),onClick:h=>c.$emit("select",g.id,h.ctrlKey||h.metaKey)},[e.createElementVNode("span",qn,e.toDisplayString(i(g)),1),e.createElementVNode("span",Yn,e.toDisplayString(d(g)),1),m(g)?(e.openBlock(),e.createElementBlock("span",jn,e.toDisplayString(m(g)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Xn,"z:"+e.toDisplayString(g.options.zIndex??0),1)],10,Kn))),128)),l.value.length>0?(e.openBlock(),e.createElementBlock("div",Zn,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[0]||(f[0]=g=>c.$emit("move-layer","top")),title:"置顶"},[e.createVNode(e.unref(se.ArrowUpToLine),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[1]||(f[1]=g=>c.$emit("move-layer","up")),title:"上移"},[e.createVNode(e.unref(se.ArrowUp),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[2]||(f[2]=g=>c.$emit("move-layer","down")),title:"下移"},[e.createVNode(e.unref(se.ArrowDown),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[3]||(f[3]=g=>c.$emit("move-layer","bottom")),title:"置底"},[e.createVNode(e.unref(se.ArrowDownToLine),{size:14})])])):e.createCommentVNode("",!0),s.value||n.value?(e.openBlock(),e.createElementBlock("div",Jn,[s.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"pd-button small",onClick:f[4]||(f[4]=g=>c.$emit("group")),title:"组合 (Ctrl+G)"},[e.createVNode(e.unref(se.Group),{size:14})])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"pd-button small",onClick:f[5]||(f[5]=g=>c.$emit("ungroup")),title:"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(se.Ungroup),{size:14})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),_n=ce(Qn,[["__scopeId","data-v-567d273e"]]),el={class:"field-tree-panel"},tl={class:"tree-container"},ol=["onClick"],nl={class:"expand-icon"},ll={class:"node-icon"},al={class:"group-label"},il=["onDragstart"],rl={class:"node-label"},sl={class:"node-key"},dl={key:0,class:"pd-empty"},cl=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(""),l=e.ref(new Set),a=e.computed(()=>!!n.value.trim()),i=e.computed(()=>E.filterGroups(E.groupFields(o.fields),n.value));function d(c){const f=new Set(l.value);f.has(c)?f.delete(c):f.add(c),l.value=f}function m(c,f){c.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:f.fieldKey,fieldLabel:f.fieldLabel})),c.dataTransfer&&(c.dataTransfer.effectAllowed="copy"),s("field-drag",f)}return(c,f)=>(e.openBlock(),e.createElementBlock("div",el,[f[2]||(f[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=g=>n.value=g),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,n.value]]),e.createElementVNode("div",tl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.key||"_top"},[g.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["field-group-header",{"is-list":g.isList}]),onClick:h=>d(g.key)},[e.createElementVNode("span",nl,e.toDisplayString(l.value.has(g.key)&&!a.value?"▶":"▼"),1),e.createElementVNode("span",ll,e.toDisplayString(g.isList?"📋":"📁"),1),e.createElementVNode("span",al,e.toDisplayString(g.label),1)],10,ol)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.fields,h=>(e.openBlock(),e.createElementBlock("div",{key:h.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(g.key?22:8)+"px"}),onDragstart:R=>m(R,h)},[f[1]||(f[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",rl,e.toDisplayString(h.fieldLabel),1),e.createElementVNode("span",sl,"("+e.toDisplayString(h.fieldKey)+")",1)],44,il))),128))],512),[[e.vShow,!g.key||a.value||!l.value.has(g.key)]])],64))),128))]),i.value.length===0?(e.openBlock(),e.createElementBlock("p",dl,"暂无字段")):e.createCommentVNode("",!0)]))}}),ul=ce(cl,[["__scopeId","data-v-9b326f07"]]),ml={key:0,class:"left-collapsed"},pl={class:"left-head"},vl={class:"pd-tabs left-tabs"},fl={class:"pd-tab-bar",role:"tablist"},gl={class:"pd-tab-pane",role:"tabpanel"},bl=["onDragstart"],hl={class:"material-icon"},El={class:"material-label"},yl={class:"pd-tab-pane",role:"tabpanel"},kl={class:"pd-tab-pane",role:"tabpanel"},Vl=e.defineComponent({__name:"LeftPanel",props:{fields:{},elements:{},selectedIds:{},collapsed:{type:Boolean}},emits:["select","move-layer","group","ungroup","toggle-visible","toggle-locked","field-drag","toggle-collapse"],setup(t,{emit:r}){const o=r,s=e.ref("elements"),n=[{type:"text",label:"文本",icon:"T"},{type:"barcode",label:"条形码",icon:"▍▍"},{type:"qrcode",label:"二维码",icon:"▦"},{type:"image",label:"图片",icon:"▧"},{type:"table",label:"表格",icon:"⊞"},{type:"longText",label:"长文",icon:"¶"},{type:"hline",label:"横线",icon:"―"},{type:"vline",label:"竖线",icon:"│"},{type:"rect",label:"矩形",icon:"▭"},{type:"oval",label:"椭圆",icon:"◯"},{type:"html",label:"HTML",icon:"<>"}];function l(d,m){d.dataTransfer?.setData("elementType",m)}function a(d){o("field-drag",d)}function i(d){s.value=d,o("toggle-collapse")}return(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",ml,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:m[0]||(m[0]=c=>i(s.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="elements"}]),title:"元素",onClick:m[1]||(m[1]=c=>i("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="fields"}]),title:"字段",onClick:m[2]||(m[2]=c=>i("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="layers"}]),title:"图层",onClick:m[3]||(m[3]=c=>i("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",pl,[m[14]||(m[14]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:m[4]||(m[4]=c=>d.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",vl,[e.createElementVNode("div",fl,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="elements"}]),onClick:m[5]||(m[5]=c=>s.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="fields"}]),onClick:m[6]||(m[6]=c=>s.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="layers"}]),onClick:m[7]||(m[7]=c=>s.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",gl,[m[15]||(m[15]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(n,c=>e.createElementVNode("div",{key:c.type,class:"material-card",draggable:"true",onDragstart:f=>l(f,c.type)},[e.createElementVNode("span",hl,e.toDisplayString(c.icon),1),e.createElementVNode("span",El,e.toDisplayString(c.label),1)],40,bl)),64))],512),[[e.vShow,s.value==="elements"]]),e.withDirectives(e.createElementVNode("div",yl,[e.createVNode(ul,{fields:t.fields,onFieldDrag:a},null,8,["fields"])],512),[[e.vShow,s.value==="fields"]]),e.withDirectives(e.createElementVNode("div",kl,[e.createVNode(_n,{elements:t.elements,"selected-ids":t.selectedIds,onSelect:m[8]||(m[8]=(c,f)=>d.$emit("select",c,f)),onMoveLayer:m[9]||(m[9]=c=>d.$emit("move-layer",c)),onGroup:m[10]||(m[10]=c=>d.$emit("group")),onUngroup:m[11]||(m[11]=c=>d.$emit("ungroup")),onToggleVisible:m[12]||(m[12]=c=>d.$emit("toggle-visible",c)),onToggleLocked:m[13]||(m[13]=c=>d.$emit("toggle-locked",c))},null,8,["elements","selected-ids"])],512),[[e.vShow,s.value==="layers"]])])],64))],2))}}),Nl=ce(Vl,[["__scopeId","data-v-4501eea7"]]);function wl(t,r){const o=e.ref(!1),s=e.ref(null);let n=0,l=0,a=0,i=0,d=!1;function m(w){if(r.disabled||w.button!==0)return;const v=w.target;if(!(v instanceof Element)||v.classList.contains("resize-handle"))return;o.value=!0,d=w.altKey,n=w.clientX,l=w.clientY;const p=t.value;p&&(a=parseFloat(p.style.left)||0,i=parseFloat(p.style.top)||0,s.value={left:a,top:i,width:parseFloat(p.style.width)||0,height:parseFloat(p.style.height)||0},r.onStart?.({altKey:d}),document.addEventListener("mousemove",f),document.addEventListener("mouseup",g),w.preventDefault())}function c(w){const v=r.getScale?.()??1;let p=a+(w.clientX-n)/v,B=i+(w.clientY-l)/v;if(r.axis==="x"&&(B=i),r.axis==="y"&&(p=a),r.onAdsorb){const Q=t.value;if(Q){const ae=parseFloat(Q.style.width)||0,K=parseFloat(Q.style.height)||0,Z=r.onAdsorb({left:p,top:B,width:ae,height:K});p=Z.left,B=Z.top}}return{left:p,top:B}}function f(w){const v=c(w);s.value&&(s.value.left=v.left,s.value.top=v.top),r.onDrag(v)}function g(w){o.value=!1;const v=c(w);r.onDragEnd?.(v,{altKey:d}),r.onStop?.(),s.value=null,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function h(){const w=t.value;w&&w.removeEventListener("mousedown",m),document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function R(){h();const w=t.value;w&&w.addEventListener("mousedown",m)}return{isDragging:o,dragPreview:s,setup:R,cleanup:h}}function Cl(t){const r=[];return t.getAttribute("data-fit")==="shrink"&&r.push(t),t.querySelectorAll('[data-fit="shrink"]').forEach(o=>r.push(o)),r}function Sl(t){t.querySelectorAll("[data-fit-size]").forEach(r=>{if(r.getAttribute("data-fit")==="shrink")return;r.removeAttribute("data-fit-size");const o=r.getAttribute("data-fit-base");o?r.style.fontSize=`${o}pt`:r.style.removeProperty("font-size")})}function ht(t,r){const o=()=>{const s=t.value;s&&(Cl(s).forEach(He.fitTextNode),Sl(s))};e.watchEffect(()=>{r(),e.nextTick(o)},{flush:"post"}),e.onMounted(()=>{e.nextTick(o)})}const xl=["data-fit","data-fit-base","data-fit-min"],$l=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o={top:"flex-start",middle:"center",bottom:"flex-end"},s={left:"flex-start",center:"center",right:"flex-end"},n=e.ref(null),l=e.computed(()=>E.resolveElementTextFit("text",r.element.options)),a=e.computed(()=>r.element.options.fontSize||12),i=e.computed(()=>E.resolveShrinkMinFontSize(r.element.options.shrinkMinFontSize)),d=e.computed(()=>{const c=r.element.options,f=l.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:c.fontWeight||"normal",fontFamily:c.fontFamily||"inherit",color:c.color||"#333",backgroundColor:c.backgroundColor||"transparent",textAlign:c.textAlign||"left",lineHeight:c.lineHeight?c.lineHeight+"pt":"normal",letterSpacing:c.letterSpacing?c.letterSpacing+"pt":"normal",textDecoration:c.textDecoration||"none",padding:`${c.contentPaddingTop||0}pt ${c.contentPaddingRight||0}pt ${c.contentPaddingBottom||0}pt ${c.contentPaddingLeft||0}pt`,width:"100%",height:f?"auto":"100%",boxSizing:"border-box",overflow:f?"visible":"hidden",...c.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...c.verticalAlign?{display:"flex",alignItems:o[c.verticalAlign]??"flex-start",justifyContent:s[c.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>r.designMode?r.element.options.testData?r.element.options.testData:r.element.options.formatter||"文本":E.resolveTextBinding(r.element.options,r.data));return ht(n,()=>[l.value,a.value,i.value,r.element.options.width,r.element.options.height,r.element.options.wordWrap,r.element.options.letterSpacing,r.element.options.lineHeight,m.value]),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"print-text",style:e.normalizeStyle(d.value),"data-fit":l.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(i.value)},e.toDisplayString(m.value),13,xl))}}),Bl={class:"print-image"},Dl=["src"],Tl={key:1,class:"image-placeholder"},Ml=e.defineComponent({__name:"ImageElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.computed(()=>{const a=r.element.options.src||"";return a?a.includes("{")?r.designMode?E.evaluateTemplate(a,E.DEFAULT_DEMO_DATA):E.evaluateTemplate(a,r.data?.[0]||{}):a:""}),s=e.ref(!1);function n(){s.value=!0}e.watch(o,()=>{s.value=!1});const l=e.computed(()=>({objectFit:r.element.options.fit||"contain"}));return(a,i)=>(e.openBlock(),e.createElementBlock("div",Bl,[o.value&&!s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,style:e.normalizeStyle(l.value),onError:n},null,44,Dl)):(e.openBlock(),e.createElementBlock("div",Tl,"图片"))]))}}),zl=ce(Ml,[["__scopeId","data-v-007a2979"]]),Al=["data-fit","data-fit-base","data-fit-min"],Pl=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o={top:"flex-start",middle:"center",bottom:"flex-end"},s={left:"flex-start",center:"center",right:"flex-end"},n=e.ref(null),l=e.computed(()=>E.resolveElementTextFit("longText",r.element.options)),a=e.computed(()=>r.element.options.fontSize||12),i=e.computed(()=>E.resolveShrinkMinFontSize(r.element.options.shrinkMinFontSize)),d=e.computed(()=>{const c=r.element.options,f=l.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:c.fontWeight||"normal",fontFamily:c.fontFamily||"inherit",color:c.color||"#333",backgroundColor:c.backgroundColor||"transparent",textAlign:c.textAlign||"left",lineHeight:c.lineHeight?c.lineHeight+"pt":"1.5",letterSpacing:c.letterSpacing?c.letterSpacing+"pt":"normal",textIndent:c.longTextIndent?c.longTextIndent+"pt":"0",width:"100%",height:f?"auto":"100%",overflow:f?"visible":"hidden",wordBreak:"break-all",boxSizing:"border-box",...c.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...c.verticalAlign?{display:"flex",alignItems:o[c.verticalAlign]??"flex-start",justifyContent:s[c.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>r.designMode?r.element.options.formatter?r.element.options.formatter:"长文本内容":E.resolveTextBinding(r.element.options,r.data));return ht(n,()=>[l.value,a.value,i.value,r.element.options.width,r.element.options.height,r.element.options.wordWrap,r.element.options.lineHeight,m.value]),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"print-longtext",style:e.normalizeStyle(d.value),"data-fit":l.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(i.value)},e.toDisplayString(m.value),13,Al))}}),Rl=["title"],Ll=["title","onClick"],Ul=e.defineComponent({__name:"TableContextMenu",props:{visible:{type:Boolean},x:{},y:{},canDeleteRow:{type:Boolean},canDeleteCol:{type:Boolean},mergeDisabledReason:{},canSplit:{type:Boolean},currentRowType:{},rowTypeDisabledReason:{type:Function}},emits:["action"],setup(t,{emit:r}){const o=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],s=r;function n(l,a){s("action",l,a)}return(l,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"table-ctx-menu",style:e.normalizeStyle({left:t.x+"px",top:t.y+"px"}),onMousedown:a[8]||(a[8]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"menu-item",onClick:a[0]||(a[0]=i=>n("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:a[1]||(a[1]=i=>n("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteRow}]),onClick:a[2]||(a[2]=i=>t.canDeleteRow&&n("delete-row"))}," 删除行 ",2),a[9]||(a[9]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:"menu-item",onClick:a[3]||(a[3]=i=>n("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:a[4]||(a[4]=i=>n("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteCol}]),onClick:a[5]||(a[5]=i=>t.canDeleteCol&&n("delete-col"))}," 删除列 ",2),a[10]||(a[10]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!!t.mergeDisabledReason}]),title:t.mergeDisabledReason||"",onClick:a[6]||(a[6]=i=>!t.mergeDisabledReason&&n("merge"))}," 合并单元格 ",10,Rl),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canSplit}]),onClick:a[7]||(a[7]=i=>t.canSplit&&n("split"))}," 拆分单元格 ",2),a[11]||(a[11]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),a[12]||(a[12]=e.createElementVNode("div",{class:"menu-group-title"},"行类型",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(o,i=>e.createElementVNode("div",{key:i.value,class:e.normalizeClass(["menu-item",{disabled:!!t.rowTypeDisabledReason(i.value),active:t.currentRowType===i.value}]),title:t.rowTypeDisabledReason(i.value)||"",onClick:d=>!t.rowTypeDisabledReason(i.value)&&n("set-row-type",i.value)},e.toDisplayString(i.label),11,Ll)),64))],36)):e.createCommentVNode("",!0)]))}}),Il=ce(Ul,[["__scopeId","data-v-44e319c1"]]),Fl={class:"cell-barcode"},Ol=["preserveAspectRatio"],Hl=["src"],Wl={key:1,class:"cell-barcode-fallback"},Gl=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{},printerDpi:{},targetWidthMm:{},targetHeightMm:{},barWidth:{},barFontSize:{}},setup(t){const r=t,o=e.ref(null),s=e.ref(!1),n=e.ref(""),l=e.ref(null),a={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},i=e.computed(()=>a[r.fit||"contain"]??"xMidYMid meet"),d=e.computed(()=>l.value?{width:l.value.width,height:l.value.height}:{maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}),m=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));function c(){if(s.value=!1,l.value=null,!o.value)return;const R=E.barcodeUnitsPerModule(r.barWidth);try{At(o.value,r.value,{format:r.barcodeType||"CODE128",width:R,height:E.BARCODE_BAR_HEIGHT_MODULES*R,displayValue:r.showText!==!1,fontSize:(r.barFontSize??E.BARCODE_TEXT_FONT_SIZE_MODULES)*R,margin:0,marginLeft:E.BARCODE_QUIET_ZONE_MODULES*R,marginRight:E.BARCODE_QUIET_ZONE_MODULES*R,marginTop:0,marginBottom:E.BARCODE_MARGIN_BOTTOM_MODULES*R})}catch{return}s.value=!0;const w=f(o.value),v=w?E.resolveBarcodeSize({unitWidth:w.width/R,unitHeight:w.height/R,boxWidthMm:E.barcodeAvailableBoxMm(r.targetWidthMm,r.maxWidth),boxHeightMm:E.barcodeAvailableBoxMm(r.targetHeightMm,r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth}):null;l.value=v?{width:`${v.widthMm}mm`,height:`${v.heightMm}mm`}:null,o.value.setAttribute("shape-rendering","crispEdges")}function f(R){const w=(R.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return w.length!==4||w.some(v=>!Number.isFinite(v))?null:{width:w[2],height:w[3]}}async function g(){if(!r.value){n.value="";return}try{n.value=await Pt.toDataURL(r.value,{width:96,margin:1,errorCorrectionLevel:r.qrCodeLevel||"M"})}catch{n.value=""}}function h(){r.cellType==="barcode"?c():g()}return e.onMounted(h),e.watch(()=>[r.cellType,r.value,r.barcodeType,r.qrCodeLevel,r.showText,r.printerDpi,r.targetWidthMm,r.targetHeightMm,r.barWidth,r.barFontSize,r.maxWidth,r.maxHeight],h),(R,w)=>(e.openBlock(),e.createElementBlock("div",Fl,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:o,preserveAspectRatio:i.value,style:e.normalizeStyle(d.value)},null,12,Ol)),[[e.vShow,t.cellType==="barcode"&&s.value]]),t.cellType==="qrcode"&&n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.value,alt:"qrcode",style:e.normalizeStyle(m.value)},null,12,Hl)):e.createCommentVNode("",!0),!s.value&&t.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",Wl,e.toDisplayString(t.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),Kl=ce(Gl,[["__scopeId","data-v-81e37239"]]),ql={class:"cell-image"},Yl=["src"],jl={key:1,class:"image-placeholder"},Xl=e.defineComponent({__name:"CellImage",props:{value:{},fit:{},maxWidth:{},maxHeight:{},designMode:{type:Boolean},data:{}},setup(t){const r=t,o=e.computed(()=>{const a=r.value||"";return a?a.includes("{")?r.designMode?E.evaluateTemplate(a,E.DEFAULT_DEMO_DATA):E.evaluateTemplate(a,r.data?.[0]||{}):a:""}),s=e.ref(!1);function n(){s.value=!0}e.watch(o,()=>{s.value=!1});const l=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));return(a,i)=>(e.openBlock(),e.createElementBlock("div",ql,[o.value&&!s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,style:e.normalizeStyle(l.value),onError:n},null,44,Yl)):(e.openBlock(),e.createElementBlock("div",jl,"图片"))]))}}),Zl=ce(Xl,[["__scopeId","data-v-d5bc444b"]]),Jl=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],Ql=["data-fit","data-fit-base","data-fit-min","data-fit-mm"],_l={key:0,class:"data-placeholder"},ea={key:3,class:"data-placeholder"},ta={key:0,class:"col-resize-layer"},oa=["aria-label","onMousedown"],na={key:1,class:"row-badges"},je=3.7795275591,la=.1,aa=e.defineComponent({__name:"TableElement",props:{element:{},designMode:{type:Boolean},isSelected:{type:Boolean},showTableGhostBorder:{type:Boolean},scale:{},data:{}},emits:["dblclick-element","dblclick-cell"],setup(t,{emit:r}){const o={header:"题",data:"数",subtotal:"小",summary:"汇"},s=t,n=r,l=e.inject(Ge,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),a=e.computed(()=>s.element.options.tableRows??[]),i=e.computed(()=>s.element.options.tableColWidths??[]),d=e.computed(()=>s.element.options.tableDefaultFontSize??10),m=e.computed(()=>s.element.options.tableDefaultColor??"#333333"),c=e.computed(()=>{const P=l.tableSelection.value;return P&&P.elementId===s.element.id?P:null});function f(P){let H=0;for(let j=0;j<P;j++)H+=a.value[j].height;return H}const g=e.ref(null),h=e.ref(null),R=e.ref([]);function w(){if(!s.designMode)return;const P=g.value;if(!P)return;const H=P.offsetHeight;if(H<=0)return;const j=s.element.options,ne=H/je;Math.abs(ne-(j.height??0))>la&&(j.height=Math.round(ne*100)/100);const _=P.offsetTop;R.value=Array.from(P.rows).map(be=>({top:(be.offsetTop-_)/je,height:be.offsetHeight/je}))}function v(P){return R.value[P]?.top??f(P)}function p(P){return R.value[P]?.height??a.value[P]?.height??0}e.watch(()=>[s.element.options,s.designMode],()=>w(),{deep:!0,flush:"post"}),e.onMounted(()=>{w(),document.fonts?.ready.then(()=>w())});const B=e.computed(()=>{const P=s.element.options.dataSource;if(P&&Array.isArray(E.DEFAULT_DEMO_DATA[P]))return E.DEFAULT_DEMO_DATA[P];for(const H of Object.values(E.DEFAULT_DEMO_DATA))if(Array.isArray(H))return H}),Q=e.computed(()=>{if(s.data)return s.data});function ae(P){return P.cellType==="barcode"||P.cellType==="qrcode"}function K(P,H){return ae(H)?E.resolveBarcodeDesignValue(H.formatter,B.value):H.formatter||""}function Z(P,H){const j=s.element.options,ne={designMode:s.designMode,showGhostBorder:s.showTableGhostBorder};return{fontFamily:H.fontFamily||"inherit",textAlign:H.align??"left",verticalAlign:H.valign??"middle",fontSize:(H.fontSize??d.value)+"pt",fontWeight:H.fontWeight??"normal",color:H.color??m.value,backgroundColor:H.backgroundColor??"transparent",borderTop:E.resolveCellBorderCss(H.borders?.top,ne),borderRight:E.resolveCellBorderCss(H.borders?.right,ne),borderBottom:E.resolveCellBorderCss(H.borders?.bottom,ne),borderLeft:E.resolveCellBorderCss(H.borders?.left,ne),padding:(H.padding??j.tableDefaultPadding??1)+"mm",whiteSpace:H.wordWrap??!0?"normal":"nowrap",overflow:H.wordWrap??!0?"visible":"hidden"}}function y(P){return E.resolveCellTextFit(P)}function W(P){return y(P)!=="autoHeight"}function X(P){return P.fontSize??d.value}function U(P,H){return E.cellFitCapMm(a.value,P,H,s.element.options.tableDefaultPadding??1)}function k(P,H){return E.cellFitWidthMm(i.value,P,H,s.element.options.tableDefaultPadding??1)}function D(P,H){return{maxHeight:U(H,P)+"mm",overflow:"hidden",...P.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}ht(h,()=>[s.designMode,s.data?.length,i.value.join(","),d.value,s.element.options.tableDefaultPadding,a.value.map(P=>`${P.height}:${P.cells.map(H=>`${H.formatter??""}|${H.fontSize??""}|${H.wordWrap??""}|${H.textFit??""}|${H.colspan??1}`).join("~")}`).join(",")]);function N(P,H){const j=c.value;return{"cell-selected":!!j&&P>=j.r1&&P<=j.r2&&H>=j.c1&&H<=j.c2,"row-data-bg":a.value[P].type==="data"}}const F=e.ref(null);function A(P,H){const j=E.normalizeSelection(a.value,P,H);l.setTableSelection({elementId:s.element.id,...j})}function V(P,H,j){!s.designMode||!s.isSelected||(j.stopPropagation(),j.shiftKey&&c.value?A({r:c.value.r1,c:c.value.c1},{r:P,c:H}):(F.value={r:P,c:H},A({r:P,c:H},{r:P,c:H})),window.addEventListener("mouseup",()=>{F.value=null},{once:!0}))}function T(P,H){F.value&&A(F.value,{r:P,c:H})}function u(P,H){s.designMode&&n("dblclick-cell",s.element.id,P,H)}const S=e.reactive({visible:!1,x:0,y:0});function Y(P,H,j){if(!s.designMode||!s.isSelected)return;const ne=c.value;ne&&P>=ne.r1&&P<=ne.r2&&H>=ne.c1&&H<=ne.c2||A({r:P,c:H},{r:P,c:H}),S.x=j.clientX,S.y=j.clientY,S.visible=!0,window.addEventListener("mousedown",()=>{S.visible=!1},{once:!0})}const Ee=e.computed(()=>{const P=c.value;return P?E.canMergeReason(a.value,P):"未选择单元格"}),fe=e.computed(()=>{const P=c.value;if(!P)return!1;for(let H=P.r1;H<=P.r2;H++)for(let j=P.c1;j<=P.c2;j++){const ne=a.value[H].cells[j];if(!ne.merged&&((ne.rowspan??1)>1||(ne.colspan??1)>1))return!0}return!1});function me(P){const H=c.value;if(!H)return"未选择单元格";if(H.r1!==H.r2)return"行类型仅支持单行设置";const j=JSON.parse(JSON.stringify(a.value));return E.setRowType(j,H.r1,P)}function ge(){E.syncTableElementSize(s.element.options)}function L(P,H){const j=l.maxTableWidth.value,ne=P.reduce((_,be)=>_+be,0)+P[H];return ne>j?`插入后表格总宽 ${Math.round(ne*10)/10}mm 超过打印范围宽度 ${j}mm,请先缩小列宽`:null}function x(P,H){const j=c.value;if(!j)return;S.visible=!1;const ne=s.element.options,_=ne.tableRows,be=ne.tableColWidths;let O=null;switch(P){case"insert-row-above":E.insertRow(_,j.r1,"above");break;case"insert-row-below":E.insertRow(_,j.r2,"below");break;case"delete-row":O=E.deleteRow(_,j.r1);break;case"insert-col-left":O=L(be,j.c1),O||E.insertCol(_,be,j.c1,"left");break;case"insert-col-right":O=L(be,j.c2),O||E.insertCol(_,be,j.c2,"right");break;case"delete-col":O=E.deleteCol(_,be,j.c1);break;case"merge":E.mergeCells(_,j);break;case"split":E.splitCells(_,j);break;case"set-row-type":O=E.setRowType(_,j.r1,H);break}if(O){alert(O);return}l.setTableSelection(null),ge(),l.recordHistory()}const $=e.computed(()=>s.designMode&&!!s.isSelected&&!s.element.options.locked&&i.value.length>=1),G=e.computed(()=>Array.from({length:i.value.length},(P,H)=>H+1));function b(P){return i.value.slice(0,P).reduce((H,j)=>H+j,0)}const C=e.ref(null);let M=0,ee=0;function oe(P,H){$.value&&H.button===0&&(C.value=P,M=H.clientX,ee=i.value[P-1],document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ve))}function ie(P){if(C.value===null)return;const H=s.scale||1,j=(P.clientX-M)/(H*je),ne=C.value-1,_=s.element.options.tableColWidths;_[ne]=E.clampResizedColumnWidth(_,ne,ee+j,l.maxTableWidth.value),ge()}function ve(){document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ve),C.value!==null&&(C.value=null,ge(),l.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ve)}),(P,H)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:h,class:e.normalizeClass(["print-table",{"design-mode":t.designMode}]),onContextmenu:H[0]||(H[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:g,style:e.normalizeStyle({fontSize:d.value+"pt",color:m.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(j,ne)=>(e.openBlock(),e.createElementBlock("col",{key:ne,style:e.normalizeStyle({width:j+"mm"})},null,4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(j,ne)=>(e.openBlock(),e.createElementBlock("tr",{key:j.id,style:e.normalizeStyle({height:j.height+"mm"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(j.cells,(_,be)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:_.id},[_.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:_.rowspan||1,colspan:_.colspan||1,class:e.normalizeClass(N(ne,be)),style:e.normalizeStyle(Z(j,_)),onMousedown:e.withModifiers(O=>V(ne,be,O),["left"]),onMouseenter:O=>T(ne,be),onDblclick:e.withModifiers(O=>u(ne,be),["stop"]),onContextmenu:e.withModifiers(O=>Y(ne,be,O),["prevent","stop"])},[ae(_)?(e.openBlock(),e.createBlock(Kl,{key:0,"cell-type":_.cellType,value:K(j,_),"barcode-type":_.barcodeType,"qr-code-level":_.qrCodeLevel,"show-text":_.showBarcodeText!==!1,fit:_.fit,"max-width":_.maxWidth,"max-height":_.maxHeight,"printer-dpi":_.printerDpi,"target-width-mm":k(be,_),"target-height-mm":U(ne,_),"bar-width":_.barWidth,"bar-font-size":_.barFontSize},null,8,["cell-type","value","barcode-type","qr-code-level","show-text","fit","max-width","max-height","printer-dpi","target-width-mm","target-height-mm","bar-width","bar-font-size"])):_.cellType==="image"?(e.openBlock(),e.createBlock(Zl,{key:1,value:_.formatter||"",fit:_.fit,"max-width":_.maxWidth,"max-height":_.maxHeight,"design-mode":t.designMode,data:Q.value},null,8,["value","fit","max-width","max-height","design-mode","data"])):W(_)?(e.openBlock(),e.createElementBlock("div",{key:2,class:"cell-fit",style:e.normalizeStyle(D(_,ne)),"data-fit":y(_)==="shrink"?"shrink":void 0,"data-fit-base":String(X(_)),"data-fit-min":String(e.unref(E.resolveShrinkMinFontSize)(_.shrinkMinFontSize)),"data-fit-mm":U(ne,_)},[j.type==="data"?(e.openBlock(),e.createElementBlock("span",_l,e.toDisplayString(K(j,_)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(K(j,_)),1)],64))],12,Ql)):j.type==="data"?(e.openBlock(),e.createElementBlock("span",ea,e.toDisplayString(K(j,_)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createTextVNode(e.toDisplayString(K(j,_)),1)],64))],46,Jl))],64))),128))],4))),128))])],4),$.value?(e.openBlock(),e.createElementBlock("div",ta,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(G.value,j=>(e.openBlock(),e.createElementBlock("div",{key:j,class:e.normalizeClass(["col-resize-handle",{dragging:C.value===j}]),role:"separator","aria-label":"列宽手柄"+j,style:e.normalizeStyle({left:b(j)+"mm"}),onMousedown:e.withModifiers(ne=>oe(j,ne),["stop","prevent"])},null,46,oa))),128))])):e.createCommentVNode("",!0),t.designMode&&t.isSelected?(e.openBlock(),e.createElementBlock("div",na,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(j,ne)=>(e.openBlock(),e.createElementBlock("span",{key:j.id,class:"row-badge",style:e.normalizeStyle({top:v(ne)+"mm",height:p(ne)+"mm"})},e.toDisplayString(o[j.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(Il,{visible:S.visible,x:S.x,y:S.y,"can-delete-row":a.value.length>1,"can-delete-col":i.value.length>1,"merge-disabled-reason":Ee.value,"can-split":fe.value,"current-row-type":c.value?a.value[c.value.r1]?.type??null:null,"row-type-disabled-reason":me,onAction:x},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),ia=ce(aa,[["__scopeId","data-v-4531a154"]]),xt=e.defineComponent({__name:"LineElement",props:{element:{}},setup(t){const r=t,o=e.computed(()=>r.element.printElementType.type==="hline"),s=e.computed(()=>{const n=r.element.options,l=(n.borderWidth||.75)+"pt",a=n.borderStyle||"solid",i=n.borderColor||"#333";return o.value?{width:"100%",height:"0",borderTop:`${l} ${a} ${i}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${l} ${a} ${i}`,boxSizing:"border-box"}});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(s.value)},null,4))}}),$t=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(t){const r=t,o=e.computed(()=>r.element.printElementType.type==="oval"),s=e.computed(()=>{const n=r.element.options;return{width:"100%",height:"100%",borderWidth:(n.borderWidth||1)+"pt",borderStyle:n.borderStyle||"solid",borderColor:n.borderColor||"#333",backgroundColor:n.backgroundColor||"transparent",borderRadius:o.value?"50%":"0",boxSizing:"border-box"}});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(s.value)},null,4))}}),ra={class:"print-barcode",ref:"containerRef"},sa=["preserveAspectRatio"],da=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.ref(null),s=e.ref(null),n={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},l=e.computed(()=>n[r.element.options.fit||"contain"]??"xMidYMid meet"),a=e.computed(()=>s.value?{width:s.value.width,height:s.value.height}:{maxWidth:"100%",maxHeight:"100%"});function i(){if(!o.value)return;const m=r.element.options,c=(r.designMode?m.testData||m.formatter:E.resolveTextBinding(m,r.data))||"条码",f=E.barcodeUnitsPerModule(m.barWidth);try{At(o.value,c,{format:m.barcodeType||"CODE128",width:f,height:E.BARCODE_BAR_HEIGHT_MODULES*f,displayValue:!m.hideTitle,fontSize:(m.fontSize??E.BARCODE_TEXT_FONT_SIZE_MODULES)*f,margin:0,marginLeft:E.BARCODE_QUIET_ZONE_MODULES*f,marginRight:E.BARCODE_QUIET_ZONE_MODULES*f,marginTop:0,marginBottom:E.BARCODE_MARGIN_BOTTOM_MODULES*f})}catch{s.value=null;return}const g=d(o.value),h=g?E.resolveBarcodeSize({unitWidth:g.width/f,unitHeight:g.height/f,boxWidthMm:E.barcodeAvailableBoxMm(m.width,m.maxWidth),boxHeightMm:E.barcodeAvailableBoxMm(m.height,m.maxHeight),dpi:m.printerDpi,barWidth:m.barWidth}):null;s.value=h?{width:`${h.widthMm}mm`,height:`${h.heightMm}mm`}:null,o.value.setAttribute("shape-rendering","crispEdges")}function d(m){const c=(m.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return c.length!==4||c.some(f=>!Number.isFinite(f))?null:{width:c[2],height:c[3]}}return e.onMounted(i),e.watch(()=>[r.element.options.formatter,r.element.options.testData,r.element.options.barcodeType,r.element.options.width,r.element.options.height,r.element.options.barWidth,r.element.options.printerDpi,r.element.options.hideTitle,r.element.options.fontSize,r.element.options.maxWidth,r.element.options.maxHeight],i),(m,c)=>(e.openBlock(),e.createElementBlock("div",ra,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:o,preserveAspectRatio:l.value,style:e.normalizeStyle(a.value)},null,12,sa))],512))}}),ca=ce(da,[["__scopeId","data-v-6eb95a40"]]),ua={class:"print-qrcode"},ma=["src"],pa=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.ref(""),s=e.computed(()=>{const l=r.element.options;return{objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}});async function n(){const l=r.element.options,a=(r.designMode?l.testData||l.formatter:E.resolveTextBinding(l,r.data))||"二维码",i=Math.min(l.width||80,l.height||80);try{o.value=await Pt.toDataURL(a,{width:i,margin:1,errorCorrectionLevel:String(l.qrCodeLevel??"M")})}catch{o.value=""}}return e.onMounted(n),e.watch(()=>[r.element.options.formatter,r.element.options.testData,r.element.options.qrCodeLevel],n),(l,a)=>(e.openBlock(),e.createElementBlock("div",ua,[o.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,alt:"qrcode",style:e.normalizeStyle(s.value)},null,12,ma)):e.createCommentVNode("",!0)]))}}),va=ce(pa,[["__scopeId","data-v-3454544f"]]),fa=["innerHTML"],ga=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.computed(()=>{if(r.element.options.formatter){const s=r.data&&r.data.length>0?r.data[0]:{},n=E.evaluateTemplate(r.element.options.formatter,s??{});return n?jt.sanitize(n):""}return'<div style="background:#e0e0e0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10pt;color:#999">HTML</div>'});return(s,n)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:o.value},null,8,fa))}}),ba=ce(ga,[["__scopeId","data-v-880bbde5"]]),ha=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.computed(()=>{const n=r.element.options;return{fontSize:(n.fontSize||12)+"pt",fontWeight:n.fontWeight||"normal",fontFamily:n.fontFamily||"inherit",color:n.color||"#333",textAlign:n.textAlign||"left",lineHeight:n.lineHeight?n.lineHeight+"pt":"normal",letterSpacing:n.letterSpacing?n.letterSpacing+"pt":"normal"}}),s=e.computed(()=>r.designMode?r.element.options.title||"{pageIndex}/{totalPages}":r.element.options.title||"");return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(o.value)},e.toDisplayString(s.value),5))}}),Ea=ce(ha,[["__scopeId","data-v-38f1d7df"]]),ya={key:0,class:"drag-preview"},ka={key:1,class:"resize-handles"},Va=["onMousedown"],Na={key:2,class:"selected-indicator"},wa={class:"position-label"},Ca=e.defineComponent({__name:"BaseElement",props:{element:{},isSelected:{type:Boolean},designMode:{type:Boolean},printData:{},scale:{},allElements:{},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},zone:{},adsorbHandler:{type:Function},clearAdsorbGuides:{type:Function}},emits:["select","update:element","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","clone-element"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(null),l=e.inject(Rt,null),a=e.computed(()=>l?.value?l.value.has(o.element.id):o.isSelected??!1),i=e.inject(Lt,null),d=e.computed(()=>i?.value.has(o.element.id)??!1),m={text:e.markRaw($l),image:e.markRaw(zl),longText:e.markRaw(Pl),table:e.markRaw(ia),hline:e.markRaw(xt),vline:e.markRaw(xt),rect:e.markRaw($t),oval:e.markRaw($t),barcode:e.markRaw(ca),qrcode:e.markRaw(va),html:e.markRaw(ba),pageNumber:e.markRaw(Ea)},c=e.computed(()=>m[o.element.printElementType.type]),f=e.computed(()=>o.element.printElementType.type==="table"?{showTableGhostBorder:o.showTableGhostBorder,scale:o.scale}:{}),g=e.computed(()=>{const k=o.element.options,D=E.resolveElementBorder(o.element.printElementType.type,k),N={};if(D?.all&&(N.border=`${D.all.borderWidth} ${D.all.borderStyle} ${D.all.borderColor}`),D)for(const F of E.ELEMENT_BORDER_SIDES){const A=D.edges[F];A&&(N[`border${F.charAt(0).toUpperCase()}${F.slice(1)}`]=`${A.borderWidth} ${A.borderStyle} ${A.borderColor}`)}return{position:"absolute",left:k.left+"mm",top:k.top+"mm",width:k.width+"mm",height:k.height+"mm",zIndex:k.zIndex||"auto",...N}}),h=e.computed(()=>{const k=o.element.options;return`x:${Math.round(k.left)} y:${Math.round(k.top)} ${Math.round(k.width)}×${Math.round(k.height)}mm`});let R=0,w=0;const v=e.reactive({disabled:!o.designMode||!!o.element.options.locked,getScale:()=>(o.scale||1)*E.mmToPx(1),onDrag:k=>{const D=k.left-R,N=k.top-w;n.value&&(n.value.style.transform=`translate(${D}mm, ${N}mm)`)},onDragEnd:(k,D)=>{if(D.altKey){const A=JSON.parse(JSON.stringify(o.element));A.id=E.generateId(),A.options.left=k.left,A.options.top=k.top,A.options.groupId=void 0,s("clone-element",A,{left:k.left,top:k.top}),n.value&&(n.value.style.transform="");return}const N=k.left-R,F=k.top-w;if(o.element.options.left=k.left,o.element.options.top=k.top,n.value&&(n.value.style.transform=""),o.element.options.groupId&&o.allElements)for(const A of o.allElements)A.id!==o.element.id&&A.options.groupId===o.element.options.groupId&&(A.options.left+=N,A.options.top+=F)},onStart:()=>{R=o.element.options.left,w=o.element.options.top,s("drag-start")},onStop:()=>{o.clearAdsorbGuides?.(),s("drag-stop")},onAdsorb:k=>{let D=k.left,N=k.top;return o.snapToGrid&&(D=Math.round(k.left/5)*5,N=Math.round(k.top/5)*5),o.adsorbHandler?o.adsorbHandler({id:o.element.id,left:D,top:N,width:o.element.options.width,height:o.element.options.height}):{left:D,top:N,lines:[]}}}),{setup:p,cleanup:B,isDragging:Q}=wl(n,v);e.watchEffect(()=>{v.disabled=!o.designMode||!!o.element.options.locked});const ae=e.computed(()=>a.value&&!!o.designMode&&!o.element.options.locked&&o.element.printElementType.type!=="table"),{startResize:K,cleanup:Z}=E.useResize({minWidth:3.5,minHeight:3.5,getScale:()=>(o.scale||1)*E.mmToPx(1),getRect:()=>({left:o.element.options.left,top:o.element.options.top,width:o.element.options.width,height:o.element.options.height}),onResize:k=>{o.element.options.left=k.left,o.element.options.top=k.top,o.element.options.width=k.width,o.element.options.height=k.height},onStart:()=>{s("drag-start")},onStop:()=>{s("drag-stop")}});function y(k){o.designMode&&k.button===0&&s("select",o.element.id,k.ctrlKey||k.metaKey)}function W(){o.designMode&&s("dblclick-element",o.element.id)}function X(k,D,N){o.designMode&&s("dblclick-cell",k,D,N)}e.onMounted(()=>{o.designMode&&p()});function U(){B(),Z(),o.clearAdsorbGuides?.()}return e.onUnmounted(()=>{U()}),(k,D)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:n,class:e.normalizeClass(["print-element",{selected:a.value,previewed:d.value,"design-mode":t.designMode,locked:t.element.options.locked,hidden:t.element.options.visible===!1,"drag-ghost":e.unref(Q),[`type-${t.element.printElementType.type}`]:!0,[`zone-${t.zone||"content"}`]:!0}]),style:e.normalizeStyle(g.value),onMousedown:e.withModifiers(y,["stop"]),onDblclick:e.withModifiers(W,["stop"]),onContextmenu:D[0]||(D[0]=e.withModifiers(N=>k.$emit("contextmenu",t.element.id,N),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value),e.mergeProps({element:t.element,data:t.printData,"design-mode":t.designMode,"is-selected":a.value},f.value,{onDblclickCell:X}),null,16,["element","data","design-mode","is-selected"])),e.unref(Q)?(e.openBlock(),e.createElementBlock("div",ya)):e.createCommentVNode("",!0),ae.value?(e.openBlock(),e.createElementBlock("div",ka,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E.RESIZE_POINTS),N=>(e.openBlock(),e.createElementBlock("div",{key:N,class:e.normalizeClass(["resize-handle",`handle-${N}`]),onMousedown:e.withModifiers(F=>e.unref(K)(N,F),["stop"])},null,42,Va))),128))])):e.createCommentVNode("",!0),a.value&&t.designMode?(e.openBlock(),e.createElementBlock("div",Na,[e.createElementVNode("div",wa,e.toDisplayString(h.value),1)])):e.createCommentVNode("",!0)],38))}}),ct=ce(Ca,[["__scopeId","data-v-c1d8b84e"]]);function Sa(t={}){const r=e.ref([]),o=e.ref({width:0,height:0});function s(a,i,d){return E.computeAdsorb(a,i,d,t)}function n(a,i,d){r.value=a,o.value={width:i,height:d}}function l(){r.value=[]}return{check:s,renderLines:n,clearLines:l,guideLines:r,paperSize:o}}function xa(t){const{check:r,renderLines:o,clearLines:s,guideLines:n,paperSize:l}=Sa(t.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function a(d){const m=t.getElements().filter(g=>g.id!==d.id).map(g=>({id:g.id,left:g.options.left,top:g.options.top,width:g.options.width,height:g.options.height})),c=r(d,m,t.getGuides?.()),f=t.getPaperSize();return o(c.lines,f.width,f.height),c}function i(){s()}return{requestAdsorb:a,clearGuides:i,guideLines:n,paperSize:l}}const $a=["src"],Ba=["width","height","viewBox"],Da=["x","y","font-size","fill","transform"],Ta={key:0,class:"zone-label"},Ma={key:0,class:"zone-height-tip"},za={key:0,class:"zone-label"},Aa={key:0,class:"zone-height-tip"},Pa=["onMousedown","onDblclick"],Ra=e.defineComponent({__name:"CanvasPaper",props:{templateData:{},runtimeElements:{},designMode:{type:Boolean},printData:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},guides:{}},emits:["select","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","zone-height-change","zone-height-commit","guide-move","guide-remove","clone-element"],setup(t,{expose:r,emit:o}){const s=t,n=o,l=e.ref(null),a=e.computed(()=>E.getPaperDimensions(s.templateData).width),i=e.computed(()=>E.getPaperDimensions(s.templateData).height),d=e.computed(()=>s.templateData.designBackground),m=e.ref(!1);e.watch(()=>d.value?.src,()=>{m.value=!1});const c=e.computed(()=>{const x=d.value?.rotation;return x===90||x===180||x===270?x:0}),f=e.computed(()=>{const x=c.value,$=x===90||x===270,G=$?i.value:a.value,b=$?a.value:i.value,C={width:G+"mm",height:b+"mm",left:(a.value-G)/2+"mm",top:(i.value-b)/2+"mm"};return x!==0&&(C.transform=`rotate(${x}deg)`),C});function g(){m.value=!0,console.warn("[print-designer] 设计背景图加载失败:",d.value?.src)}const h=e.computed(()=>`${8/(s.scale||1)}px`),R=e.computed(()=>{const x=s.scale||1,$=E.mmToPx(a.value)*x,G=E.mmToPx(i.value)*x;return{width:$+"px",height:G+"px",position:"relative"}}),w=e.computed(()=>{const x=s.templateData.margins,$=s.templateData.header.height,G=s.templateData.footer.height,b=a.value-x.left-x.right;return{header:{left:x.left,top:x.top,width:b,height:$},content:{left:x.left,top:x.top+$,width:b,height:i.value-x.top-x.bottom-$-G},footer:{left:x.left,top:i.value-x.bottom-G,width:b,height:G}}});function v(x){return{position:"absolute",left:x.left+"mm",top:x.top+"mm",width:x.width+"mm",height:x.height+"mm"}}const p=e.computed(()=>{const x={header:[],footer:[],content:[]};for(const $ of s.runtimeElements)$.zone==="header"?x.header.push($):$.zone==="footer"?x.footer.push($):x.content.push($);return x}),B=e.computed(()=>p.value.header),Q=e.computed(()=>p.value.footer),ae=e.computed(()=>p.value.content);let K="content";const{requestAdsorb:Z,clearGuides:y,guideLines:W,paperSize:X}=xa({getElements:()=>p.value[K],getPaperSize:()=>{const x=w.value[K];return{width:x.width,height:x.height}},getGuides:()=>{const x=[],$=[];for(const G of s.guides??[])G.type==="vertical"?x.push(G.position):$.push(G.position);return{vertical:x,horizontal:$}}});function U(x){K=s.runtimeElements.find(b=>b.id===x.id)?.zone||"content";const G=Z(x);return(G.left!==x.left||G.top!==x.top)&&u(G.left+x.width/2,G.top+x.height/2),G}function k(x,$){if(x.button!==0)return;const G=$.position,b=x.clientX,C=x.clientY,M=s.scale??1,ee=25.4/96,oe=ve=>{const P=($.type==="vertical"?ve.clientX-b:ve.clientY-C)/M*ee,H=$.type==="vertical"?a.value:i.value,j=Math.min(Math.max(G+P,0),H);n("guide-move",$.id,j)},ie=()=>{window.removeEventListener("mousemove",oe),window.removeEventListener("mouseup",ie)};window.addEventListener("mousemove",oe),window.addEventListener("mouseup",ie)}const D=e.computed(()=>({width:a.value+"mm",minHeight:i.value+"mm",background:s.templateData.pageBackground||"var(--pd-paper, #fff)",boxShadow:"var(--pd-shadow-paper, 0 1px 2px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08))",overflow:"hidden",position:"relative",transform:s.scale?`scale(${s.scale})`:void 0,transformOrigin:"0 0"})),N=e.computed(()=>{const x=s.templateData.margins;return{padding:`${x.top}mm ${x.right}mm ${x.bottom}mm ${x.left}mm`,position:"relative",boxSizing:"border-box",minHeight:i.value+"mm"}}),F=e.computed(()=>({backgroundImage:`url("data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M0 .5H20M.5 0V20" fill="none" stroke="rgba(0,0,0,0.08)" stroke-width="1" stroke-dasharray="4 4"/></svg>')}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}));let A=0,V=null;const T=e.ref(null);function u(x,$){A+=1,T.value={left:x,top:$,key:A},V&&clearTimeout(V),V=setTimeout(()=>{T.value=null},300)}const S=e.computed(()=>he.resolveWatermarkLayout(s.templateData.watermark,s.printData,{width:a.value,height:i.value})),Y=e.ref(null);function Ee(x,$){$.button===0&&(ge(),Y.value={zone:x,startY:$.clientY,startH:s.templateData[x].height},window.addEventListener("mousemove",fe),window.addEventListener("mouseup",me))}function fe(x){if(!Y.value)return;const{zone:$,startY:G,startH:b}=Y.value,M=(x.clientY-G)/(s.scale||1)*25.4/96,ee=$==="header"?M:-M,oe=Math.min(100,i.value-s.templateData.margins.top-s.templateData.margins.bottom-($==="header"?s.templateData.footer.height:s.templateData.header.height)-10),ie=Math.min(oe,Math.max(0,Math.round((b+ee)*10)/10));n("zone-height-change",$,ie)}function me(){if(!Y.value)return;const x=Y.value.zone;Y.value=null,window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",me),n("zone-height-commit",x)}function ge(){window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",me),Y.value=null}e.onUnmounted(()=>{ge(),V&&clearTimeout(V)});function L(x,$){n("select",x,$)}return r({contentRef:l}),(x,$)=>(e.openBlock(),e.createElementBlock("div",{class:"paper-wrapper",style:e.normalizeStyle(R.value)},[e.createElementVNode("div",{class:"hiprint-printPaper",style:e.normalizeStyle(D.value)},[t.designMode&&d.value?.src&&!m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"design-background",style:e.normalizeStyle(f.value)},[e.createElementVNode("img",{src:d.value.src,draggable:"false",alt:"",onError:g},null,40,$a)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:l,style:e.normalizeStyle(N.value)},[t.showGrid&&t.designMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"grid-bg",style:e.normalizeStyle(F.value)},null,4)):e.createCommentVNode("",!0),T.value?(e.openBlock(),e.createElementBlock("div",{key:T.value.key,class:"snap-indicator",style:e.normalizeStyle({left:T.value.left+"mm",top:T.value.top+"mm"})},null,4)):e.createCommentVNode("",!0),S.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"watermark-layer",style:e.normalizeStyle({opacity:String(S.value.opacity)})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value.tiles,(G,b)=>(e.openBlock(),e.createElementBlock("svg",{key:b,class:"watermark-tile",width:G.widthMm+"mm",height:G.heightMm+"mm",viewBox:`0 0 ${S.value.tileWidthPx} ${S.value.tileHeightPx}`,style:e.normalizeStyle({left:G.leftMm+"mm",top:G.topMm+"mm"}),xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("text",{x:S.value.tileWidthPx/2,y:S.value.tileHeightPx/2,"font-size":S.value.fontSizePx,fill:S.value.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${S.value.rotate},${S.value.tileWidthPx/2},${S.value.tileHeightPx/2})`},e.toDisplayString(S.value.text),9,Da)],12,Ba))),128))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-header",{"design-mode":t.designMode}]),style:e.normalizeStyle(v(w.value.header))},[t.designMode?(e.openBlock(),e.createElementBlock("span",Ta,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,G=>(e.openBlock(),e.createBlock(ct,{key:G.id,element:G,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":B.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"header","adsorb-handler":U,"clear-adsorb-guides":e.unref(y),onSelect:L,onDragStart:$[0]||($[0]=b=>x.$emit("drag-start")),onDragStop:$[1]||($[1]=b=>x.$emit("drag-stop")),onDblclickElement:$[2]||($[2]=b=>x.$emit("dblclick-element",b)),onDblclickCell:$[3]||($[3]=(b,C,M)=>x.$emit("dblclick-cell",b,C,M)),onContextmenu:$[4]||($[4]=(b,C)=>x.$emit("contextmenu",b,C)),onCloneElement:(b,C)=>x.$emit("clone-element",b,C)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),t.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-bottom",onMousedown:$[5]||($[5]=e.withModifiers(G=>Ee("header",G),["prevent","stop"]))},[Y.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",Ma,e.toDisplayString(t.templateData.header.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-content",{"design-mode":t.designMode}]),style:e.normalizeStyle(v(w.value.content))},[t.designMode&&t.templateData.firstPageOverlay.height>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:"zone-overlay",style:e.normalizeStyle({height:t.templateData.firstPageOverlay.height+"mm"})},[...$[17]||($[17]=[e.createElementVNode("span",{class:"zone-label"},"首页叠加",-1)])],4)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ae.value,G=>(e.openBlock(),e.createBlock(ct,{key:G.id,element:G,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":ae.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"content","adsorb-handler":U,"clear-adsorb-guides":e.unref(y),onSelect:L,onDragStart:$[6]||($[6]=b=>x.$emit("drag-start")),onDragStop:$[7]||($[7]=b=>x.$emit("drag-stop")),onDblclickElement:$[8]||($[8]=b=>x.$emit("dblclick-element",b)),onDblclickCell:$[9]||($[9]=(b,C,M)=>x.$emit("dblclick-cell",b,C,M)),onContextmenu:$[10]||($[10]=(b,C)=>x.$emit("contextmenu",b,C)),onCloneElement:(b,C)=>x.$emit("clone-element",b,C)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128))],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-footer",{"design-mode":t.designMode}]),style:e.normalizeStyle(v(w.value.footer))},[t.designMode?(e.openBlock(),e.createElementBlock("span",za,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,G=>(e.openBlock(),e.createBlock(ct,{key:G.id,element:G,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":Q.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"footer","adsorb-handler":U,"clear-adsorb-guides":e.unref(y),onSelect:L,onDragStart:$[11]||($[11]=b=>x.$emit("drag-start")),onDragStop:$[12]||($[12]=b=>x.$emit("drag-stop")),onDblclickElement:$[13]||($[13]=b=>x.$emit("dblclick-element",b)),onDblclickCell:$[14]||($[14]=(b,C,M)=>x.$emit("dblclick-cell",b,C,M)),onContextmenu:$[15]||($[15]=(b,C)=>x.$emit("contextmenu",b,C)),onCloneElement:(b,C)=>x.$emit("clone-element",b,C)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),t.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-top",onMousedown:$[16]||($[16]=e.withModifiers(G=>Ee("footer",G),["prevent","stop"]))},[Y.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",Aa,e.toDisplayString(t.templateData.footer.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(W),(G,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:e.normalizeClass(["adsorb-guide",[`guide-${G.type}`]]),style:e.normalizeStyle(G.type==="vertical"?{left:G.position+"mm",top:"0",height:e.unref(X).height+"mm",borderLeftColor:G.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:G.position+"mm",left:"0",width:e.unref(X).width+"mm",borderTopColor:G.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.guides,G=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+G.id,class:e.normalizeClass(["manual-guide",[`guide-${G.type}`]]),style:e.normalizeStyle(G.type==="vertical"?{left:G.position+"mm",top:"0",height:i.value+"mm","--guide-hit":h.value}:{top:G.position+"mm",left:"0",width:a.value+"mm","--guide-hit":h.value}),onMousedown:e.withModifiers(b=>k(b,G),["prevent","stop"]),onDblclick:e.withModifiers(b=>G.id&&n("guide-remove",G.id),["prevent","stop"])},null,46,Pa))),128))],4)],4)],4))}}),La=ce(Ra,[["__scopeId","data-v-38b3a452"]]),Ua=e.defineComponent({__name:"Ruler",props:{orientation:{},viewportPx:{},originPx:{},paperLengthMM:{},scale:{},cursorPx:{}},emits:["add-guide","guide-dragging"],setup(t,{emit:r}){const o=t,s=r,n=e.computed(()=>o.orientation==="horizontal"),l=e.computed(()=>n.value?"vertical":"horizontal"),a=e.ref(null),i=e.ref(null),d=e.computed(()=>i.value??o.cursorPx??null),m=e.computed(()=>n.value?{width:o.viewportPx+"px",height:E.RULER_THICKNESS+"px"}:{width:E.RULER_THICKNESS+"px",height:o.viewportPx+"px"});let c=0;function f(){c||(c=requestAnimationFrame(()=>{c=0,g()}))}function g(){const y=a.value;if(!y)return;const W=y.getContext("2d");if(!W)return;const X=window.devicePixelRatio||1,U=Math.max(0,Math.round(o.viewportPx)),k=E.RULER_THICKNESS;y.width=(n.value?U:k)*X,y.height=(n.value?k:U)*X,W.setTransform(X,0,0,X,0,0);const D=getComputedStyle(y),N=D.getPropertyValue("--pd-ruler-bg").trim()||"#F8F9FC",F=D.getPropertyValue("--pd-ruler").trim()||"#9AA1AF",A=D.getPropertyValue("--pd-accent").trim()||"#165DFF";W.fillStyle=N,W.fillRect(0,0,n.value?U:k,n.value?k:U);const V=o.scale>0?o.scale:1,T=E.mmToPx(1)*V;if(T<=0)return;const u=-o.originPx/T,S=(U-o.originPx)/T,Y=E.chooseMajorStepMM(V),Ee=E.buildRulerTicks(u,S,Y);h(W,Ee,T,F,!0),h(W,Ee,T,F,!1),R(W,0,A),R(W,o.paperLengthMM,A);const fe=d.value;if(fe!==null&&fe>=0&&fe<=U){if(W.strokeStyle=A,W.lineWidth=1.5,W.beginPath(),n.value){const me=Math.round(fe)+.5;W.moveTo(me,0),W.lineTo(me,k)}else{const me=Math.round(fe)+.5;W.moveTo(0,me),W.lineTo(k,me)}W.stroke()}}function h(y,W,X,U,k){y.strokeStyle=U,y.fillStyle=U,y.globalAlpha=k?.32:1,y.lineWidth=1,y.font="9px ui-monospace, Menlo, monospace",y.textBaseline="top";for(const D of W){if((D.mm<0||D.mm>o.paperLengthMM)!==k)continue;const F=Math.round(o.originPx+D.mm*X)+.5,A=D.major?8:4;y.beginPath(),n.value?(y.moveTo(F,0),y.lineTo(F,A)):(y.moveTo(0,F),y.lineTo(A,F)),y.stroke(),D.major&&D.label&&(n.value?y.fillText(D.label,F+2,11):(y.save(),y.translate(11,F+2),y.rotate(-Math.PI/2),y.fillText(D.label,0,0),y.restore()))}y.globalAlpha=1}function R(y,W,X){const U=E.mmToPx(1)*(o.scale>0?o.scale:1),k=Math.round(o.originPx+W*U)+.5;k<=0||k>=o.viewportPx||(y.strokeStyle=X,y.globalAlpha=.55,y.lineWidth=1,y.beginPath(),n.value?(y.moveTo(k,0),y.lineTo(k,E.RULER_THICKNESS)):(y.moveTo(0,k),y.lineTo(E.RULER_THICKNESS,k)),y.stroke(),y.globalAlpha=1)}e.watch(()=>[o.viewportPx,o.originPx,o.paperLengthMM,o.scale,o.cursorPx,o.orientation],f),e.onMounted(f),e.onBeforeUnmount(()=>{c&&cancelAnimationFrame(c)});let w=!1;function v(y){const W=a.value;if(!W)return null;const X=W.getBoundingClientRect(),U=n.value?y.clientX-X.left:y.clientY-X.top;if(U<0||U>o.viewportPx)return null;const k=E.mmToPx(1)*(o.scale>0?o.scale:1);return(U-o.originPx)/k}function p(y){y.button===0&&(w=!0,y.preventDefault(),window.addEventListener("mousemove",K),window.addEventListener("mouseup",Z),ae(y))}function B(y){const W=a.value;if(!W)return;const X=W.getBoundingClientRect();i.value=n.value?y.clientX-X.left:y.clientY-X.top,f()}function Q(){i.value=null,f()}function ae(y){const W=v(y);s("guide-dragging",W)}function K(y){w&&ae(y)}function Z(y){if(!w)return;w=!1,window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",Z);const W=v(y);W!==null&&W>=0&&W<=o.paperLengthMM&&s("add-guide",l.value,W),s("guide-dragging",null)}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",Z)}),(y,W)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:a,class:e.normalizeClass(["pd-ruler",`is-${t.orientation}`]),style:e.normalizeStyle(m.value),onMousedown:p,onMousemove:B,onMouseleave:Q},null,38))}}),Bt=ce(Ua,[["__scopeId","data-v-1e7d0633"]]),Ia={class:"canvas-scroll"},Fa={key:0,class:"overlay-layer"},Oa=["src"],Xe=96/25.4,Ha=e.defineComponent({__name:"CanvasArea",props:{templateData:{},elements:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},hasClipboard:{type:Boolean},guides:{},overlayVisible:{type:Boolean},screenshotUrl:{},overlayOpacity:{},showRuler:{type:Boolean,default:!0}},emits:["select","drop-element","drop-field","drag-start","drag-stop","dblclick-element","dblclick-cell","zone-height-change","zone-height-commit","select-all","clear-selection","preview","commit-preview","paste","copy","cut","delete","move-layer","coordinate","add-guide","guide-move","guide-remove","zoom","clone-element"],setup(t,{expose:r,emit:o}){const s=t,n=o;function l(b,C){n("select",b,C)}const a=e.ref(null),i=e.computed(()=>E.getPaperDimensions(s.templateData).width),d=e.computed(()=>E.getPaperDimensions(s.templateData).height),m=e.reactive({originX:0,originY:0,viewW:0,viewH:0,paperScale:1}),c=e.reactive({x:null,y:null}),f=e.reactive({x:0,y:0}),g=e.computed(()=>({transform:`translate(${f.x}px, ${f.y}px)`}));function h(){const b=a.value,C=b?.querySelector(".hiprint-printPaper");if(!b||!C)return;const M=b.getBoundingClientRect(),ee=C.getBoundingClientRect(),oe=s.scale||1,ie=ee.width/E.mmToPx(i.value);m.paperScale=Math.abs(ie-oe)<.002?oe:ie,m.originX=ee.left-M.left-E.RULER_THICKNESS,m.originY=ee.top-M.top-E.RULER_THICKNESS,m.viewW=b.clientWidth-E.RULER_THICKNESS,m.viewH=b.clientHeight-E.RULER_THICKNESS}function R(){f.x=a.value?.scrollLeft??0,f.y=a.value?.scrollTop??0,h()}let w=null,v=0;function p(){cancelAnimationFrame(v);const b=performance.now()+220,C=()=>{h(),performance.now()<b&&(v=requestAnimationFrame(C))};v=requestAnimationFrame(C)}const B=e.ref(null);function Q(b,C){B.value=C===null?null:{type:b,mm:C}}const ae=e.computed(()=>{const b=B.value,C=a.value?.querySelector(".hiprint-printPaper");if(!b||!C)return{};const M=C.getBoundingClientRect(),ee=M.width/E.mmToPx(i.value),oe=E.mmToPx(b.mm)*(ee>0?ee:s.scale||1);return b.type==="vertical"?{left:M.left+oe+"px",top:M.top+"px",height:M.height+"px"}:{left:M.left+"px",top:M.top+oe+"px",width:M.width+"px"}});function K(b){const C=a.value?.querySelector(".hiprint-printPaper");if(!C)return;const M=C.getBoundingClientRect(),ee=s.scale||1,oe=E.pxToMm((b.clientX-M.left)/ee),ie=E.pxToMm((b.clientY-M.top)/ee);if(!(oe<0||ie<0))return{x:oe,y:ie}}function Z(b){const C=K(b),M=b.dataTransfer?.getData("fieldData");if(M)try{const oe=JSON.parse(M);n("drop-field",oe,C);return}catch{}const ee=b.dataTransfer?.getData("elementType");ee&&n("drop-element",ee,C)}const y=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let W={x:0,y:0};function X(b){return!b||!(b instanceof HTMLElement)?!1:!!(b===a.value||b.classList.contains("canvas-scroll")||b.classList.contains("hiprint-printPaper")||b.classList.contains("hiprint-printPaper-content")||b.classList.contains("zone-layer")||b.classList.contains("grid-bg")||b.classList.contains("watermark-layer"))}function U(b){const C=a.value,M=C?.querySelector(".hiprint-printPaper");if(!C||!M)return;const ee=C.getBoundingClientRect();c.x=b.clientX-ee.left-E.RULER_THICKNESS,c.y=b.clientY-ee.top-E.RULER_THICKNESS;const oe=M.getBoundingClientRect(),ie=s.scale||1,ve=E.pxToMm((b.clientX-oe.left)/ie),P=E.pxToMm((b.clientY-oe.top)/ie);if(ve<0||P<0){n("coordinate",null);return}n("coordinate",{x:ve,y:P})}function k(){n("coordinate",null),c.x=null,c.y=null}function D(b,C,M,ee){const oe=a.value;if(!oe)return;const ie=Math.max(ee,Math.round(b)),ve=Math.round((s.scale||1)*100);if(ie===ve)return;const P=s.scale||1,H=ie/100/P,j=getComputedStyle(oe),ne=parseFloat(j.paddingLeft)||0,_=parseFloat(j.paddingTop)||0,be=oe.scrollLeft+C-ne,O=oe.scrollTop+M-_;n("zoom",ie-ve),e.nextTick(()=>{const z=getComputedStyle(oe),te=parseFloat(z.paddingLeft)||0,pe=parseFloat(z.paddingTop)||0;oe.scrollLeft=be*H-C+te,oe.scrollTop=O*H-M+pe})}function N(b){if(!(b.ctrlKey||b.metaKey))return;b.preventDefault();const C=a.value;if(!C)return;const M=Math.round((s.scale||1)*100),ee=E.nextWheelScale(M,b.deltaY>0?-1:1);if(ee===M)return;const oe=C.getBoundingClientRect();D(ee,b.clientX-oe.left,b.clientY-oe.top,E.MIN_SCALE_PERCENT)}function F(b){const C=a.value;if(!C)return;const M=Math.round((s.scale||1)*100),ee=E.nextWheelScale(M,b);D(ee,C.clientWidth/2,C.clientHeight/2,E.MIN_SCALE_PERCENT)}function A(b){const C=a.value;if(!C)return;const M=C.querySelector(".hiprint-printPaper"),ee=M?.style.transition??"";M&&(M.style.transition="none"),D(b,C.clientWidth/2,C.clientHeight/2,E.FIT_SCALE_MIN_PERCENT),e.nextTick(()=>{M&&(M.style.transition=ee)})}function V(b){b.button!==2&&X(b.target)&&(n("clear-selection"),W={x:b.clientX,y:b.clientY},y.visible=!0,y.x=b.clientX,y.y=b.clientY,y.w=0,y.h=0,window.addEventListener("mousemove",u),window.addEventListener("mouseup",S))}function T(){if(y.w<3||y.h<3)return[];const b=a.value?.querySelector(".hiprint-printPaper");if(!b)return[];const C=b.getBoundingClientRect(),M=s.scale||1,ee=y.x<W.x,oe=[];for(const ie of s.elements){if(ie.options.visible===!1||ie.options.locked)continue;const ve=C.left+ie.options.left*Xe*M,P=C.top+ie.options.top*Xe*M,H=ve+ie.options.width*Xe*M,j=P+ie.options.height*Xe*M,ne=ve<y.x+y.w&&H>y.x&&P<y.y+y.h&&j>y.y,_=ve>=y.x&&H<=y.x+y.w&&P>=y.y&&j<=y.y+y.h;(ee?_:ne)&&oe.push(ie.id)}return oe}function u(b){const C=b.clientX-W.x,M=b.clientY-W.y;y.x=C>=0?W.x:b.clientX,y.y=M>=0?W.y:b.clientY,y.w=Math.abs(C),y.h=Math.abs(M),n("preview",T())}function S(){window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",S);const b=T();n("preview",b),b.length>0?n("commit-preview"):n("clear-selection"),n("preview",[]),y.visible=!1}const Y=e.reactive({visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null}),Ee=e.ref(null);function fe(b,C){!C&&!X(b.target)||(Y.targetId=C??null,Y.visible=!0,Y.x=b.clientX,Y.y=b.clientY,Y.flipX=0,Y.flipY=0,e.nextTick(()=>{const M=Ee.value;if(!M)return;const ee=M.getBoundingClientRect(),oe=4;b.clientX+ee.width+oe>window.innerWidth&&(Y.flipX=-ee.width),b.clientY+ee.height+oe>window.innerHeight&&(Y.flipY=-ee.height)}),window.removeEventListener("mousedown",me),setTimeout(()=>{window.addEventListener("mousedown",me,{once:!0})},0))}function me(){Y.visible=!1,window.removeEventListener("mousedown",me)}function ge(){Y.visible=!1,s.hasClipboard&&n("paste")}function L(){Y.visible=!1,n("select-all")}function x(){Y.visible=!1,n("clear-selection")}function $(b,C){Y.visible=!1,b==="copy"?n("copy"):b==="cut"?n("cut"):b==="paste"?n("paste"):b==="delete"?n("delete"):b==="move-layer"&&n("move-layer",C)}e.onMounted(()=>{e.nextTick(h),a.value&&typeof ResizeObserver<"u"&&(w=new ResizeObserver(h),w.observe(a.value))}),e.watch(()=>s.scale,p),e.watch([i,d],()=>e.nextTick(h));function G(){const b=a.value;if(!b)return;let C=0,M=0,ee=0;const oe=performance.now()+800,ie=()=>{const{scrollWidth:ve,scrollHeight:P}=b;if(ve===M&&P===ee?C++:C=0,M=ve,ee=P,C>=2||performance.now()>oe){const H=b.scrollWidth,j=b.scrollHeight,ne=b.clientWidth,_=b.clientHeight;b.scrollLeft=Math.max(0,(H-ne)/2),b.scrollTop=Math.max(0,(j-_)/2);return}requestAnimationFrame(ie)};requestAnimationFrame(ie)}return r({centerScroll:G,fitToWindow:A,zoomByStep:F}),e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",S),w?.disconnect(),cancelAnimationFrame(v)}),(b,C)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"canvas-area",onDragover:C[22]||(C[22]=e.withModifiers(()=>{},["prevent"])),onDrop:Z,onMousedown:V,onMousemove:U,onMouseleave:k,onWheel:N,onScroll:R,onContextmenu:e.withModifiers(fe,["prevent"])},[e.createElementVNode("div",Ia,[e.createVNode(La,{"template-data":t.templateData,"runtime-elements":t.elements,"design-mode":!0,"print-data":[],scale:t.scale,"show-grid":t.showGrid,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,guides:t.guides,onSelect:l,onGuideMove:C[0]||(C[0]=(M,ee)=>b.$emit("guide-move",M,ee)),onGuideRemove:C[1]||(C[1]=M=>b.$emit("guide-remove",M)),onDragStart:C[2]||(C[2]=M=>b.$emit("drag-start")),onDragStop:C[3]||(C[3]=M=>b.$emit("drag-stop")),onDblclickElement:C[4]||(C[4]=M=>b.$emit("dblclick-element",M)),onDblclickCell:C[5]||(C[5]=(M,ee,oe)=>b.$emit("dblclick-cell",M,ee,oe)),onContextmenu:C[6]||(C[6]=(M,ee)=>fe(ee,M)),onZoneHeightChange:C[7]||(C[7]=(M,ee)=>b.$emit("zone-height-change",M,ee)),onZoneHeightCommit:C[8]||(C[8]=M=>b.$emit("zone-height-commit",M)),onCloneElement:C[9]||(C[9]=(M,ee)=>b.$emit("clone-element",M,ee))},null,8,["template-data","runtime-elements","scale","show-grid","snap-to-grid","show-table-ghost-border","guides"]),t.overlayVisible&&t.screenshotUrl?(e.openBlock(),e.createElementBlock("div",Fa,[e.createElementVNode("img",{src:t.screenshotUrl,class:"overlay-image",style:e.normalizeStyle({opacity:t.overlayOpacity??.5})},null,12,Oa)])):e.createCommentVNode("",!0)]),t.showRuler?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ruler-overlay",style:e.normalizeStyle(g.value)},[C[23]||(C[23]=e.createElementVNode("div",{class:"ruler-corner"},null,-1)),e.createVNode(Bt,{orientation:"horizontal","viewport-px":m.viewW,"origin-px":m.originX,"paper-length-m-m":i.value,scale:m.paperScale,"cursor-px":c.x,onAddGuide:C[10]||(C[10]=(M,ee)=>n("add-guide",M,ee)),onGuideDragging:C[11]||(C[11]=M=>Q("vertical",M))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"]),e.createVNode(Bt,{orientation:"vertical","viewport-px":m.viewH,"origin-px":m.originY,"paper-length-m-m":d.value,scale:m.paperScale,"cursor-px":c.y,onAddGuide:C[12]||(C[12]=(M,ee)=>n("add-guide",M,ee)),onGuideDragging:C[13]||(C[13]=M=>Q("horizontal",M))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"])],4)):e.createCommentVNode("",!0),B.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ruler-guide-preview",`guide-${B.value.type}`]),style:e.normalizeStyle(ae.value)},null,6)):e.createCommentVNode("",!0),y.visible?(e.openBlock(),e.createElementBlock("div",{key:2,class:"marquee-selection",style:e.normalizeStyle({left:y.x+"px",top:y.y+"px",width:y.w+"px",height:y.h+"px"})},null,4)):e.createCommentVNode("",!0),Y.visible?(e.openBlock(),e.createElementBlock("div",{key:3,ref_key:"contextMenuRef",ref:Ee,class:"context-menu",style:e.normalizeStyle({left:Y.x+Y.flipX+"px",top:Y.y+Y.flipY+"px"})},[Y.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:C[14]||(C[14]=M=>$("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:C[15]||(C[15]=M=>$("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:C[16]||(C[16]=M=>$("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:C[17]||(C[17]=M=>$("delete"))},"删除"),C[24]||(C[24]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:C[18]||(C[18]=M=>$("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:C[19]||(C[19]=M=>$("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:C[20]||(C[20]=M=>$("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:C[21]||(C[21]=M=>$("move-layer","bottom"))},"置底")],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:ge},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:L},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:x},"取消选择")],64))],4)):e.createCommentVNode("",!0)],544))}}),Wa=ce(Ha,[["__scopeId","data-v-50127da1"]]),Ga={class:"property-search"},Ka=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(t,{emit:r}){const o=e.ref(""),s=r;function n(){s("search",o.value)}return(l,a)=>(e.openBlock(),e.createElementBlock("div",Ga,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=i=>o.value=i),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:n},null,544),[[e.vModelText,o.value]])]))}}),qa=ce(Ka,[["__scopeId","data-v-10ab6c84"]]),Ya={class:"group-icon"},ja={class:"group-title"},Xa={class:"expand-icon"},Za={class:"group-content"},Ja=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(t){const r=t,o=e.ref(r.defaultExpanded??!0),n={Document:"≡",Brush:"◧",Setting:"⚙"}[r.icon]||"•";function l(){o.value=!o.value,a()}function a(){const d=`property-group-${r.groupKey}`;try{localStorage.setItem(d,String(o.value))}catch{}}function i(){const d=`property-group-${r.groupKey}`;try{const m=localStorage.getItem(d);m!==null&&(o.value=m==="true")}catch{}}return e.onMounted(()=>{i()}),(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":o.value}])},[e.createElementVNode("div",{class:"group-header",onClick:l},[e.createElementVNode("span",Ya,e.toDisplayString(e.unref(n)),1),e.createElementVNode("span",ja,e.toDisplayString(t.title),1),e.createElementVNode("span",Xa,e.toDisplayString(o.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",Za,[e.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[e.vShow,o.value]])],2))}}),$e=ce(Ja,[["__scopeId","data-v-2ba57031"]]),Qa={class:"position-grid"},_a={class:"pd-field"},ei={class:"pd-field"},ti={class:"pd-field"},oi={class:"pd-field"},ni=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const r=t;function o(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[4]||(n[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Qa,[e.withDirectives(e.createElementVNode("div",_a,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(de,{modelValue:t.element.options.left,"onUpdate:modelValue":n[0]||(n[0]=l=>t.element.options.left=l),min:0},null,8,["modelValue"])],512),[[e.vShow,o("ps-left")]]),e.withDirectives(e.createElementVNode("div",ei,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(de,{modelValue:t.element.options.top,"onUpdate:modelValue":n[1]||(n[1]=l=>t.element.options.top=l),min:0},null,8,["modelValue"])],512),[[e.vShow,o("ps-top")]]),e.withDirectives(e.createElementVNode("div",ti,[n[7]||(n[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(de,{modelValue:t.element.options.width,"onUpdate:modelValue":n[2]||(n[2]=l=>t.element.options.width=l),min:4},null,8,["modelValue"])],512),[[e.vShow,o("ps-width")]]),e.withDirectives(e.createElementVNode("div",oi,[n[8]||(n[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(de,{modelValue:t.element.options.height,"onUpdate:modelValue":n[3]||(n[3]=l=>t.element.options.height=l),min:4},null,8,["modelValue"])],512),[[e.vShow,o("ps-height")]])])],32)]),_:1}))}}),li=ce(ni,[["__scopeId","data-v-bc364679"]]),ai={class:"pd-field"},ii={class:"pd-field"},ri={class:"pd-field"},si={class:"pd-field"},di={class:"pd-radio-group",role:"radiogroup"},ci={class:"pd-radio"},ui={class:"pd-radio"},mi={class:"pd-radio"},pi={class:"pd-field"},vi={class:"pd-radio-group",role:"radiogroup"},fi={class:"pd-radio"},gi={class:"pd-radio"},bi={class:"pd-radio"},hi={class:"color-row"},Ei={class:"pd-field"},yi={class:"pd-field"},ki={class:"pd-field"},Vi={class:"pd-field"},Ni={class:"pd-field"},wi=["value"],Ci={key:0,class:"pd-field"},Si={class:"pd-field"},xi=["checked"],$i={key:1,class:"pd-empty"},Bi=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(t){const r=t;function o(a){return r.searching?r.matchedKeys?.has(a)??!0:!0}const s=e.computed(()=>r.element.printElementType.type==="table"),n=e.computed(()=>E.resolveElementTextFit(r.element.printElementType.type||"text",r.element.options));function l(a){r.element.options.textFit=a.target.value}return(a,i)=>(e.openBlock(),e.createBlock($e,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[15]||(i[15]=e.withModifiers(()=>{},["prevent"]))},[t.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",ai,[i[16]||(i[16]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(bt,{modelValue:t.element.options.fontFamily,"onUpdate:modelValue":i[0]||(i[0]=d=>t.element.options.fontFamily=d)},null,8,["modelValue"])],512),[[e.vShow,o("ap-font-family")]]),e.withDirectives(e.createElementVNode("div",ii,[i[17]||(i[17]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(de,{modelValue:t.element.options.fontSize,"onUpdate:modelValue":i[1]||(i[1]=d=>t.element.options.fontSize=d),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,o("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",ri,[i[19]||(i[19]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":i[2]||(i[2]=d=>t.element.options.fontWeight=d),style:{width:"100%"}},[...i[18]||(i[18]=[e.createElementVNode("option",{value:"normal"},"正常",-1),e.createElementVNode("option",{value:"bold"},"粗体",-1),e.createElementVNode("option",{value:"bolder"},"更粗",-1),e.createElementVNode("option",{value:"lighter"},"细体",-1)])],512),[[e.vModelSelect,t.element.options.fontWeight]])],512),[[e.vShow,o("ap-font-weight")]]),e.withDirectives(e.createElementVNode("div",si,[i[23]||(i[23]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",di,[e.createElementVNode("label",ci,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[3]||(i[3]=d=>t.element.options.textAlign=d),value:"left"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),i[20]||(i[20]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",ui,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[4]||(i[4]=d=>t.element.options.textAlign=d),value:"center"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),i[21]||(i[21]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",mi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[5]||(i[5]=d=>t.element.options.textAlign=d),value:"right"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),i[22]||(i[22]=e.createElementVNode("span",null,"右",-1))])])],512),[[e.vShow,o("ap-align")]]),e.withDirectives(e.createElementVNode("div",pi,[i[27]||(i[27]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",vi,[e.createElementVNode("label",fi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[6]||(i[6]=d=>t.element.options.verticalAlign=d),value:"top"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),i[24]||(i[24]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",gi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[7]||(i[7]=d=>t.element.options.verticalAlign=d),value:"middle"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),i[25]||(i[25]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",bi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[8]||(i[8]=d=>t.element.options.verticalAlign=d),value:"bottom"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),i[26]||(i[26]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,o("ap-vertical-align")]]),e.createElementVNode("div",hi,[e.withDirectives(e.createElementVNode("div",Ei,[i[28]||(i[28]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ce,{modelValue:t.element.options.color,"onUpdate:modelValue":i[9]||(i[9]=d=>t.element.options.color=d)},null,8,["modelValue"])],512),[[e.vShow,o("ap-color")]]),e.withDirectives(e.createElementVNode("div",yi,[i[29]||(i[29]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ce,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":i[10]||(i[10]=d=>t.element.options.backgroundColor=d)},null,8,["modelValue"])],512),[[e.vShow,o("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",ki,[i[30]||(i[30]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(de,{modelValue:t.element.options.lineHeight,"onUpdate:modelValue":i[11]||(i[11]=d=>t.element.options.lineHeight=d),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,o("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",Vi,[i[31]||(i[31]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(de,{modelValue:t.element.options.letterSpacing,"onUpdate:modelValue":i[12]||(i[12]=d=>t.element.options.letterSpacing=d),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,o("ap-letter-spacing")]]),e.withDirectives(e.createElementVNode("div",Ni,[i[33]||(i[33]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:n.value,style:{width:"100%"},onChange:l},[...i[32]||(i[32]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,wi)],512),[[e.vShow,o("ap-text-fit")]]),n.value==="shrink"?e.withDirectives((e.openBlock(),e.createElementBlock("div",Ci,[i[34]||(i[34]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(de,{"model-value":t.element.options.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":i[13]||(i[13]=d=>t.element.options.shrinkMinFontSize=d??void 0)},null,8,["model-value"])],512)),[[e.vShow,o("ap-shrink-min")]]):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",Si,[i[35]||(i[35]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:t.element.options.wordWrap!==!1,type:"checkbox",class:"pd-switch",onInput:i[14]||(i[14]=d=>t.element.options.wordWrap=d.target.checked?void 0:!1)},null,40,xi)],512),[[e.vShow,o("ap-word-wrap")]])],64)):e.createCommentVNode("",!0),!t.isTextType&&!s.value?(e.openBlock(),e.createElementBlock("p",$i,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),Di=ce(Bi,[["__scopeId","data-v-ec9e5cb7"]]),Ti={class:"pd-field"},Mi=["value"],zi={class:"pd-field"},Ai=["value"],Pi={class:"pd-hint"},Ri={class:"pd-field"},Li={class:"pd-field"},Ui=["checked"],Ii={class:"pd-field"},Fi={key:1,class:"pd-field"},Oi=["value"],Hi={key:2,class:"pd-hint"},Wi={key:3,class:"pd-field"},Gi=["value"],Ki={class:"pd-field"},qi={class:"pd-field"},Yi=e.defineComponent({__name:"CodeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["change"],setup(t,{emit:r}){const o=t,s=r,n=e.computed(()=>o.element.printElementType.type==="barcode"),l=e.computed(()=>o.element.printElementType.type==="qrcode"),a=e.computed(()=>(o.element.options.barcodeType||"CODE128").toUpperCase()),i=e.computed(()=>o.element.options.printerDpi?String(o.element.options.printerDpi):""),d=e.computed(()=>!!o.element.options.printerDpi),m=e.computed(()=>n.value&&d.value);function c(w){const v=Number(w.target.value);o.element.options.printerDpi=v>0?v:void 0,R()}function f(w){const v=w.target.value;o.element.options.barcodeType=v==="CODE128"?void 0:v,R()}function g(w){o.element.options.fit=w.target.value||void 0,R()}function h(w){return o.searching?o.matchedKeys?.has(w)??!0:!0}function R(){s("change")}return(w,v)=>(e.openBlock(),e.createBlock($e,{title:"条码设置",icon:"Postcard","default-expanded":"","group-key":"code"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:v[6]||(v[6]=e.withModifiers(()=>{},["prevent"]))},[n.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Ti,[v[8]||(v[8]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{class:"pd-select",value:a.value,onChange:f},[...v[7]||(v[7]=[e.createElementVNode("option",{value:"CODE128"},"CODE128(通用)",-1),e.createElementVNode("option",{value:"EAN13"},"EAN13(商品码)",-1),e.createElementVNode("option",{value:"EAN8"},"EAN8",-1),e.createElementVNode("option",{value:"UPC"},"UPC",-1),e.createElementVNode("option",{value:"CODE39"},"CODE39",-1),e.createElementVNode("option",{value:"ITF14"},"ITF14",-1)])],40,Mi)],512),[[e.vShow,h("cd-type")]]),e.withDirectives(e.createElementVNode("div",zi,[v[10]||(v[10]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{class:"pd-select",value:i.value,onChange:c},[...v[9]||(v[9]=[e.createElementVNode("option",{value:""},"不指定(按条宽渲染)",-1),e.createElementVNode("option",{value:"203"},"203 dpi(8 点/mm)",-1),e.createElementVNode("option",{value:"300"},"300 dpi(11.8 点/mm)",-1),e.createElementVNode("option",{value:"600"},"600 dpi(23.6 点/mm)",-1)])],40,Ai)],512),[[e.vShow,h("cd-dpi")]]),e.withDirectives(e.createElementVNode("p",Pi,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小",512),[[e.vShow,h("cd-dpi")]]),e.withDirectives(e.createElementVNode("div",Ri,[v[11]||(v[11]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(de,{"model-value":t.element.options.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":v[0]||(v[0]=p=>{t.element.options.barWidth=p,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-bar-width")]]),e.withDirectives(e.createElementVNode("p",{class:"pd-hint"},e.toDisplayString(m.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),513),[[e.vShow,h("cd-bar-width")]]),e.withDirectives(e.createElementVNode("div",Li,[v[12]||(v[12]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:t.element.options.hideTitle!==!0,type:"checkbox",class:"pd-switch",onInput:v[1]||(v[1]=p=>{t.element.options.hideTitle=p.target.checked?void 0:!0,R()})},null,40,Ui)],512),[[e.vShow,h("cd-show-text")]]),e.withDirectives(e.createElementVNode("div",Ii,[v[13]||(v[13]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(de,{"model-value":t.element.options.fontSize,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":v[2]||(v[2]=p=>{t.element.options.fontSize=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-font-size")]])],64)):l.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",Fi,[v[15]||(v[15]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{class:"pd-select",value:String(t.element.options.qrCodeLevel??"M"),onChange:v[3]||(v[3]=p=>{t.element.options.qrCodeLevel=p.target.value,R()})},[...v[14]||(v[14]=[e.createElementVNode("option",{value:"L"},"L(最低,容量大)",-1),e.createElementVNode("option",{value:"M"},"M(推荐)",-1),e.createElementVNode("option",{value:"Q"},"Q",-1),e.createElementVNode("option",{value:"H"},"H(最高)",-1)])],40,Oi)],512)),[[e.vShow,h("cd-ec-level")]]):e.createCommentVNode("",!0),v[20]||(v[20]=e.createElementVNode("h3",{class:"pd-divider"},"自定义设置",-1)),n.value?(e.openBlock(),e.createElementBlock("p",Hi,"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),n.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("div",Wi,[v[17]||(v[17]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{class:"pd-select",value:t.element.options.fit||"contain",onChange:g},[...v[16]||(v[16]=[e.createElementVNode("option",{value:"contain"},"包含(保持比例)",-1),e.createElementVNode("option",{value:"cover"},"覆盖(保持比例)",-1),e.createElementVNode("option",{value:"fill"},"拉伸填满",-1),e.createElementVNode("option",{value:"none"},"原始尺寸",-1),e.createElementVNode("option",{value:"scale-down"},"缩小(保持比例)",-1)])],40,Gi)],512)),[[e.vShow,h("cd-fit")]]),e.withDirectives(e.createElementVNode("div",Ki,[v[18]||(v[18]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(de,{"model-value":t.element.options.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[4]||(v[4]=p=>{t.element.options.maxWidth=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-max-width")]]),e.withDirectives(e.createElementVNode("div",qi,[v[19]||(v[19]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(de,{"model-value":t.element.options.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[5]||(v[5]=p=>{t.element.options.maxHeight=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-max-height")]])],32)]),_:1}))}}),ji={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},Xi={class:"pd-dialog-header"},Zi={class:"expression-editor"},Ji={class:"ee-nav"},Qi={class:"ee-nav-tabs"},_i={class:"ee-content"},er={class:"ee-content-search"},tr=["placeholder"],or={class:"ee-content-list"},nr={class:"ee-field-group-icon"},lr=["onDblclick"],ar={class:"ee-field-info"},ir={class:"ee-item-label"},rr={class:"ee-item-key"},sr={key:0,class:"pd-empty"},dr=["onDblclick"],cr={class:"ee-field-info"},ur={class:"ee-item-label"},mr={class:"ee-item-key"},pr={class:"ee-func-group"},vr=["onDblclick"],fr={class:"ee-field-info"},gr={class:"ee-item-label"},br={class:"ee-item-key"},hr={class:"ee-func-group"},Er=["onDblclick"],yr={class:"ee-field-info"},kr={class:"ee-item-label"},Vr={class:"ee-item-key"},Nr={class:"ee-func-group"},wr=["onDblclick"],Cr={class:"ee-field-info"},Sr={class:"ee-item-label"},xr={class:"ee-item-key"},$r={class:"ee-editor"},Br={class:"ee-editor-section"},Dr={class:"ee-editor-section"},Tr={class:"pd-dialog-footer"},Mr=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(t,{emit:r}){const o=t,s=r,n=e.computed({get:()=>o.modelValue,set:U=>s("update:modelValue",U)}),l=e.ref("field"),a=e.computed(()=>{switch(l.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),i=e.ref(""),d=e.computed(()=>E.filterGroups(E.groupFields(o.fields??[]),i.value));e.watch(n,U=>{U&&(p.value=o.expression||"")});function m(U){const{insideParens:k}=g();W(k?U.fieldKey:`{${U.fieldKey}}`)}function c(U){const{insideParens:k}=g();W(k?U.template.replace(/^\{|\}$/g,""):U.template)}function f(U){const{insideBlock:k}=g(),D=k?U.template:`{${U.template}}`,N=D.indexOf("(")+1;W(D,N)}function g(){const k=B.value?.selectionStart??p.value.length,D=p.value.substring(0,k);let N=!1;const F=D.lastIndexOf("{");F!==-1&&!D.slice(F+1).includes("}")&&(N=!0);let A=!1;const V=D.lastIndexOf("(");return V!==-1&&!D.slice(V+1).includes(")")&&(A=!0),{insideBlock:N,insideParens:A}}const h=e.computed(()=>{if(!i.value.trim())return Z;const U=i.value.trim().toLowerCase();return Z.filter(k=>k.label.toLowerCase().includes(U)||k.name.toLowerCase().includes(U))}),R=e.computed(()=>{if(!i.value.trim())return Q;const U=i.value.trim().toLowerCase();return Q.filter(k=>k.label.toLowerCase().includes(U)||k.name.toLowerCase().includes(U))}),w=e.computed(()=>{if(!i.value.trim())return ae;const U=i.value.trim().toLowerCase();return ae.filter(k=>k.label.toLowerCase().includes(U)||k.name.toLowerCase().includes(U))}),v=e.computed(()=>{if(!i.value.trim())return K;const U=i.value.trim().toLowerCase();return K.filter(k=>k.label.toLowerCase().includes(U)||k.name.toLowerCase().includes(U))}),p=e.ref(o.expression||""),B=e.ref(null);e.watch(()=>o.expression,U=>{p.value=U||""});const Q=[{name:"SUM",label:"求和",template:"SUM()"},{name:"AVG",label:"平均值",template:"AVG()"},{name:"COUNT",label:"计数",template:"COUNT()"},{name:"MIN",label:"最小值",template:"MIN()"},{name:"MAX",label:"最大值",template:"MAX()"}],ae=[{name:"ADD",label:"相加",template:"ADD()"},{name:"SUB",label:"相减",template:"SUB()"},{name:"MUL",label:"相乘",template:"MUL()"},{name:"DIV",label:"相除",template:"DIV()"},{name:"ROUND",label:"四舍五入",template:"ROUND()"},{name:"ROUNDUP",label:"进一法",template:"ROUNDUP()"},{name:"ROUNDDOWN",label:"去尾法",template:"ROUNDDOWN()"},{name:"ROUNDBANK",label:"四舍六入五成双",template:"ROUNDBANK()"}],K=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],Z=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],y=e.computed(()=>{if(!p.value.trim())return"(输入表达式后预览)";try{const U={...E.DEFAULT_DEMO_DATA,...he.resolveSystemVariables()},k=E.evaluateTemplate(p.value,U);return k==null?"(无法计算)":String(k)}catch{return"(表达式错误)"}});function W(U,k=U.length){const D=B.value;if(!D){p.value+=U;return}const N=D.selectionStart,F=D.selectionEnd,A=p.value.substring(0,N),V=p.value.substring(F);p.value=A+U+V;const T=N+k;e.nextTick(()=>{D.focus(),D.selectionStart=D.selectionEnd=T})}function X(){s("update:expression",p.value),n.value=!1}return(U,k)=>n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:k[7]||(k[7]=e.withKeys(D=>n.value=!1,["esc"]))},[e.createElementVNode("section",ji,[e.createElementVNode("header",Xi,[k[8]||(k[8]=e.createElementVNode("strong",{id:"expression-editor-title"},"编辑表达式",-1)),e.createElementVNode("button",{type:"button",class:"pd-close","aria-label":"关闭",onClick:k[0]||(k[0]=D=>n.value=!1)},"×")]),e.createElementVNode("div",Zi,[e.createElementVNode("div",Ji,[k[9]||(k[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",Qi,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="field"}]),onClick:k[1]||(k[1]=D=>l.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="variable"}]),onClick:k[2]||(k[2]=D=>l.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="function"}]),onClick:k[3]||(k[3]=D=>l.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",_i,[e.createElementVNode("div",er,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":k[4]||(k[4]=D=>i.value=D),placeholder:a.value},null,8,tr),[[e.vModelText,i.value]])]),e.createElementVNode("div",or,[l.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,D=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:D.key||"_top"},[D.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":D.isList}])},[e.createElementVNode("span",nr,e.toDisplayString(D.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(D.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.fields,N=>(e.openBlock(),e.createElementBlock("div",{key:N.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:D.key?"22px":"10px"}),onDblclick:F=>m(N)},[e.createElementVNode("div",ar,[e.createElementVNode("span",ir,e.toDisplayString(N.fieldLabel),1),e.createElementVNode("span",rr,e.toDisplayString(N.fieldKey),1)])],44,lr))),128))],64))),128)),d.value.length===0?(e.openBlock(),e.createElementBlock("p",sr,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),l.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(h.value,D=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:"ee-list-item",onDblclick:N=>c(D)},[e.createElementVNode("div",cr,[e.createElementVNode("span",ur,e.toDisplayString(D.label),1),e.createElementVNode("span",mr,e.toDisplayString(D.template),1)])],40,dr))),128)):e.createCommentVNode("",!0),l.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",pr,[k[10]||(k[10]=e.createElementVNode("div",{class:"ee-func-group-title"},"聚合函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,D=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:"ee-list-item",onDblclick:N=>f(D)},[e.createElementVNode("div",fr,[e.createElementVNode("span",gr,e.toDisplayString(D.label),1),e.createElementVNode("span",br,e.toDisplayString(D.name)+"()",1)])],40,vr))),128))]),e.createElementVNode("div",hr,[k[11]||(k[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"数值运算",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,D=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:"ee-list-item",onDblclick:N=>f(D)},[e.createElementVNode("div",yr,[e.createElementVNode("span",kr,e.toDisplayString(D.label),1),e.createElementVNode("span",Vr,e.toDisplayString(D.name)+"()",1)])],40,Er))),128))]),e.createElementVNode("div",Nr,[k[12]||(k[12]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,D=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:"ee-list-item",onDblclick:N=>f(D)},[e.createElementVNode("div",Cr,[e.createElementVNode("span",Sr,e.toDisplayString(D.label),1),e.createElementVNode("span",xr,e.toDisplayString(D.name)+"()",1)])],40,wr))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",$r,[e.createElementVNode("div",Br,[k[13]||(k[13]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:B,"onUpdate:modelValue":k[5]||(k[5]=D=>p.value=D),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,p.value]])]),e.createElementVNode("div",Dr,[k[14]||(k[14]=e.createElementVNode("div",{class:"ee-editor-title"},"预览结果",-1)),e.createElementVNode("div",{class:e.normalizeClass(["ee-preview",{"ee-preview-error":y.value==="(表达式错误)"}])},e.toDisplayString(y.value),3)]),k[15]||(k[15]=e.createStaticVNode('<div class="ee-help-section" data-v-3fb017fe><div class="ee-help-title" data-v-3fb017fe>帮助信息</div><div class="ee-help-grid" data-v-3fb017fe><div class="ee-help-card ee-help-field" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>输入方式</div><div class="ee-help-card-content" data-v-3fb017fe> 双击左侧字段、变量、函数即可插入到表达式输入框中<br data-v-3fb017fe> 静态数据直接输入即可,如:供应商名称<br data-v-3fb017fe> 动态解析字段、变量、函数必须用 {} 包裹<br data-v-3fb017fe> 示例:{SUM(supplier.name)}<br data-v-3fb017fe> 注意:只能嵌套一层 </div></div><div class="ee-help-card ee-help-function" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>函数使用</div><div class="ee-help-card-content" data-v-3fb017fe> SUM(字段) - 求和<br data-v-3fb017fe> AVG(字段) - 平均值<br data-v-3fb017fe> COUNT(字段) - 计数<br data-v-3fb017fe> IF(条件, 真值, 假值) - 条件判断<br data-v-3fb017fe> 四则运算:{qty * price}、{ADD(qty, 1)}<br data-v-3fb017fe> 修约:ROUND 四舍五入 / ROUNDUP 进一 / ROUNDDOWN 去尾 / ROUNDBANK 四舍六入五成双 </div></div><div class="ee-help-card ee-help-variable" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>系统变量</div><div class="ee-help-card-content" data-v-3fb017fe> {pageIndex} - 当前页码<br data-v-3fb017fe> {totalPages} - 总页数<br data-v-3fb017fe> {printDate} - 打印日期 </div></div><div class="ee-help-card ee-help-conditional" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>示例</div><div class="ee-help-card-content" data-v-3fb017fe> 静态文本:供应商名称<br data-v-3fb017fe> 动态字段:{supplier.name}<br data-v-3fb017fe> 函数调用:{SUM(amount)}<br data-v-3fb017fe> 条件判断:{IF(amount>1000, "大单", "小单")}<br data-v-3fb017fe> 运算并修约:{ROUND(qty * price, 2)} </div></div></div></div>',1))])]),e.createElementVNode("footer",Tr,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:k[6]||(k[6]=D=>n.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:X},"确定")])])],32)):e.createCommentVNode("",!0)}}),Qe=ce(Mr,[["__scopeId","data-v-3fb017fe"]]),zr={class:"pd-field"},Ar={class:"pd-label"},Pr=["value","placeholder"],Rr=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(t,{emit:r}){const o=r,s=e.ref(!1);function n(){s.value=!0}return(l,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",zr,[e.createElementVNode("span",Ar,e.toDisplayString(t.descriptor.label),1),e.createElementVNode("input",{value:t.modelValue,class:"pd-input",placeholder:t.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:a[0]||(a[0]=i=>o("update:modelValue",i.target.value)),onDblclick:n},null,40,Pr)]),e.createVNode(Qe,{modelValue:s.value,"onUpdate:modelValue":a[1]||(a[1]=i=>s.value=i),fields:t.fields,expression:t.modelValue,"onUpdate:expression":a[2]||(a[2]=i=>o("update:modelValue",i))},null,8,["modelValue","fields","expression"])],64))}}),Lr=ce(Rr,[["__scopeId","data-v-40a99329"]]),Ur={class:"pd-field"},Ir=["value"],Fr=["value"],Or={class:"pd-field"},Hr={class:"pd-field"},Wr={class:"pd-field"},Gr={class:"pd-field"},Kr={style:{width:"60px"}},qr=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(t){const r=t,o=e.inject(Ge,null),s=e.computed(()=>r.fields.filter(a=>a.fieldType==="list").map(a=>({label:a.fieldLabel,value:a.fieldKey})));function n(a){r.element.options.dataSource=a||void 0,o?.recordHistory()}function l(a,i){if(i===void 0)return;const d=r.element.options.tableColWidths,m=o?.maxTableWidth.value??1/0,c=d.reduce((f,g,h)=>h===a?f:f+g,0);if(c+i>m){const f=Math.max(5,Math.round((m-c)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${m}mm,列${a+1} 已调整为 ${f}mm`),d[a]=f}else d[a]=i;E.syncTableElementSize(r.element.options),o?.recordHistory()}return(a,i)=>(e.openBlock(),e.createBlock($e,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[4]||(i[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ur,[i[5]||(i[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:t.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:i[0]||(i[0]=d=>n(d.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,d=>(e.openBlock(),e.createElementBlock("option",{key:d.value,value:d.value},e.toDisplayString(d.label),9,Fr))),128))],40,Ir)]),e.createElementVNode("div",Or,[i[6]||(i[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(de,{modelValue:t.element.options.tableDefaultFontSize,"onUpdate:modelValue":i[1]||(i[1]=d=>t.element.options.tableDefaultFontSize=d),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Hr,[i[7]||(i[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(Ce,{modelValue:t.element.options.tableDefaultColor,"onUpdate:modelValue":i[2]||(i[2]=d=>t.element.options.tableDefaultColor=d)},null,8,["modelValue"])]),e.createElementVNode("div",Wr,[i[8]||(i[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(de,{modelValue:t.element.options.tableDefaultPadding,"onUpdate:modelValue":i[3]||(i[3]=d=>t.element.options.tableDefaultPadding=d),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Gr,[i[9]||(i[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.element.options.tableColWidths,(d,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"col-width-row"},[e.createElementVNode("span",Kr,"列"+e.toDisplayString(m+1),1),e.createVNode(de,{"model-value":d,min:5,max:200,"onUpdate:modelValue":c=>l(m,c)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),Yr=ce(qr,[["__scopeId","data-v-b5fdc7ff"]]),jr={class:"border-row"},Xr={class:"pd-field"},Zr={class:"pd-field"},Jr={class:"pd-field"},Qr=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const r=t;function o(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[3]||(n[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",jr,[e.withDirectives(e.createElementVNode("div",Xr,[n[4]||(n[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(de,{modelValue:t.element.options.borderWidth,"onUpdate:modelValue":n[0]||(n[0]=l=>t.element.options.borderWidth=l),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,o("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",Zr,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(Ce,{modelValue:t.element.options.borderColor,"onUpdate:modelValue":n[1]||(n[1]=l=>t.element.options.borderColor=l)},null,8,["modelValue"])],512),[[e.vShow,o("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",Jr,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ce,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":n[2]||(n[2]=l=>t.element.options.backgroundColor=l)},null,8,["modelValue"])],512),[[e.vShow,o("bb-bg-color")]])],32)]),_:1}))}}),_r=ce(Qr,[["__scopeId","data-v-e0e6d714"]]),es={class:"advanced-row"},ts={class:"pd-field"},os={class:"pd-field"},ns={class:"pd-field"},ls={class:"pd-field"},as=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(t){const r=t;function o(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[4]||(n[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",es,[e.withDirectives(e.createElementVNode("div",ts,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":n[0]||(n[0]=l=>t.element.options.locked=l)},null,512),[[e.vModelCheckbox,t.element.options.locked]])],512),[[e.vShow,o("ad-locked")]]),e.withDirectives(e.createElementVNode("div",os,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":n[1]||(n[1]=l=>t.element.options.fixed=l)},null,512),[[e.vModelCheckbox,t.element.options.fixed]])],512),[[e.vShow,o("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",ns,[n[7]||(n[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(de,{modelValue:t.element.options.zIndex,"onUpdate:modelValue":n[2]||(n[2]=l=>t.element.options.zIndex=l),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,o("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",ls,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:n[3]||(n[3]=l=>s.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,o("ad-delete")]])],32)]),_:1}))}}),is=ce(as,[["__scopeId","data-v-14924be2"]]),rs={key:0,class:"pd-field"},ss=["checked"],ds={class:"pd-field"},cs=["checked"],us={class:"pd-field"},ms=["checked"],Dt=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const r=t,o=e.computed(()=>r.element.printElementType.type==="table"),s=e.computed({get:()=>r.element.options.tablePagination?.enabled??!0,set:()=>{}});function n(c){r.element.options.tablePagination={enabled:c}}const l=e.computed({get:()=>r.element.options.pagination?.pageable??!0,set:()=>{}}),a=e.computed({get:()=>r.element.options.pagination?.keepWithNext??!1,set:()=>{}});function i(c){r.element.options.pagination={pageable:c,keepWithNext:a.value}}function d(c){r.element.options.pagination={pageable:l.value,keepWithNext:c}}function m(c){return r.searching?r.matchedKeys?.has(c)??!0:!0}return(c,f)=>(e.openBlock(),e.createBlock($e,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:f[3]||(f[3]=e.withModifiers(()=>{},["prevent"]))},[o.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",rs,[f[4]||(f[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:s.value,onChange:f[0]||(f[0]=g=>n(g.target.checked))},null,40,ss)],512)),[[e.vShow,m("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",ds,[f[5]||(f[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:l.value,onChange:f[1]||(f[1]=g=>i(g.target.checked))},null,40,cs)],512),[[e.vShow,m("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",us,[f[6]||(f[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:a.value,onChange:f[2]||(f[2]=g=>d(g.target.checked))},null,40,ms)],512),[[e.vShow,m("pg-keep-with-next")]])],64))],32)]),_:1}))}}),ps={class:"image-content-upload"},vs=["disabled"],fs=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(!1),l=e.inject(vt,e.computed(()=>{})),a=e.computed(()=>o.disabled||n.value||!l.value);async function i(d){const m=d.target,c=m.files?.[0];if(c){if(!c.type.startsWith("image/")){alert("仅支持上传图片文件"),m.value="";return}if(!l.value){alert("图片上传能力未配置"),m.value="";return}n.value=!0;try{const f=await l.value(c);f?s("success",f):alert("图片上传失败")}catch(f){alert(f instanceof Error?f.message:"图片上传失败")}finally{n.value=!1,m.value=""}}}return(d,m)=>(e.openBlock(),e.createElementBlock("div",ps,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[m[0]||(m[0]=e.createElementVNode("svg",{class:"pd-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[e.createElementVNode("path",{fill:"currentColor",d:"M12 3l4 4h-3v7h-2V7H8zm-7 12h14v5H5Z"})],-1)),e.createTextVNode(" "+e.toDisplayString(n.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:i},null,40,vs)],2),m[1]||(m[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),gs=ce(fs,[["__scopeId","data-v-b730e8e6"]]),bs={class:"pd-field"},hs=["value"],Es={class:"pd-field"},ys={key:0,class:"pd-field"},ks=["checked"],Vs=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(t){const r=t,o=e.inject(Ge),s=e.computed(()=>r.element.options.tableRows[r.selection.r1]);function n(i){const d=E.setRowType(r.element.options.tableRows,r.selection.r1,i);if(d){alert(d);return}o.recordHistory()}function l(i){i!==void 0&&(s.value.height=i,E.syncTableElementSize(r.element.options),o.recordHistory())}function a(i){E.setHeaderRepeat(r.element.options.tableRows,i),o.recordHistory()}return(i,d)=>(e.openBlock(),e.createBlock($e,{title:"行属性",icon:"Grid","default-expanded":"","group-key":"table-row"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:d[2]||(d[2]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",bs,[d[4]||(d[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:s.value.type,class:"pd-select",style:{width:"100%"},onChange:d[0]||(d[0]=m=>n(m.target.value))},[...d[3]||(d[3]=[e.createElementVNode("option",{value:"header"},"标题行",-1),e.createElementVNode("option",{value:"data"},"数据行",-1),e.createElementVNode("option",{value:"subtotal"},"小计行(每页小计)",-1),e.createElementVNode("option",{value:"summary"},"汇总行",-1)])],40,hs)]),e.createElementVNode("div",Es,[d[5]||(d[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(de,{"model-value":s.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":l},null,8,["model-value"])]),s.value.type==="header"?(e.openBlock(),e.createElementBlock("div",ys,[d[6]||(d[6]=e.createElementVNode("span",{class:"pd-label",title:"多级表头作为一个结构整体重复,勾选后表头区所有行都会在每页顶部重复"},"表头每页重复",-1)),e.createElementVNode("input",{checked:s.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:d[1]||(d[1]=m=>a(!!m.target.checked))},null,40,ks)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),Ns={class:"pd-field"},ws={class:"pd-radio-group",role:"radiogroup"},Cs={class:"pd-radio"},Ss=["checked"],xs={class:"pd-radio"},$s=["checked"],Bs={class:"pd-radio"},Ds=["checked"],Ts={class:"pd-radio"},Ms=["checked"],zs={key:0,class:"pd-field"},As=["value"],Ps={key:1,class:"pd-field"},Rs=["checked"],Ls={key:2,class:"pd-field"},Us={key:3,class:"pd-hint"},Is={key:4,class:"pd-field"},Fs={key:5,class:"pd-field"},Os=["value"],Hs={key:6,class:"pd-hint"},Ws={key:7,class:"pd-field"},Gs=["value"],Ks={key:8,class:"pd-hint"},qs={key:9,class:"pd-field"},Ys=["value"],js={key:10,class:"pd-field"},Xs={key:11,class:"pd-field"},Zs={class:"pd-field"},Js=["value"],Qs={class:"pd-field"},_s={class:"pd-radio-group",role:"radiogroup"},ed={class:"pd-radio"},td=["checked"],od={class:"pd-radio"},nd=["checked"],ld={class:"pd-radio"},ad=["checked"],id={class:"pd-field"},rd={class:"pd-radio-group",role:"radiogroup"},sd={class:"pd-radio"},dd=["checked"],cd={class:"pd-radio"},ud=["checked"],md={class:"pd-radio"},pd=["checked"],vd={class:"cell-style-grid"},fd={class:"pd-field cell-font-field"},gd={class:"pd-field"},bd={class:"pd-field"},hd=["checked"],Ed={class:"pd-field"},yd={class:"pd-field"},kd={class:"border-style-row"},Vd={style:{width:"112px","flex-shrink":"0"}},Nd={class:"pd-button-group border-presets"},wd={class:"pd-checkbox-group"},Cd={class:"pd-checkbox"},Sd={class:"pd-checkbox"},xd={class:"pd-checkbox"},$d={class:"pd-checkbox"},Bd={class:"pd-field"},Dd={class:"pd-field"},Td=["checked"],Md={key:12,class:"pd-field"},zd=["value"],Ad={key:13,class:"pd-field"},Pd={class:"merge-btns"},Rd=["disabled","title"],Ld=["disabled"],Ud=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(t,{expose:r}){const o=t,s=e.inject(Ge),n=e.computed(()=>o.element.options.tableRows),l=e.computed(()=>{const T=E.findMainCell(n.value,o.selection.r1,o.selection.c1);return n.value[T.r].cells[T.c]}),a=e.ref(!1),i=e.ref(""),d=e.computed(()=>l.value.cellType==="barcode"),m=e.computed(()=>l.value.cellType==="qrcode"),c=e.computed(()=>l.value.cellType==="image"),f=e.computed(()=>d.value&&!!l.value.printerDpi),g=e.computed(()=>!d.value&&!m.value&&!c.value),h=e.computed(()=>E.resolveCellTextFit(l.value));function R(T){const u=T.target.value;K(S=>{S.textFit=u})}function w(T){K(u=>{u.align=T})}function v(T){K(u=>{u.valign=T})}function p(T){const u=Number(T);K(S=>{S.printerDpi=u>0?u:void 0})}function B(T){K(u=>{u.cellType=T==="text"?void 0:T,T!=="barcode"&&(u.barcodeType=void 0,u.showBarcodeText=void 0,u.printerDpi=void 0),T!=="qrcode"&&(u.qrCodeLevel=void 0)})}function Q(){i.value=l.value.formatter||"",a.value=!0}function ae(T){K(u=>{u.formatter=T||void 0})}function K(T){const u=o.selection;for(let S=u.r1;S<=u.r2;S++)for(let Y=u.c1;Y<=u.c2;Y++){const Ee=n.value[S].cells[Y];Ee.merged||T(Ee)}s.recordHistory()}const Z=e.ref("solid"),y=e.ref(.75),W=e.ref("#333333"),X=e.ref([]);function U(){return{width:y.value,style:Z.value,color:W.value}}function k(T){E.applyBorderPreset(n.value,o.selection,T,U()),s.recordHistory()}function D(T){const u=T.target,S=new Set(X.value);u.checked?S.add(u.value):S.delete(u.value),X.value=[...S];const Y=U();K(Ee=>{const fe={...Ee.borders??{}};for(const me of["top","right","bottom","left"])S.has(me)?fe[me]={...Y}:delete fe[me];Ee.borders=fe})}const N=e.computed(()=>E.canMergeReason(n.value,o.selection)),F=e.computed(()=>{const T=o.selection;for(let u=T.r1;u<=T.r2;u++)for(let S=T.c1;S<=T.c2;S++){const Y=n.value[u].cells[S];if(!Y.merged&&((Y.rowspan??1)>1||(Y.colspan??1)>1))return!0}return!1});function A(){E.mergeCells(n.value,o.selection),s.recordHistory()}function V(){E.splitCells(n.value,o.selection),s.recordHistory()}return r({openFormatterEditor:Q}),(T,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode($e,{title:"单元格",icon:"Menu","default-expanded":"","group-key":"table-cell"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:u[43]||(u[43]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ns,[u[49]||(u[49]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",ws,[e.createElementVNode("label",Cs,[e.createElementVNode("input",{type:"radio",value:"text",checked:(l.value.cellType||"text")==="text",onChange:u[0]||(u[0]=S=>B(S.target.value))},null,40,Ss),u[45]||(u[45]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",xs,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:l.value.cellType==="barcode",onChange:u[1]||(u[1]=S=>B(S.target.value))},null,40,$s),u[46]||(u[46]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",Bs,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:l.value.cellType==="qrcode",onChange:u[2]||(u[2]=S=>B(S.target.value))},null,40,Ds),u[47]||(u[47]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",Ts,[e.createElementVNode("input",{type:"radio",value:"image",checked:l.value.cellType==="image",onChange:u[3]||(u[3]=S=>B(S.target.value))},null,40,Ms),u[48]||(u[48]=e.createElementVNode("span",null,"图片",-1))])])]),d.value?(e.openBlock(),e.createElementBlock("div",zs,[u[51]||(u[51]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:l.value.barcodeType||"CODE128",class:"pd-select",onChange:u[4]||(u[4]=S=>K(Y=>{Y.barcodeType=S.target.value||void 0}))},[...u[50]||(u[50]=[e.createElementVNode("option",{value:"CODE128"},"CODE128(通用)",-1),e.createElementVNode("option",{value:"EAN13"},"EAN13(商品码)",-1),e.createElementVNode("option",{value:"EAN8"},"EAN8",-1),e.createElementVNode("option",{value:"UPC"},"UPC",-1),e.createElementVNode("option",{value:"CODE39"},"CODE39",-1),e.createElementVNode("option",{value:"ITF14"},"ITF14",-1)])],40,As)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Ps,[u[52]||(u[52]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:l.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:u[5]||(u[5]=S=>K(Y=>{Y.showBarcodeText=!!S.target.checked}))},null,40,Rs)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Ls,[u[53]||(u[53]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(de,{"model-value":l.value.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":u[6]||(u[6]=S=>K(Y=>{Y.barWidth=S}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Us,e.toDisplayString(f.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),1)):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Is,[u[54]||(u[54]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(de,{"model-value":l.value.barFontSize??10,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":u[7]||(u[7]=S=>K(Y=>{Y.barFontSize=S??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Fs,[u[56]||(u[56]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{value:l.value.printerDpi?String(l.value.printerDpi):"",class:"pd-select",onChange:u[8]||(u[8]=S=>p(S.target.value))},[...u[55]||(u[55]=[e.createElementVNode("option",{value:""},"不指定(按条宽渲染)",-1),e.createElementVNode("option",{value:"203"},"203 dpi(8 点/mm)",-1),e.createElementVNode("option",{value:"300"},"300 dpi(11.8 点/mm)",-1),e.createElementVNode("option",{value:"600"},"600 dpi(23.6 点/mm)",-1)])],40,Os)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Hs,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小")):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",Ws,[u[58]||(u[58]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:l.value.qrCodeLevel||"M",class:"pd-select",onChange:u[9]||(u[9]=S=>K(Y=>{Y.qrCodeLevel=S.target.value||void 0}))},[...u[57]||(u[57]=[e.createElementVNode("option",{value:"L"},"L(最低,容量大)",-1),e.createElementVNode("option",{value:"M"},"M(推荐)",-1),e.createElementVNode("option",{value:"Q"},"Q",-1),e.createElementVNode("option",{value:"H"},"H(最高)",-1)])],40,Gs)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Ks,"单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),m.value||c.value?(e.openBlock(),e.createElementBlock("div",qs,[u[60]||(u[60]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:l.value.fit||"contain",class:"pd-select",onChange:u[10]||(u[10]=S=>K(Y=>{Y.fit=S.target.value}))},[...u[59]||(u[59]=[e.createElementVNode("option",{value:"contain"},"包含(保持比例)",-1),e.createElementVNode("option",{value:"cover"},"覆盖(保持比例)",-1),e.createElementVNode("option",{value:"fill"},"拉伸填满",-1),e.createElementVNode("option",{value:"none"},"原始尺寸",-1),e.createElementVNode("option",{value:"scale-down"},"缩小(保持比例)",-1)])],40,Ys)])):e.createCommentVNode("",!0),d.value||m.value||c.value?(e.openBlock(),e.createElementBlock("div",js,[u[61]||(u[61]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(de,{"model-value":l.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[11]||(u[11]=S=>K(Y=>{Y.maxWidth=S??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value||m.value||c.value?(e.openBlock(),e.createElementBlock("div",Xs,[u[62]||(u[62]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(de,{"model-value":l.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[12]||(u[12]=S=>K(Y=>{Y.maxHeight=S??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Zs,[u[63]||(u[63]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:l.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:u[13]||(u[13]=S=>K(Y=>{Y.formatter=S.target.value||void 0})),onDblclick:Q},null,40,Js)]),e.createElementVNode("div",Qs,[u[67]||(u[67]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",_s,[e.createElementVNode("label",ed,[e.createElementVNode("input",{type:"radio",value:"left",checked:l.value.align==="left",onChange:u[14]||(u[14]=S=>w(S.target.value))},null,40,td),u[64]||(u[64]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",od,[e.createElementVNode("input",{type:"radio",value:"center",checked:l.value.align==="center",onChange:u[15]||(u[15]=S=>w(S.target.value))},null,40,nd),u[65]||(u[65]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ld,[e.createElementVNode("input",{type:"radio",value:"right",checked:l.value.align==="right",onChange:u[16]||(u[16]=S=>w(S.target.value))},null,40,ad),u[66]||(u[66]=e.createElementVNode("span",null,"右",-1))])])]),e.createElementVNode("div",id,[u[71]||(u[71]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",rd,[e.createElementVNode("label",sd,[e.createElementVNode("input",{type:"radio",value:"top",checked:l.value.valign==="top",onChange:u[17]||(u[17]=S=>v(S.target.value))},null,40,dd),u[68]||(u[68]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",cd,[e.createElementVNode("input",{type:"radio",value:"middle",checked:l.value.valign==="middle",onChange:u[18]||(u[18]=S=>v(S.target.value))},null,40,ud),u[69]||(u[69]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",md,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:l.value.valign==="bottom",onChange:u[19]||(u[19]=S=>v(S.target.value))},null,40,pd),u[70]||(u[70]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",vd,[e.createElementVNode("div",fd,[u[72]||(u[72]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(bt,{"model-value":l.value.fontFamily,placeholder:"继承默认","onUpdate:modelValue":u[20]||(u[20]=S=>K(Y=>{Y.fontFamily=S}))},null,8,["model-value"])]),e.createElementVNode("div",gd,[u[73]||(u[73]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(de,{"model-value":l.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":u[21]||(u[21]=S=>K(Y=>{Y.fontSize=S??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",bd,[u[74]||(u[74]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:l.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:u[22]||(u[22]=S=>K(Y=>{Y.fontWeight=S.target.checked?"bold":void 0}))},null,40,hd)]),e.createElementVNode("div",Ed,[u[75]||(u[75]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(Ce,{"model-value":l.value.color,"onUpdate:modelValue":u[23]||(u[23]=S=>K(Y=>{Y.color=S}))},null,8,["model-value"])]),e.createElementVNode("div",yd,[u[76]||(u[76]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ce,{"model-value":l.value.backgroundColor,"onUpdate:modelValue":u[24]||(u[24]=S=>K(Y=>{Y.backgroundColor=S}))},null,8,["model-value"])])]),u[87]||(u[87]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",kd,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":u[25]||(u[25]=S=>Z.value=S),style:{width:"90px"}},[...u[77]||(u[77]=[e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1),e.createElementVNode("option",{value:"double"},"双线",-1)])],512),[[e.vModelSelect,Z.value]]),e.createElementVNode("div",Vd,[e.createVNode(de,{modelValue:y.value,"onUpdate:modelValue":u[26]||(u[26]=S=>y.value=S),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(Ce,{modelValue:W.value,"onUpdate:modelValue":u[27]||(u[27]=S=>W.value=S),clearable:!1},null,8,["modelValue"])]),e.createElementVNode("div",Nd,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[28]||(u[28]=S=>k("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[29]||(u[29]=S=>k("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[30]||(u[30]=S=>k("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[31]||(u[31]=S=>k("none"))},"无")]),e.createElementVNode("div",wd,[e.createElementVNode("label",Cd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[32]||(u[32]=S=>X.value=S),value:"top",onChange:u[33]||(u[33]=S=>D(S))},null,544),[[e.vModelCheckbox,X.value]]),u[78]||(u[78]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",Sd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[34]||(u[34]=S=>X.value=S),value:"right",onChange:u[35]||(u[35]=S=>D(S))},null,544),[[e.vModelCheckbox,X.value]]),u[79]||(u[79]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",xd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[36]||(u[36]=S=>X.value=S),value:"bottom",onChange:u[37]||(u[37]=S=>D(S))},null,544),[[e.vModelCheckbox,X.value]]),u[80]||(u[80]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",$d,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[38]||(u[38]=S=>X.value=S),value:"left",onChange:u[39]||(u[39]=S=>D(S))},null,544),[[e.vModelCheckbox,X.value]]),u[81]||(u[81]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",Bd,[u[82]||(u[82]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(de,{"model-value":l.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":u[40]||(u[40]=S=>K(Y=>{Y.padding=S??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",Dd,[u[83]||(u[83]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:l.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:u[41]||(u[41]=S=>K(Y=>{Y.wordWrap=!!S.target.checked}))},null,40,Td)]),g.value?(e.openBlock(),e.createElementBlock("div",Md,[u[85]||(u[85]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:h.value,style:{width:"100%"},onChange:R},[...u[84]||(u[84]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,zd)])):e.createCommentVNode("",!0),g.value&&h.value==="shrink"?(e.openBlock(),e.createElementBlock("div",Ad,[u[86]||(u[86]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(de,{"model-value":l.value.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":u[42]||(u[42]=S=>K(Y=>{Y.shrinkMinFontSize=S??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Pd,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!N.value,title:N.value||"",onClick:A}," 合并单元格 ",8,Rd),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!F.value,onClick:V},"拆分单元格",8,Ld)])],32)]),_:1}),e.createVNode(Qe,{modelValue:a.value,"onUpdate:modelValue":u[44]||(u[44]=S=>a.value=S),fields:t.fields,expression:i.value,"onUpdate:expression":ae},null,8,["modelValue","fields","expression"])],64))}}),Id=ce(Ud,[["__scopeId","data-v-8a66df60"]]),Fd={class:"watermark-config"},Od={class:"pd-field"},Hd={key:0,class:"pd-field"},Wd={class:"pd-field"},Gd={class:"pd-hint"},Kd={class:"pd-field"},qd={class:"pd-field"},Yd={class:"pd-hint"},jd={class:"pd-field"},Xd=["value"],Zd={class:"pd-field"},Jd=["min"],Qd={class:"pd-field"},_d=["min"],ec=e.defineComponent({__name:"WatermarkConfig",props:{modelValue:{},fields:{}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=he.WATERMARK_DENSITY_PRESETS,l=he.WATERMARK_DEFAULTS.minTileWidth,a=he.WATERMARK_DEFAULTS.minTileHeight;function i(Z){const y=Z.trim();return y?/[{}]/.test(y)||/^[A-Za-z_$][\w$]*\s*\(/.test(y)?!0:/^[A-Za-z_$][\w$]*(\.[\w$]+)+$/.test(y):!1}function d(Z){return Z?Z.mode==="binding"?Z.binding??"":Z.content??"":""}const m=e.ref(d(o.modelValue)),c=e.ref(o.modelValue?.testData||""),f=e.ref(!1),g=e.ref(o.modelValue?.mode==="binding"?"binding":"fixed"),h=e.reactive({rotate:o.modelValue?.rotate??he.WATERMARK_DEFAULTS.rotate,color:o.modelValue?.color||he.WATERMARK_DEFAULTS.color,opacity:o.modelValue?.opacity??he.WATERMARK_DEFAULTS.opacity,tileWidth:o.modelValue?.tileWidth??he.WATERMARK_DEFAULTS.tileWidth,tileHeight:o.modelValue?.tileHeight??he.WATERMARK_DEFAULTS.tileHeight}),R=e.computed(()=>g.value==="binding");e.watch(()=>o.modelValue,Z=>{Z&&(m.value=d(Z),g.value=Z.mode==="binding"?"binding":"fixed",c.value=Z.testData||"",h.rotate=Z.rotate??he.WATERMARK_DEFAULTS.rotate,h.color=Z.color||he.WATERMARK_DEFAULTS.color,h.opacity=Z.opacity??he.WATERMARK_DEFAULTS.opacity,h.tileWidth=Z.tileWidth??he.WATERMARK_DEFAULTS.tileWidth,h.tileHeight=Z.tileHeight??he.WATERMARK_DEFAULTS.tileHeight)},{deep:!0});const w=e.computed({get(){const{tileWidth:Z,tileHeight:y}=h;for(const[W,X]of Object.entries(n))if(Z===X.width&&y===X.height)return W;return"custom"},set(Z){const y=n[Z];y&&(h.tileWidth=y.width,h.tileHeight=y.height)}});function v(){g.value=i(m.value)?"binding":"fixed",K()}function p(){v()}function B(){f.value=!0}function Q(Z){m.value=Z,v()}function ae(Z){h.color=Z,K()}function K(){const Z={testData:c.value,rotate:h.rotate,color:h.color,opacity:h.opacity,tileWidth:h.tileWidth,tileHeight:h.tileHeight};s("update:modelValue",g.value==="binding"?{...Z,mode:"binding",binding:m.value,content:""}:{...Z,mode:"fixed",content:m.value,binding:""})}return(Z,y)=>(e.openBlock(),e.createElementBlock("div",Fd,[y[18]||(y[18]=e.createElementVNode("h3",{class:"pd-divider"},"水印",-1)),e.createElementVNode("form",{class:"pd-form",onSubmit:y[8]||(y[8]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Od,[y[9]||(y[9]=e.createElementVNode("span",{class:"pd-label"},"水印表达式",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":y[0]||(y[0]=W=>m.value=W),placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onInput:p,onDblclick:B},null,544),[[e.vModelText,m.value]]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:B},"编辑表达式")]),R.value?(e.openBlock(),e.createElementBlock("div",Hd,[y[10]||(y[10]=e.createElementVNode("span",{class:"pd-label"},"测试值",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":y[1]||(y[1]=W=>c.value=W),placeholder:"表达式取不到值时预览显示",onInput:K},null,544),[[e.vModelText,c.value]])])):e.createCommentVNode("",!0),e.createVNode(Qe,{modelValue:f.value,"onUpdate:modelValue":y[2]||(y[2]=W=>f.value=W),fields:t.fields,expression:m.value,"onUpdate:expression":Q},null,8,["modelValue","fields","expression"]),e.createElementVNode("div",Wd,[y[11]||(y[11]=e.createElementVNode("span",{class:"pd-label"},"旋转角度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":y[3]||(y[3]=W=>h.rotate=W),min:-90,max:90,step:5,onChange:K},null,544),[[e.vModelText,h.rotate,void 0,{number:!0}]]),e.createElementVNode("span",Gd,e.toDisplayString(h.rotate)+"°",1)]),e.createElementVNode("div",Kd,[y[12]||(y[12]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ce,{"model-value":h.color,"onUpdate:modelValue":ae},null,8,["model-value"])]),e.createElementVNode("div",qd,[y[13]||(y[13]=e.createElementVNode("span",{class:"pd-label"},"透明度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":y[4]||(y[4]=W=>h.opacity=W),min:.05,max:.5,step:.05,onChange:K},null,544),[[e.vModelText,h.opacity,void 0,{number:!0}]]),e.createElementVNode("span",Yd,e.toDisplayString(h.opacity.toFixed(2)),1)]),e.createElementVNode("div",jd,[y[15]||(y[15]=e.createElementVNode("span",{class:"pd-label"},"密度",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":y[5]||(y[5]=W=>w.value=W),style:{width:"100%"},onChange:K},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),(W,X)=>(e.openBlock(),e.createElementBlock("option",{key:X,value:X},e.toDisplayString(W.label)+"("+e.toDisplayString(W.width)+"×"+e.toDisplayString(W.height)+")",9,Xd))),128)),y[14]||(y[14]=e.createElementVNode("option",{value:"custom"},"自定义",-1))],544),[[e.vModelSelect,w.value]])]),w.value==="custom"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Zd,[y[16]||(y[16]=e.createElementVNode("span",{class:"pd-label"},"瓦片宽",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":y[6]||(y[6]=W=>h.tileWidth=W),min:e.unref(l),step:10,onChange:K},null,40,Jd),[[e.vModelText,h.tileWidth,void 0,{number:!0}]])]),e.createElementVNode("div",Qd,[y[17]||(y[17]=e.createElementVNode("span",{class:"pd-label"},"瓦片高",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":y[7]||(y[7]=W=>h.tileHeight=W),min:e.unref(a),step:10,onChange:K},null,40,_d),[[e.vModelText,h.tileHeight,void 0,{number:!0}]])])],64)):e.createCommentVNode("",!0)],32)]))}}),tc=ce(ec,[["__scopeId","data-v-b55bfc50"]]),oc={class:"design-background-config"},nc=["title"],lc={class:"design-background-actions"},ac=["disabled"],ic=e.defineComponent({__name:"DesignBackgroundConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(!1),l=e.inject(ft,e.computed(()=>{})),a=e.computed(()=>n.value||!l.value),i=e.computed(()=>o.modelValue?.rotation??0);async function d(f){const g=f.target,h=g.files?.[0];if(h){if(!h.type.startsWith("image/")){alert("仅支持上传图片文件"),g.value="";return}if(!l.value){alert("设计背景上传能力未配置"),g.value="";return}n.value=!0;try{const R=await l.value(h);R?s("update:modelValue",{src:R,rotation:0}):alert("设计背景上传失败")}catch(R){alert(R instanceof Error?R.message:"设计背景上传失败")}finally{n.value=!1,g.value=""}}}function m(){if(!o.modelValue?.src)return;const f=(i.value+90)%360;s("update:modelValue",{src:o.modelValue.src,rotation:f})}function c(){s("update:modelValue",void 0)}return(f,g)=>(e.openBlock(),e.createElementBlock("div",oc,[g[0]||(g[0]=e.createElementVNode("h3",{class:"pd-divider"},"设计背景",-1)),g[1]||(g[1]=e.createElementVNode("p",{class:"design-background-tip"},"仅设计器显示,用于套打定位,不会出现在预览和打印中",-1)),t.modelValue?.src?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"design-background-path",title:t.modelValue.src},e.toDisplayString(t.modelValue.src),9,nc),e.createElementVNode("div",lc,[e.createElementVNode("button",{type:"button",class:"pd-button small rotate-btn",onClick:m}," 旋转("+e.toDisplayString(i.value)+"°) ",1),e.createElementVNode("button",{type:"button",class:"pd-button small remove-btn",onClick:c},"移除")])],64)):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[e.createTextVNode(e.toDisplayString(n.value?"上传中...":"上传背景图")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:d},null,40,ac)],2))]))}}),rc=ce(ic,[["__scopeId","data-v-3f4d2e32"]]),sc={class:"tiling-config","data-test":"tiling-config"},dc={class:"pd-field"},cc={class:"tiling-switch"},uc=["checked","disabled"],mc={key:0,class:"pd-hint tiling-error"},pc={class:"pd-field"},vc=["value"],fc=["value"],gc={key:0,class:"pd-field"},bc={class:"custom-size-grid"},hc={key:1,class:"pd-field"},Ec={class:"pd-radio-group",role:"radiogroup"},yc={class:"pd-radio"},kc=["checked"],Vc={class:"pd-radio"},Nc=["checked"],wc={class:"margin-grid"},Cc={class:"pd-field"},Sc={class:"pd-field"},xc={class:"pd-field"},$c={class:"pd-field"},Bc={class:"pd-field"},Dc={class:"pd-field"},Tc={class:"pd-field"},Mc={key:2,class:"pd-hint tiling-summary"},zc=e.defineComponent({__name:"TilingConfig",props:{modelValue:{},templateData:{}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=Object.keys(E.PAPER_PRESETS).filter(v=>v!=="CUSTOM"&&!E.PAPER_PRESETS[v]?.continuous),l=e.computed(()=>E.isContinuousPaperSize(o.templateData?.paperSize)),a=e.computed(()=>({...he.TILE_DEFAULTS,...o.modelValue??{},enabled:o.modelValue?.enabled??!1,sheetMargin:{...he.TILE_DEFAULTS.sheetMargin,...o.modelValue?.sheetMargin??{}}})),i=e.computed(()=>o.templateData?{...o.templateData,tiling:a.value}:void 0),d=e.computed(()=>i.value?he.validateTiling(i.value):[]),m=e.computed(()=>{const v=i.value;return v?Math.max(he.computeMaxColumns(v),1):1}),c=e.computed(()=>{const v=i.value;if(!(!v||d.value.length))try{return he.computeTileLayout(v)}catch{return}}),f=e.computed(()=>{const v=c.value,p=i.value;if(!v||!p)return"";const B=he.resolveSheetMm(p),Q=a.value.sheetPaperSize==="CUSTOM"?"自定义":a.value.sheetPaperSize??"A4",ae=a.value.sheetPaperSize==="CUSTOM"?"":a.value.sheetOrientation==="landscape"?" 横向":" 纵向";return`目标纸 ${Q}${ae} ${B.width}×${B.height}mm · ${v.columns} 列 × ${v.rows} 行 = 每张 ${v.perSheet} 格`});function g(v){s("update:modelValue",{...a.value,...v})}function h(v,p){g({sheetMargin:{...a.value.sheetMargin,[v]:p??0}})}function R(v){if(v!=="CUSTOM"){g({sheetPaperSize:v});return}const p=i.value,B=p?he.resolveSheetMm(p):{width:210,height:297};g({sheetPaperSize:"CUSTOM",sheetCustomWidth:a.value.sheetCustomWidth??B.width,sheetCustomHeight:a.value.sheetCustomHeight??B.height})}function w(v){if(!v){g({enabled:!1});return}const p=m.value,B=p>=1?Math.min(he.TILE_DEFAULTS.columns,p):1;g({...he.TILE_DEFAULTS,columns:B})}return(v,p)=>(e.openBlock(),e.createElementBlock("div",sc,[p[30]||(p[30]=e.createElementVNode("h3",{class:"pd-divider"},"拼版打印",-1)),p[31]||(p[31]=e.createElementVNode("p",{class:"pd-hint"},"把标签按「列 × 行」铺到一张大纸上批量打印",-1)),e.createElementVNode("div",dc,[e.createElementVNode("label",cc,[e.createElementVNode("input",{type:"checkbox",checked:a.value.enabled,disabled:l.value,onChange:p[0]||(p[0]=B=>w(B.target.checked))},null,40,uc),p[13]||(p[13]=e.createElementVNode("span",null,"启用拼版",-1))]),l.value?(e.openBlock(),e.createElementBlock("p",mc,"连续纸不支持拼版")):e.createCommentVNode("",!0)]),a.value.enabled&&!l.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",pc,[p[15]||(p[15]=e.createElementVNode("span",{class:"pd-label"},"目标纸张",-1)),e.createElementVNode("select",{class:"pd-select",style:{width:"100%"},value:a.value.sheetPaperSize??"A4",onChange:p[1]||(p[1]=B=>R(B.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),B=>(e.openBlock(),e.createElementBlock("option",{key:B,value:B},e.toDisplayString(e.unref(E.PAPER_PRESETS)[B]?.label??B),9,fc))),128)),p[14]||(p[14]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,vc)]),a.value.sheetPaperSize==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",gc,[p[17]||(p[17]=e.createElementVNode("span",{class:"pd-label"},"目标纸宽高 (mm)",-1)),e.createElementVNode("div",bc,[e.createVNode(de,{"model-value":a.value.sheetCustomWidth,min:25,max:2e3,"onUpdate:modelValue":p[2]||(p[2]=B=>g({sheetCustomWidth:B}))},null,8,["model-value"]),p[16]||(p[16]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(de,{"model-value":a.value.sheetCustomHeight,min:25,max:2e3,"onUpdate:modelValue":p[3]||(p[3]=B=>g({sheetCustomHeight:B}))},null,8,["model-value"])])])):(e.openBlock(),e.createElementBlock("div",hc,[p[20]||(p[20]=e.createElementVNode("span",{class:"pd-label"},"目标纸方向",-1)),e.createElementVNode("div",Ec,[e.createElementVNode("label",yc,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:(a.value.sheetOrientation??"portrait")==="portrait",onChange:p[4]||(p[4]=B=>g({sheetOrientation:"portrait"}))},null,40,kc),p[18]||(p[18]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",Vc,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:a.value.sheetOrientation==="landscape",onChange:p[5]||(p[5]=B=>g({sheetOrientation:"landscape"}))},null,40,Nc),p[19]||(p[19]=e.createElementVNode("span",null,"横向",-1))])])])),p[28]||(p[28]=e.createElementVNode("h3",{class:"pd-divider"},"拼版留白 (mm)",-1)),e.createElementVNode("div",wc,[e.createElementVNode("div",Cc,[p[21]||(p[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.top,min:0,max:100,"onUpdate:modelValue":p[6]||(p[6]=B=>h("top",B))},null,8,["model-value"])]),e.createElementVNode("div",Sc,[p[22]||(p[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.bottom,min:0,max:100,"onUpdate:modelValue":p[7]||(p[7]=B=>h("bottom",B))},null,8,["model-value"])]),e.createElementVNode("div",xc,[p[23]||(p[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.left,min:0,max:100,"onUpdate:modelValue":p[8]||(p[8]=B=>h("left",B))},null,8,["model-value"])]),e.createElementVNode("div",$c,[p[24]||(p[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.right,min:0,max:100,"onUpdate:modelValue":p[9]||(p[9]=B=>h("right",B))},null,8,["model-value"])])]),p[29]||(p[29]=e.createElementVNode("h3",{class:"pd-divider"},"格间距与列数",-1)),e.createElementVNode("div",Bc,[p[25]||(p[25]=e.createElementVNode("span",{class:"pd-label"},"横向间距",-1)),e.createVNode(de,{"model-value":a.value.gapX,min:0,max:50,"onUpdate:modelValue":p[10]||(p[10]=B=>g({gapX:B??0}))},null,8,["model-value"])]),e.createElementVNode("div",Dc,[p[26]||(p[26]=e.createElementVNode("span",{class:"pd-label"},"纵向间距",-1)),e.createVNode(de,{"model-value":a.value.gapY,min:0,max:50,"onUpdate:modelValue":p[11]||(p[11]=B=>g({gapY:B??0}))},null,8,["model-value"])]),e.createElementVNode("div",Tc,[p[27]||(p[27]=e.createElementVNode("span",{class:"pd-label"},"列数",-1)),e.createVNode(de,{"model-value":a.value.columns,min:1,max:m.value,"onUpdate:modelValue":p[12]||(p[12]=B=>g({columns:B??1}))},null,8,["model-value","max"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,B=>(e.openBlock(),e.createElementBlock("p",{key:B.code,class:"pd-hint tiling-error"},e.toDisplayString(B.message),1))),128)),!d.value.length&&f.value?(e.openBlock(),e.createElementBlock("p",Mc,e.toDisplayString(f.value),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]))}}),Ac=ce(zc,[["__scopeId","data-v-aa278268"]]),Pc={key:0,class:"prop-collapsed"},Rc={class:"prop-head"},Lc={class:"pd-tabs prop-tabs"},Uc={class:"pd-tab-bar",role:"tablist"},Ic={class:"pd-tab-pane",role:"tabpanel"},Fc={class:"property-content"},Oc={key:1,class:"pd-empty"},Hc={class:"pd-tab-pane",role:"tabpanel"},Wc={class:"pd-field"},Gc=["value"],Kc=["label"],qc=["value"],Yc={key:0,class:"pd-hint"},jc={key:1,class:"pd-field"},Xc={class:"pd-label"},Zc={class:"custom-size-grid"},Jc={key:2,class:"pd-field"},Qc={class:"pd-radio-group",role:"radiogroup"},_c={class:"pd-radio"},eu=["checked"],tu={class:"pd-radio"},ou=["checked"],nu={key:3,class:"pd-field"},lu={class:"pd-radio-group pd-radio-group--2col",role:"radiogroup"},au={class:"pd-radio"},iu=["checked"],ru={class:"pd-radio"},su=["checked"],du={class:"pd-radio"},cu=["checked"],uu={class:"pd-radio"},mu=["checked"],pu={class:"pd-field"},vu={class:"page-bg-row"},fu={key:5,class:"pd-hint"},gu={class:"margin-grid"},bu={class:"pd-field"},hu={class:"pd-field"},Eu={class:"pd-field"},yu={class:"pd-field"},ku={class:"pd-field"},Vu={class:"pd-field"},Nu={class:"pd-field"},wu=e.defineComponent({__name:"PropertyPanel",props:{element:{},templateData:{},fields:{},activeTab:{},tableSelection:{},recordHistory:{type:Function},collapsed:{type:Boolean},multiPage:{type:Boolean}},emits:["delete-element","update:templateData","update:activeTab","toggle-collapse"],setup(t,{emit:r}){const o=t,s=r,n=e.computed(()=>{const O=[];for(const[z,te]of Object.entries(E.PAPER_PRESETS)){if(o.multiPage&&E.isContinuousPaperSize(z))continue;const pe=te.group??"其他";let ke=O.find(Ve=>Ve.group===pe);ke||(ke={group:pe,items:[]},O.push(ke)),ke.items.push({key:z,label:te.label??z})}return O}),l=e.ref(""),a=e.computed(()=>o.element?["text","longText"].includes(o.element.printElementType.type):!1),i=e.computed(()=>o.element?o.element.printElementType.type==="image":!1),d=e.computed(()=>o.element?["barcode","qrcode"].includes(o.element.printElementType.type):!1),m=e.computed(()=>!o.element||o.element.printElementType.type!=="table"?!1:!!o.tableSelection&&o.tableSelection.elementId===o.element.id),c=e.computed(()=>o.element?o.element.printElementType.type==="table":!1),f=e.computed(()=>E.searchProperties(l.value)),g=e.computed(()=>f.value.groups),h=e.computed(()=>f.value.itemKeys),R=e.computed(()=>!!l.value.trim()),w=e.computed(()=>{if(!o.element)return[];if(o.element.printElementType.type==="table"&&o.tableSelection){const{r1:O,c1:z}=o.tableSelection,te=o.element.options.tableRows;if(te&&te[O]){const pe=te[O],ke=o.element.options.fields?.[0]?.dataSource;return E.getTableCellBindings(pe.type,O,z,ke)}}return E.getElementBindings(o.element)});function v(O){return O.split(".").flatMap(z=>{const te=z.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!te)return[z];const pe=te[1],ke=[...te[2].matchAll(/\[(\d+)\]/g)].map(Ve=>Number(Ve[1]));return[pe,...ke]})}function p(O){return o.element?v(O).reduce((pe,ke)=>pe==null?"":pe[ke],o.element)??"":""}function B(O,z){if(!o.element)return;const te=v(O),pe=te.pop(),ke=te.reduce((Ve,De)=>((Ve[De]===void 0||Ve[De]===null)&&(Ve[De]={}),Ve[De]),o.element);ke[pe]=z||void 0,o.recordHistory?.()}function Q(O){l.value=O}function ae(O){o.element&&B("options.src",O)}const K=e.computed(()=>o.templateData?.paperSize||"A4"),Z=e.computed(()=>!o.multiPage&&E.isContinuousPaperSize(K.value)),y=e.computed(()=>E.isLabelPaperSize(K.value)),W=e.computed(()=>o.templateData?.orientation||"portrait"),X=e.computed(()=>!!o.templateData?.tiling?.enabled),U=e.computed(()=>o.templateData?.outputRotation??0),k=e.computed({get:()=>o.templateData?.pageBackground||"#ffffff",set:O=>b(O)}),D=e.computed(()=>o.templateData?.margins.top??10),N=e.computed(()=>o.templateData?.margins.bottom??10),F=e.computed(()=>o.templateData?.margins.left??10),A=e.computed(()=>o.templateData?.margins.right??10),V=e.computed(()=>o.templateData?.header.height??10),T=e.computed(()=>o.templateData?.footer.height??10),u=e.computed(()=>o.templateData?.firstPageOverlay.height??0),S=e.computed(()=>o.templateData?.customWidth??E.PAPER_PRESETS[K.value]?.width??210),Y=e.computed(()=>o.templateData?.customHeight??297),Ee=e.computed(()=>o.templateData?.designBackground);function fe(O){if(o.templateData){if(!O){const z={...o.templateData};delete z.designBackground,s("update:templateData",z);return}L({designBackground:O})}}const me=e.computed(()=>o.templateData?.watermark??{});function ge(O){L({watermark:O})}function L(O){if(!o.templateData)return;const z={...o.templateData,...O};s("update:templateData",z)}function x(O){if(o.templateData){if(E.isContinuousPaperSize(O)){L({paperSize:O,customWidth:O==="CONTINUOUS"?o.templateData?.customWidth??80:void 0,orientation:"portrait",margins:{...o.templateData.margins,bottom:o.templateData?.margins.bottom??0}});return}if(O==="CUSTOM"){L({paperSize:"CUSTOM"});return}if(E.PAPER_PRESETS[O]){if(E.isLabelPaperSize(O)){L({paperSize:O,...E.labelPaperDefaults(o.templateData)});return}L({paperSize:O})}}}function $(O){L({orientation:String(O)})}function G(O){L({outputRotation:Number(O)})}function b(O){const z=O&&O.toLowerCase()!=="#ffffff"&&O.toLowerCase()!=="#fff"?O:void 0;L(z===void 0?{pageBackground:void 0}:{pageBackground:z})}function C(){L({pageBackground:void 0})}function M(O){O!==void 0&&L({customWidth:O})}function ee(O){O!==void 0&&L({customHeight:O})}function oe(O){O!==void 0&&L({margins:{...o.templateData.margins,top:O}})}function ie(O){O!==void 0&&L({margins:{...o.templateData.margins,bottom:O}})}function ve(O){O!==void 0&&L({margins:{...o.templateData.margins,left:O}})}function P(O){O!==void 0&&L({margins:{...o.templateData.margins,right:O}})}function H(O){O!==void 0&&L({header:{...o.templateData.header,height:O}})}function j(O){O!==void 0&&L({footer:{...o.templateData.footer,height:O}})}function ne(O){O!==void 0&&L({firstPageOverlay:{...o.templateData.firstPageOverlay,height:O}})}const _=e.computed(()=>o.activeTab||"page");function be(O){s("update:activeTab",O),s("toggle-collapse")}return(O,z)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",Pc,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:z[0]||(z[0]=te=>be(_.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:_.value==="element"}]),title:"元素属性",onClick:z[1]||(z[1]=te=>be("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:_.value==="page"}]),title:"页面属性",onClick:z[2]||(z[2]=te=>be("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Rc,[z[18]||(z[18]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:z[3]||(z[3]=te=>O.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",Lc,[e.createElementVNode("div",Uc,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="element"}]),onClick:z[4]||(z[4]=te=>O.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="page"}]),onClick:z[5]||(z[5]=te=>O.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",Ic,[t.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(qa,{onSearch:Q}),e.createElementVNode("div",Fc,[g.value.includes("position-size")&&!m.value?(e.openBlock(),e.createBlock(li,{key:0,element:t.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("appearance")?(e.openBlock(),e.createBlock(Di,{key:1,element:t.element,"is-text-type":a.value,"matched-keys":h.value,searching:R.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("code")&&d.value?(e.openBlock(),e.createBlock(Yi,{key:2,element:t.element,"matched-keys":h.value,searching:R.value,onChange:z[6]||(z[6]=te=>t.recordHistory?.())},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("binding")?(e.openBlock(),e.createBlock($e,{key:3,title:"内容",icon:"Document","default-expanded":"","group-key":"binding"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,te=>(e.openBlock(),e.createBlock(Lr,{key:te.targetPath,descriptor:te,fields:t.fields,"model-value":p(te.targetPath),"onUpdate:modelValue":pe=>B(te.targetPath,pe)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),i.value?(e.openBlock(),e.createBlock(gs,{key:0,onSuccess:ae})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),c.value&&t.tableSelection&&t.tableSelection.elementId===t.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createVNode(Vs,{element:t.element,selection:t.tableSelection},null,8,["element","selection"]),e.createVNode(Id,{element:t.element,selection:t.tableSelection,fields:t.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),c.value&&g.value.includes("content")?(e.openBlock(),e.createBlock(Yr,{key:5,element:t.element,fields:t.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),g.value.includes("border-bg")?(e.openBlock(),e.createBlock(_r,{key:6,element:t.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&c.value?(e.openBlock(),e.createBlock(Dt,{key:7,element:t.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&!c.value?(e.openBlock(),e.createBlock(Dt,{key:8,element:t.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("advanced")?(e.openBlock(),e.createBlock(is,{key:9,element:t.element,"matched-keys":h.value,searching:R.value,onDeleteElement:z[7]||(z[7]=te=>O.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",Oc,"请在画布中选择一个元素"))],512),[[e.vShow,(t.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",Hc,[e.createElementVNode("form",{class:"pd-form",onSubmit:z[17]||(z[17]=e.withModifiers(()=>{},["prevent"]))},[z[40]||(z[40]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",Wc,[z[20]||(z[20]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:K.value,class:"pd-select",onChange:z[8]||(z[8]=te=>x(te.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,te=>(e.openBlock(),e.createElementBlock("optgroup",{key:te.group,label:te.group},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.items,pe=>(e.openBlock(),e.createElementBlock("option",{key:pe.key,value:pe.key},e.toDisplayString(pe.label),9,qc))),128))],8,Kc))),128)),z[19]||(z[19]=e.createElementVNode("option",{value:"CUSTOM"},"自定义宽高",-1))],40,Gc)]),y.value?(e.openBlock(),e.createElementBlock("p",Yc,"标签纸默认整张给内容区:已取消页边距与页眉页脚,可在下方自行改回")):e.createCommentVNode("",!0),Z.value||K.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",jc,[e.createElementVNode("span",Xc,e.toDisplayString(Z.value?"纸宽 (mm)":"自定义宽高 (mm)"),1),e.createElementVNode("div",Zc,[e.createVNode(de,{"model-value":S.value,min:25,max:2e3,"onUpdate:modelValue":M},null,8,["model-value"]),K.value==="CUSTOM"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[z[21]||(z[21]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(de,{"model-value":Y.value,min:25,max:2e3,"onUpdate:modelValue":ee},null,8,["model-value"])],64)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),Z.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Jc,[z[24]||(z[24]=e.createElementVNode("span",{class:"pd-label"},"纸张方向",-1)),e.createElementVNode("div",Qc,[e.createElementVNode("label",_c,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:W.value==="portrait",onChange:z[9]||(z[9]=te=>$(te.target.value))},null,40,eu),z[22]||(z[22]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",tu,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:W.value==="landscape",onChange:z[10]||(z[10]=te=>$(te.target.value))},null,40,ou),z[23]||(z[23]=e.createElementVNode("span",null,"横向",-1))])]),z[25]||(z[25]=e.createElementVNode("p",{class:"pd-hint"},"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)",-1))])),!Z.value&&!X.value?(e.openBlock(),e.createElementBlock("div",nu,[z[30]||(z[30]=e.createElementVNode("span",{class:"pd-label"},"内容旋转角度",-1)),e.createElementVNode("div",lu,[e.createElementVNode("label",au,[e.createElementVNode("input",{type:"radio",value:"0",checked:U.value===0,onChange:z[11]||(z[11]=te=>G(te.target.value))},null,40,iu),z[26]||(z[26]=e.createElementVNode("span",null,"0°",-1))]),e.createElementVNode("label",ru,[e.createElementVNode("input",{type:"radio",value:"90",checked:U.value===90,onChange:z[12]||(z[12]=te=>G(te.target.value))},null,40,su),z[27]||(z[27]=e.createElementVNode("span",null,"90°",-1))]),e.createElementVNode("label",du,[e.createElementVNode("input",{type:"radio",value:"180",checked:U.value===180,onChange:z[13]||(z[13]=te=>G(te.target.value))},null,40,cu),z[28]||(z[28]=e.createElementVNode("span",null,"180°",-1))]),e.createElementVNode("label",uu,[e.createElementVNode("input",{type:"radio",value:"270",checked:U.value===270,onChange:z[14]||(z[14]=te=>G(te.target.value))},null,40,mu),z[29]||(z[29]=e.createElementVNode("span",null,"270°",-1))])]),z[31]||(z[31]=e.createElementVNode("p",{class:"pd-hint"},"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)",-1))])):e.createCommentVNode("",!0),e.createElementVNode("div",pu,[z[32]||(z[32]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",vu,[e.createVNode(Ce,{modelValue:k.value,"onUpdate:modelValue":z[15]||(z[15]=te=>k.value=te),class:"page-bg-picker"},null,8,["modelValue"]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:C},"默认")])]),e.createVNode(rc,{"model-value":Ee.value,"onUpdate:modelValue":fe},null,8,["model-value"]),t.multiPage?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Ac,{key:4,"model-value":t.templateData?.tiling,"template-data":t.templateData,"onUpdate:modelValue":z[16]||(z[16]=te=>L({tiling:te}))},null,8,["model-value","template-data"])),z[41]||(z[41]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),Z.value?(e.openBlock(),e.createElementBlock("p",fu,"底部边距即连续纸走纸留白")):e.createCommentVNode("",!0),e.createElementVNode("div",gu,[e.createElementVNode("div",bu,[z[33]||(z[33]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(de,{"model-value":D.value,min:0,max:50,"onUpdate:modelValue":oe},null,8,["model-value"])]),e.createElementVNode("div",hu,[z[34]||(z[34]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(de,{"model-value":N.value,min:0,max:100,"onUpdate:modelValue":ie},null,8,["model-value"])]),e.createElementVNode("div",Eu,[z[35]||(z[35]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(de,{"model-value":F.value,min:0,max:50,"onUpdate:modelValue":ve},null,8,["model-value"])]),e.createElementVNode("div",yu,[z[36]||(z[36]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(de,{"model-value":A.value,min:0,max:50,"onUpdate:modelValue":P},null,8,["model-value"])])]),z[42]||(z[42]=e.createElementVNode("h3",{class:"pd-divider"},"三区高度 (mm)",-1)),e.createElementVNode("div",ku,[z[37]||(z[37]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(de,{"model-value":V.value,min:0,max:100,step:.1,"onUpdate:modelValue":H},null,8,["model-value"])]),e.createElementVNode("div",Vu,[z[38]||(z[38]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(de,{"model-value":T.value,min:0,max:100,step:.1,"onUpdate:modelValue":j},null,8,["model-value"])]),e.createElementVNode("div",Nu,[z[39]||(z[39]=e.createElementVNode("span",{class:"pd-label"},"首页叠加高度",-1)),e.createVNode(de,{"model-value":u.value,min:0,max:200,"onUpdate:modelValue":ne},null,8,["model-value"])])],32),e.createVNode(tc,{"model-value":me.value,fields:t.fields,"onUpdate:modelValue":ge},null,8,["model-value","fields"])],512),[[e.vShow,(t.activeTab||"page")==="page"]])])],64))],2))}}),Cu=ce(wu,[["__scopeId","data-v-f7152fc4"]]),Su={class:"status-bar"},xu={key:0,class:"status-item coord"},$u={class:"status-item"},Bu={class:"status-item"},Du={class:"status-item status-paper"},Tu=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(t){return(r,o)=>(e.openBlock(),e.createElementBlock("div",Su,[t.coordinate?(e.openBlock(),e.createElementBlock("span",xu," x:"+e.toDisplayString(t.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(t.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",$u,"缩放 "+e.toDisplayString(t.scale)+"%",1),e.createElementVNode("span",Bu,"元素 "+e.toDisplayString(t.elementCount)+e.toDisplayString(t.selectedCount?` (选中 ${t.selectedCount})`:""),1),e.createElementVNode("span",{class:e.normalizeClass(["status-dirty",{on:t.dirty}])},[o[0]||(o[0]=e.createElementVNode("span",{class:"dirty-dot"},null,-1)),e.createTextVNode(e.toDisplayString(t.dirty?"未保存":"已保存"),1)],2),e.createElementVNode("span",Du,e.toDisplayString(t.paper),1)]))}}),Mu=ce(Tu,[["__scopeId","data-v-a91952ff"]]),zu={id:"getting-started",title:"快速入门",content:`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),be=require("@worm-vue3-print/core"),E=require("@worm-vue3-print/core/designer"),se=require("lucide-vue-next"),He=require("@worm-vue3-print/core/browser"),At=require("jsbarcode"),Pt=require("qrcode"),jt=require("dompurify"),Rt=Symbol("selected-ids"),Lt=Symbol("preview-ids");function Xt(t){const r=e.ref(new Set),o=e.ref(new Set),s=e.computed(()=>t.value.filter(g=>r.value.has(g.id))),n=e.computed(()=>r.value.size>0);function l(g,b=!1){if(b){const R=new Set(r.value);R.has(g)?R.delete(g):R.add(g),r.value=R}else r.value=new Set([g])}function a(){r.value=new Set}function i(g){r.value=new Set(g)}function d(g){o.value=new Set(g)}function m(){o.value=new Set}function c(){r.value=new Set(o.value),o.value=new Set}function f(){const g=s.value;if(g.length===0)return null;let b=1/0,R=1/0,w=-1/0,v=-1/0;return g.forEach(p=>{b=Math.min(b,p.options.left),R=Math.min(R,p.options.top),w=Math.max(w,p.options.left+p.options.width),v=Math.max(v,p.options.top+p.options.height)}),{left:b,top:R,width:w-b,height:v-R}}return{selectedIds:r,selectedElements:s,hasSelection:n,select:l,clearSelection:a,selectAll:i,getSelectionBounds:f,previewIds:o,setPreview:d,clearPreview:m,commitPreview:c}}function Zt(){const t=e.ref(null);function r(n){t.value=n.map(l=>({options:{...l.options},printElementType:{...l.printElementType}}))}function o(n=10){if(!t.value)return null;const l=new Map;for(const i of t.value){const d=i.options.groupId;d&&l.set(d,(l.get(d)??0)+1)}const a=new Map;for(const[i,d]of l)a.set(i,d>=2?E.generateGroupId():void 0);return t.value.map(i=>({id:E.generateId(),options:{...i.options,left:i.options.left+n,top:i.options.top+n,groupId:i.options.groupId?a.get(i.options.groupId):void 0},printElementType:{...i.printElementType}}))}function s(){return t.value!==null&&t.value.length>0}return{clipboard:t,copy:r,paste:o,hasData:s}}function Jt(t){const o=e.ref([]),s=e.ref([]),n=e.ref(!1),l=e.ref(!1);function a(){n.value=o.value.length>0,l.value=s.value.length>0}function i(b){const R={elements:JSON.parse(JSON.stringify(b?.elements??[])),templateData:JSON.parse(JSON.stringify(b?.templateData??{}))};return b?.pages&&(R.pages=JSON.parse(JSON.stringify(b.pages)),b.activePageIndex!==void 0&&(R.activePageIndex=b.activePageIndex)),R}function d(b){return i(b)}function m(b){o.value.push(d(b)),s.value=[],o.value.length>50&&o.value.shift(),a()}function c(b){if(o.value.length===0)return null;const R=o.value.pop();return s.value.push(b?d(b):i(R)),a(),o.value.length>0?i(o.value[o.value.length-1]):null}function f(b){if(s.value.length===0)return null;const R=s.value.pop();return o.value.push(b?d(b):i(R)),a(),i(R)}function g(){o.value=[],s.value=[],a()}return{push:m,undo:c,redo:f,canUndo:n,canRedo:l,clear:g}}const mt="开启拼版后只能有一个设计页面";function Ue(){return{paperSize:"A4",orientation:"portrait",unit:"mm",margins:{top:10,right:10,bottom:10,left:10},header:{height:10,elements:[]},footer:{height:10,elements:[]},firstPageOverlay:{height:0,elements:[]},elements:[],watermark:{}}}function Ze(t){const r=(o,s)=>(o??[]).map(n=>{const l={...n.options};return(n.printElementType?.type??n.type)==="table"&&E.syncTableElementSize(l),{id:n.id||E.generateId(),zone:s,options:l,printElementType:{...n.printElementType}}});return{...t,margins:{...t.margins},header:{height:t.header?.height??10,elements:[]},footer:{height:t.footer?.height??10,elements:[]},firstPageOverlay:{height:t.firstPageOverlay?.height??0,elements:[...t.firstPageOverlay?.elements??[]]},guides:[...t.guides??[]],elements:[...r(t.elements??[],"content"),...r(t.header?.elements??[],"header"),...r(t.footer?.elements??[],"footer")]}}function kt(t){const r=(s,n)=>{const l=Ze(E.normalizeTemplateUnits(s));return l.name||(l.name=`页面 ${n+1}`),l};if(!t)return[r(Ue(),0)];const o=Array.isArray(t.pages)?t.pages:[t];return o.length?o.map(r):[r(Ue(),0)]}function Vt(t){const r=t.elements,o=s=>r.filter(n=>(n.zone||"content")===s).map(n=>({id:n.id,type:n.printElementType.type,options:{...n.options},printElementType:{...n.printElementType}}));return{unit:"mm",...t,header:{...t.header,elements:o("header")},footer:{...t.footer,elements:o("footer")},firstPageOverlay:{...t.firstPageOverlay,elements:(t.firstPageOverlay?.elements??[]).map(s=>({id:s.id||E.generateId(),type:s.printElementType?.type||"text",options:{...s.options},printElementType:{...s.printElementType}}))},elements:o("content"),guides:[...t.guides??[]]}}function Qt(t={}){const r=e.ref(100),o=e.ref(!0),s=e.ref(!0),n=e.ref(!1),l=e.ref(!0),a=e.ref(kt(t.initialTemplate)),i=e.ref(0),d=e.ref(a.value[0]??Ze(Ue())),m=e.computed(()=>a.value.some(I=>I.tiling?.enabled===!0));function c(){return m.value?(alert(mt),!0):!1}function f(){a.value[i.value]=d.value}function g(I){I<0||I>=a.value.length||(f(),i.value=I,d.value=a.value[I],me())}const b=e.computed({get:()=>d.value.elements,set:I=>{d.value.elements=I}}),R=e.ref(t.initialFields||[]),{selectedIds:w,selectedElements:v,select:p,clearSelection:B,selectAll:Q,previewIds:ae,setPreview:K,clearPreview:Z,commitPreview:y}=Xt(b),{group:W,ungroup:X,getGroupedIds:U}=E.useGroup(),{copy:k,paste:D,hasData:N}=Zt(),{align:F}=E.useAlign(),{push:A,undo:V,redo:T,canUndo:u,canRedo:S}=Jt(),Y=e.computed(()=>{if(w.value.size===0)return null;const I=w.value.values().next().value;return b.value.find(le=>le.id===I)||null}),Ee=e.ref(null);function fe(I){Ee.value=I}function me(){B(),fe(null)}function ge(){return{elements:b.value.map(I=>({id:I.id,zone:I.zone,options:JSON.parse(JSON.stringify(I.options)),printElementType:{...I.printElementType}})),templateData:{paperSize:d.value.paperSize,orientation:d.value.orientation,outputRotation:d.value.outputRotation,margins:{...d.value.margins},header:{height:d.value.header.height,elements:[]},footer:{height:d.value.footer.height,elements:[]},firstPageOverlay:{height:d.value.firstPageOverlay.height,elements:[]},elements:[],customWidth:d.value.customWidth,customHeight:d.value.customHeight,watermark:d.value.watermark?{...d.value.watermark}:void 0,guides:[...d.value.guides??[]]},pages:JSON.parse(JSON.stringify(a.value)),activePageIndex:i.value}}function L(){A(ge())}function x(I){return I.pages?.[I.activePageIndex??0]?.elements??I.elements}function $(){const I=V(ge());I?.pages?(a.value=I.pages,i.value=I.activePageIndex??0,d.value=a.value[i.value]??a.value[0],me()):I?.templateData&&(d.value={...I.templateData,elements:I.elements})}function G(){const I=T(ge());I?.pages?(a.value=I.pages,i.value=I.activePageIndex??0,d.value=a.value[i.value]??a.value[0],me()):I?.templateData&&(d.value={...I.templateData,elements:I.elements})}function h(){k(v.value)}function C(){k(v.value),te()}function M(){const I=D();I&&I.length>0&&(b.value.push(...I),L())}function ee(){k(v.value);const I=D();I&&I.length>0&&(I.forEach(le=>{le.options.left+=5,le.options.top+=5}),b.value.push(...I),p(I[0].id,!1),L())}function oe(){r.value=100}const ie=e.computed(()=>N());let ve=!1,P=null;const H=300;function j(I,le){const re=v.value.filter(Ne=>!Ne.options.locked);re.length!==0&&(re.forEach(Ne=>{Ne.options.left+=I,Ne.options.top+=le}),ve||(ve=!0,L()),P&&clearTimeout(P),P=setTimeout(()=>{ve=!1,P=null},H))}function ne(){Q(b.value.map(I=>I.id))}function _(I){F(v.value,I),L()}function he(I,le=!1){if(le){p(I,!0);return}w.value=new Set(U(b.value,I))}function O(){b.value=W(b.value,w.value),L()}function z(){b.value=X(b.value,w.value),L()}function te(){w.value.size!==0&&(b.value=b.value.filter(I=>!w.value.has(I.id)),B(),L())}const{setup:pe,cleanup:ke}=E.useKeyboard({onMove:j,onDelete:te,onCopy:h,onPaste:M,onSelectAll:ne,onUndo:$,onRedo:G,onDuplicate:ee,onResetZoom:oe,onAlignLeft:()=>_("left"),onAlignRight:()=>_("right"),onAlignCenterH:()=>_("vertical"),onAlignTop:()=>_("top"),onAlignBottom:()=>_("bottom"),onGroup:O,onUngroup:z});let Ve=null;function De(){Ve=ge()}function _e(){if(!Ve)return;const I=new Map(Ve.elements.map(ye=>[ye.id,ye]));let le=!1;for(const ye of b.value){const Be=I.get(ye.id);if(!Be)continue;(Be.options.left!==ye.options.left||Be.options.top!==ye.options.top||Be.options.width!==ye.options.width||Be.options.height!==ye.options.height)&&E.finalizeElementZone(ye,d.value).rejected&&(le=!0)}le&&alert("该元素类型不能放入页眉/页脚");const re=ye=>`${ye.id}:${ye.zone||"content"}:${ye.options.left},${ye.options.top},${ye.options.width},${ye.options.height}`,Ne=x(Ve).map(re).join("|"),xe=x(ge()).map(re).join("|");Ve=null,Ne!==xe&&L()}function Ke(I,le){const re=E.zoneFromPaperPoint(d.value,le.x,le.y);if(re!=="content"&&!E.ZONE_ALLOWED_TYPES.includes(I.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const Ne=E.getZoneRects(d.value)[re];return I.zone=re,I.options.left=le.x-Ne.left,I.options.top=le.y-Ne.top,re!=="content"&&E.clampToZone(I,Ne),!0}function et(I,le){const re=E.createRuntimeElement(I);le&&!Ke(re,le)||(b.value.push(re),p(re.id,!1),L())}function tt(I,le){const re=E.createFieldElement(I);le&&!Ke(re,le)||(b.value.push(re),p(re.id,!1),L())}function ot(I){if(w.value.size===0)return;const le=w.value.values().next().value,re=b.value.find(Re=>Re.id===le);if(!re)return;const Ne=re.options.zIndex??0,xe=b.value.map(Re=>Re.options.zIndex??0),ye=Math.max(...xe,0),Be=Math.min(...xe,0);switch(I){case"top":re.options.zIndex=ye+1;break;case"bottom":re.options.zIndex=Be-1;break;case"up":re.options.zIndex=Ne+1;break;case"down":re.options.zIndex=Ne-1;break}L()}function nt(I,le){const{width:re,height:Ne}=E.getPaperDimensions(d.value),xe=96/25.4;r.value=E.computeFitScale(I,le,re*xe,Ne*xe)}function lt(I){if(d.value={...I},a.value[i.value]=d.value,a.value.length>1){const le={paperSize:I.paperSize,orientation:I.orientation,outputRotation:I.outputRotation,customWidth:I.customWidth,customHeight:I.customHeight};for(const re of a.value)Object.assign(re,le)}L()}function Ie(){return f(),a.value.length<=1?Vt(a.value[0]):{version:1,pages:a.value.map(Vt)}}function Ae(I,le){a.value=kt(I),i.value=0,d.value=a.value[0],le&&(d.value={...d.value,elements:le.map(re=>({...re,id:re.id||E.generateId(),zone:re.zone||"content",options:{...re.options},printElementType:{...re.printElementType}}))},a.value[i.value]=d.value),A(ge())}function ze(){const I=new Set(a.value.map(re=>re.name));let le=a.value.length+1;for(;I.has(`页面 ${le}`);)le++;return`页面 ${le}`}function Pe(){if(c())return;f();const I=a.value[i.value]??Ue(),le=Ze({...Ue(),paperSize:I.paperSize,orientation:I.orientation,customWidth:I.customWidth,customHeight:I.customHeight,name:ze()});a.value.push(le),i.value=a.value.length-1,d.value=le,me(),L()}function at(){if(c())return;f();const I=a.value[i.value],le=JSON.parse(JSON.stringify(I));le.name=`${I.name??`页面 ${i.value+1}`} 副本`,le.elements=le.elements.map(re=>({...re,id:E.generateId()})),le.firstPageOverlay={...le.firstPageOverlay,elements:(le.firstPageOverlay?.elements??[]).map(re=>({...re,id:E.generateId()}))},a.value.splice(i.value+1,0,le),g(i.value+1),L()}function it(I){a.value.length<=1||(f(),a.value.splice(I,1),I<i.value?i.value--:I===i.value&&i.value>=a.value.length&&(i.value=a.value.length-1),d.value=a.value[i.value],me(),L())}function qe(I,le){a.value[I]&&(a.value[I].name=le)}function rt(I,le){if(I===le)return;f();const[re]=a.value.splice(I,1);a.value.splice(le,0,re),i.value=le,d.value=re,me(),L()}return A(ge()),e.onMounted(()=>pe()),e.onUnmounted(()=>{ke(),P&&(clearTimeout(P),P=null)}),{scale:r,showRuler:o,showGrid:s,snapToGrid:n,showTableGhostBorder:l,templateData:d,elements:b,fields:R,tilingEnabled:m,pages:a,activePageIndex:i,switchPage:g,addPage:Pe,duplicatePage:at,deletePage:it,renamePage:qe,movePage:rt,selectedIds:w,selectedElements:v,selectedElement:Y,select:p,selectElement:he,clearSelection:B,selectAll:ne,previewIds:ae,setPreview:K,clearPreview:Z,commitPreview:y,hasClipboard:ie,copy:h,paste:M,cutSelected:C,tableSelection:Ee,setTableSelection:fe,canUndo:u,canRedo:S,undo:$,redo:G,recordHistory:L,alignSelected:_,groupSelected:O,ungroupSelected:z,deleteSelected:te,duplicateSelected:ee,resetZoom:oe,dragStart:De,dragStop:_e,addElement:et,addFieldElement:tt,moveLayer:ot,fitToWindow:nt,updateTemplateData:lt,getTemplateJson:Ie,loadTemplate:Ae}}const Se=Symbol("mixed"),pt=new Set(["text","longText"]);function _t(t){const{elements:r,selectedIds:o,tableSelection:s,recordHistory:n}=t,l=e.computed(()=>r.value.filter(N=>o.value.has(N.id)&&!N.options.locked)),a=e.computed(()=>{const N=s.value;return N?r.value.find(F=>F.id===N.elementId)??null:null}),i=e.computed(()=>s.value&&a.value?"cells":l.value.length>0||o.value.size>0?"elements":"none"),d=e.computed(()=>{const N=s.value,F=a.value?.options.tableRows;if(!N||!F)return[];const A=[];for(let V=N.r1;V<=N.r2;V++)for(let T=N.c1;T<=N.c2;T++){const u=F[V]?.cells[T];u&&!u.merged&&A.push(u)}return A}),m=e.computed(()=>l.value.filter(N=>pt.has(N.printElementType.type))),c=e.computed(()=>i.value==="cells"?d.value.length>0:i.value!=="elements"?!1:l.value.length>0&&m.value.length===l.value.length),f=e.computed(()=>i.value==="cells"?d.value:m.value.map(N=>N.options));function g(N){if(!N.length)return;const F=N[0];return N.every(A=>A===F)?F:Se}const b=(N,F)=>(N??"").split(/\s+/).includes(F),R=e.computed(()=>{const N=f.value;if(!N.length)return{fontFamily:void 0,fontSize:void 0,color:void 0,backgroundColor:void 0,textAlign:void 0,verticalAlign:void 0,bold:!1,underline:!1,strike:!1};const F=N.map(V=>V.fontWeight==="bold"||V.fontWeight==="bolder"),A=N.map(V=>V.textDecoration);return{fontFamily:g(N.map(V=>V.fontFamily)),fontSize:g(N.map(V=>V.fontSize)),color:g(N.map(V=>V.color)),backgroundColor:g(N.map(V=>V.backgroundColor)),textAlign:g(N.map(V=>i.value==="cells"?V.align:V.textAlign)),verticalAlign:g(N.map(V=>i.value==="cells"?V.valign:V.verticalAlign)),bold:F.every(Boolean)?!0:F.some(Boolean)?Se:!1,underline:A.map(V=>b(V,"underline")).every(Boolean)?!0:A.some(V=>b(V,"underline"))?Se:!1,strike:A.map(V=>b(V,"line-through")).every(Boolean)?!0:A.some(V=>b(V,"line-through"))?Se:!1}});function w(N){const F=d.value;F.length&&(F.forEach(N),n())}function v(N){if(i.value==="cells"){w(S=>{"fontFamily"in N&&(S.fontFamily=N.fontFamily),"fontSize"in N&&(S.fontSize=N.fontSize),"color"in N&&(S.color=N.color),"backgroundColor"in N&&(S.backgroundColor=N.backgroundColor),"textAlign"in N&&(S.align=N.textAlign),"verticalAlign"in N&&(S.valign=N.verticalAlign)});return}const F=m.value,A=l.value,T=["fontFamily","fontSize","color","textAlign","verticalAlign"].some(S=>S in N),u="backgroundColor"in N;!(F.length&&T)&&!(A.length&&u)||(F.forEach(S=>{const Y=S.options;"fontFamily"in N&&(Y.fontFamily=N.fontFamily),"fontSize"in N&&(Y.fontSize=N.fontSize),"color"in N&&(Y.color=N.color),"textAlign"in N&&(Y.textAlign=N.textAlign),"verticalAlign"in N&&(Y.verticalAlign=N.verticalAlign)}),u&&A.forEach(S=>{S.options.backgroundColor=N.backgroundColor}),n())}function p(){if(i.value==="cells"){const A=R.value.bold!==!0;w(V=>{V.fontWeight=A?"bold":void 0});return}const N=R.value.bold!==!0,F=m.value;F.length&&(F.forEach(A=>{A.options.fontWeight=N?"bold":"normal"}),n())}function B(N){if(i.value==="cells")return;const F=m.value;if(!F.length)return;const A=R.value[N==="underline"?"underline":"strike"]!==!0;F.forEach(V=>{const T=(V.options.textDecoration??"").split(/\s+/).filter(Boolean),u=T.indexOf(N);A&&u<0&&T.push(N),!A&&u>=0&&T.splice(u,1),V.options.textDecoration=T.length?T.join(" "):void 0}),n()}const Q=()=>B("underline"),ae=()=>B("line-through");function K(N,F){const A=l.value;A.length&&(A.forEach(V=>{V.options.borders=void 0,N==="none"?V.options.borderWidth=0:(V.options.borderWidth=F.width,V.options.borderStyle=F.style,V.options.borderColor=F.color)}),n())}function Z(N,F){const A=s.value,V=a.value?.options.tableRows;!A||!V||(E.applyBorderPreset(V,{r1:A.r1,c1:A.c1,r2:A.r2,c2:A.c2},N,F),n())}function y(N,F,A){w(V=>{const T={...V.borders??{}};for(const u of N)A?T[u]={...F}:delete T[u];V.borders=T})}const W=["top","right","bottom","left"],X=e.computed(()=>{if(i.value!=="cells")return null;const N=d.value;if(!N.length)return null;const F={};for(const A of W){const V=N.map(T=>!!T.borders?.[A]);F[A]=V.every(Boolean)?!0:V.some(Boolean)?Se:!1}return F});function U(N,F){const A=X.value?.[N]!==!0;y([N],F,A)}const k=e.computed(()=>{if(i.value!=="elements")return null;const N=l.value;if(!N.length)return null;const F={};for(const A of W){const V=N.map(T=>!!T.options.borders?.[A]);F[A]=V.every(Boolean)?!0:V.some(Boolean)?Se:!1}return F});function D(N,F){const A=l.value;if(!A.length)return;const V=k.value?.[N]!==!0;A.forEach(T=>{const u={...T.options.borders??{}};V?u[N]={width:F.width,style:F.style,color:F.color}:delete u[N],T.options.borders=u}),n()}return{context:i,fontEditable:c,values:R,applyStyle:v,toggleBold:p,toggleUnderline:Q,toggleStrike:ae,applyElementBorder:K,applyCellBorderPreset:Z,applyCellBorderEdges:y,cellEdges:X,toggleCellEdge:U,elementEdges:k,toggleElementEdge:D}}const eo=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];function to(t){const{elements:r,selectedIds:o,recordHistory:s}=t,n=e.ref(!1),l=e.ref(!1),a=e.ref(null);let i=null;const d=e.computed(()=>r.value.filter(w=>o.value.has(w.id)&&!w.options.locked)),m=e.computed(()=>d.value.length===1);function c(w){if(!w)return;const v={};for(const p of E.ELEMENT_BORDER_SIDES){const B=w[p];B&&(v[p]={...B})}return v}function f(w=!1){const v=d.value[0];if(!v)return!1;const p=v.options,B=v.printElementType.type;return i={text:pt.has(B)?Object.fromEntries(eo.map(Q=>[Q,p[Q]])):null,backgroundColor:p.backgroundColor,border:E.acceptsElementBorder(B)?{borderWidth:p.borderWidth,borderStyle:p.borderStyle,borderColor:p.borderColor,borders:c(p.borders)}:null},a.value=v.id,n.value=!0,l.value=w,!0}function g(){n.value=!1,l.value=!1,a.value=null,i=null}function b(w){const v=i;if(!v||w.options.locked||w.id===a.value)return!1;const p=w.options,B=w.printElementType.type;return v.text&&pt.has(B)&&Object.assign(p,v.text),p.backgroundColor=v.backgroundColor,v.border&&E.acceptsElementBorder(B)&&(p.borderWidth=v.border.borderWidth,p.borderStyle=v.border.borderStyle,p.borderColor=v.border.borderColor,p.borders=c(v.border.borders)),!0}e.watch(o,()=>{if(!n.value||!i)return;const w=d.value;if(!w.length){g();return}let v=!1;w.forEach(p=>{v=b(p)||v}),v&&(s(),l.value||g())});function R(w){if(w.key!=="Escape"||!n.value)return;const v=w.target?.tagName;v==="INPUT"||v==="TEXTAREA"||v==="SELECT"||g()}return document.addEventListener("keydown",R),e.onScopeDispose(()=>document.removeEventListener("keydown",R)),{active:n,locked:l,sourceId:a,capturable:m,capture:f,cancel:g}}let Nt=0;function oo(){return Nt+=1,`guide-${Nt}`}function no(t,r){const o=e.computed(()=>t.value.guides??[]);function s(d){t.value={...t.value,guides:d([...t.value.guides??[]])},r()}function n(d,m){s(c=>(c.push({type:d,position:m,id:oo()}),c))}function l(d,m){s(c=>c.map(f=>f.id===d?{...f,position:m}:f))}function a(d){s(m=>m.filter(c=>c.id!==d))}function i(){const d=[],m=[];for(const c of o.value)c.type==="vertical"?d.push(c.position):m.push(c.position);return{vertical:d,horizontal:m}}return{guides:o,addGuide:n,moveGuide:l,removeGuide:a,getGuidePositions:i}}const Ge=Symbol("table-edit"),vt=Symbol("print-upload-image"),ft=Symbol("print-upload-design-background"),gt=Symbol("print-font-catalog"),lo=e.computed(()=>[]);function ao(t){return{catalog:e.computed(()=>{const o=[],s=new Set;for(const n of e.toValue(t)??[]){const l=n?.family?.trim();if(!l)continue;const a=l.toLowerCase();if(s.has(a))continue;s.add(a);const i=n.label?.trim();o.push(i?{family:l,label:i}:{family:l})}return o})}}function io(){return e.inject(gt,lo)}function wt(t,r){const o=r?.trim().toLowerCase();if(o)return t.find(s=>s.family.trim().toLowerCase()===o)}function Ct(t){return t.label?`${t.label}(${t.family})`:t.family}function We(t){return t.toLowerCase().replace(/\s+/g,"")}function St(t,r){if(t===r)return 0;if(t.startsWith(r))return 1;if(t.includes(r))return 2;let o=0;for(const s of t)if(s===r[o]&&o++,o===r.length)return 3;return-1}function ro(t,r){const o=We(r.trim());return o?t.map((s,n)=>({font:s,index:n,rank:so(s,o)})).filter(s=>s.rank>=0).sort((s,n)=>s.rank-n.rank||s.index-n.index).map(s=>s.font):[...t]}function so(t,r){const o=St(We(t.family),r);if(!t.label)return o;const s=St(We(t.label),r);return o<0?s:s<0?o:Math.min(o,s)}const co="print-designer-font-face";function uo(t){const r=`${co}-${e.useId()}`;let o;e.watchEffect(()=>{const s=e.toValue(t);if(!s){o?.remove(),o=void 0;return}o||(o=document.createElement("style"),o.id=r,document.head.appendChild(o)),o.textContent=s}),e.onUnmounted(()=>{o?.remove(),o=void 0})}const mo=e.defineComponent({__name:"HelpButton",emits:["click"],setup(t){return(r,o)=>(e.openBlock(),e.createElementBlock("button",{class:"help-button",title:"帮助文档",onClick:o[0]||(o[0]=s=>r.$emit("click"))},[...o[1]||(o[1]=[e.createElementVNode("span",{class:"help-icon"},"?",-1)])]))}}),ce=(t,r)=>{const o=t.__vccOpts||t;for(const[s,n]of r)o[s]=n;return o},po=ce(mo,[["__scopeId","data-v-80ccab03"]]),vo=["disabled","data-test","data-tip"],fo=e.defineComponent({__name:"ToolbarDropdown",props:{disabled:{type:Boolean,default:!1},testId:{default:"dd-trigger"},tip:{},panelClass:{}},setup(t){const r=t,o=e.ref(!1),s=e.ref(null);function n(l){o.value&&(s.value?.contains(l.target)||(o.value=!1))}return e.watch(()=>r.disabled,l=>{l&&(o.value=!1)}),e.onMounted(()=>document.addEventListener("pointerdown",n)),e.onUnmounted(()=>document.removeEventListener("pointerdown",n)),(l,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapRef",ref:s,class:"tb-dd"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["tb-dd-trigger",{on:o.value}]),disabled:t.disabled,"data-test":t.testId,"data-tip":t.tip,onClick:a[0]||(a[0]=i=>o.value=!o.value)},[e.renderSlot(l.$slots,"trigger",{},void 0,!0),e.createVNode(e.unref(se.ChevronDown),{size:12,class:e.normalizeClass(["tb-dd-arrow",{up:o.value}])},null,8,["class"])],10,vo),o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["tb-dd-panel",t.panelClass])},[e.renderSlot(l.$slots,"default",{},void 0,!0)],2)):e.createCommentVNode("",!0)],512))}}),Je=ce(fo,[["__scopeId","data-v-74fd00c6"]]),go={class:"designer-toolbar"},ho={class:"tb-group"},bo={class:"tb-title"},Eo={class:"tb-title-name"},yo={class:"tb-group"},ko=["disabled"],Vo=["disabled"],No={class:"tb-group"},wo={class:"tb-menu","data-test":"arrange-panel"},Co={class:"tb-menu-grid"},So=["disabled"],xo=["disabled"],$o=["disabled"],Bo=["disabled"],Do=["disabled"],To=["disabled"],Mo=["disabled"],zo=["disabled"],Ao={class:"tb-menu-grid"},Po=["disabled"],Ro=["disabled"],Lo=["disabled"],Uo=["disabled"],Io={class:"tb-menu-grid"},Fo=["disabled"],Oo=["disabled"],Ho={class:"tb-menu tb-menu-rows","data-test":"view-panel"},Wo={class:"tb-group"},Go={class:"tb-zoom"},Ko={class:"tb-group"},qo=["disabled","data-tip"],Yo=["disabled","data-tip"],jo=["disabled","data-tip"],Xo={key:0,class:"tb-group"},Zo={class:"tb-group"},Jo=e.defineComponent({__name:"DesignerToolbar",props:e.mergeModels({isEdit:{type:Boolean},canUndo:{type:Boolean},canRedo:{type:Boolean},hasMultiSelection:{type:Boolean},hasSelection:{type:Boolean},showRuler:{type:Boolean,default:!0},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},selectedElementHasGroup:{type:Boolean},overlayVisible:{type:Boolean},showHelp:{type:Boolean,default:!0},clipboardDisabled:{type:Boolean,default:!0},hasClipboard:{type:Boolean,default:!1}},{scale:{default:100},scaleModifiers:{}}),emits:e.mergeModels(["preview","save","undo","redo","align","move-layer","toggle-ruler","toggle-grid","toggle-snap","toggle-table-ghost-border","toggle-overlay","group","ungroup","add-overlay-element","fit-window","zoom","help","copy","paste","delete"],["update:scale"]),setup(t){const r=e.useModel(t,"scale"),o=t,s=e.computed(()=>o.clipboardDisabled?"粘贴 (Ctrl+V),需选中元素":o.hasClipboard?"粘贴 (Ctrl+V)":"粘贴 (Ctrl+V),剪贴板为空");return(n,l)=>(e.openBlock(),e.createElementBlock("div",go,[e.createElementVNode("div",ho,[l[32]||(l[32]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-37d71dfb><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-37d71dfb><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-37d71dfb></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-37d71dfb></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-37d71dfb></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-37d71dfb></line></svg></span>',1)),e.createElementVNode("div",bo,[e.createElementVNode("span",Eo,e.toDisplayString(t.isEdit?"编辑模板":"新建模板"),1),l[31]||(l[31]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",yo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canUndo,onClick:l[0]||(l[0]=a=>n.$emit("undo")),"data-tip":"撤销"},[e.createVNode(e.unref(se.Undo2),{size:15})],8,ko),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canRedo,onClick:l[1]||(l[1]=a=>n.$emit("redo")),"data-tip":"重做"},[e.createVNode(e.unref(se.Redo2),{size:15})],8,Vo)]),e.renderSlot(n.$slots,"default",{},void 0,!0),e.createElementVNode("div",No,[e.createVNode(Je,{"test-id":"arrange-dd",tip:"排列"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(se.Layers),{size:15}),l[33]||(l[33]=e.createElementVNode("span",{class:"tb-btn-text"},"排列",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",wo,[l[34]||(l[34]=e.createElementVNode("div",{class:"tb-menu-label"},"对齐 / 分布",-1)),e.createElementVNode("div",Co,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[2]||(l[2]=a=>n.$emit("align","left")),"data-tip":"左对齐"},[e.createVNode(e.unref(se.AlignStartVertical),{size:15})],8,So),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[3]||(l[3]=a=>n.$emit("align","right")),"data-tip":"右对齐"},[e.createVNode(e.unref(se.AlignEndVertical),{size:15})],8,xo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[4]||(l[4]=a=>n.$emit("align","top")),"data-tip":"顶对齐"},[e.createVNode(e.unref(se.AlignStartHorizontal),{size:15})],8,$o),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[5]||(l[5]=a=>n.$emit("align","bottom")),"data-tip":"底对齐"},[e.createVNode(e.unref(se.AlignEndHorizontal),{size:15})],8,Bo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[6]||(l[6]=a=>n.$emit("align","vertical")),"data-tip":"水平居中"},[e.createVNode(e.unref(se.AlignCenterVertical),{size:15})],8,Do),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[7]||(l[7]=a=>n.$emit("align","horizontal")),"data-tip":"垂直居中"},[e.createVNode(e.unref(se.AlignCenterHorizontal),{size:15})],8,To),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[8]||(l[8]=a=>n.$emit("align","distributeHor")),"data-tip":"水平分布"},[e.createVNode(e.unref(se.AlignHorizontalSpaceBetween),{size:15})],8,Mo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[9]||(l[9]=a=>n.$emit("align","distributeVer")),"data-tip":"垂直分布"},[e.createVNode(e.unref(se.AlignVerticalSpaceBetween),{size:15})],8,zo)]),l[35]||(l[35]=e.createElementVNode("div",{class:"tb-menu-label"},"层级",-1)),e.createElementVNode("div",Ao,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:l[10]||(l[10]=a=>n.$emit("move-layer","top")),"data-tip":"置顶"},[e.createVNode(e.unref(se.ArrowUpToLine),{size:15})],8,Po),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:l[11]||(l[11]=a=>n.$emit("move-layer","up")),"data-tip":"上移一层"},[e.createVNode(e.unref(se.ArrowUp),{size:15})],8,Ro),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:l[12]||(l[12]=a=>n.$emit("move-layer","down")),"data-tip":"下移一层"},[e.createVNode(e.unref(se.ArrowDown),{size:15})],8,Lo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:l[13]||(l[13]=a=>n.$emit("move-layer","bottom")),"data-tip":"置底"},[e.createVNode(e.unref(se.ArrowDownToLine),{size:15})],8,Uo)]),l[36]||(l[36]=e.createElementVNode("div",{class:"tb-menu-label"},"组合",-1)),e.createElementVNode("div",Io,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:l[14]||(l[14]=a=>n.$emit("group")),"data-tip":"组合 (Ctrl+G)"},[e.createVNode(e.unref(se.Group),{size:15})],8,Fo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.selectedElementHasGroup,onClick:l[15]||(l[15]=a=>n.$emit("ungroup")),"data-tip":"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(se.Ungroup),{size:15})],8,Oo)])])]),_:1}),e.createVNode(Je,{"test-id":"view-dd",tip:"视图"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(se.Eye),{size:15}),l[37]||(l[37]=e.createElementVNode("span",{class:"tb-btn-text"},"视图",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Ho,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.showRuler}]),"data-tip":"显示/隐藏标尺",onClick:l[16]||(l[16]=a=>n.$emit("toggle-ruler"))},[...l[38]||(l[38]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 标尺 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.showGrid}]),"data-tip":"显示/隐藏网格背景",onClick:l[17]||(l[17]=a=>n.$emit("toggle-grid"))},[...l[39]||(l[39]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.showTableGhostBorder}]),"data-tip":"显示/隐藏无边框表格的虚拟虚线",onClick:l[18]||(l[18]=a=>n.$emit("toggle-table-ghost-border"))},[...l[40]||(l[40]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.snapToGrid}]),"data-tip":"开启/关闭元素吸附到网格",onClick:l[19]||(l[19]=a=>n.$emit("toggle-snap"))},[...l[41]||(l[41]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2),l[42]||(l[42]=e.createElementVNode("span",{class:"tb-menu-sep"},null,-1)),e.createElementVNode("button",{class:"tb-btn tb-menu-row","data-tip":"添加一个仅在首页叠加显示的页眉/页脚元素",onClick:l[20]||(l[20]=a=>n.$emit("add-overlay-element"))},"首页专属"),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{warn:t.overlayVisible}]),"data-tip":"叠加显示渲染截图,与设计稿对比效果",onClick:l[21]||(l[21]=a=>n.$emit("toggle-overlay"))},"叠层对比",2)])]),_:1})]),e.createElementVNode("div",Wo,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[22]||(l[22]=a=>n.$emit("fit-window")),"data-tip":"适应窗口"},[e.createVNode(e.unref(se.Maximize),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[23]||(l[23]=a=>n.$emit("zoom",-10)),"data-tip":"缩小"},[e.createVNode(e.unref(se.ZoomOut),{size:15})]),e.createElementVNode("span",Go,e.toDisplayString(r.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[24]||(l[24]=a=>n.$emit("zoom",10)),"data-tip":"放大"},[e.createVNode(e.unref(se.ZoomIn),{size:15})])]),e.createElementVNode("div",Ko,[e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"copy",disabled:t.clipboardDisabled,onClick:l[25]||(l[25]=a=>n.$emit("copy")),"data-tip":t.clipboardDisabled?"复制 (Ctrl+C),需选中元素":"复制 (Ctrl+C)"},[e.createVNode(e.unref(se.Copy),{size:15})],8,qo),e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"paste",disabled:t.clipboardDisabled||!t.hasClipboard,onClick:l[26]||(l[26]=a=>n.$emit("paste")),"data-tip":s.value},[e.createVNode(e.unref(se.ClipboardPaste),{size:15})],8,Yo),e.createElementVNode("button",{class:"tb-btn tb-icon danger","data-test":"delete",disabled:t.clipboardDisabled,onClick:l[27]||(l[27]=a=>n.$emit("delete")),"data-tip":t.clipboardDisabled?"删除 (Delete),需选中元素":"删除 (Delete)"},[e.createVNode(e.unref(se.Trash2),{size:15})],8,jo)]),l[43]||(l[43]=e.createElementVNode("div",{class:"tb-spacer"},null,-1)),t.showHelp?(e.openBlock(),e.createElementBlock("div",Xo,[e.createVNode(po,{onClick:l[28]||(l[28]=a=>n.$emit("help"))})])):e.createCommentVNode("",!0),e.createElementVNode("div",Zo,[e.createElementVNode("button",{class:"btn-secondary","data-tip":"预览模板打印效果",onClick:l[29]||(l[29]=a=>n.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary","data-tip":"保存模板",onClick:l[30]||(l[30]=a=>n.$emit("save"))},"保存")])]))}}),Qo=ce(Jo,[["__scopeId","data-v-37d71dfb"]]),_o={class:"font-select"},en=["placeholder","disabled","aria-expanded","aria-activedescendant","onKeydown"],tn=["id","aria-selected","onMousedown"],on=e.defineComponent({__name:"FontSelect",props:{modelValue:{},placeholder:{default:"默认"},disabled:{type:Boolean,default:!1}},emits:["update:model-value"],setup(t,{emit:r}){const o=t,s=r,n=io(),l=`font-select-list-${e.useId()}`,a=e.ref(null),i=e.ref(R(o.modelValue)),d=e.ref(""),m=e.ref(!1),c=e.ref(-1),f=e.computed(()=>{const X=o.modelValue?.trim();return X?wt(n.value,X)?"":X:""}),g=e.computed(()=>{const X=(o.modelValue??"").trim(),U=(N,F,A,V)=>({kind:N,key:F,label:A,value:V,selected:(V??"")===X}),k=d.value.trim();if(!k){const N=[U("clear","__clear__",o.placeholder)];f.value&&N.push(U("unknown","__unknown__",`${f.value}(未知)`,f.value));for(const F of n.value)N.push(U("font",F.family,Ct(F),F.family));return N}const D=ro(n.value,k).map(N=>U("font",N.family,Ct(N),N.family));if(!D.length){const N=b(k);D.push(U("free","__free__",`使用「${N}」`,N))}return D});function b(X){const U=We(X);return n.value.find(D=>D.label&&We(D.label)===U)?.family??X}function R(X){const U=X?.trim();return U?wt(n.value,U)?.label??U:""}const w=e.computed(()=>m.value&&c.value>=0?`${l}-${c.value}`:void 0);function v(){const X=(o.modelValue??"").trim();return g.value.findIndex(U=>(U.value??"")===X)}function p(){m.value||(m.value=!0,d.value="",c.value=v())}function B(){m.value=!0}function Q(){m.value=!0,d.value=i.value,c.value=g.value.length?0:-1}function ae(X){if(!m.value){p();return}const U=g.value.length-1;U<0||(c.value=Math.min(Math.max(c.value+X,0),U),K())}function K(){e.nextTick(()=>{a.value?.children[c.value]?.scrollIntoView?.({block:"nearest"})})}function Z(){if(!m.value)return;const X=g.value[c.value];if(X){y(X);return}const U=d.value.trim();if(U){const k=b(U);y({value:k})}}function y(X){i.value=R(X.value),d.value="",m.value=!1,c.value=-1,s("update:model-value",X.value)}function W(){m.value=!1,d.value="",c.value=-1,i.value=R(o.modelValue)}return e.watch(()=>o.modelValue,X=>{i.value=R(X)}),(X,U)=>(e.openBlock(),e.createElementBlock("div",_o,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":U[0]||(U[0]=k=>i.value=k),class:"pd-input font-select-input",type:"text",role:"combobox","aria-autocomplete":"list",autocomplete:"off",placeholder:t.placeholder,disabled:t.disabled,"aria-expanded":m.value,"aria-controls":l,"aria-activedescendant":w.value,onFocus:p,onClick:B,onInput:Q,onKeydown:[U[1]||(U[1]=e.withKeys(e.withModifiers(k=>ae(1),["prevent"]),["down"])),U[2]||(U[2]=e.withKeys(e.withModifiers(k=>ae(-1),["prevent"]),["up"])),e.withKeys(e.withModifiers(Z,["prevent"]),["enter"]),e.withKeys(e.withModifiers(W,["prevent"]),["esc"])],onBlur:W},null,40,en),[[e.vModelText,i.value]]),m.value?(e.openBlock(),e.createElementBlock("ul",{key:0,id:l,ref_key:"listRef",ref:a,class:"font-select-list",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(k,D)=>(e.openBlock(),e.createElementBlock("li",{id:`${l}-${D}`,key:k.key,class:e.normalizeClass(["font-select-option",{"is-active":D===c.value,"is-muted":k.kind==="unknown"||k.kind==="free"}]),role:"option","aria-selected":k.selected,onMousedown:e.withModifiers(N=>y(k),["prevent"])},e.toDisplayString(k.label),43,tn))),128))],512)):e.createCommentVNode("",!0)]))}}),ht=ce(on,[["__scopeId","data-v-f1aae453"]]),nn={class:"pd-stepper"},ln=["disabled"],an=["value","placeholder","min","max","step","disabled"],rn=["disabled"],sn=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=e.computed(()=>{const w=String(o.step),v=w.indexOf(".");return v===-1?0:w.length-v-1});function l(w){return Number.isFinite(w)?Number(w.toFixed(n.value)):0}const a=e.computed(()=>{const w=o.modelValue;if(!(w==null||!Number.isFinite(w)))return l(w)}),i=e.ref(a.value===void 0?"":String(a.value));e.watch(a,w=>{i.value=w===void 0?"":String(w)});const d=e.computed(()=>a.value!==void 0?a.value:o.min!==void 0?o.min:0),m=e.computed(()=>o.min!==void 0&&d.value<=o.min),c=e.computed(()=>o.max!==void 0&&d.value>=o.max);function f(w){let v=l(w);return o.min!==void 0&&v<o.min&&(v=o.min),o.max!==void 0&&v>o.max&&(v=o.max),v}function g(w){if(w<0&&m.value||w>0&&c.value)return;const v=f(d.value+w*o.step);i.value=String(v),s("update:modelValue",v)}function b(w){i.value=w.target.value}function R(){const w=i.value.trim();if(w===""){a.value!==void 0&&(i.value=String(a.value));return}const v=Number(w);if(!Number.isFinite(v)){i.value=a.value===void 0?"":String(a.value);return}const p=f(v);i.value=String(p),p!==a.value&&s("update:modelValue",p)}return(w,v)=>(e.openBlock(),e.createElementBlock("div",nn,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:m.value||t.disabled,title:"减小","aria-label":"减小",onClick:v[0]||(v[0]=p=>g(-1))},"−",8,ln),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:i.value,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,disabled:t.disabled,onInput:b,onChange:R,onBlur:R,onKeydown:v[1]||(v[1]=e.withKeys(e.withModifiers(p=>p.target.blur(),["prevent"]),["enter"]))},null,40,an),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:c.value||t.disabled,title:"增大","aria-label":"增大",onClick:v[2]||(v[2]=p=>g(1))},"+",8,rn)]))}}),de=ce(sn,[["__scopeId","data-v-627f09cb"]]),dn=["aria-expanded","title"],cn={class:"picker-preview"},un={class:"picker-heading"},mn=["disabled"],pn={class:"preset-color-grid"},vn=["title","aria-label","onClick"],fn=e.defineComponent({__name:"PresetColorPicker",props:{modelValue:{},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(!1),l=e.ref(),a=e.ref(),i=e.ref(),d=e.ref({}),m=e.ref(0),c=e.ref(0),f=e.ref(0),g=e.ref("#000000"),b=e.ref(!1),R=e.computed(()=>o.modelValue||"#000000"),w=e.computed(()=>o.modelValue?{background:o.modelValue}:{background:"transparent"}),v=e.computed(()=>Y(fe(m.value,c.value,f.value))),p=e.computed({get:()=>Math.round(m.value),set:L=>Z(me(L),c.value,f.value)});e.watch(()=>o.modelValue,L=>{if(!L){g.value="";return}K(L)},{immediate:!0});function B(L){g.value=L.toUpperCase(),K(L),s("update:modelValue",L)}function Q(){o.clearable&&s("update:modelValue","")}function ae(L){const $=L.target.value.trim();if(!$){o.clearable&&s("update:modelValue","");return}u($)&&(K($),s("update:modelValue",S($)))}function K(L){const x=u(L);if(!x)return;const $=Ee(x.r,x.g,x.b);m.value=$.h,c.value=$.s,f.value=$.v,g.value=S(L).toUpperCase()}function Z(L,x,$){m.value=me(L),c.value=ge(x),f.value=ge($),g.value=v.value.toUpperCase(),s("update:modelValue",v.value)}function y(L){L.currentTarget.setPointerCapture(L.pointerId),b.value=!0,U(L)}function W(L){b.value&&U(L)}function X(L){b.value=!1;const x=L.currentTarget;x.hasPointerCapture(L.pointerId)&&x.releasePointerCapture(L.pointerId)}function U(L){const x=i.value;if(!x)return;const $=x.getBoundingClientRect(),G=ge((L.clientX-$.left)/$.width),h=ge(1-(L.clientY-$.top)/$.height);Z(m.value,G,h)}function k(L){const x=L.shiftKey?.1:.02;let $=!0;L.key==="ArrowLeft"?Z(m.value,c.value-x,f.value):L.key==="ArrowRight"?Z(m.value,c.value+x,f.value):L.key==="ArrowUp"?Z(m.value,c.value,f.value+x):L.key==="ArrowDown"?Z(m.value,c.value,f.value-x):$=!1,$&&L.preventDefault()}function D(){n.value?F():N()}async function N(){const L=l.value;if(!L)return;o.modelValue&&K(R.value),n.value=!0,await e.nextTick();const x=L.getBoundingClientRect(),$=190,G=a.value?.offsetHeight??216,h=8,C=Math.min(x.left,window.innerWidth-$-h),M=x.bottom+6,ee=M+G>window.innerHeight-h?Math.max(h,x.top-G-6):M;d.value={left:`${Math.max(h,C)}px`,top:`${ee}px`}}function F(){n.value=!1}function A(L){const x=L.target;l.value?.contains(x)||a.value?.contains(x)||F()}function V(){n.value&&F()}function T(L){L.key==="Escape"&&n.value&&F()}function u(L){const x=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(L.trim());if(!x)return null;const $=x[1],G=$.length===3?$.split("").map(h=>h+h).join(""):$;return{r:Number.parseInt(G.slice(0,2),16),g:Number.parseInt(G.slice(2,4),16),b:Number.parseInt(G.slice(4,6),16)}}function S(L){const x=u(L);return x?Y(x):"#000000"}function Y({r:L,g:x,b:$}){return`#${[L,x,$].map(G=>Math.round(ge(G/255)*255).toString(16).padStart(2,"0")).join("")}`}function Ee(L,x,$){const G=L/255,h=x/255,C=$/255,M=Math.max(G,h,C),ee=Math.min(G,h,C),oe=M-ee;let ie=0;return oe!==0&&(M===G?ie=(h-C)/oe%6:M===h?ie=(C-G)/oe+2:ie=(G-h)/oe+4,ie*=60,ie<0&&(ie+=360)),{h:ie,s:M===0?0:oe/M,v:M}}function fe(L,x,$){const G=$*x,h=(L%360+360)%360/60,C=G*(1-Math.abs(h%2-1)),[M,ee,oe]=h<1?[G,C,0]:h<2?[C,G,0]:h<3?[0,G,C]:h<4?[0,C,G]:h<5?[C,0,G]:[G,0,C],ie=$-G;return{r:(M+ie)*255,g:(ee+ie)*255,b:(oe+ie)*255}}function me(L){return((Number.isFinite(L)?L:0)%360+360)%360}function ge(L){return Math.min(1,Math.max(0,Number.isFinite(L)?L:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",A,!0),window.addEventListener("scroll",V,!0),window.addEventListener("resize",V),document.addEventListener("keydown",T)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",A,!0),window.removeEventListener("scroll",V,!0),window.removeEventListener("resize",V),document.removeEventListener("keydown",T)}),(L,x)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{ref_key:"triggerRef",ref:l,type:"button",class:"preset-color-trigger","aria-expanded":n.value,"aria-haspopup":"dialog",title:t.modelValue||"自动",onClick:D},[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle(w.value)},null,4)],8,dn),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:a,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(d.value),onPointerdown:x[2]||(x[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",cn,[e.createElementVNode("span",{class:e.normalizeClass(["picker-current",{"is-empty":!t.modelValue}]),style:e.normalizeStyle(t.modelValue?{background:v.value}:void 0)},null,6),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":x[0]||(x[0]=$=>g.value=$),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:ae},null,544),[[e.vModelText,g.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:i,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(m.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:y,onPointermove:W,onPointerup:X,onPointercancel:X,onKeydown:k},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${c.value*100}%`,top:`${(1-f.value)*100}%`,background:v.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":x[1]||(x[1]=$=>p.value=$),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,p.value,void 0,{number:!0}]]),e.createElementVNode("div",un,[x[4]||(x[4]=e.createElementVNode("span",null,"常用颜色",-1)),t.clearable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"picker-clear",disabled:!t.modelValue,title:"清除选中的颜色",onClick:Q},[...x[3]||(x[3]=[e.createElementVNode("svg",{viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":"true"},[e.createElementVNode("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",fill:"none"})],-1),e.createTextVNode(" 清除 ",-1)])],8,mn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E.PRESET_COLORS),$=>(e.openBlock(),e.createElementBlock("button",{key:$,type:"button",class:e.normalizeClass(["preset-color-item",{active:!!t.modelValue&&$.toLowerCase()===t.modelValue.toLowerCase()}]),style:e.normalizeStyle({background:$}),title:$,"aria-label":$,onClick:G=>B($)},null,14,vn))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),Ce=ce(fn,[["__scopeId","data-v-12290e7e"]]),gn={class:"format-toolbar"},hn={class:"ft-group"},bn=["disabled","data-tip"],En={class:"ft-group"},yn={class:"ft-font"},kn={class:"ft-size","data-test":"font-size"},Vn={class:"ft-group"},Nn=["disabled","data-tip"],wn=["disabled","data-tip"],Cn=["disabled","data-tip"],Sn={class:"ft-group"},xn=["title"],$n={class:"ft-glyph"},Bn={class:"ft-group"},Dn={class:"ft-align-panel","data-test":"align-panel"},Tn={class:"ft-align-row"},Mn={class:"ft-align-row"},zn={class:"ft-group"},An={class:"ft-border-panel","data-test":"border-panel"},Pn={class:"ft-border-grid"},Rn=["disabled","data-tip"],Ln={class:"ft-style-row"},Un=["data-test","data-tip","onClick"],In={class:"ft-border-style-row"},Fn={class:"ft-line-width"},On={class:"ft-border-style-row"},Hn=e.defineComponent({__name:"FormatToolbar",props:{format:{},painter:{}},setup(t){const r=t,o=e.computed(()=>r.format.values.value),s=e.computed(()=>!r.format.fontEditable.value),n=e.computed(()=>s.value||r.format.context.value==="cells"),l=e.computed(()=>r.format.context.value==="none"),a=e.computed(()=>r.painter?.active.value===!0),i=e.computed(()=>!r.painter||!a.value&&(r.format.context.value==="none"||r.format.context.value==="cells"||!r.painter.capturable.value)),d=e.computed(()=>a.value?"退出格式刷(Esc)":r.painter?r.format.context.value==="cells"?"格式刷(表格单元格暂不支持)":r.format.context.value==="none"?"格式刷(需选中元素)":r.painter.capturable.value?"格式刷:单击刷一次,双击连续刷":"格式刷(请仅选中一个源元素)":"格式刷");function m(){const A=r.painter;if(A){if(A.active.value){A.cancel();return}A.capture(!1)}}function c(){r.painter?.capture(!0)}const f=e.computed(()=>o.value.fontFamily===Se?void 0:o.value.fontFamily),g=e.computed(()=>o.value.fontFamily===Se?"混合":"默认"),b=e.computed(()=>o.value.fontSize===Se?void 0:o.value.fontSize),R=e.computed(()=>o.value.fontSize===Se?"混合":"默认"),w=e.computed(()=>o.value.bold===!0),v=e.computed(()=>o.value.color===Se?void 0:o.value.color),p=e.computed(()=>o.value.backgroundColor===Se?void 0:o.value.backgroundColor),B=e.computed(()=>o.value.textAlign==="center"?se.TextAlignCenter:o.value.textAlign==="right"?se.TextAlignEnd:se.TextAlignStart),Q=e.computed(()=>s.value?"对齐(需选中文本元素或单元格)":"对齐"),ae=e.computed(()=>l.value?"边框(需选中元素)":"边框");function K(A){return s.value?`${A}(需选中文本元素)`:r.format.context.value==="cells"?`${A}(单元格不支持)`:A}const Z=e.ref("solid"),y=e.ref(.75),W=e.ref("#333333"),X=e.computed(()=>r.format.context.value==="cells"),U=[{key:"solid",label:"实线",preview:"2px solid currentColor"},{key:"dashed",label:"虚线",preview:"2px dashed currentColor"},{key:"dotted",label:"点线",preview:"2px dotted currentColor"},{key:"double",label:"双线",preview:"3px double currentColor"}];function k(){return{width:y.value,style:Z.value,color:W.value}}function D(A){X.value?r.format.applyCellBorderPreset(A,k()):r.format.applyElementBorder(A==="none"?"none":"all",k())}function N(A){return(X.value?r.format.cellEdges.value:r.format.elementEdges.value)?.[A]===!0}function F(A){X.value?r.format.toggleCellEdge(A,k()):r.format.toggleElementEdge(A,k())}return(A,V)=>(e.openBlock(),e.createElementBlock("div",gn,[e.createElementVNode("div",hn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:a.value}]),"data-test":"format-painter",disabled:i.value,"data-tip":d.value,onClick:m,onDblclick:c},[e.createVNode(e.unref(se.Paintbrush),{size:15})],42,bn)]),e.createElementVNode("div",En,[e.createElementVNode("div",yn,[e.createVNode(ht,{"model-value":f.value,placeholder:g.value,disabled:s.value,"onUpdate:modelValue":V[0]||(V[0]=T=>t.format.applyStyle({fontFamily:T}))},null,8,["model-value","placeholder","disabled"])]),e.createElementVNode("div",kn,[e.createVNode(de,{"model-value":b.value,min:5,max:72,placeholder:R.value,disabled:s.value,"onUpdate:modelValue":V[1]||(V[1]=T=>t.format.applyStyle({fontSize:T}))},null,8,["model-value","placeholder","disabled"])])]),e.createElementVNode("div",Vn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:w.value}]),"data-test":"bold",disabled:s.value,"data-tip":s.value?"加粗(需选中文本元素或单元格)":"加粗",onClick:V[2]||(V[2]=T=>t.format.toggleBold())},[e.createVNode(e.unref(se.Bold),{size:15})],10,Nn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:o.value.underline===!0}]),"data-test":"underline",disabled:n.value,"data-tip":K("下划线"),onClick:V[3]||(V[3]=T=>t.format.toggleUnderline())},[e.createVNode(e.unref(se.Underline),{size:15})],10,wn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:o.value.strike===!0}]),"data-test":"strike",disabled:n.value,"data-tip":K("删除线"),onClick:V[4]||(V[4]=T=>t.format.toggleStrike())},[e.createVNode(e.unref(se.Strikethrough),{size:15})],10,Cn)]),e.createElementVNode("div",Sn,[e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:s.value}]),title:`字体颜色${s.value?"(需选中或混选文本元素)":""}`},[e.createVNode(Ce,{"model-value":v.value,"onUpdate:modelValue":V[5]||(V[5]=T=>t.format.applyStyle({color:T}))},null,8,["model-value"]),V[23]||(V[23]=e.createElementVNode("span",{class:"ft-glyph"},"A",-1))],10,xn),e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:l.value}]),title:"背景色"},[e.createVNode(Ce,{"model-value":p.value,"onUpdate:modelValue":V[6]||(V[6]=T=>t.format.applyStyle({backgroundColor:T}))},null,8,["model-value"]),e.createElementVNode("span",$n,[e.createVNode(e.unref(se.PaintBucket),{size:14})])],2)]),e.createElementVNode("div",Bn,[e.createVNode(Je,{"test-id":"align-dd",tip:Q.value,disabled:s.value},{trigger:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(B.value),{size:15})),V[24]||(V[24]=e.createElementVNode("span",{class:"ft-btn-text"},"对齐",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Dn,[e.createElementVNode("div",Tn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.textAlign==="left"}]),"data-test":"align-left","data-tip":"左对齐",onClick:V[7]||(V[7]=T=>t.format.applyStyle({textAlign:"left"}))},[e.createVNode(e.unref(se.TextAlignStart),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.textAlign==="center"}]),"data-test":"align-center","data-tip":"水平居中",onClick:V[8]||(V[8]=T=>t.format.applyStyle({textAlign:"center"}))},[e.createVNode(e.unref(se.TextAlignCenter),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.textAlign==="right"}]),"data-test":"align-right","data-tip":"右对齐",onClick:V[9]||(V[9]=T=>t.format.applyStyle({textAlign:"right"}))},[e.createVNode(e.unref(se.TextAlignEnd),{size:15})],2)]),e.createElementVNode("div",Mn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.verticalAlign==="top"}]),"data-test":"valign-top","data-tip":"顶端对齐",onClick:V[10]||(V[10]=T=>t.format.applyStyle({verticalAlign:"top"}))},[e.createVNode(e.unref(se.ArrowUpToLine),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.verticalAlign==="middle"}]),"data-test":"valign-middle","data-tip":"垂直居中",onClick:V[11]||(V[11]=T=>t.format.applyStyle({verticalAlign:"middle"}))},[e.createVNode(e.unref(se.ChevronsUpDown),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:o.value.verticalAlign==="bottom"}]),"data-test":"valign-bottom","data-tip":"底端对齐",onClick:V[12]||(V[12]=T=>t.format.applyStyle({verticalAlign:"bottom"}))},[e.createVNode(e.unref(se.ArrowDownToLine),{size:15})],2)])])]),_:1},8,["tip","disabled"])]),e.createElementVNode("div",zn,[e.createVNode(Je,{"test-id":"border",tip:ae.value,disabled:l.value},{trigger:e.withCtx(()=>[e.createVNode(e.unref(se.Grid3x3),{size:15}),V[25]||(V[25]=e.createElementVNode("span",{class:"ft-btn-text"},"边框",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",An,[e.createElementVNode("div",Pn,[e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-none","data-tip":"无边框",onClick:V[13]||(V[13]=T=>D("none"))},[...V[26]||(V[26]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"4",y1:"14",x2:"14",y2:"4"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-all","data-tip":"所有边框",onClick:V[14]||(V[14]=T=>D("all"))},[...V[27]||(V[27]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-outer","data-tip":"外侧边框",onClick:V[15]||(V[15]=T=>D("outer"))},[...V[28]||(V[28]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-inner",disabled:!X.value,"data-tip":X.value?"内部边框":"内部边框(仅表格单元格可用)",onClick:V[16]||(V[16]=T=>D("inner"))},[...V[29]||(V[29]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])],8,Rn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("top")}]),"data-test":"edge-top","data-tip":"上边框",onClick:V[17]||(V[17]=T=>F("top"))},[...V[30]||(V[30]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"3",x2:"16",y2:"3"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("bottom")}]),"data-test":"edge-bottom","data-tip":"下边框",onClick:V[18]||(V[18]=T=>F("bottom"))},[...V[31]||(V[31]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"15",x2:"16",y2:"15"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("left")}]),"data-test":"edge-left","data-tip":"左边框",onClick:V[19]||(V[19]=T=>F("left"))},[...V[32]||(V[32]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"2",x2:"3",y2:"16"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("right")}]),"data-test":"edge-right","data-tip":"右边框",onClick:V[20]||(V[20]=T=>F("right"))},[...V[33]||(V[33]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"15",y1:"2",x2:"15",y2:"16"})],-1)])],2)]),e.createElementVNode("div",Ln,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(U,T=>e.createElementVNode("button",{key:T.key,type:"button",class:e.normalizeClass(["ft-style-btn",{on:Z.value===T.key}]),"data-test":`style-${T.key}`,"data-tip":T.label,onClick:u=>Z.value=T.key},[e.createElementVNode("span",{class:"ft-style-line",style:e.normalizeStyle({borderTop:T.preview})},null,4)],10,Un)),64))]),e.createElementVNode("div",In,[V[34]||(V[34]=e.createElementVNode("span",{class:"ft-edge-label"},"粗细",-1)),e.createElementVNode("div",Fn,[e.createVNode(de,{modelValue:y.value,"onUpdate:modelValue":V[21]||(V[21]=T=>y.value=T),min:.25,max:5,step:.25},null,8,["modelValue"])])]),e.createElementVNode("div",On,[V[35]||(V[35]=e.createElementVNode("span",{class:"ft-edge-label"},"颜色",-1)),e.createVNode(Ce,{modelValue:W.value,"onUpdate:modelValue":V[22]||(V[22]=T=>W.value=T),clearable:!1},null,8,["modelValue"])])])]),_:1},8,["tip","disabled"])])]))}}),Wn=ce(Hn,[["__scopeId","data-v-83fd8dc4"]]),Gn={class:"layer-panel"},Kn=["onClick"],qn={class:"layer-icon"},Yn={class:"layer-name"},jn={key:0,class:"layer-zone"},Xn={class:"layer-zindex"},Zn={key:0,class:"layer-actions"},Jn={key:1,class:"layer-actions"},Qn=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer","group","ungroup"],setup(t){const r=t,o=e.computed(()=>r.elements.filter(c=>r.selectedIds.has(c.id))),s=e.computed(()=>o.value.length>=2),n=e.computed(()=>o.value.some(c=>!!c.options.groupId)),l=e.computed(()=>[...r.elements].sort((c,f)=>(f.options.zIndex??0)-(c.options.zIndex??0))),a={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function i(c){return a[c.printElementType.type]||"?"}function d(c){return c.options.title||c.printElementType.title||c.printElementType.type}function m(c){return c.zone==="header"?"页眉":c.zone==="footer"?"页脚":""}return(c,f)=>(e.openBlock(),e.createElementBlock("div",Gn,[f[6]||(f[6]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:e.normalizeClass(["layer-item",{active:t.selectedIds.has(g.id)}]),onClick:b=>c.$emit("select",g.id,b.ctrlKey||b.metaKey)},[e.createElementVNode("span",qn,e.toDisplayString(i(g)),1),e.createElementVNode("span",Yn,e.toDisplayString(d(g)),1),m(g)?(e.openBlock(),e.createElementBlock("span",jn,e.toDisplayString(m(g)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Xn,"z:"+e.toDisplayString(g.options.zIndex??0),1)],10,Kn))),128)),l.value.length>0?(e.openBlock(),e.createElementBlock("div",Zn,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[0]||(f[0]=g=>c.$emit("move-layer","top")),title:"置顶"},[e.createVNode(e.unref(se.ArrowUpToLine),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[1]||(f[1]=g=>c.$emit("move-layer","up")),title:"上移"},[e.createVNode(e.unref(se.ArrowUp),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[2]||(f[2]=g=>c.$emit("move-layer","down")),title:"下移"},[e.createVNode(e.unref(se.ArrowDown),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[3]||(f[3]=g=>c.$emit("move-layer","bottom")),title:"置底"},[e.createVNode(e.unref(se.ArrowDownToLine),{size:14})])])):e.createCommentVNode("",!0),s.value||n.value?(e.openBlock(),e.createElementBlock("div",Jn,[s.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"pd-button small",onClick:f[4]||(f[4]=g=>c.$emit("group")),title:"组合 (Ctrl+G)"},[e.createVNode(e.unref(se.Group),{size:14})])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"pd-button small",onClick:f[5]||(f[5]=g=>c.$emit("ungroup")),title:"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(se.Ungroup),{size:14})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),_n=ce(Qn,[["__scopeId","data-v-567d273e"]]),el={class:"field-tree-panel"},tl={class:"tree-container"},ol=["onClick"],nl={class:"expand-icon"},ll={class:"node-icon"},al={class:"group-label"},il=["onDragstart"],rl={class:"node-label"},sl={class:"node-key"},dl={key:0,class:"pd-empty"},cl=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(""),l=e.ref(new Set),a=e.computed(()=>!!n.value.trim()),i=e.computed(()=>E.filterGroups(E.groupFields(o.fields),n.value));function d(c){const f=new Set(l.value);f.has(c)?f.delete(c):f.add(c),l.value=f}function m(c,f){c.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:f.fieldKey,fieldLabel:f.fieldLabel})),c.dataTransfer&&(c.dataTransfer.effectAllowed="copy"),s("field-drag",f)}return(c,f)=>(e.openBlock(),e.createElementBlock("div",el,[f[2]||(f[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=g=>n.value=g),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,n.value]]),e.createElementVNode("div",tl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.key||"_top"},[g.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["field-group-header",{"is-list":g.isList}]),onClick:b=>d(g.key)},[e.createElementVNode("span",nl,e.toDisplayString(l.value.has(g.key)&&!a.value?"▶":"▼"),1),e.createElementVNode("span",ll,e.toDisplayString(g.isList?"📋":"📁"),1),e.createElementVNode("span",al,e.toDisplayString(g.label),1)],10,ol)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.fields,b=>(e.openBlock(),e.createElementBlock("div",{key:b.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(g.key?22:8)+"px"}),onDragstart:R=>m(R,b)},[f[1]||(f[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",rl,e.toDisplayString(b.fieldLabel),1),e.createElementVNode("span",sl,"("+e.toDisplayString(b.fieldKey)+")",1)],44,il))),128))],512),[[e.vShow,!g.key||a.value||!l.value.has(g.key)]])],64))),128))]),i.value.length===0?(e.openBlock(),e.createElementBlock("p",dl,"暂无字段")):e.createCommentVNode("",!0)]))}}),ul=ce(cl,[["__scopeId","data-v-9b326f07"]]),ml={key:0,class:"left-collapsed"},pl={class:"left-head"},vl={class:"pd-tabs left-tabs"},fl={class:"pd-tab-bar",role:"tablist"},gl={class:"pd-tab-pane",role:"tabpanel"},hl=["onDragstart"],bl={class:"material-icon"},El={class:"material-label"},yl={class:"pd-tab-pane",role:"tabpanel"},kl={class:"pd-tab-pane",role:"tabpanel"},Vl=e.defineComponent({__name:"LeftPanel",props:{fields:{},elements:{},selectedIds:{},collapsed:{type:Boolean}},emits:["select","move-layer","group","ungroup","toggle-visible","toggle-locked","field-drag","toggle-collapse"],setup(t,{emit:r}){const o=r,s=e.ref("elements"),n=[{type:"text",label:"文本",icon:"T"},{type:"barcode",label:"条形码",icon:"▍▍"},{type:"qrcode",label:"二维码",icon:"▦"},{type:"image",label:"图片",icon:"▧"},{type:"table",label:"表格",icon:"⊞"},{type:"longText",label:"长文",icon:"¶"},{type:"hline",label:"横线",icon:"―"},{type:"vline",label:"竖线",icon:"│"},{type:"rect",label:"矩形",icon:"▭"},{type:"oval",label:"椭圆",icon:"◯"},{type:"html",label:"HTML",icon:"<>"}];function l(d,m){d.dataTransfer?.setData("elementType",m)}function a(d){o("field-drag",d)}function i(d){s.value=d,o("toggle-collapse")}return(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",ml,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:m[0]||(m[0]=c=>i(s.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="elements"}]),title:"元素",onClick:m[1]||(m[1]=c=>i("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="fields"}]),title:"字段",onClick:m[2]||(m[2]=c=>i("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="layers"}]),title:"图层",onClick:m[3]||(m[3]=c=>i("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",pl,[m[14]||(m[14]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:m[4]||(m[4]=c=>d.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",vl,[e.createElementVNode("div",fl,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="elements"}]),onClick:m[5]||(m[5]=c=>s.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="fields"}]),onClick:m[6]||(m[6]=c=>s.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="layers"}]),onClick:m[7]||(m[7]=c=>s.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",gl,[m[15]||(m[15]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(n,c=>e.createElementVNode("div",{key:c.type,class:"material-card",draggable:"true",onDragstart:f=>l(f,c.type)},[e.createElementVNode("span",bl,e.toDisplayString(c.icon),1),e.createElementVNode("span",El,e.toDisplayString(c.label),1)],40,hl)),64))],512),[[e.vShow,s.value==="elements"]]),e.withDirectives(e.createElementVNode("div",yl,[e.createVNode(ul,{fields:t.fields,onFieldDrag:a},null,8,["fields"])],512),[[e.vShow,s.value==="fields"]]),e.withDirectives(e.createElementVNode("div",kl,[e.createVNode(_n,{elements:t.elements,"selected-ids":t.selectedIds,onSelect:m[8]||(m[8]=(c,f)=>d.$emit("select",c,f)),onMoveLayer:m[9]||(m[9]=c=>d.$emit("move-layer",c)),onGroup:m[10]||(m[10]=c=>d.$emit("group")),onUngroup:m[11]||(m[11]=c=>d.$emit("ungroup")),onToggleVisible:m[12]||(m[12]=c=>d.$emit("toggle-visible",c)),onToggleLocked:m[13]||(m[13]=c=>d.$emit("toggle-locked",c))},null,8,["elements","selected-ids"])],512),[[e.vShow,s.value==="layers"]])])],64))],2))}}),Nl=ce(Vl,[["__scopeId","data-v-4501eea7"]]);function wl(t,r){const o=e.ref(!1),s=e.ref(null);let n=0,l=0,a=0,i=0,d=!1;function m(w){if(r.disabled||w.button!==0)return;const v=w.target;if(!(v instanceof Element)||v.classList.contains("resize-handle"))return;o.value=!0,d=w.altKey,n=w.clientX,l=w.clientY;const p=t.value;p&&(a=parseFloat(p.style.left)||0,i=parseFloat(p.style.top)||0,s.value={left:a,top:i,width:parseFloat(p.style.width)||0,height:parseFloat(p.style.height)||0},r.onStart?.({altKey:d}),document.addEventListener("mousemove",f),document.addEventListener("mouseup",g),w.preventDefault())}function c(w){const v=r.getScale?.()??1;let p=a+(w.clientX-n)/v,B=i+(w.clientY-l)/v;if(r.axis==="x"&&(B=i),r.axis==="y"&&(p=a),r.onAdsorb){const Q=t.value;if(Q){const ae=parseFloat(Q.style.width)||0,K=parseFloat(Q.style.height)||0,Z=r.onAdsorb({left:p,top:B,width:ae,height:K});p=Z.left,B=Z.top}}return{left:p,top:B}}function f(w){const v=c(w);s.value&&(s.value.left=v.left,s.value.top=v.top),r.onDrag(v)}function g(w){o.value=!1;const v=c(w);r.onDragEnd?.(v,{altKey:d}),r.onStop?.(),s.value=null,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function b(){const w=t.value;w&&w.removeEventListener("mousedown",m),document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function R(){b();const w=t.value;w&&w.addEventListener("mousedown",m)}return{isDragging:o,dragPreview:s,setup:R,cleanup:b}}function Cl(t){const r=[];return t.getAttribute("data-fit")==="shrink"&&r.push(t),t.querySelectorAll('[data-fit="shrink"]').forEach(o=>r.push(o)),r}function Sl(t){t.querySelectorAll("[data-fit-size]").forEach(r=>{if(r.getAttribute("data-fit")==="shrink")return;r.removeAttribute("data-fit-size");const o=r.getAttribute("data-fit-base");o?r.style.fontSize=`${o}pt`:r.style.removeProperty("font-size")})}function bt(t,r){const o=()=>{const s=t.value;s&&(Cl(s).forEach(He.fitTextNode),Sl(s))};e.watchEffect(()=>{r(),e.nextTick(o)},{flush:"post"}),e.onMounted(()=>{e.nextTick(o)})}const xl=["data-fit","data-fit-base","data-fit-min"],$l=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o={top:"flex-start",middle:"center",bottom:"flex-end"},s={left:"flex-start",center:"center",right:"flex-end"},n=e.ref(null),l=e.computed(()=>E.resolveElementTextFit("text",r.element.options)),a=e.computed(()=>r.element.options.fontSize||12),i=e.computed(()=>E.resolveShrinkMinFontSize(r.element.options.shrinkMinFontSize)),d=e.computed(()=>{const c=r.element.options,f=l.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:c.fontWeight||"normal",fontFamily:c.fontFamily||"inherit",color:c.color||"#333",backgroundColor:c.backgroundColor||"transparent",textAlign:c.textAlign||"left",lineHeight:c.lineHeight?c.lineHeight+"pt":"normal",letterSpacing:c.letterSpacing?c.letterSpacing+"pt":"normal",textDecoration:c.textDecoration||"none",padding:`${c.contentPaddingTop||0}pt ${c.contentPaddingRight||0}pt ${c.contentPaddingBottom||0}pt ${c.contentPaddingLeft||0}pt`,width:"100%",height:f?"auto":"100%",boxSizing:"border-box",overflow:f?"visible":"hidden",...c.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...c.verticalAlign?{display:"flex",alignItems:o[c.verticalAlign]??"flex-start",justifyContent:s[c.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>r.designMode?r.element.options.testData?r.element.options.testData:r.element.options.formatter||"文本":E.resolveTextBinding(r.element.options,r.data));return bt(n,()=>[l.value,a.value,i.value,r.element.options.width,r.element.options.height,r.element.options.wordWrap,r.element.options.letterSpacing,r.element.options.lineHeight,m.value]),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"print-text",style:e.normalizeStyle(d.value),"data-fit":l.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(i.value)},e.toDisplayString(m.value),13,xl))}}),Bl={class:"print-image"},Dl=["src"],Tl={key:1,class:"image-placeholder"},Ml=e.defineComponent({__name:"ImageElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.computed(()=>{const a=r.element.options.src||"";return a?a.includes("{")?r.designMode?E.evaluateTemplate(a,E.DEFAULT_DEMO_DATA):E.evaluateTemplate(a,r.data?.[0]||{}):a:""}),s=e.ref(!1);function n(){s.value=!0}e.watch(o,()=>{s.value=!1});const l=e.computed(()=>({objectFit:r.element.options.fit||"contain"}));return(a,i)=>(e.openBlock(),e.createElementBlock("div",Bl,[o.value&&!s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,style:e.normalizeStyle(l.value),onError:n},null,44,Dl)):(e.openBlock(),e.createElementBlock("div",Tl,"图片"))]))}}),zl=ce(Ml,[["__scopeId","data-v-007a2979"]]),Al=["data-fit","data-fit-base","data-fit-min"],Pl=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o={top:"flex-start",middle:"center",bottom:"flex-end"},s={left:"flex-start",center:"center",right:"flex-end"},n=e.ref(null),l=e.computed(()=>E.resolveElementTextFit("longText",r.element.options)),a=e.computed(()=>r.element.options.fontSize||12),i=e.computed(()=>E.resolveShrinkMinFontSize(r.element.options.shrinkMinFontSize)),d=e.computed(()=>{const c=r.element.options,f=l.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:c.fontWeight||"normal",fontFamily:c.fontFamily||"inherit",color:c.color||"#333",backgroundColor:c.backgroundColor||"transparent",textAlign:c.textAlign||"left",lineHeight:c.lineHeight?c.lineHeight+"pt":"1.5",letterSpacing:c.letterSpacing?c.letterSpacing+"pt":"normal",textIndent:c.longTextIndent?c.longTextIndent+"pt":"0",width:"100%",height:f?"auto":"100%",overflow:f?"visible":"hidden",wordBreak:"break-all",boxSizing:"border-box",...c.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...c.verticalAlign?{display:"flex",alignItems:o[c.verticalAlign]??"flex-start",justifyContent:s[c.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>r.designMode?r.element.options.formatter?r.element.options.formatter:"长文本内容":E.resolveTextBinding(r.element.options,r.data));return bt(n,()=>[l.value,a.value,i.value,r.element.options.width,r.element.options.height,r.element.options.wordWrap,r.element.options.lineHeight,m.value]),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"print-longtext",style:e.normalizeStyle(d.value),"data-fit":l.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(i.value)},e.toDisplayString(m.value),13,Al))}}),Rl=["title"],Ll=["title","onClick"],Ul=e.defineComponent({__name:"TableContextMenu",props:{visible:{type:Boolean},x:{},y:{},canDeleteRow:{type:Boolean},canDeleteCol:{type:Boolean},mergeDisabledReason:{},canSplit:{type:Boolean},currentRowType:{},rowTypeDisabledReason:{type:Function}},emits:["action"],setup(t,{emit:r}){const o=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],s=r;function n(l,a){s("action",l,a)}return(l,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"table-ctx-menu",style:e.normalizeStyle({left:t.x+"px",top:t.y+"px"}),onMousedown:a[8]||(a[8]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"menu-item",onClick:a[0]||(a[0]=i=>n("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:a[1]||(a[1]=i=>n("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteRow}]),onClick:a[2]||(a[2]=i=>t.canDeleteRow&&n("delete-row"))}," 删除行 ",2),a[9]||(a[9]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:"menu-item",onClick:a[3]||(a[3]=i=>n("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:a[4]||(a[4]=i=>n("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteCol}]),onClick:a[5]||(a[5]=i=>t.canDeleteCol&&n("delete-col"))}," 删除列 ",2),a[10]||(a[10]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!!t.mergeDisabledReason}]),title:t.mergeDisabledReason||"",onClick:a[6]||(a[6]=i=>!t.mergeDisabledReason&&n("merge"))}," 合并单元格 ",10,Rl),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canSplit}]),onClick:a[7]||(a[7]=i=>t.canSplit&&n("split"))}," 拆分单元格 ",2),a[11]||(a[11]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),a[12]||(a[12]=e.createElementVNode("div",{class:"menu-group-title"},"行类型",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(o,i=>e.createElementVNode("div",{key:i.value,class:e.normalizeClass(["menu-item",{disabled:!!t.rowTypeDisabledReason(i.value),active:t.currentRowType===i.value}]),title:t.rowTypeDisabledReason(i.value)||"",onClick:d=>!t.rowTypeDisabledReason(i.value)&&n("set-row-type",i.value)},e.toDisplayString(i.label),11,Ll)),64))],36)):e.createCommentVNode("",!0)]))}}),Il=ce(Ul,[["__scopeId","data-v-44e319c1"]]),Fl={class:"cell-barcode"},Ol=["preserveAspectRatio"],Hl=["src"],Wl={key:1,class:"cell-barcode-fallback"},Gl=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{},printerDpi:{},targetWidthMm:{},targetHeightMm:{},barWidth:{},barFontSize:{}},setup(t){const r=t,o=e.ref(null),s=e.ref(!1),n=e.ref(""),l=e.ref(null),a={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},i=e.computed(()=>a[r.fit||"contain"]??"xMidYMid meet"),d=e.computed(()=>l.value?{width:l.value.width,height:l.value.height}:{maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}),m=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));function c(){if(s.value=!1,l.value=null,!o.value)return;const R=E.barcodeUnitsPerModule(r.barWidth);try{At(o.value,r.value,{format:r.barcodeType||"CODE128",width:R,height:E.BARCODE_BAR_HEIGHT_MODULES*R,displayValue:r.showText!==!1,fontSize:(r.barFontSize??E.BARCODE_TEXT_FONT_SIZE_MODULES)*R,margin:0,marginLeft:E.BARCODE_QUIET_ZONE_MODULES*R,marginRight:E.BARCODE_QUIET_ZONE_MODULES*R,marginTop:0,marginBottom:E.BARCODE_MARGIN_BOTTOM_MODULES*R})}catch{return}s.value=!0;const w=f(o.value),v=w?E.resolveBarcodeSize({unitWidth:w.width/R,unitHeight:w.height/R,boxWidthMm:E.barcodeAvailableBoxMm(r.targetWidthMm,r.maxWidth),boxHeightMm:E.barcodeAvailableBoxMm(r.targetHeightMm,r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth}):null;l.value=v?{width:`${v.widthMm}mm`,height:`${v.heightMm}mm`}:null,o.value.setAttribute("shape-rendering","crispEdges")}function f(R){const w=(R.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return w.length!==4||w.some(v=>!Number.isFinite(v))?null:{width:w[2],height:w[3]}}async function g(){if(!r.value){n.value="";return}try{n.value=await Pt.toDataURL(r.value,{width:96,margin:1,errorCorrectionLevel:r.qrCodeLevel||"M"})}catch{n.value=""}}function b(){r.cellType==="barcode"?c():g()}return e.onMounted(b),e.watch(()=>[r.cellType,r.value,r.barcodeType,r.qrCodeLevel,r.showText,r.printerDpi,r.targetWidthMm,r.targetHeightMm,r.barWidth,r.barFontSize,r.maxWidth,r.maxHeight],b),(R,w)=>(e.openBlock(),e.createElementBlock("div",Fl,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:o,preserveAspectRatio:i.value,style:e.normalizeStyle(d.value)},null,12,Ol)),[[e.vShow,t.cellType==="barcode"&&s.value]]),t.cellType==="qrcode"&&n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.value,alt:"qrcode",style:e.normalizeStyle(m.value)},null,12,Hl)):e.createCommentVNode("",!0),!s.value&&t.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",Wl,e.toDisplayString(t.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),Kl=ce(Gl,[["__scopeId","data-v-81e37239"]]),ql={class:"cell-image"},Yl=["src"],jl={key:1,class:"image-placeholder"},Xl=e.defineComponent({__name:"CellImage",props:{value:{},fit:{},maxWidth:{},maxHeight:{},designMode:{type:Boolean},data:{}},setup(t){const r=t,o=e.computed(()=>{const a=r.value||"";return a?a.includes("{")?r.designMode?E.evaluateTemplate(a,E.DEFAULT_DEMO_DATA):E.evaluateTemplate(a,r.data?.[0]||{}):a:""}),s=e.ref(!1);function n(){s.value=!0}e.watch(o,()=>{s.value=!1});const l=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));return(a,i)=>(e.openBlock(),e.createElementBlock("div",ql,[o.value&&!s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,style:e.normalizeStyle(l.value),onError:n},null,44,Yl)):(e.openBlock(),e.createElementBlock("div",jl,"图片"))]))}}),Zl=ce(Xl,[["__scopeId","data-v-d5bc444b"]]),Jl=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],Ql=["data-fit","data-fit-base","data-fit-min","data-fit-mm"],_l={key:0,class:"data-placeholder"},ea={key:3,class:"data-placeholder"},ta={key:0,class:"col-resize-layer"},oa=["aria-label","onMousedown"],na={key:1,class:"row-badges"},je=3.7795275591,la=.1,aa=e.defineComponent({__name:"TableElement",props:{element:{},designMode:{type:Boolean},isSelected:{type:Boolean},showTableGhostBorder:{type:Boolean},scale:{},data:{}},emits:["dblclick-element","dblclick-cell"],setup(t,{emit:r}){const o={header:"题",data:"数",subtotal:"小",summary:"汇"},s=t,n=r,l=e.inject(Ge,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),a=e.computed(()=>s.element.options.tableRows??[]),i=e.computed(()=>s.element.options.tableColWidths??[]),d=e.computed(()=>s.element.options.tableDefaultFontSize??10),m=e.computed(()=>s.element.options.tableDefaultColor??"#333333"),c=e.computed(()=>{const P=l.tableSelection.value;return P&&P.elementId===s.element.id?P:null});function f(P){let H=0;for(let j=0;j<P;j++)H+=a.value[j].height;return H}const g=e.ref(null),b=e.ref(null),R=e.ref([]);function w(){if(!s.designMode)return;const P=g.value;if(!P)return;const H=P.offsetHeight;if(H<=0)return;const j=s.element.options,ne=H/je;Math.abs(ne-(j.height??0))>la&&(j.height=Math.round(ne*100)/100);const _=P.offsetTop;R.value=Array.from(P.rows).map(he=>({top:(he.offsetTop-_)/je,height:he.offsetHeight/je}))}function v(P){return R.value[P]?.top??f(P)}function p(P){return R.value[P]?.height??a.value[P]?.height??0}e.watch(()=>[s.element.options,s.designMode],()=>w(),{deep:!0,flush:"post"}),e.onMounted(()=>{w(),document.fonts?.ready.then(()=>w())});const B=e.computed(()=>{const P=s.element.options.dataSource;if(P&&Array.isArray(E.DEFAULT_DEMO_DATA[P]))return E.DEFAULT_DEMO_DATA[P];for(const H of Object.values(E.DEFAULT_DEMO_DATA))if(Array.isArray(H))return H}),Q=e.computed(()=>{if(s.data)return s.data});function ae(P){return P.cellType==="barcode"||P.cellType==="qrcode"}function K(P,H){return ae(H)?E.resolveBarcodeDesignValue(H.formatter,B.value):H.formatter||""}function Z(P,H){const j=s.element.options,ne={designMode:s.designMode,showGhostBorder:s.showTableGhostBorder};return{fontFamily:H.fontFamily||"inherit",textAlign:H.align??"left",verticalAlign:H.valign??"middle",fontSize:(H.fontSize??d.value)+"pt",fontWeight:H.fontWeight??"normal",color:H.color??m.value,backgroundColor:H.backgroundColor??"transparent",borderTop:E.resolveCellBorderCss(H.borders?.top,ne),borderRight:E.resolveCellBorderCss(H.borders?.right,ne),borderBottom:E.resolveCellBorderCss(H.borders?.bottom,ne),borderLeft:E.resolveCellBorderCss(H.borders?.left,ne),padding:(H.padding??j.tableDefaultPadding??1)+"mm",whiteSpace:H.wordWrap??!0?"normal":"nowrap",overflow:H.wordWrap??!0?"visible":"hidden"}}function y(P){return E.resolveCellTextFit(P)}function W(P){return y(P)!=="autoHeight"}function X(P){return P.fontSize??d.value}function U(P,H){return E.cellFitCapMm(a.value,P,H,s.element.options.tableDefaultPadding??1)}function k(P,H){return E.cellFitWidthMm(i.value,P,H,s.element.options.tableDefaultPadding??1)}function D(P,H){return{maxHeight:U(H,P)+"mm",overflow:"hidden",...P.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}bt(b,()=>[s.designMode,s.data?.length,i.value.join(","),d.value,s.element.options.tableDefaultPadding,a.value.map(P=>`${P.height}:${P.cells.map(H=>`${H.formatter??""}|${H.fontSize??""}|${H.wordWrap??""}|${H.textFit??""}|${H.colspan??1}`).join("~")}`).join(",")]);function N(P,H){const j=c.value;return{"cell-selected":!!j&&P>=j.r1&&P<=j.r2&&H>=j.c1&&H<=j.c2,"row-data-bg":a.value[P].type==="data"}}const F=e.ref(null);function A(P,H){const j=E.normalizeSelection(a.value,P,H);l.setTableSelection({elementId:s.element.id,...j})}function V(P,H,j){!s.designMode||!s.isSelected||(j.stopPropagation(),j.shiftKey&&c.value?A({r:c.value.r1,c:c.value.c1},{r:P,c:H}):(F.value={r:P,c:H},A({r:P,c:H},{r:P,c:H})),window.addEventListener("mouseup",()=>{F.value=null},{once:!0}))}function T(P,H){F.value&&A(F.value,{r:P,c:H})}function u(P,H){s.designMode&&n("dblclick-cell",s.element.id,P,H)}const S=e.reactive({visible:!1,x:0,y:0});function Y(P,H,j){if(!s.designMode||!s.isSelected)return;const ne=c.value;ne&&P>=ne.r1&&P<=ne.r2&&H>=ne.c1&&H<=ne.c2||A({r:P,c:H},{r:P,c:H}),S.x=j.clientX,S.y=j.clientY,S.visible=!0,window.addEventListener("mousedown",()=>{S.visible=!1},{once:!0})}const Ee=e.computed(()=>{const P=c.value;return P?E.canMergeReason(a.value,P):"未选择单元格"}),fe=e.computed(()=>{const P=c.value;if(!P)return!1;for(let H=P.r1;H<=P.r2;H++)for(let j=P.c1;j<=P.c2;j++){const ne=a.value[H].cells[j];if(!ne.merged&&((ne.rowspan??1)>1||(ne.colspan??1)>1))return!0}return!1});function me(P){const H=c.value;if(!H)return"未选择单元格";if(H.r1!==H.r2)return"行类型仅支持单行设置";const j=JSON.parse(JSON.stringify(a.value));return E.setRowType(j,H.r1,P)}function ge(){E.syncTableElementSize(s.element.options)}function L(P,H){const j=l.maxTableWidth.value,ne=P.reduce((_,he)=>_+he,0)+P[H];return ne>j?`插入后表格总宽 ${Math.round(ne*10)/10}mm 超过打印范围宽度 ${j}mm,请先缩小列宽`:null}function x(P,H){const j=c.value;if(!j)return;S.visible=!1;const ne=s.element.options,_=ne.tableRows,he=ne.tableColWidths;let O=null;switch(P){case"insert-row-above":E.insertRow(_,j.r1,"above");break;case"insert-row-below":E.insertRow(_,j.r2,"below");break;case"delete-row":O=E.deleteRow(_,j.r1);break;case"insert-col-left":O=L(he,j.c1),O||E.insertCol(_,he,j.c1,"left");break;case"insert-col-right":O=L(he,j.c2),O||E.insertCol(_,he,j.c2,"right");break;case"delete-col":O=E.deleteCol(_,he,j.c1);break;case"merge":E.mergeCells(_,j);break;case"split":E.splitCells(_,j);break;case"set-row-type":O=E.setRowType(_,j.r1,H);break}if(O){alert(O);return}l.setTableSelection(null),ge(),l.recordHistory()}const $=e.computed(()=>s.designMode&&!!s.isSelected&&!s.element.options.locked&&i.value.length>=1),G=e.computed(()=>Array.from({length:i.value.length},(P,H)=>H+1));function h(P){return i.value.slice(0,P).reduce((H,j)=>H+j,0)}const C=e.ref(null);let M=0,ee=0;function oe(P,H){$.value&&H.button===0&&(C.value=P,M=H.clientX,ee=i.value[P-1],document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ve))}function ie(P){if(C.value===null)return;const H=s.scale||1,j=(P.clientX-M)/(H*je),ne=C.value-1,_=s.element.options.tableColWidths;_[ne]=E.clampResizedColumnWidth(_,ne,ee+j,l.maxTableWidth.value),ge()}function ve(){document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ve),C.value!==null&&(C.value=null,ge(),l.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ve)}),(P,H)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:b,class:e.normalizeClass(["print-table",{"design-mode":t.designMode}]),onContextmenu:H[0]||(H[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:g,style:e.normalizeStyle({fontSize:d.value+"pt",color:m.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(j,ne)=>(e.openBlock(),e.createElementBlock("col",{key:ne,style:e.normalizeStyle({width:j+"mm"})},null,4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(j,ne)=>(e.openBlock(),e.createElementBlock("tr",{key:j.id,style:e.normalizeStyle({height:j.height+"mm"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(j.cells,(_,he)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:_.id},[_.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:_.rowspan||1,colspan:_.colspan||1,class:e.normalizeClass(N(ne,he)),style:e.normalizeStyle(Z(j,_)),onMousedown:e.withModifiers(O=>V(ne,he,O),["left"]),onMouseenter:O=>T(ne,he),onDblclick:e.withModifiers(O=>u(ne,he),["stop"]),onContextmenu:e.withModifiers(O=>Y(ne,he,O),["prevent","stop"])},[ae(_)?(e.openBlock(),e.createBlock(Kl,{key:0,"cell-type":_.cellType,value:K(j,_),"barcode-type":_.barcodeType,"qr-code-level":_.qrCodeLevel,"show-text":_.showBarcodeText!==!1,fit:_.fit,"max-width":_.maxWidth,"max-height":_.maxHeight,"printer-dpi":_.printerDpi,"target-width-mm":k(he,_),"target-height-mm":U(ne,_),"bar-width":_.barWidth,"bar-font-size":_.barFontSize},null,8,["cell-type","value","barcode-type","qr-code-level","show-text","fit","max-width","max-height","printer-dpi","target-width-mm","target-height-mm","bar-width","bar-font-size"])):_.cellType==="image"?(e.openBlock(),e.createBlock(Zl,{key:1,value:_.formatter||"",fit:_.fit,"max-width":_.maxWidth,"max-height":_.maxHeight,"design-mode":t.designMode,data:Q.value},null,8,["value","fit","max-width","max-height","design-mode","data"])):W(_)?(e.openBlock(),e.createElementBlock("div",{key:2,class:"cell-fit",style:e.normalizeStyle(D(_,ne)),"data-fit":y(_)==="shrink"?"shrink":void 0,"data-fit-base":String(X(_)),"data-fit-min":String(e.unref(E.resolveShrinkMinFontSize)(_.shrinkMinFontSize)),"data-fit-mm":U(ne,_)},[j.type==="data"?(e.openBlock(),e.createElementBlock("span",_l,e.toDisplayString(K(j,_)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(K(j,_)),1)],64))],12,Ql)):j.type==="data"?(e.openBlock(),e.createElementBlock("span",ea,e.toDisplayString(K(j,_)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createTextVNode(e.toDisplayString(K(j,_)),1)],64))],46,Jl))],64))),128))],4))),128))])],4),$.value?(e.openBlock(),e.createElementBlock("div",ta,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(G.value,j=>(e.openBlock(),e.createElementBlock("div",{key:j,class:e.normalizeClass(["col-resize-handle",{dragging:C.value===j}]),role:"separator","aria-label":"列宽手柄"+j,style:e.normalizeStyle({left:h(j)+"mm"}),onMousedown:e.withModifiers(ne=>oe(j,ne),["stop","prevent"])},null,46,oa))),128))])):e.createCommentVNode("",!0),t.designMode&&t.isSelected?(e.openBlock(),e.createElementBlock("div",na,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(j,ne)=>(e.openBlock(),e.createElementBlock("span",{key:j.id,class:"row-badge",style:e.normalizeStyle({top:v(ne)+"mm",height:p(ne)+"mm"})},e.toDisplayString(o[j.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(Il,{visible:S.visible,x:S.x,y:S.y,"can-delete-row":a.value.length>1,"can-delete-col":i.value.length>1,"merge-disabled-reason":Ee.value,"can-split":fe.value,"current-row-type":c.value?a.value[c.value.r1]?.type??null:null,"row-type-disabled-reason":me,onAction:x},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),ia=ce(aa,[["__scopeId","data-v-4531a154"]]),xt=e.defineComponent({__name:"LineElement",props:{element:{}},setup(t){const r=t,o=e.computed(()=>r.element.printElementType.type==="hline"),s=e.computed(()=>{const n=r.element.options,l=(n.borderWidth||.75)+"pt",a=n.borderStyle||"solid",i=n.borderColor||"#333";return o.value?{width:"100%",height:"0",borderTop:`${l} ${a} ${i}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${l} ${a} ${i}`,boxSizing:"border-box"}});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(s.value)},null,4))}}),$t=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(t){const r=t,o=e.computed(()=>r.element.printElementType.type==="oval"),s=e.computed(()=>{const n=r.element.options;return{width:"100%",height:"100%",borderWidth:(n.borderWidth||1)+"pt",borderStyle:n.borderStyle||"solid",borderColor:n.borderColor||"#333",backgroundColor:n.backgroundColor||"transparent",borderRadius:o.value?"50%":"0",boxSizing:"border-box"}});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(s.value)},null,4))}}),ra={class:"print-barcode",ref:"containerRef"},sa=["preserveAspectRatio"],da=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.ref(null),s=e.ref(null),n={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},l=e.computed(()=>n[r.element.options.fit||"contain"]??"xMidYMid meet"),a=e.computed(()=>s.value?{width:s.value.width,height:s.value.height}:{maxWidth:"100%",maxHeight:"100%"});function i(){if(!o.value)return;const m=r.element.options,c=(r.designMode?m.testData||m.formatter:E.resolveTextBinding(m,r.data))||"条码",f=E.barcodeUnitsPerModule(m.barWidth);try{At(o.value,c,{format:m.barcodeType||"CODE128",width:f,height:E.BARCODE_BAR_HEIGHT_MODULES*f,displayValue:!m.hideTitle,fontSize:(m.fontSize??E.BARCODE_TEXT_FONT_SIZE_MODULES)*f,margin:0,marginLeft:E.BARCODE_QUIET_ZONE_MODULES*f,marginRight:E.BARCODE_QUIET_ZONE_MODULES*f,marginTop:0,marginBottom:E.BARCODE_MARGIN_BOTTOM_MODULES*f})}catch{s.value=null;return}const g=d(o.value),b=g?E.resolveBarcodeSize({unitWidth:g.width/f,unitHeight:g.height/f,boxWidthMm:E.barcodeAvailableBoxMm(m.width,m.maxWidth),boxHeightMm:E.barcodeAvailableBoxMm(m.height,m.maxHeight),dpi:m.printerDpi,barWidth:m.barWidth}):null;s.value=b?{width:`${b.widthMm}mm`,height:`${b.heightMm}mm`}:null,o.value.setAttribute("shape-rendering","crispEdges")}function d(m){const c=(m.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return c.length!==4||c.some(f=>!Number.isFinite(f))?null:{width:c[2],height:c[3]}}return e.onMounted(i),e.watch(()=>[r.element.options.formatter,r.element.options.testData,r.element.options.barcodeType,r.element.options.width,r.element.options.height,r.element.options.barWidth,r.element.options.printerDpi,r.element.options.hideTitle,r.element.options.fontSize,r.element.options.maxWidth,r.element.options.maxHeight],i),(m,c)=>(e.openBlock(),e.createElementBlock("div",ra,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:o,preserveAspectRatio:l.value,style:e.normalizeStyle(a.value)},null,12,sa))],512))}}),ca=ce(da,[["__scopeId","data-v-6eb95a40"]]),ua={class:"print-qrcode"},ma=["src"],pa=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.ref(""),s=e.computed(()=>{const l=r.element.options;return{objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}});async function n(){const l=r.element.options,a=(r.designMode?l.testData||l.formatter:E.resolveTextBinding(l,r.data))||"二维码",i=Math.min(l.width||80,l.height||80);try{o.value=await Pt.toDataURL(a,{width:i,margin:1,errorCorrectionLevel:String(l.qrCodeLevel??"M")})}catch{o.value=""}}return e.onMounted(n),e.watch(()=>[r.element.options.formatter,r.element.options.testData,r.element.options.qrCodeLevel],n),(l,a)=>(e.openBlock(),e.createElementBlock("div",ua,[o.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,alt:"qrcode",style:e.normalizeStyle(s.value)},null,12,ma)):e.createCommentVNode("",!0)]))}}),va=ce(pa,[["__scopeId","data-v-3454544f"]]),fa=["innerHTML"],ga=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.computed(()=>{if(r.element.options.formatter){const s=r.data&&r.data.length>0?r.data[0]:{},n=E.evaluateTemplate(r.element.options.formatter,s??{});return n?jt.sanitize(n):""}return'<div style="background:#e0e0e0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10pt;color:#999">HTML</div>'});return(s,n)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:o.value},null,8,fa))}}),ha=ce(ga,[["__scopeId","data-v-880bbde5"]]),ba=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const r=t,o=e.computed(()=>{const n=r.element.options;return{fontSize:(n.fontSize||12)+"pt",fontWeight:n.fontWeight||"normal",fontFamily:n.fontFamily||"inherit",color:n.color||"#333",textAlign:n.textAlign||"left",lineHeight:n.lineHeight?n.lineHeight+"pt":"normal",letterSpacing:n.letterSpacing?n.letterSpacing+"pt":"normal"}}),s=e.computed(()=>r.designMode?r.element.options.title||"{pageIndex}/{totalPages}":r.element.options.title||"");return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(o.value)},e.toDisplayString(s.value),5))}}),Ea=ce(ba,[["__scopeId","data-v-38f1d7df"]]),ya={key:0,class:"drag-preview"},ka={key:1,class:"resize-handles"},Va=["onMousedown"],Na={key:2,class:"selected-indicator"},wa={class:"position-label"},Ca=e.defineComponent({__name:"BaseElement",props:{element:{},isSelected:{type:Boolean},designMode:{type:Boolean},printData:{},scale:{},allElements:{},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},zone:{},adsorbHandler:{type:Function},clearAdsorbGuides:{type:Function}},emits:["select","update:element","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","clone-element"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(null),l=e.inject(Rt,null),a=e.computed(()=>l?.value?l.value.has(o.element.id):o.isSelected??!1),i=e.inject(Lt,null),d=e.computed(()=>i?.value.has(o.element.id)??!1),m={text:e.markRaw($l),image:e.markRaw(zl),longText:e.markRaw(Pl),table:e.markRaw(ia),hline:e.markRaw(xt),vline:e.markRaw(xt),rect:e.markRaw($t),oval:e.markRaw($t),barcode:e.markRaw(ca),qrcode:e.markRaw(va),html:e.markRaw(ha),pageNumber:e.markRaw(Ea)},c=e.computed(()=>m[o.element.printElementType.type]),f=e.computed(()=>o.element.printElementType.type==="table"?{showTableGhostBorder:o.showTableGhostBorder,scale:o.scale}:{}),g=e.computed(()=>{const k=o.element.options,D=E.resolveElementBorder(o.element.printElementType.type,k),N={};if(D?.all&&(N.border=`${D.all.borderWidth} ${D.all.borderStyle} ${D.all.borderColor}`),D)for(const F of E.ELEMENT_BORDER_SIDES){const A=D.edges[F];A&&(N[`border${F.charAt(0).toUpperCase()}${F.slice(1)}`]=`${A.borderWidth} ${A.borderStyle} ${A.borderColor}`)}return{position:"absolute",left:k.left+"mm",top:k.top+"mm",width:k.width+"mm",height:k.height+"mm",zIndex:k.zIndex||"auto",...N}}),b=e.computed(()=>{const k=o.element.options;return`x:${Math.round(k.left)} y:${Math.round(k.top)} ${Math.round(k.width)}×${Math.round(k.height)}mm`});let R=0,w=0;const v=e.reactive({disabled:!o.designMode||!!o.element.options.locked,getScale:()=>(o.scale||1)*E.mmToPx(1),onDrag:k=>{const D=k.left-R,N=k.top-w;n.value&&(n.value.style.transform=`translate(${D}mm, ${N}mm)`)},onDragEnd:(k,D)=>{if(D.altKey){const A=JSON.parse(JSON.stringify(o.element));A.id=E.generateId(),A.options.left=k.left,A.options.top=k.top,A.options.groupId=void 0,s("clone-element",A,{left:k.left,top:k.top}),n.value&&(n.value.style.transform="");return}const N=k.left-R,F=k.top-w;if(o.element.options.left=k.left,o.element.options.top=k.top,n.value&&(n.value.style.transform=""),o.element.options.groupId&&o.allElements)for(const A of o.allElements)A.id!==o.element.id&&A.options.groupId===o.element.options.groupId&&(A.options.left+=N,A.options.top+=F)},onStart:()=>{R=o.element.options.left,w=o.element.options.top,s("drag-start")},onStop:()=>{o.clearAdsorbGuides?.(),s("drag-stop")},onAdsorb:k=>{let D=k.left,N=k.top;return o.snapToGrid&&(D=Math.round(k.left/5)*5,N=Math.round(k.top/5)*5),o.adsorbHandler?o.adsorbHandler({id:o.element.id,left:D,top:N,width:o.element.options.width,height:o.element.options.height}):{left:D,top:N,lines:[]}}}),{setup:p,cleanup:B,isDragging:Q}=wl(n,v);e.watchEffect(()=>{v.disabled=!o.designMode||!!o.element.options.locked});const ae=e.computed(()=>a.value&&!!o.designMode&&!o.element.options.locked&&o.element.printElementType.type!=="table"),{startResize:K,cleanup:Z}=E.useResize({minWidth:3.5,minHeight:3.5,getScale:()=>(o.scale||1)*E.mmToPx(1),getRect:()=>({left:o.element.options.left,top:o.element.options.top,width:o.element.options.width,height:o.element.options.height}),onResize:k=>{o.element.options.left=k.left,o.element.options.top=k.top,o.element.options.width=k.width,o.element.options.height=k.height},onStart:()=>{s("drag-start")},onStop:()=>{s("drag-stop")}});function y(k){o.designMode&&k.button===0&&s("select",o.element.id,k.ctrlKey||k.metaKey)}function W(){o.designMode&&s("dblclick-element",o.element.id)}function X(k,D,N){o.designMode&&s("dblclick-cell",k,D,N)}e.onMounted(()=>{o.designMode&&p()});function U(){B(),Z(),o.clearAdsorbGuides?.()}return e.onUnmounted(()=>{U()}),(k,D)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:n,class:e.normalizeClass(["print-element",{selected:a.value,previewed:d.value,"design-mode":t.designMode,locked:t.element.options.locked,hidden:t.element.options.visible===!1,"drag-ghost":e.unref(Q),[`type-${t.element.printElementType.type}`]:!0,[`zone-${t.zone||"content"}`]:!0}]),style:e.normalizeStyle(g.value),onMousedown:e.withModifiers(y,["stop"]),onDblclick:e.withModifiers(W,["stop"]),onContextmenu:D[0]||(D[0]=e.withModifiers(N=>k.$emit("contextmenu",t.element.id,N),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value),e.mergeProps({element:t.element,data:t.printData,"design-mode":t.designMode,"is-selected":a.value},f.value,{onDblclickCell:X}),null,16,["element","data","design-mode","is-selected"])),e.unref(Q)?(e.openBlock(),e.createElementBlock("div",ya)):e.createCommentVNode("",!0),ae.value?(e.openBlock(),e.createElementBlock("div",ka,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E.RESIZE_POINTS),N=>(e.openBlock(),e.createElementBlock("div",{key:N,class:e.normalizeClass(["resize-handle",`handle-${N}`]),onMousedown:e.withModifiers(F=>e.unref(K)(N,F),["stop"])},null,42,Va))),128))])):e.createCommentVNode("",!0),a.value&&t.designMode?(e.openBlock(),e.createElementBlock("div",Na,[e.createElementVNode("div",wa,e.toDisplayString(b.value),1)])):e.createCommentVNode("",!0)],38))}}),ct=ce(Ca,[["__scopeId","data-v-c1d8b84e"]]);function Sa(t={}){const r=e.ref([]),o=e.ref({width:0,height:0});function s(a,i,d){return E.computeAdsorb(a,i,d,t)}function n(a,i,d){r.value=a,o.value={width:i,height:d}}function l(){r.value=[]}return{check:s,renderLines:n,clearLines:l,guideLines:r,paperSize:o}}function xa(t){const{check:r,renderLines:o,clearLines:s,guideLines:n,paperSize:l}=Sa(t.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function a(d){const m=t.getElements().filter(g=>g.id!==d.id).map(g=>({id:g.id,left:g.options.left,top:g.options.top,width:g.options.width,height:g.options.height})),c=r(d,m,t.getGuides?.()),f=t.getPaperSize();return o(c.lines,f.width,f.height),c}function i(){s()}return{requestAdsorb:a,clearGuides:i,guideLines:n,paperSize:l}}const $a=["src"],Ba=["width","height","viewBox"],Da=["x","y","font-size","fill","transform"],Ta={key:0,class:"zone-label"},Ma={key:0,class:"zone-height-tip"},za={key:0,class:"zone-label"},Aa={key:0,class:"zone-height-tip"},Pa=["onMousedown","onDblclick"],Ra=e.defineComponent({__name:"CanvasPaper",props:{templateData:{},runtimeElements:{},designMode:{type:Boolean},printData:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},guides:{}},emits:["select","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","zone-height-change","zone-height-commit","guide-move","guide-remove","clone-element"],setup(t,{expose:r,emit:o}){const s=t,n=o,l=e.ref(null),a=e.computed(()=>E.getPaperDimensions(s.templateData).width),i=e.computed(()=>E.getPaperDimensions(s.templateData).height),d=e.computed(()=>s.templateData.designBackground),m=e.ref(!1);e.watch(()=>d.value?.src,()=>{m.value=!1});const c=e.computed(()=>{const x=d.value?.rotation;return x===90||x===180||x===270?x:0}),f=e.computed(()=>{const x=c.value,$=x===90||x===270,G=$?i.value:a.value,h=$?a.value:i.value,C={width:G+"mm",height:h+"mm",left:(a.value-G)/2+"mm",top:(i.value-h)/2+"mm"};return x!==0&&(C.transform=`rotate(${x}deg)`),C});function g(){m.value=!0,console.warn("[print-designer] 设计背景图加载失败:",d.value?.src)}const b=e.computed(()=>`${8/(s.scale||1)}px`),R=e.computed(()=>{const x=s.scale||1,$=E.mmToPx(a.value)*x,G=E.mmToPx(i.value)*x;return{width:$+"px",height:G+"px",position:"relative"}}),w=e.computed(()=>{const x=s.templateData.margins,$=s.templateData.header.height,G=s.templateData.footer.height,h=a.value-x.left-x.right;return{header:{left:x.left,top:x.top,width:h,height:$},content:{left:x.left,top:x.top+$,width:h,height:i.value-x.top-x.bottom-$-G},footer:{left:x.left,top:i.value-x.bottom-G,width:h,height:G}}});function v(x){return{position:"absolute",left:x.left+"mm",top:x.top+"mm",width:x.width+"mm",height:x.height+"mm"}}const p=e.computed(()=>{const x={header:[],footer:[],content:[]};for(const $ of s.runtimeElements)$.zone==="header"?x.header.push($):$.zone==="footer"?x.footer.push($):x.content.push($);return x}),B=e.computed(()=>p.value.header),Q=e.computed(()=>p.value.footer),ae=e.computed(()=>p.value.content);let K="content";const{requestAdsorb:Z,clearGuides:y,guideLines:W,paperSize:X}=xa({getElements:()=>p.value[K],getPaperSize:()=>{const x=w.value[K];return{width:x.width,height:x.height}},getGuides:()=>{const x=[],$=[];for(const G of s.guides??[])G.type==="vertical"?x.push(G.position):$.push(G.position);return{vertical:x,horizontal:$}}});function U(x){K=s.runtimeElements.find(h=>h.id===x.id)?.zone||"content";const G=Z(x);return(G.left!==x.left||G.top!==x.top)&&u(G.left+x.width/2,G.top+x.height/2),G}function k(x,$){if(x.button!==0)return;const G=$.position,h=x.clientX,C=x.clientY,M=s.scale??1,ee=25.4/96,oe=ve=>{const P=($.type==="vertical"?ve.clientX-h:ve.clientY-C)/M*ee,H=$.type==="vertical"?a.value:i.value,j=Math.min(Math.max(G+P,0),H);n("guide-move",$.id,j)},ie=()=>{window.removeEventListener("mousemove",oe),window.removeEventListener("mouseup",ie)};window.addEventListener("mousemove",oe),window.addEventListener("mouseup",ie)}const D=e.computed(()=>({width:a.value+"mm",minHeight:i.value+"mm",background:s.templateData.pageBackground||"var(--pd-paper, #fff)",boxShadow:"var(--pd-shadow-paper, 0 1px 2px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08))",overflow:"hidden",position:"relative",transform:s.scale?`scale(${s.scale})`:void 0,transformOrigin:"0 0"})),N=e.computed(()=>{const x=s.templateData.margins;return{padding:`${x.top}mm ${x.right}mm ${x.bottom}mm ${x.left}mm`,position:"relative",boxSizing:"border-box",minHeight:i.value+"mm"}}),F=e.computed(()=>({backgroundImage:`url("data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M0 .5H20M.5 0V20" fill="none" stroke="rgba(0,0,0,0.08)" stroke-width="1" stroke-dasharray="4 4"/></svg>')}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}));let A=0,V=null;const T=e.ref(null);function u(x,$){A+=1,T.value={left:x,top:$,key:A},V&&clearTimeout(V),V=setTimeout(()=>{T.value=null},300)}const S=e.computed(()=>be.resolveWatermarkLayout(s.templateData.watermark,s.printData,{width:a.value,height:i.value})),Y=e.ref(null);function Ee(x,$){$.button===0&&(ge(),Y.value={zone:x,startY:$.clientY,startH:s.templateData[x].height},window.addEventListener("mousemove",fe),window.addEventListener("mouseup",me))}function fe(x){if(!Y.value)return;const{zone:$,startY:G,startH:h}=Y.value,M=(x.clientY-G)/(s.scale||1)*25.4/96,ee=$==="header"?M:-M,oe=Math.min(100,i.value-s.templateData.margins.top-s.templateData.margins.bottom-($==="header"?s.templateData.footer.height:s.templateData.header.height)-10),ie=Math.min(oe,Math.max(0,Math.round((h+ee)*10)/10));n("zone-height-change",$,ie)}function me(){if(!Y.value)return;const x=Y.value.zone;Y.value=null,window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",me),n("zone-height-commit",x)}function ge(){window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",me),Y.value=null}e.onUnmounted(()=>{ge(),V&&clearTimeout(V)});function L(x,$){n("select",x,$)}return r({contentRef:l}),(x,$)=>(e.openBlock(),e.createElementBlock("div",{class:"paper-wrapper",style:e.normalizeStyle(R.value)},[e.createElementVNode("div",{class:"hiprint-printPaper",style:e.normalizeStyle(D.value)},[t.designMode&&d.value?.src&&!m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"design-background",style:e.normalizeStyle(f.value)},[e.createElementVNode("img",{src:d.value.src,draggable:"false",alt:"",onError:g},null,40,$a)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:l,style:e.normalizeStyle(N.value)},[t.showGrid&&t.designMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"grid-bg",style:e.normalizeStyle(F.value)},null,4)):e.createCommentVNode("",!0),T.value?(e.openBlock(),e.createElementBlock("div",{key:T.value.key,class:"snap-indicator",style:e.normalizeStyle({left:T.value.left+"mm",top:T.value.top+"mm"})},null,4)):e.createCommentVNode("",!0),S.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"watermark-layer",style:e.normalizeStyle({opacity:String(S.value.opacity)})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value.tiles,(G,h)=>(e.openBlock(),e.createElementBlock("svg",{key:h,class:"watermark-tile",width:G.widthMm+"mm",height:G.heightMm+"mm",viewBox:`0 0 ${S.value.tileWidthPx} ${S.value.tileHeightPx}`,style:e.normalizeStyle({left:G.leftMm+"mm",top:G.topMm+"mm"}),xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("text",{x:S.value.tileWidthPx/2,y:S.value.tileHeightPx/2,"font-size":S.value.fontSizePx,fill:S.value.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${S.value.rotate},${S.value.tileWidthPx/2},${S.value.tileHeightPx/2})`},e.toDisplayString(S.value.text),9,Da)],12,Ba))),128))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-header",{"design-mode":t.designMode}]),style:e.normalizeStyle(v(w.value.header))},[t.designMode?(e.openBlock(),e.createElementBlock("span",Ta,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,G=>(e.openBlock(),e.createBlock(ct,{key:G.id,element:G,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":B.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"header","adsorb-handler":U,"clear-adsorb-guides":e.unref(y),onSelect:L,onDragStart:$[0]||($[0]=h=>x.$emit("drag-start")),onDragStop:$[1]||($[1]=h=>x.$emit("drag-stop")),onDblclickElement:$[2]||($[2]=h=>x.$emit("dblclick-element",h)),onDblclickCell:$[3]||($[3]=(h,C,M)=>x.$emit("dblclick-cell",h,C,M)),onContextmenu:$[4]||($[4]=(h,C)=>x.$emit("contextmenu",h,C)),onCloneElement:(h,C)=>x.$emit("clone-element",h,C)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),t.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-bottom",onMousedown:$[5]||($[5]=e.withModifiers(G=>Ee("header",G),["prevent","stop"]))},[Y.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",Ma,e.toDisplayString(t.templateData.header.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-content",{"design-mode":t.designMode}]),style:e.normalizeStyle(v(w.value.content))},[t.designMode&&t.templateData.firstPageOverlay.height>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:"zone-overlay",style:e.normalizeStyle({height:t.templateData.firstPageOverlay.height+"mm"})},[...$[17]||($[17]=[e.createElementVNode("span",{class:"zone-label"},"首页叠加",-1)])],4)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ae.value,G=>(e.openBlock(),e.createBlock(ct,{key:G.id,element:G,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":ae.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"content","adsorb-handler":U,"clear-adsorb-guides":e.unref(y),onSelect:L,onDragStart:$[6]||($[6]=h=>x.$emit("drag-start")),onDragStop:$[7]||($[7]=h=>x.$emit("drag-stop")),onDblclickElement:$[8]||($[8]=h=>x.$emit("dblclick-element",h)),onDblclickCell:$[9]||($[9]=(h,C,M)=>x.$emit("dblclick-cell",h,C,M)),onContextmenu:$[10]||($[10]=(h,C)=>x.$emit("contextmenu",h,C)),onCloneElement:(h,C)=>x.$emit("clone-element",h,C)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128))],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-footer",{"design-mode":t.designMode}]),style:e.normalizeStyle(v(w.value.footer))},[t.designMode?(e.openBlock(),e.createElementBlock("span",za,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,G=>(e.openBlock(),e.createBlock(ct,{key:G.id,element:G,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":Q.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"footer","adsorb-handler":U,"clear-adsorb-guides":e.unref(y),onSelect:L,onDragStart:$[11]||($[11]=h=>x.$emit("drag-start")),onDragStop:$[12]||($[12]=h=>x.$emit("drag-stop")),onDblclickElement:$[13]||($[13]=h=>x.$emit("dblclick-element",h)),onDblclickCell:$[14]||($[14]=(h,C,M)=>x.$emit("dblclick-cell",h,C,M)),onContextmenu:$[15]||($[15]=(h,C)=>x.$emit("contextmenu",h,C)),onCloneElement:(h,C)=>x.$emit("clone-element",h,C)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),t.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-top",onMousedown:$[16]||($[16]=e.withModifiers(G=>Ee("footer",G),["prevent","stop"]))},[Y.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",Aa,e.toDisplayString(t.templateData.footer.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(W),(G,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["adsorb-guide",[`guide-${G.type}`]]),style:e.normalizeStyle(G.type==="vertical"?{left:G.position+"mm",top:"0",height:e.unref(X).height+"mm",borderLeftColor:G.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:G.position+"mm",left:"0",width:e.unref(X).width+"mm",borderTopColor:G.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.guides,G=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+G.id,class:e.normalizeClass(["manual-guide",[`guide-${G.type}`]]),style:e.normalizeStyle(G.type==="vertical"?{left:G.position+"mm",top:"0",height:i.value+"mm","--guide-hit":b.value}:{top:G.position+"mm",left:"0",width:a.value+"mm","--guide-hit":b.value}),onMousedown:e.withModifiers(h=>k(h,G),["prevent","stop"]),onDblclick:e.withModifiers(h=>G.id&&n("guide-remove",G.id),["prevent","stop"])},null,46,Pa))),128))],4)],4)],4))}}),La=ce(Ra,[["__scopeId","data-v-38b3a452"]]),Ua=e.defineComponent({__name:"Ruler",props:{orientation:{},viewportPx:{},originPx:{},paperLengthMM:{},scale:{},cursorPx:{}},emits:["add-guide","guide-dragging"],setup(t,{emit:r}){const o=t,s=r,n=e.computed(()=>o.orientation==="horizontal"),l=e.computed(()=>n.value?"vertical":"horizontal"),a=e.ref(null),i=e.ref(null),d=e.computed(()=>i.value??o.cursorPx??null),m=e.computed(()=>n.value?{width:o.viewportPx+"px",height:E.RULER_THICKNESS+"px"}:{width:E.RULER_THICKNESS+"px",height:o.viewportPx+"px"});let c=0;function f(){c||(c=requestAnimationFrame(()=>{c=0,g()}))}function g(){const y=a.value;if(!y)return;const W=y.getContext("2d");if(!W)return;const X=window.devicePixelRatio||1,U=Math.max(0,Math.round(o.viewportPx)),k=E.RULER_THICKNESS;y.width=(n.value?U:k)*X,y.height=(n.value?k:U)*X,W.setTransform(X,0,0,X,0,0);const D=getComputedStyle(y),N=D.getPropertyValue("--pd-ruler-bg").trim()||"#F8F9FC",F=D.getPropertyValue("--pd-ruler").trim()||"#9AA1AF",A=D.getPropertyValue("--pd-accent").trim()||"#165DFF";W.fillStyle=N,W.fillRect(0,0,n.value?U:k,n.value?k:U);const V=o.scale>0?o.scale:1,T=E.mmToPx(1)*V;if(T<=0)return;const u=-o.originPx/T,S=(U-o.originPx)/T,Y=E.chooseMajorStepMM(V),Ee=E.buildRulerTicks(u,S,Y);b(W,Ee,T,F,!0),b(W,Ee,T,F,!1),R(W,0,A),R(W,o.paperLengthMM,A);const fe=d.value;if(fe!==null&&fe>=0&&fe<=U){if(W.strokeStyle=A,W.lineWidth=1.5,W.beginPath(),n.value){const me=Math.round(fe)+.5;W.moveTo(me,0),W.lineTo(me,k)}else{const me=Math.round(fe)+.5;W.moveTo(0,me),W.lineTo(k,me)}W.stroke()}}function b(y,W,X,U,k){y.strokeStyle=U,y.fillStyle=U,y.globalAlpha=k?.32:1,y.lineWidth=1,y.font="9px ui-monospace, Menlo, monospace",y.textBaseline="top";for(const D of W){if((D.mm<0||D.mm>o.paperLengthMM)!==k)continue;const F=Math.round(o.originPx+D.mm*X)+.5,A=D.major?8:4;y.beginPath(),n.value?(y.moveTo(F,0),y.lineTo(F,A)):(y.moveTo(0,F),y.lineTo(A,F)),y.stroke(),D.major&&D.label&&(n.value?y.fillText(D.label,F+2,11):(y.save(),y.translate(11,F+2),y.rotate(-Math.PI/2),y.fillText(D.label,0,0),y.restore()))}y.globalAlpha=1}function R(y,W,X){const U=E.mmToPx(1)*(o.scale>0?o.scale:1),k=Math.round(o.originPx+W*U)+.5;k<=0||k>=o.viewportPx||(y.strokeStyle=X,y.globalAlpha=.55,y.lineWidth=1,y.beginPath(),n.value?(y.moveTo(k,0),y.lineTo(k,E.RULER_THICKNESS)):(y.moveTo(0,k),y.lineTo(E.RULER_THICKNESS,k)),y.stroke(),y.globalAlpha=1)}e.watch(()=>[o.viewportPx,o.originPx,o.paperLengthMM,o.scale,o.cursorPx,o.orientation],f),e.onMounted(f),e.onBeforeUnmount(()=>{c&&cancelAnimationFrame(c)});let w=!1;function v(y){const W=a.value;if(!W)return null;const X=W.getBoundingClientRect(),U=n.value?y.clientX-X.left:y.clientY-X.top;if(U<0||U>o.viewportPx)return null;const k=E.mmToPx(1)*(o.scale>0?o.scale:1);return(U-o.originPx)/k}function p(y){y.button===0&&(w=!0,y.preventDefault(),window.addEventListener("mousemove",K),window.addEventListener("mouseup",Z),ae(y))}function B(y){const W=a.value;if(!W)return;const X=W.getBoundingClientRect();i.value=n.value?y.clientX-X.left:y.clientY-X.top,f()}function Q(){i.value=null,f()}function ae(y){const W=v(y);s("guide-dragging",W)}function K(y){w&&ae(y)}function Z(y){if(!w)return;w=!1,window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",Z);const W=v(y);W!==null&&W>=0&&W<=o.paperLengthMM&&s("add-guide",l.value,W),s("guide-dragging",null)}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",Z)}),(y,W)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:a,class:e.normalizeClass(["pd-ruler",`is-${t.orientation}`]),style:e.normalizeStyle(m.value),onMousedown:p,onMousemove:B,onMouseleave:Q},null,38))}}),Bt=ce(Ua,[["__scopeId","data-v-1e7d0633"]]),Ia={class:"canvas-scroll"},Fa={key:0,class:"overlay-layer"},Oa=["src"],Xe=96/25.4,Ha=e.defineComponent({__name:"CanvasArea",props:{templateData:{},elements:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},hasClipboard:{type:Boolean},guides:{},overlayVisible:{type:Boolean},screenshotUrl:{},overlayOpacity:{},showRuler:{type:Boolean,default:!0}},emits:["select","drop-element","drop-field","drag-start","drag-stop","dblclick-element","dblclick-cell","zone-height-change","zone-height-commit","select-all","clear-selection","preview","commit-preview","paste","copy","cut","delete","move-layer","coordinate","add-guide","guide-move","guide-remove","zoom","clone-element"],setup(t,{expose:r,emit:o}){const s=t,n=o;function l(h,C){n("select",h,C)}const a=e.ref(null),i=e.computed(()=>E.getPaperDimensions(s.templateData).width),d=e.computed(()=>E.getPaperDimensions(s.templateData).height),m=e.reactive({originX:0,originY:0,viewW:0,viewH:0,paperScale:1}),c=e.reactive({x:null,y:null}),f=e.reactive({x:0,y:0}),g=e.computed(()=>({transform:`translate(${f.x}px, ${f.y}px)`}));function b(){const h=a.value,C=h?.querySelector(".hiprint-printPaper");if(!h||!C)return;const M=h.getBoundingClientRect(),ee=C.getBoundingClientRect(),oe=s.scale||1,ie=ee.width/E.mmToPx(i.value);m.paperScale=Math.abs(ie-oe)<.002?oe:ie,m.originX=ee.left-M.left-E.RULER_THICKNESS,m.originY=ee.top-M.top-E.RULER_THICKNESS,m.viewW=h.clientWidth-E.RULER_THICKNESS,m.viewH=h.clientHeight-E.RULER_THICKNESS}function R(){f.x=a.value?.scrollLeft??0,f.y=a.value?.scrollTop??0,b()}let w=null,v=0;function p(){cancelAnimationFrame(v);const h=performance.now()+220,C=()=>{b(),performance.now()<h&&(v=requestAnimationFrame(C))};v=requestAnimationFrame(C)}const B=e.ref(null);function Q(h,C){B.value=C===null?null:{type:h,mm:C}}const ae=e.computed(()=>{const h=B.value,C=a.value?.querySelector(".hiprint-printPaper");if(!h||!C)return{};const M=C.getBoundingClientRect(),ee=M.width/E.mmToPx(i.value),oe=E.mmToPx(h.mm)*(ee>0?ee:s.scale||1);return h.type==="vertical"?{left:M.left+oe+"px",top:M.top+"px",height:M.height+"px"}:{left:M.left+"px",top:M.top+oe+"px",width:M.width+"px"}});function K(h){const C=a.value?.querySelector(".hiprint-printPaper");if(!C)return;const M=C.getBoundingClientRect(),ee=s.scale||1,oe=E.pxToMm((h.clientX-M.left)/ee),ie=E.pxToMm((h.clientY-M.top)/ee);if(!(oe<0||ie<0))return{x:oe,y:ie}}function Z(h){const C=K(h),M=h.dataTransfer?.getData("fieldData");if(M)try{const oe=JSON.parse(M);n("drop-field",oe,C);return}catch{}const ee=h.dataTransfer?.getData("elementType");ee&&n("drop-element",ee,C)}const y=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let W={x:0,y:0};function X(h){return!h||!(h instanceof HTMLElement)?!1:!!(h===a.value||h.classList.contains("canvas-scroll")||h.classList.contains("hiprint-printPaper")||h.classList.contains("hiprint-printPaper-content")||h.classList.contains("zone-layer")||h.classList.contains("grid-bg")||h.classList.contains("watermark-layer"))}function U(h){const C=a.value,M=C?.querySelector(".hiprint-printPaper");if(!C||!M)return;const ee=C.getBoundingClientRect();c.x=h.clientX-ee.left-E.RULER_THICKNESS,c.y=h.clientY-ee.top-E.RULER_THICKNESS;const oe=M.getBoundingClientRect(),ie=s.scale||1,ve=E.pxToMm((h.clientX-oe.left)/ie),P=E.pxToMm((h.clientY-oe.top)/ie);if(ve<0||P<0){n("coordinate",null);return}n("coordinate",{x:ve,y:P})}function k(){n("coordinate",null),c.x=null,c.y=null}function D(h,C,M,ee){const oe=a.value;if(!oe)return;const ie=Math.max(ee,Math.round(h)),ve=Math.round((s.scale||1)*100);if(ie===ve)return;const P=s.scale||1,H=ie/100/P,j=getComputedStyle(oe),ne=parseFloat(j.paddingLeft)||0,_=parseFloat(j.paddingTop)||0,he=oe.scrollLeft+C-ne,O=oe.scrollTop+M-_;n("zoom",ie-ve),e.nextTick(()=>{const z=getComputedStyle(oe),te=parseFloat(z.paddingLeft)||0,pe=parseFloat(z.paddingTop)||0;oe.scrollLeft=he*H-C+te,oe.scrollTop=O*H-M+pe})}function N(h){if(!(h.ctrlKey||h.metaKey))return;h.preventDefault();const C=a.value;if(!C)return;const M=Math.round((s.scale||1)*100),ee=E.nextWheelScale(M,h.deltaY>0?-1:1);if(ee===M)return;const oe=C.getBoundingClientRect();D(ee,h.clientX-oe.left,h.clientY-oe.top,E.MIN_SCALE_PERCENT)}function F(h){const C=a.value;if(!C)return;const M=Math.round((s.scale||1)*100),ee=E.nextWheelScale(M,h);D(ee,C.clientWidth/2,C.clientHeight/2,E.MIN_SCALE_PERCENT)}function A(h){const C=a.value;if(!C)return;const M=C.querySelector(".hiprint-printPaper"),ee=M?.style.transition??"";M&&(M.style.transition="none"),D(h,C.clientWidth/2,C.clientHeight/2,E.FIT_SCALE_MIN_PERCENT),e.nextTick(()=>{M&&(M.style.transition=ee)})}function V(h){h.button!==2&&X(h.target)&&(n("clear-selection"),W={x:h.clientX,y:h.clientY},y.visible=!0,y.x=h.clientX,y.y=h.clientY,y.w=0,y.h=0,window.addEventListener("mousemove",u),window.addEventListener("mouseup",S))}function T(){if(y.w<3||y.h<3)return[];const h=a.value?.querySelector(".hiprint-printPaper");if(!h)return[];const C=h.getBoundingClientRect(),M=s.scale||1,ee=y.x<W.x,oe=[];for(const ie of s.elements){if(ie.options.visible===!1||ie.options.locked)continue;const ve=C.left+ie.options.left*Xe*M,P=C.top+ie.options.top*Xe*M,H=ve+ie.options.width*Xe*M,j=P+ie.options.height*Xe*M,ne=ve<y.x+y.w&&H>y.x&&P<y.y+y.h&&j>y.y,_=ve>=y.x&&H<=y.x+y.w&&P>=y.y&&j<=y.y+y.h;(ee?_:ne)&&oe.push(ie.id)}return oe}function u(h){const C=h.clientX-W.x,M=h.clientY-W.y;y.x=C>=0?W.x:h.clientX,y.y=M>=0?W.y:h.clientY,y.w=Math.abs(C),y.h=Math.abs(M),n("preview",T())}function S(){window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",S);const h=T();n("preview",h),h.length>0?n("commit-preview"):n("clear-selection"),n("preview",[]),y.visible=!1}const Y=e.reactive({visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null}),Ee=e.ref(null);function fe(h,C){!C&&!X(h.target)||(Y.targetId=C??null,Y.visible=!0,Y.x=h.clientX,Y.y=h.clientY,Y.flipX=0,Y.flipY=0,e.nextTick(()=>{const M=Ee.value;if(!M)return;const ee=M.getBoundingClientRect(),oe=4;h.clientX+ee.width+oe>window.innerWidth&&(Y.flipX=-ee.width),h.clientY+ee.height+oe>window.innerHeight&&(Y.flipY=-ee.height)}),window.removeEventListener("mousedown",me),setTimeout(()=>{window.addEventListener("mousedown",me,{once:!0})},0))}function me(){Y.visible=!1,window.removeEventListener("mousedown",me)}function ge(){Y.visible=!1,s.hasClipboard&&n("paste")}function L(){Y.visible=!1,n("select-all")}function x(){Y.visible=!1,n("clear-selection")}function $(h,C){Y.visible=!1,h==="copy"?n("copy"):h==="cut"?n("cut"):h==="paste"?n("paste"):h==="delete"?n("delete"):h==="move-layer"&&n("move-layer",C)}e.onMounted(()=>{e.nextTick(b),a.value&&typeof ResizeObserver<"u"&&(w=new ResizeObserver(b),w.observe(a.value))}),e.watch(()=>s.scale,p),e.watch([i,d],()=>e.nextTick(b));function G(){const h=a.value;if(!h)return;let C=0,M=0,ee=0;const oe=performance.now()+800,ie=()=>{const{scrollWidth:ve,scrollHeight:P}=h;if(ve===M&&P===ee?C++:C=0,M=ve,ee=P,C>=2||performance.now()>oe){const H=h.scrollWidth,j=h.scrollHeight,ne=h.clientWidth,_=h.clientHeight;h.scrollLeft=Math.max(0,(H-ne)/2),h.scrollTop=Math.max(0,(j-_)/2);return}requestAnimationFrame(ie)};requestAnimationFrame(ie)}return r({centerScroll:G,fitToWindow:A,zoomByStep:F}),e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",S),w?.disconnect(),cancelAnimationFrame(v)}),(h,C)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"canvas-area",onDragover:C[22]||(C[22]=e.withModifiers(()=>{},["prevent"])),onDrop:Z,onMousedown:V,onMousemove:U,onMouseleave:k,onWheel:N,onScroll:R,onContextmenu:e.withModifiers(fe,["prevent"])},[e.createElementVNode("div",Ia,[e.createVNode(La,{"template-data":t.templateData,"runtime-elements":t.elements,"design-mode":!0,"print-data":[],scale:t.scale,"show-grid":t.showGrid,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,guides:t.guides,onSelect:l,onGuideMove:C[0]||(C[0]=(M,ee)=>h.$emit("guide-move",M,ee)),onGuideRemove:C[1]||(C[1]=M=>h.$emit("guide-remove",M)),onDragStart:C[2]||(C[2]=M=>h.$emit("drag-start")),onDragStop:C[3]||(C[3]=M=>h.$emit("drag-stop")),onDblclickElement:C[4]||(C[4]=M=>h.$emit("dblclick-element",M)),onDblclickCell:C[5]||(C[5]=(M,ee,oe)=>h.$emit("dblclick-cell",M,ee,oe)),onContextmenu:C[6]||(C[6]=(M,ee)=>fe(ee,M)),onZoneHeightChange:C[7]||(C[7]=(M,ee)=>h.$emit("zone-height-change",M,ee)),onZoneHeightCommit:C[8]||(C[8]=M=>h.$emit("zone-height-commit",M)),onCloneElement:C[9]||(C[9]=(M,ee)=>h.$emit("clone-element",M,ee))},null,8,["template-data","runtime-elements","scale","show-grid","snap-to-grid","show-table-ghost-border","guides"]),t.overlayVisible&&t.screenshotUrl?(e.openBlock(),e.createElementBlock("div",Fa,[e.createElementVNode("img",{src:t.screenshotUrl,class:"overlay-image",style:e.normalizeStyle({opacity:t.overlayOpacity??.5})},null,12,Oa)])):e.createCommentVNode("",!0)]),t.showRuler?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ruler-overlay",style:e.normalizeStyle(g.value)},[C[23]||(C[23]=e.createElementVNode("div",{class:"ruler-corner"},null,-1)),e.createVNode(Bt,{orientation:"horizontal","viewport-px":m.viewW,"origin-px":m.originX,"paper-length-m-m":i.value,scale:m.paperScale,"cursor-px":c.x,onAddGuide:C[10]||(C[10]=(M,ee)=>n("add-guide",M,ee)),onGuideDragging:C[11]||(C[11]=M=>Q("vertical",M))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"]),e.createVNode(Bt,{orientation:"vertical","viewport-px":m.viewH,"origin-px":m.originY,"paper-length-m-m":d.value,scale:m.paperScale,"cursor-px":c.y,onAddGuide:C[12]||(C[12]=(M,ee)=>n("add-guide",M,ee)),onGuideDragging:C[13]||(C[13]=M=>Q("horizontal",M))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"])],4)):e.createCommentVNode("",!0),B.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ruler-guide-preview",`guide-${B.value.type}`]),style:e.normalizeStyle(ae.value)},null,6)):e.createCommentVNode("",!0),y.visible?(e.openBlock(),e.createElementBlock("div",{key:2,class:"marquee-selection",style:e.normalizeStyle({left:y.x+"px",top:y.y+"px",width:y.w+"px",height:y.h+"px"})},null,4)):e.createCommentVNode("",!0),Y.visible?(e.openBlock(),e.createElementBlock("div",{key:3,ref_key:"contextMenuRef",ref:Ee,class:"context-menu",style:e.normalizeStyle({left:Y.x+Y.flipX+"px",top:Y.y+Y.flipY+"px"})},[Y.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:C[14]||(C[14]=M=>$("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:C[15]||(C[15]=M=>$("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:C[16]||(C[16]=M=>$("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:C[17]||(C[17]=M=>$("delete"))},"删除"),C[24]||(C[24]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:C[18]||(C[18]=M=>$("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:C[19]||(C[19]=M=>$("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:C[20]||(C[20]=M=>$("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:C[21]||(C[21]=M=>$("move-layer","bottom"))},"置底")],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:ge},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:L},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:x},"取消选择")],64))],4)):e.createCommentVNode("",!0)],544))}}),Wa=ce(Ha,[["__scopeId","data-v-50127da1"]]),Ga={class:"property-search"},Ka=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(t,{emit:r}){const o=e.ref(""),s=r;function n(){s("search",o.value)}return(l,a)=>(e.openBlock(),e.createElementBlock("div",Ga,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=i=>o.value=i),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:n},null,544),[[e.vModelText,o.value]])]))}}),qa=ce(Ka,[["__scopeId","data-v-10ab6c84"]]),Ya={class:"group-icon"},ja={class:"group-title"},Xa={class:"expand-icon"},Za={class:"group-content"},Ja=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(t){const r=t,o=e.ref(r.defaultExpanded??!0),n={Document:"≡",Brush:"◧",Setting:"⚙"}[r.icon]||"•";function l(){o.value=!o.value,a()}function a(){const d=`property-group-${r.groupKey}`;try{localStorage.setItem(d,String(o.value))}catch{}}function i(){const d=`property-group-${r.groupKey}`;try{const m=localStorage.getItem(d);m!==null&&(o.value=m==="true")}catch{}}return e.onMounted(()=>{i()}),(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":o.value}])},[e.createElementVNode("div",{class:"group-header",onClick:l},[e.createElementVNode("span",Ya,e.toDisplayString(e.unref(n)),1),e.createElementVNode("span",ja,e.toDisplayString(t.title),1),e.createElementVNode("span",Xa,e.toDisplayString(o.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",Za,[e.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[e.vShow,o.value]])],2))}}),$e=ce(Ja,[["__scopeId","data-v-2ba57031"]]),Qa={class:"position-grid"},_a={class:"pd-field"},ei={class:"pd-field"},ti={class:"pd-field"},oi={class:"pd-field"},ni=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const r=t;function o(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[4]||(n[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Qa,[e.withDirectives(e.createElementVNode("div",_a,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(de,{modelValue:t.element.options.left,"onUpdate:modelValue":n[0]||(n[0]=l=>t.element.options.left=l),min:0},null,8,["modelValue"])],512),[[e.vShow,o("ps-left")]]),e.withDirectives(e.createElementVNode("div",ei,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(de,{modelValue:t.element.options.top,"onUpdate:modelValue":n[1]||(n[1]=l=>t.element.options.top=l),min:0},null,8,["modelValue"])],512),[[e.vShow,o("ps-top")]]),e.withDirectives(e.createElementVNode("div",ti,[n[7]||(n[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(de,{modelValue:t.element.options.width,"onUpdate:modelValue":n[2]||(n[2]=l=>t.element.options.width=l),min:4},null,8,["modelValue"])],512),[[e.vShow,o("ps-width")]]),e.withDirectives(e.createElementVNode("div",oi,[n[8]||(n[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(de,{modelValue:t.element.options.height,"onUpdate:modelValue":n[3]||(n[3]=l=>t.element.options.height=l),min:4},null,8,["modelValue"])],512),[[e.vShow,o("ps-height")]])])],32)]),_:1}))}}),li=ce(ni,[["__scopeId","data-v-bc364679"]]),ai={class:"pd-field"},ii={class:"pd-field"},ri={class:"pd-field"},si={class:"pd-field"},di={class:"pd-radio-group",role:"radiogroup"},ci={class:"pd-radio"},ui={class:"pd-radio"},mi={class:"pd-radio"},pi={class:"pd-field"},vi={class:"pd-radio-group",role:"radiogroup"},fi={class:"pd-radio"},gi={class:"pd-radio"},hi={class:"pd-radio"},bi={class:"color-row"},Ei={class:"pd-field"},yi={class:"pd-field"},ki={class:"pd-field"},Vi={class:"pd-field"},Ni={class:"pd-field"},wi=["value"],Ci={key:0,class:"pd-field"},Si={class:"pd-field"},xi=["checked"],$i={key:1,class:"pd-empty"},Bi=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(t){const r=t;function o(a){return r.searching?r.matchedKeys?.has(a)??!0:!0}const s=e.computed(()=>r.element.printElementType.type==="table"),n=e.computed(()=>E.resolveElementTextFit(r.element.printElementType.type||"text",r.element.options));function l(a){r.element.options.textFit=a.target.value}return(a,i)=>(e.openBlock(),e.createBlock($e,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[15]||(i[15]=e.withModifiers(()=>{},["prevent"]))},[t.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",ai,[i[16]||(i[16]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(ht,{modelValue:t.element.options.fontFamily,"onUpdate:modelValue":i[0]||(i[0]=d=>t.element.options.fontFamily=d)},null,8,["modelValue"])],512),[[e.vShow,o("ap-font-family")]]),e.withDirectives(e.createElementVNode("div",ii,[i[17]||(i[17]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(de,{modelValue:t.element.options.fontSize,"onUpdate:modelValue":i[1]||(i[1]=d=>t.element.options.fontSize=d),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,o("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",ri,[i[19]||(i[19]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":i[2]||(i[2]=d=>t.element.options.fontWeight=d),style:{width:"100%"}},[...i[18]||(i[18]=[e.createElementVNode("option",{value:"normal"},"正常",-1),e.createElementVNode("option",{value:"bold"},"粗体",-1),e.createElementVNode("option",{value:"bolder"},"更粗",-1),e.createElementVNode("option",{value:"lighter"},"细体",-1)])],512),[[e.vModelSelect,t.element.options.fontWeight]])],512),[[e.vShow,o("ap-font-weight")]]),e.withDirectives(e.createElementVNode("div",si,[i[23]||(i[23]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",di,[e.createElementVNode("label",ci,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[3]||(i[3]=d=>t.element.options.textAlign=d),value:"left"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),i[20]||(i[20]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",ui,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[4]||(i[4]=d=>t.element.options.textAlign=d),value:"center"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),i[21]||(i[21]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",mi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[5]||(i[5]=d=>t.element.options.textAlign=d),value:"right"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),i[22]||(i[22]=e.createElementVNode("span",null,"右",-1))])])],512),[[e.vShow,o("ap-align")]]),e.withDirectives(e.createElementVNode("div",pi,[i[27]||(i[27]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",vi,[e.createElementVNode("label",fi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[6]||(i[6]=d=>t.element.options.verticalAlign=d),value:"top"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),i[24]||(i[24]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",gi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[7]||(i[7]=d=>t.element.options.verticalAlign=d),value:"middle"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),i[25]||(i[25]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",hi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[8]||(i[8]=d=>t.element.options.verticalAlign=d),value:"bottom"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),i[26]||(i[26]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,o("ap-vertical-align")]]),e.createElementVNode("div",bi,[e.withDirectives(e.createElementVNode("div",Ei,[i[28]||(i[28]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ce,{modelValue:t.element.options.color,"onUpdate:modelValue":i[9]||(i[9]=d=>t.element.options.color=d)},null,8,["modelValue"])],512),[[e.vShow,o("ap-color")]]),e.withDirectives(e.createElementVNode("div",yi,[i[29]||(i[29]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ce,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":i[10]||(i[10]=d=>t.element.options.backgroundColor=d)},null,8,["modelValue"])],512),[[e.vShow,o("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",ki,[i[30]||(i[30]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(de,{modelValue:t.element.options.lineHeight,"onUpdate:modelValue":i[11]||(i[11]=d=>t.element.options.lineHeight=d),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,o("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",Vi,[i[31]||(i[31]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(de,{modelValue:t.element.options.letterSpacing,"onUpdate:modelValue":i[12]||(i[12]=d=>t.element.options.letterSpacing=d),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,o("ap-letter-spacing")]]),e.withDirectives(e.createElementVNode("div",Ni,[i[33]||(i[33]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:n.value,style:{width:"100%"},onChange:l},[...i[32]||(i[32]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,wi)],512),[[e.vShow,o("ap-text-fit")]]),n.value==="shrink"?e.withDirectives((e.openBlock(),e.createElementBlock("div",Ci,[i[34]||(i[34]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(de,{"model-value":t.element.options.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":i[13]||(i[13]=d=>t.element.options.shrinkMinFontSize=d??void 0)},null,8,["model-value"])],512)),[[e.vShow,o("ap-shrink-min")]]):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",Si,[i[35]||(i[35]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:t.element.options.wordWrap!==!1,type:"checkbox",class:"pd-switch",onInput:i[14]||(i[14]=d=>t.element.options.wordWrap=d.target.checked?void 0:!1)},null,40,xi)],512),[[e.vShow,o("ap-word-wrap")]])],64)):e.createCommentVNode("",!0),!t.isTextType&&!s.value?(e.openBlock(),e.createElementBlock("p",$i,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),Di=ce(Bi,[["__scopeId","data-v-ec9e5cb7"]]),Ti={class:"pd-field"},Mi=["value"],zi={class:"pd-field"},Ai=["value"],Pi={class:"pd-hint"},Ri={class:"pd-field"},Li={class:"pd-field"},Ui=["checked"],Ii={class:"pd-field"},Fi={key:1,class:"pd-field"},Oi=["value"],Hi={key:2,class:"pd-hint"},Wi={key:3,class:"pd-field"},Gi=["value"],Ki={class:"pd-field"},qi={class:"pd-field"},Yi=e.defineComponent({__name:"CodeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["change"],setup(t,{emit:r}){const o=t,s=r,n=e.computed(()=>o.element.printElementType.type==="barcode"),l=e.computed(()=>o.element.printElementType.type==="qrcode"),a=e.computed(()=>(o.element.options.barcodeType||"CODE128").toUpperCase()),i=e.computed(()=>o.element.options.printerDpi?String(o.element.options.printerDpi):""),d=e.computed(()=>!!o.element.options.printerDpi),m=e.computed(()=>n.value&&d.value);function c(w){const v=Number(w.target.value);o.element.options.printerDpi=v>0?v:void 0,R()}function f(w){const v=w.target.value;o.element.options.barcodeType=v==="CODE128"?void 0:v,R()}function g(w){o.element.options.fit=w.target.value||void 0,R()}function b(w){return o.searching?o.matchedKeys?.has(w)??!0:!0}function R(){s("change")}return(w,v)=>(e.openBlock(),e.createBlock($e,{title:"条码设置",icon:"Postcard","default-expanded":"","group-key":"code"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:v[6]||(v[6]=e.withModifiers(()=>{},["prevent"]))},[n.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Ti,[v[8]||(v[8]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{class:"pd-select",value:a.value,onChange:f},[...v[7]||(v[7]=[e.createElementVNode("option",{value:"CODE128"},"CODE128(通用)",-1),e.createElementVNode("option",{value:"EAN13"},"EAN13(商品码)",-1),e.createElementVNode("option",{value:"EAN8"},"EAN8",-1),e.createElementVNode("option",{value:"UPC"},"UPC",-1),e.createElementVNode("option",{value:"CODE39"},"CODE39",-1),e.createElementVNode("option",{value:"ITF14"},"ITF14",-1)])],40,Mi)],512),[[e.vShow,b("cd-type")]]),e.withDirectives(e.createElementVNode("div",zi,[v[10]||(v[10]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{class:"pd-select",value:i.value,onChange:c},[...v[9]||(v[9]=[e.createElementVNode("option",{value:""},"不指定(按条宽渲染)",-1),e.createElementVNode("option",{value:"203"},"203 dpi(8 点/mm)",-1),e.createElementVNode("option",{value:"300"},"300 dpi(11.8 点/mm)",-1),e.createElementVNode("option",{value:"600"},"600 dpi(23.6 点/mm)",-1)])],40,Ai)],512),[[e.vShow,b("cd-dpi")]]),e.withDirectives(e.createElementVNode("p",Pi,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小",512),[[e.vShow,b("cd-dpi")]]),e.withDirectives(e.createElementVNode("div",Ri,[v[11]||(v[11]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(de,{"model-value":t.element.options.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":v[0]||(v[0]=p=>{t.element.options.barWidth=p,R()})},null,8,["model-value"])],512),[[e.vShow,b("cd-bar-width")]]),e.withDirectives(e.createElementVNode("p",{class:"pd-hint"},e.toDisplayString(m.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),513),[[e.vShow,b("cd-bar-width")]]),e.withDirectives(e.createElementVNode("div",Li,[v[12]||(v[12]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:t.element.options.hideTitle!==!0,type:"checkbox",class:"pd-switch",onInput:v[1]||(v[1]=p=>{t.element.options.hideTitle=p.target.checked?void 0:!0,R()})},null,40,Ui)],512),[[e.vShow,b("cd-show-text")]]),e.withDirectives(e.createElementVNode("div",Ii,[v[13]||(v[13]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(de,{"model-value":t.element.options.fontSize,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":v[2]||(v[2]=p=>{t.element.options.fontSize=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,b("cd-font-size")]])],64)):l.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",Fi,[v[15]||(v[15]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{class:"pd-select",value:String(t.element.options.qrCodeLevel??"M"),onChange:v[3]||(v[3]=p=>{t.element.options.qrCodeLevel=p.target.value,R()})},[...v[14]||(v[14]=[e.createElementVNode("option",{value:"L"},"L(最低,容量大)",-1),e.createElementVNode("option",{value:"M"},"M(推荐)",-1),e.createElementVNode("option",{value:"Q"},"Q",-1),e.createElementVNode("option",{value:"H"},"H(最高)",-1)])],40,Oi)],512)),[[e.vShow,b("cd-ec-level")]]):e.createCommentVNode("",!0),v[20]||(v[20]=e.createElementVNode("h3",{class:"pd-divider"},"自定义设置",-1)),n.value?(e.openBlock(),e.createElementBlock("p",Hi,"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),n.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("div",Wi,[v[17]||(v[17]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{class:"pd-select",value:t.element.options.fit||"contain",onChange:g},[...v[16]||(v[16]=[e.createElementVNode("option",{value:"contain"},"包含(保持比例)",-1),e.createElementVNode("option",{value:"cover"},"覆盖(保持比例)",-1),e.createElementVNode("option",{value:"fill"},"拉伸填满",-1),e.createElementVNode("option",{value:"none"},"原始尺寸",-1),e.createElementVNode("option",{value:"scale-down"},"缩小(保持比例)",-1)])],40,Gi)],512)),[[e.vShow,b("cd-fit")]]),e.withDirectives(e.createElementVNode("div",Ki,[v[18]||(v[18]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(de,{"model-value":t.element.options.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[4]||(v[4]=p=>{t.element.options.maxWidth=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,b("cd-max-width")]]),e.withDirectives(e.createElementVNode("div",qi,[v[19]||(v[19]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(de,{"model-value":t.element.options.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[5]||(v[5]=p=>{t.element.options.maxHeight=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,b("cd-max-height")]])],32)]),_:1}))}}),ji={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},Xi={class:"pd-dialog-header"},Zi={class:"expression-editor"},Ji={class:"ee-nav"},Qi={class:"ee-nav-tabs"},_i={class:"ee-content"},er={class:"ee-content-search"},tr=["placeholder"],or={class:"ee-content-list"},nr={class:"ee-field-group-icon"},lr=["onDblclick"],ar={class:"ee-field-info"},ir={class:"ee-item-label"},rr={class:"ee-item-key"},sr={key:0,class:"pd-empty"},dr=["onDblclick"],cr={class:"ee-field-info"},ur={class:"ee-item-label"},mr={class:"ee-item-key"},pr={class:"ee-func-group"},vr=["onDblclick"],fr={class:"ee-field-info"},gr={class:"ee-item-label"},hr={class:"ee-item-key"},br={class:"ee-func-group"},Er=["onDblclick"],yr={class:"ee-field-info"},kr={class:"ee-item-label"},Vr={class:"ee-item-key"},Nr={class:"ee-func-group"},wr=["onDblclick"],Cr={class:"ee-field-info"},Sr={class:"ee-item-label"},xr={class:"ee-item-key"},$r={class:"ee-editor"},Br={class:"ee-editor-section"},Dr={class:"ee-editor-section"},Tr={class:"pd-dialog-footer"},Mr=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(t,{emit:r}){const o=t,s=r,n=e.computed({get:()=>o.modelValue,set:U=>s("update:modelValue",U)}),l=e.ref("field"),a=e.computed(()=>{switch(l.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),i=e.ref(""),d=e.computed(()=>E.filterGroups(E.groupFields(o.fields??[]),i.value));e.watch(n,U=>{U&&(p.value=o.expression||"")});function m(U){const{insideParens:k}=g();W(k?U.fieldKey:`{${U.fieldKey}}`)}function c(U){const{insideParens:k}=g();W(k?U.template.replace(/^\{|\}$/g,""):U.template)}function f(U){const{insideBlock:k}=g(),D=k?U.template:`{${U.template}}`,N=D.indexOf("(")+1;W(D,N)}function g(){const k=B.value?.selectionStart??p.value.length,D=p.value.substring(0,k);let N=!1;const F=D.lastIndexOf("{");F!==-1&&!D.slice(F+1).includes("}")&&(N=!0);let A=!1;const V=D.lastIndexOf("(");return V!==-1&&!D.slice(V+1).includes(")")&&(A=!0),{insideBlock:N,insideParens:A}}const b=e.computed(()=>{if(!i.value.trim())return Z;const U=i.value.trim().toLowerCase();return Z.filter(k=>k.label.toLowerCase().includes(U)||k.name.toLowerCase().includes(U))}),R=e.computed(()=>{if(!i.value.trim())return Q;const U=i.value.trim().toLowerCase();return Q.filter(k=>k.label.toLowerCase().includes(U)||k.name.toLowerCase().includes(U))}),w=e.computed(()=>{if(!i.value.trim())return ae;const U=i.value.trim().toLowerCase();return ae.filter(k=>k.label.toLowerCase().includes(U)||k.name.toLowerCase().includes(U))}),v=e.computed(()=>{if(!i.value.trim())return K;const U=i.value.trim().toLowerCase();return K.filter(k=>k.label.toLowerCase().includes(U)||k.name.toLowerCase().includes(U))}),p=e.ref(o.expression||""),B=e.ref(null);e.watch(()=>o.expression,U=>{p.value=U||""});const Q=[{name:"SUM",label:"求和",template:"SUM()"},{name:"AVG",label:"平均值",template:"AVG()"},{name:"COUNT",label:"计数",template:"COUNT()"},{name:"MIN",label:"最小值",template:"MIN()"},{name:"MAX",label:"最大值",template:"MAX()"}],ae=[{name:"ADD",label:"相加",template:"ADD()"},{name:"SUB",label:"相减",template:"SUB()"},{name:"MUL",label:"相乘",template:"MUL()"},{name:"DIV",label:"相除",template:"DIV()"},{name:"ROUND",label:"四舍五入",template:"ROUND()"},{name:"ROUNDUP",label:"进一法",template:"ROUNDUP()"},{name:"ROUNDDOWN",label:"去尾法",template:"ROUNDDOWN()"},{name:"ROUNDBANK",label:"四舍六入五成双",template:"ROUNDBANK()"}],K=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],Z=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],y=e.computed(()=>{if(!p.value.trim())return"(输入表达式后预览)";try{const U={...E.DEFAULT_DEMO_DATA,...be.resolveSystemVariables()},k=E.evaluateTemplate(p.value,U);return k==null?"(无法计算)":String(k)}catch{return"(表达式错误)"}});function W(U,k=U.length){const D=B.value;if(!D){p.value+=U;return}const N=D.selectionStart,F=D.selectionEnd,A=p.value.substring(0,N),V=p.value.substring(F);p.value=A+U+V;const T=N+k;e.nextTick(()=>{D.focus(),D.selectionStart=D.selectionEnd=T})}function X(){s("update:expression",p.value),n.value=!1}return(U,k)=>n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:k[7]||(k[7]=e.withKeys(D=>n.value=!1,["esc"]))},[e.createElementVNode("section",ji,[e.createElementVNode("header",Xi,[k[8]||(k[8]=e.createElementVNode("strong",{id:"expression-editor-title"},"编辑表达式",-1)),e.createElementVNode("button",{type:"button",class:"pd-close","aria-label":"关闭",onClick:k[0]||(k[0]=D=>n.value=!1)},"×")]),e.createElementVNode("div",Zi,[e.createElementVNode("div",Ji,[k[9]||(k[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",Qi,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="field"}]),onClick:k[1]||(k[1]=D=>l.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="variable"}]),onClick:k[2]||(k[2]=D=>l.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="function"}]),onClick:k[3]||(k[3]=D=>l.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",_i,[e.createElementVNode("div",er,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":k[4]||(k[4]=D=>i.value=D),placeholder:a.value},null,8,tr),[[e.vModelText,i.value]])]),e.createElementVNode("div",or,[l.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,D=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:D.key||"_top"},[D.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":D.isList}])},[e.createElementVNode("span",nr,e.toDisplayString(D.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(D.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.fields,N=>(e.openBlock(),e.createElementBlock("div",{key:N.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:D.key?"22px":"10px"}),onDblclick:F=>m(N)},[e.createElementVNode("div",ar,[e.createElementVNode("span",ir,e.toDisplayString(N.fieldLabel),1),e.createElementVNode("span",rr,e.toDisplayString(N.fieldKey),1)])],44,lr))),128))],64))),128)),d.value.length===0?(e.openBlock(),e.createElementBlock("p",sr,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),l.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(b.value,D=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:"ee-list-item",onDblclick:N=>c(D)},[e.createElementVNode("div",cr,[e.createElementVNode("span",ur,e.toDisplayString(D.label),1),e.createElementVNode("span",mr,e.toDisplayString(D.template),1)])],40,dr))),128)):e.createCommentVNode("",!0),l.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",pr,[k[10]||(k[10]=e.createElementVNode("div",{class:"ee-func-group-title"},"聚合函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,D=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:"ee-list-item",onDblclick:N=>f(D)},[e.createElementVNode("div",fr,[e.createElementVNode("span",gr,e.toDisplayString(D.label),1),e.createElementVNode("span",hr,e.toDisplayString(D.name)+"()",1)])],40,vr))),128))]),e.createElementVNode("div",br,[k[11]||(k[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"数值运算",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,D=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:"ee-list-item",onDblclick:N=>f(D)},[e.createElementVNode("div",yr,[e.createElementVNode("span",kr,e.toDisplayString(D.label),1),e.createElementVNode("span",Vr,e.toDisplayString(D.name)+"()",1)])],40,Er))),128))]),e.createElementVNode("div",Nr,[k[12]||(k[12]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,D=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:"ee-list-item",onDblclick:N=>f(D)},[e.createElementVNode("div",Cr,[e.createElementVNode("span",Sr,e.toDisplayString(D.label),1),e.createElementVNode("span",xr,e.toDisplayString(D.name)+"()",1)])],40,wr))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",$r,[e.createElementVNode("div",Br,[k[13]||(k[13]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:B,"onUpdate:modelValue":k[5]||(k[5]=D=>p.value=D),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,p.value]])]),e.createElementVNode("div",Dr,[k[14]||(k[14]=e.createElementVNode("div",{class:"ee-editor-title"},"预览结果",-1)),e.createElementVNode("div",{class:e.normalizeClass(["ee-preview",{"ee-preview-error":y.value==="(表达式错误)"}])},e.toDisplayString(y.value),3)]),k[15]||(k[15]=e.createStaticVNode('<div class="ee-help-section" data-v-3fb017fe><div class="ee-help-title" data-v-3fb017fe>帮助信息</div><div class="ee-help-grid" data-v-3fb017fe><div class="ee-help-card ee-help-field" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>输入方式</div><div class="ee-help-card-content" data-v-3fb017fe> 双击左侧字段、变量、函数即可插入到表达式输入框中<br data-v-3fb017fe> 静态数据直接输入即可,如:供应商名称<br data-v-3fb017fe> 动态解析字段、变量、函数必须用 {} 包裹<br data-v-3fb017fe> 示例:{SUM(supplier.name)}<br data-v-3fb017fe> 注意:只能嵌套一层 </div></div><div class="ee-help-card ee-help-function" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>函数使用</div><div class="ee-help-card-content" data-v-3fb017fe> SUM(字段) - 求和<br data-v-3fb017fe> AVG(字段) - 平均值<br data-v-3fb017fe> COUNT(字段) - 计数<br data-v-3fb017fe> IF(条件, 真值, 假值) - 条件判断<br data-v-3fb017fe> 四则运算:{qty * price}、{ADD(qty, 1)}<br data-v-3fb017fe> 修约:ROUND 四舍五入 / ROUNDUP 进一 / ROUNDDOWN 去尾 / ROUNDBANK 四舍六入五成双 </div></div><div class="ee-help-card ee-help-variable" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>系统变量</div><div class="ee-help-card-content" data-v-3fb017fe> {pageIndex} - 当前页码<br data-v-3fb017fe> {totalPages} - 总页数<br data-v-3fb017fe> {printDate} - 打印日期 </div></div><div class="ee-help-card ee-help-conditional" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>示例</div><div class="ee-help-card-content" data-v-3fb017fe> 静态文本:供应商名称<br data-v-3fb017fe> 动态字段:{supplier.name}<br data-v-3fb017fe> 函数调用:{SUM(amount)}<br data-v-3fb017fe> 条件判断:{IF(amount>1000, "大单", "小单")}<br data-v-3fb017fe> 运算并修约:{ROUND(qty * price, 2)} </div></div></div></div>',1))])]),e.createElementVNode("footer",Tr,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:k[6]||(k[6]=D=>n.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:X},"确定")])])],32)):e.createCommentVNode("",!0)}}),Qe=ce(Mr,[["__scopeId","data-v-3fb017fe"]]),zr={class:"pd-field"},Ar={class:"pd-label"},Pr=["value","placeholder"],Rr=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(t,{emit:r}){const o=r,s=e.ref(!1);function n(){s.value=!0}return(l,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",zr,[e.createElementVNode("span",Ar,e.toDisplayString(t.descriptor.label),1),e.createElementVNode("input",{value:t.modelValue,class:"pd-input",placeholder:t.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:a[0]||(a[0]=i=>o("update:modelValue",i.target.value)),onDblclick:n},null,40,Pr)]),e.createVNode(Qe,{modelValue:s.value,"onUpdate:modelValue":a[1]||(a[1]=i=>s.value=i),fields:t.fields,expression:t.modelValue,"onUpdate:expression":a[2]||(a[2]=i=>o("update:modelValue",i))},null,8,["modelValue","fields","expression"])],64))}}),Lr=ce(Rr,[["__scopeId","data-v-40a99329"]]),Ur={class:"pd-field"},Ir=["value"],Fr=["value"],Or={class:"pd-field"},Hr={class:"pd-field"},Wr={class:"pd-field"},Gr={class:"pd-field"},Kr={style:{width:"60px"}},qr=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(t){const r=t,o=e.inject(Ge,null),s=e.computed(()=>r.fields.filter(a=>a.fieldType==="list").map(a=>({label:a.fieldLabel,value:a.fieldKey})));function n(a){r.element.options.dataSource=a||void 0,o?.recordHistory()}function l(a,i){if(i===void 0)return;const d=r.element.options.tableColWidths,m=o?.maxTableWidth.value??1/0,c=d.reduce((f,g,b)=>b===a?f:f+g,0);if(c+i>m){const f=Math.max(5,Math.round((m-c)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${m}mm,列${a+1} 已调整为 ${f}mm`),d[a]=f}else d[a]=i;E.syncTableElementSize(r.element.options),o?.recordHistory()}return(a,i)=>(e.openBlock(),e.createBlock($e,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[4]||(i[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ur,[i[5]||(i[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:t.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:i[0]||(i[0]=d=>n(d.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,d=>(e.openBlock(),e.createElementBlock("option",{key:d.value,value:d.value},e.toDisplayString(d.label),9,Fr))),128))],40,Ir)]),e.createElementVNode("div",Or,[i[6]||(i[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(de,{modelValue:t.element.options.tableDefaultFontSize,"onUpdate:modelValue":i[1]||(i[1]=d=>t.element.options.tableDefaultFontSize=d),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Hr,[i[7]||(i[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(Ce,{modelValue:t.element.options.tableDefaultColor,"onUpdate:modelValue":i[2]||(i[2]=d=>t.element.options.tableDefaultColor=d)},null,8,["modelValue"])]),e.createElementVNode("div",Wr,[i[8]||(i[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(de,{modelValue:t.element.options.tableDefaultPadding,"onUpdate:modelValue":i[3]||(i[3]=d=>t.element.options.tableDefaultPadding=d),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Gr,[i[9]||(i[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.element.options.tableColWidths,(d,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"col-width-row"},[e.createElementVNode("span",Kr,"列"+e.toDisplayString(m+1),1),e.createVNode(de,{"model-value":d,min:5,max:200,"onUpdate:modelValue":c=>l(m,c)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),Yr=ce(qr,[["__scopeId","data-v-b5fdc7ff"]]),jr={class:"border-row"},Xr={class:"pd-field"},Zr={class:"pd-field"},Jr={class:"pd-field"},Qr=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const r=t;function o(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[3]||(n[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",jr,[e.withDirectives(e.createElementVNode("div",Xr,[n[4]||(n[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(de,{modelValue:t.element.options.borderWidth,"onUpdate:modelValue":n[0]||(n[0]=l=>t.element.options.borderWidth=l),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,o("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",Zr,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(Ce,{modelValue:t.element.options.borderColor,"onUpdate:modelValue":n[1]||(n[1]=l=>t.element.options.borderColor=l)},null,8,["modelValue"])],512),[[e.vShow,o("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",Jr,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ce,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":n[2]||(n[2]=l=>t.element.options.backgroundColor=l)},null,8,["modelValue"])],512),[[e.vShow,o("bb-bg-color")]])],32)]),_:1}))}}),_r=ce(Qr,[["__scopeId","data-v-e0e6d714"]]),es={class:"advanced-row"},ts={class:"pd-field"},os={class:"pd-field"},ns={class:"pd-field"},ls={class:"pd-field"},as=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(t){const r=t;function o(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[4]||(n[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",es,[e.withDirectives(e.createElementVNode("div",ts,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":n[0]||(n[0]=l=>t.element.options.locked=l)},null,512),[[e.vModelCheckbox,t.element.options.locked]])],512),[[e.vShow,o("ad-locked")]]),e.withDirectives(e.createElementVNode("div",os,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":n[1]||(n[1]=l=>t.element.options.fixed=l)},null,512),[[e.vModelCheckbox,t.element.options.fixed]])],512),[[e.vShow,o("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",ns,[n[7]||(n[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(de,{modelValue:t.element.options.zIndex,"onUpdate:modelValue":n[2]||(n[2]=l=>t.element.options.zIndex=l),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,o("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",ls,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:n[3]||(n[3]=l=>s.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,o("ad-delete")]])],32)]),_:1}))}}),is=ce(as,[["__scopeId","data-v-14924be2"]]),rs={key:0,class:"pd-field"},ss=["checked"],ds={class:"pd-field"},cs=["checked"],us={class:"pd-field"},ms=["checked"],Dt=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const r=t,o=e.computed(()=>r.element.printElementType.type==="table"),s=e.computed({get:()=>r.element.options.tablePagination?.enabled??!0,set:()=>{}});function n(c){r.element.options.tablePagination={enabled:c}}const l=e.computed({get:()=>r.element.options.pagination?.pageable??!0,set:()=>{}}),a=e.computed({get:()=>r.element.options.pagination?.keepWithNext??!1,set:()=>{}});function i(c){r.element.options.pagination={pageable:c,keepWithNext:a.value}}function d(c){r.element.options.pagination={pageable:l.value,keepWithNext:c}}function m(c){return r.searching?r.matchedKeys?.has(c)??!0:!0}return(c,f)=>(e.openBlock(),e.createBlock($e,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:f[3]||(f[3]=e.withModifiers(()=>{},["prevent"]))},[o.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",rs,[f[4]||(f[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:s.value,onChange:f[0]||(f[0]=g=>n(g.target.checked))},null,40,ss)],512)),[[e.vShow,m("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",ds,[f[5]||(f[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:l.value,onChange:f[1]||(f[1]=g=>i(g.target.checked))},null,40,cs)],512),[[e.vShow,m("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",us,[f[6]||(f[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:a.value,onChange:f[2]||(f[2]=g=>d(g.target.checked))},null,40,ms)],512),[[e.vShow,m("pg-keep-with-next")]])],64))],32)]),_:1}))}}),ps={class:"image-content-upload"},vs=["disabled"],fs=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(!1),l=e.inject(vt,e.computed(()=>{})),a=e.computed(()=>o.disabled||n.value||!l.value);async function i(d){const m=d.target,c=m.files?.[0];if(c){if(!c.type.startsWith("image/")){alert("仅支持上传图片文件"),m.value="";return}if(!l.value){alert("图片上传能力未配置"),m.value="";return}n.value=!0;try{const f=await l.value(c);f?s("success",f):alert("图片上传失败")}catch(f){alert(f instanceof Error?f.message:"图片上传失败")}finally{n.value=!1,m.value=""}}}return(d,m)=>(e.openBlock(),e.createElementBlock("div",ps,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[m[0]||(m[0]=e.createElementVNode("svg",{class:"pd-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[e.createElementVNode("path",{fill:"currentColor",d:"M12 3l4 4h-3v7h-2V7H8zm-7 12h14v5H5Z"})],-1)),e.createTextVNode(" "+e.toDisplayString(n.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:i},null,40,vs)],2),m[1]||(m[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),gs=ce(fs,[["__scopeId","data-v-b730e8e6"]]),hs={class:"pd-field"},bs=["value"],Es={class:"pd-field"},ys={key:0,class:"pd-field"},ks=["checked"],Vs=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(t){const r=t,o=e.inject(Ge),s=e.computed(()=>r.element.options.tableRows[r.selection.r1]);function n(i){const d=E.setRowType(r.element.options.tableRows,r.selection.r1,i);if(d){alert(d);return}o.recordHistory()}function l(i){i!==void 0&&(s.value.height=i,E.syncTableElementSize(r.element.options),o.recordHistory())}function a(i){E.setHeaderRepeat(r.element.options.tableRows,i),o.recordHistory()}return(i,d)=>(e.openBlock(),e.createBlock($e,{title:"行属性",icon:"Grid","default-expanded":"","group-key":"table-row"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:d[2]||(d[2]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",hs,[d[4]||(d[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:s.value.type,class:"pd-select",style:{width:"100%"},onChange:d[0]||(d[0]=m=>n(m.target.value))},[...d[3]||(d[3]=[e.createElementVNode("option",{value:"header"},"标题行",-1),e.createElementVNode("option",{value:"data"},"数据行",-1),e.createElementVNode("option",{value:"subtotal"},"小计行(每页小计)",-1),e.createElementVNode("option",{value:"summary"},"汇总行",-1)])],40,bs)]),e.createElementVNode("div",Es,[d[5]||(d[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(de,{"model-value":s.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":l},null,8,["model-value"])]),s.value.type==="header"?(e.openBlock(),e.createElementBlock("div",ys,[d[6]||(d[6]=e.createElementVNode("span",{class:"pd-label",title:"多级表头作为一个结构整体重复,勾选后表头区所有行都会在每页顶部重复"},"表头每页重复",-1)),e.createElementVNode("input",{checked:s.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:d[1]||(d[1]=m=>a(!!m.target.checked))},null,40,ks)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),Ns={class:"pd-field"},ws={class:"pd-radio-group",role:"radiogroup"},Cs={class:"pd-radio"},Ss=["checked"],xs={class:"pd-radio"},$s=["checked"],Bs={class:"pd-radio"},Ds=["checked"],Ts={class:"pd-radio"},Ms=["checked"],zs={key:0,class:"pd-field"},As=["value"],Ps={key:1,class:"pd-field"},Rs=["checked"],Ls={key:2,class:"pd-field"},Us={key:3,class:"pd-hint"},Is={key:4,class:"pd-field"},Fs={key:5,class:"pd-field"},Os=["value"],Hs={key:6,class:"pd-hint"},Ws={key:7,class:"pd-field"},Gs=["value"],Ks={key:8,class:"pd-hint"},qs={key:9,class:"pd-field"},Ys=["value"],js={key:10,class:"pd-field"},Xs={key:11,class:"pd-field"},Zs={class:"pd-field"},Js=["value"],Qs={class:"pd-field"},_s={class:"pd-radio-group",role:"radiogroup"},ed={class:"pd-radio"},td=["checked"],od={class:"pd-radio"},nd=["checked"],ld={class:"pd-radio"},ad=["checked"],id={class:"pd-field"},rd={class:"pd-radio-group",role:"radiogroup"},sd={class:"pd-radio"},dd=["checked"],cd={class:"pd-radio"},ud=["checked"],md={class:"pd-radio"},pd=["checked"],vd={class:"cell-style-grid"},fd={class:"pd-field cell-font-field"},gd={class:"pd-field"},hd={class:"pd-field"},bd=["checked"],Ed={class:"pd-field"},yd={class:"pd-field"},kd={class:"border-style-row"},Vd={style:{width:"112px","flex-shrink":"0"}},Nd={class:"pd-button-group border-presets"},wd={class:"pd-checkbox-group"},Cd={class:"pd-checkbox"},Sd={class:"pd-checkbox"},xd={class:"pd-checkbox"},$d={class:"pd-checkbox"},Bd={class:"pd-field"},Dd={class:"pd-field"},Td=["checked"],Md={key:12,class:"pd-field"},zd=["value"],Ad={key:13,class:"pd-field"},Pd={class:"merge-btns"},Rd=["disabled","title"],Ld=["disabled"],Ud=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(t,{expose:r}){const o=t,s=e.inject(Ge),n=e.computed(()=>o.element.options.tableRows),l=e.computed(()=>{const T=E.findMainCell(n.value,o.selection.r1,o.selection.c1);return n.value[T.r].cells[T.c]}),a=e.ref(!1),i=e.ref(""),d=e.computed(()=>l.value.cellType==="barcode"),m=e.computed(()=>l.value.cellType==="qrcode"),c=e.computed(()=>l.value.cellType==="image"),f=e.computed(()=>d.value&&!!l.value.printerDpi),g=e.computed(()=>!d.value&&!m.value&&!c.value),b=e.computed(()=>E.resolveCellTextFit(l.value));function R(T){const u=T.target.value;K(S=>{S.textFit=u})}function w(T){K(u=>{u.align=T})}function v(T){K(u=>{u.valign=T})}function p(T){const u=Number(T);K(S=>{S.printerDpi=u>0?u:void 0})}function B(T){K(u=>{u.cellType=T==="text"?void 0:T,T!=="barcode"&&(u.barcodeType=void 0,u.showBarcodeText=void 0,u.printerDpi=void 0),T!=="qrcode"&&(u.qrCodeLevel=void 0)})}function Q(){i.value=l.value.formatter||"",a.value=!0}function ae(T){K(u=>{u.formatter=T||void 0})}function K(T){const u=o.selection;for(let S=u.r1;S<=u.r2;S++)for(let Y=u.c1;Y<=u.c2;Y++){const Ee=n.value[S].cells[Y];Ee.merged||T(Ee)}s.recordHistory()}const Z=e.ref("solid"),y=e.ref(.75),W=e.ref("#333333"),X=e.ref([]);function U(){return{width:y.value,style:Z.value,color:W.value}}function k(T){E.applyBorderPreset(n.value,o.selection,T,U()),s.recordHistory()}function D(T){const u=T.target,S=new Set(X.value);u.checked?S.add(u.value):S.delete(u.value),X.value=[...S];const Y=U();K(Ee=>{const fe={...Ee.borders??{}};for(const me of["top","right","bottom","left"])S.has(me)?fe[me]={...Y}:delete fe[me];Ee.borders=fe})}const N=e.computed(()=>E.canMergeReason(n.value,o.selection)),F=e.computed(()=>{const T=o.selection;for(let u=T.r1;u<=T.r2;u++)for(let S=T.c1;S<=T.c2;S++){const Y=n.value[u].cells[S];if(!Y.merged&&((Y.rowspan??1)>1||(Y.colspan??1)>1))return!0}return!1});function A(){E.mergeCells(n.value,o.selection),s.recordHistory()}function V(){E.splitCells(n.value,o.selection),s.recordHistory()}return r({openFormatterEditor:Q}),(T,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode($e,{title:"单元格",icon:"Menu","default-expanded":"","group-key":"table-cell"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:u[43]||(u[43]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ns,[u[49]||(u[49]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",ws,[e.createElementVNode("label",Cs,[e.createElementVNode("input",{type:"radio",value:"text",checked:(l.value.cellType||"text")==="text",onChange:u[0]||(u[0]=S=>B(S.target.value))},null,40,Ss),u[45]||(u[45]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",xs,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:l.value.cellType==="barcode",onChange:u[1]||(u[1]=S=>B(S.target.value))},null,40,$s),u[46]||(u[46]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",Bs,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:l.value.cellType==="qrcode",onChange:u[2]||(u[2]=S=>B(S.target.value))},null,40,Ds),u[47]||(u[47]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",Ts,[e.createElementVNode("input",{type:"radio",value:"image",checked:l.value.cellType==="image",onChange:u[3]||(u[3]=S=>B(S.target.value))},null,40,Ms),u[48]||(u[48]=e.createElementVNode("span",null,"图片",-1))])])]),d.value?(e.openBlock(),e.createElementBlock("div",zs,[u[51]||(u[51]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:l.value.barcodeType||"CODE128",class:"pd-select",onChange:u[4]||(u[4]=S=>K(Y=>{Y.barcodeType=S.target.value||void 0}))},[...u[50]||(u[50]=[e.createElementVNode("option",{value:"CODE128"},"CODE128(通用)",-1),e.createElementVNode("option",{value:"EAN13"},"EAN13(商品码)",-1),e.createElementVNode("option",{value:"EAN8"},"EAN8",-1),e.createElementVNode("option",{value:"UPC"},"UPC",-1),e.createElementVNode("option",{value:"CODE39"},"CODE39",-1),e.createElementVNode("option",{value:"ITF14"},"ITF14",-1)])],40,As)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Ps,[u[52]||(u[52]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:l.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:u[5]||(u[5]=S=>K(Y=>{Y.showBarcodeText=!!S.target.checked}))},null,40,Rs)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Ls,[u[53]||(u[53]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(de,{"model-value":l.value.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":u[6]||(u[6]=S=>K(Y=>{Y.barWidth=S}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Us,e.toDisplayString(f.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),1)):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Is,[u[54]||(u[54]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(de,{"model-value":l.value.barFontSize??10,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":u[7]||(u[7]=S=>K(Y=>{Y.barFontSize=S??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Fs,[u[56]||(u[56]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{value:l.value.printerDpi?String(l.value.printerDpi):"",class:"pd-select",onChange:u[8]||(u[8]=S=>p(S.target.value))},[...u[55]||(u[55]=[e.createElementVNode("option",{value:""},"不指定(按条宽渲染)",-1),e.createElementVNode("option",{value:"203"},"203 dpi(8 点/mm)",-1),e.createElementVNode("option",{value:"300"},"300 dpi(11.8 点/mm)",-1),e.createElementVNode("option",{value:"600"},"600 dpi(23.6 点/mm)",-1)])],40,Os)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Hs,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小")):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",Ws,[u[58]||(u[58]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:l.value.qrCodeLevel||"M",class:"pd-select",onChange:u[9]||(u[9]=S=>K(Y=>{Y.qrCodeLevel=S.target.value||void 0}))},[...u[57]||(u[57]=[e.createElementVNode("option",{value:"L"},"L(最低,容量大)",-1),e.createElementVNode("option",{value:"M"},"M(推荐)",-1),e.createElementVNode("option",{value:"Q"},"Q",-1),e.createElementVNode("option",{value:"H"},"H(最高)",-1)])],40,Gs)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Ks,"单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),m.value||c.value?(e.openBlock(),e.createElementBlock("div",qs,[u[60]||(u[60]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:l.value.fit||"contain",class:"pd-select",onChange:u[10]||(u[10]=S=>K(Y=>{Y.fit=S.target.value}))},[...u[59]||(u[59]=[e.createElementVNode("option",{value:"contain"},"包含(保持比例)",-1),e.createElementVNode("option",{value:"cover"},"覆盖(保持比例)",-1),e.createElementVNode("option",{value:"fill"},"拉伸填满",-1),e.createElementVNode("option",{value:"none"},"原始尺寸",-1),e.createElementVNode("option",{value:"scale-down"},"缩小(保持比例)",-1)])],40,Ys)])):e.createCommentVNode("",!0),d.value||m.value||c.value?(e.openBlock(),e.createElementBlock("div",js,[u[61]||(u[61]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(de,{"model-value":l.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[11]||(u[11]=S=>K(Y=>{Y.maxWidth=S??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value||m.value||c.value?(e.openBlock(),e.createElementBlock("div",Xs,[u[62]||(u[62]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(de,{"model-value":l.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[12]||(u[12]=S=>K(Y=>{Y.maxHeight=S??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Zs,[u[63]||(u[63]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:l.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:u[13]||(u[13]=S=>K(Y=>{Y.formatter=S.target.value||void 0})),onDblclick:Q},null,40,Js)]),e.createElementVNode("div",Qs,[u[67]||(u[67]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",_s,[e.createElementVNode("label",ed,[e.createElementVNode("input",{type:"radio",value:"left",checked:l.value.align==="left",onChange:u[14]||(u[14]=S=>w(S.target.value))},null,40,td),u[64]||(u[64]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",od,[e.createElementVNode("input",{type:"radio",value:"center",checked:l.value.align==="center",onChange:u[15]||(u[15]=S=>w(S.target.value))},null,40,nd),u[65]||(u[65]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ld,[e.createElementVNode("input",{type:"radio",value:"right",checked:l.value.align==="right",onChange:u[16]||(u[16]=S=>w(S.target.value))},null,40,ad),u[66]||(u[66]=e.createElementVNode("span",null,"右",-1))])])]),e.createElementVNode("div",id,[u[71]||(u[71]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",rd,[e.createElementVNode("label",sd,[e.createElementVNode("input",{type:"radio",value:"top",checked:l.value.valign==="top",onChange:u[17]||(u[17]=S=>v(S.target.value))},null,40,dd),u[68]||(u[68]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",cd,[e.createElementVNode("input",{type:"radio",value:"middle",checked:l.value.valign==="middle",onChange:u[18]||(u[18]=S=>v(S.target.value))},null,40,ud),u[69]||(u[69]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",md,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:l.value.valign==="bottom",onChange:u[19]||(u[19]=S=>v(S.target.value))},null,40,pd),u[70]||(u[70]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",vd,[e.createElementVNode("div",fd,[u[72]||(u[72]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(ht,{"model-value":l.value.fontFamily,placeholder:"继承默认","onUpdate:modelValue":u[20]||(u[20]=S=>K(Y=>{Y.fontFamily=S}))},null,8,["model-value"])]),e.createElementVNode("div",gd,[u[73]||(u[73]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(de,{"model-value":l.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":u[21]||(u[21]=S=>K(Y=>{Y.fontSize=S??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",hd,[u[74]||(u[74]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:l.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:u[22]||(u[22]=S=>K(Y=>{Y.fontWeight=S.target.checked?"bold":void 0}))},null,40,bd)]),e.createElementVNode("div",Ed,[u[75]||(u[75]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(Ce,{"model-value":l.value.color,"onUpdate:modelValue":u[23]||(u[23]=S=>K(Y=>{Y.color=S}))},null,8,["model-value"])]),e.createElementVNode("div",yd,[u[76]||(u[76]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ce,{"model-value":l.value.backgroundColor,"onUpdate:modelValue":u[24]||(u[24]=S=>K(Y=>{Y.backgroundColor=S}))},null,8,["model-value"])])]),u[87]||(u[87]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",kd,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":u[25]||(u[25]=S=>Z.value=S),style:{width:"90px"}},[...u[77]||(u[77]=[e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1),e.createElementVNode("option",{value:"double"},"双线",-1)])],512),[[e.vModelSelect,Z.value]]),e.createElementVNode("div",Vd,[e.createVNode(de,{modelValue:y.value,"onUpdate:modelValue":u[26]||(u[26]=S=>y.value=S),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(Ce,{modelValue:W.value,"onUpdate:modelValue":u[27]||(u[27]=S=>W.value=S),clearable:!1},null,8,["modelValue"])]),e.createElementVNode("div",Nd,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[28]||(u[28]=S=>k("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[29]||(u[29]=S=>k("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[30]||(u[30]=S=>k("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[31]||(u[31]=S=>k("none"))},"无")]),e.createElementVNode("div",wd,[e.createElementVNode("label",Cd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[32]||(u[32]=S=>X.value=S),value:"top",onChange:u[33]||(u[33]=S=>D(S))},null,544),[[e.vModelCheckbox,X.value]]),u[78]||(u[78]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",Sd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[34]||(u[34]=S=>X.value=S),value:"right",onChange:u[35]||(u[35]=S=>D(S))},null,544),[[e.vModelCheckbox,X.value]]),u[79]||(u[79]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",xd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[36]||(u[36]=S=>X.value=S),value:"bottom",onChange:u[37]||(u[37]=S=>D(S))},null,544),[[e.vModelCheckbox,X.value]]),u[80]||(u[80]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",$d,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[38]||(u[38]=S=>X.value=S),value:"left",onChange:u[39]||(u[39]=S=>D(S))},null,544),[[e.vModelCheckbox,X.value]]),u[81]||(u[81]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",Bd,[u[82]||(u[82]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(de,{"model-value":l.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":u[40]||(u[40]=S=>K(Y=>{Y.padding=S??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",Dd,[u[83]||(u[83]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:l.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:u[41]||(u[41]=S=>K(Y=>{Y.wordWrap=!!S.target.checked}))},null,40,Td)]),g.value?(e.openBlock(),e.createElementBlock("div",Md,[u[85]||(u[85]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:b.value,style:{width:"100%"},onChange:R},[...u[84]||(u[84]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,zd)])):e.createCommentVNode("",!0),g.value&&b.value==="shrink"?(e.openBlock(),e.createElementBlock("div",Ad,[u[86]||(u[86]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(de,{"model-value":l.value.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":u[42]||(u[42]=S=>K(Y=>{Y.shrinkMinFontSize=S??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Pd,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!N.value,title:N.value||"",onClick:A}," 合并单元格 ",8,Rd),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!F.value,onClick:V},"拆分单元格",8,Ld)])],32)]),_:1}),e.createVNode(Qe,{modelValue:a.value,"onUpdate:modelValue":u[44]||(u[44]=S=>a.value=S),fields:t.fields,expression:i.value,"onUpdate:expression":ae},null,8,["modelValue","fields","expression"])],64))}}),Id=ce(Ud,[["__scopeId","data-v-8a66df60"]]),Fd={class:"watermark-config"},Od={class:"pd-field"},Hd={key:0,class:"pd-field"},Wd={class:"pd-field"},Gd={class:"pd-hint"},Kd={class:"pd-field"},qd={class:"pd-field"},Yd={class:"pd-hint"},jd={class:"pd-field"},Xd=["value"],Zd={class:"pd-field"},Jd=["min"],Qd={class:"pd-field"},_d=["min"],ec=e.defineComponent({__name:"WatermarkConfig",props:{modelValue:{},fields:{}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=be.WATERMARK_DENSITY_PRESETS,l=be.WATERMARK_DEFAULTS.minTileWidth,a=be.WATERMARK_DEFAULTS.minTileHeight;function i(Z){const y=Z.trim();return y?/[{}]/.test(y)||/^[A-Za-z_$][\w$]*\s*\(/.test(y)?!0:/^[A-Za-z_$][\w$]*(\.[\w$]+)+$/.test(y):!1}function d(Z){return Z?Z.mode==="binding"?Z.binding??"":Z.content??"":""}const m=e.ref(d(o.modelValue)),c=e.ref(o.modelValue?.testData||""),f=e.ref(!1),g=e.ref(o.modelValue?.mode==="binding"?"binding":"fixed"),b=e.reactive({rotate:o.modelValue?.rotate??be.WATERMARK_DEFAULTS.rotate,color:o.modelValue?.color||be.WATERMARK_DEFAULTS.color,opacity:o.modelValue?.opacity??be.WATERMARK_DEFAULTS.opacity,tileWidth:o.modelValue?.tileWidth??be.WATERMARK_DEFAULTS.tileWidth,tileHeight:o.modelValue?.tileHeight??be.WATERMARK_DEFAULTS.tileHeight}),R=e.computed(()=>g.value==="binding");e.watch(()=>o.modelValue,Z=>{Z&&(m.value=d(Z),g.value=Z.mode==="binding"?"binding":"fixed",c.value=Z.testData||"",b.rotate=Z.rotate??be.WATERMARK_DEFAULTS.rotate,b.color=Z.color||be.WATERMARK_DEFAULTS.color,b.opacity=Z.opacity??be.WATERMARK_DEFAULTS.opacity,b.tileWidth=Z.tileWidth??be.WATERMARK_DEFAULTS.tileWidth,b.tileHeight=Z.tileHeight??be.WATERMARK_DEFAULTS.tileHeight)},{deep:!0});const w=e.computed({get(){const{tileWidth:Z,tileHeight:y}=b;for(const[W,X]of Object.entries(n))if(Z===X.width&&y===X.height)return W;return"custom"},set(Z){const y=n[Z];y&&(b.tileWidth=y.width,b.tileHeight=y.height)}});function v(){g.value=i(m.value)?"binding":"fixed",K()}function p(){v()}function B(){f.value=!0}function Q(Z){m.value=Z,v()}function ae(Z){b.color=Z,K()}function K(){const Z={testData:c.value,rotate:b.rotate,color:b.color,opacity:b.opacity,tileWidth:b.tileWidth,tileHeight:b.tileHeight};s("update:modelValue",g.value==="binding"?{...Z,mode:"binding",binding:m.value,content:""}:{...Z,mode:"fixed",content:m.value,binding:""})}return(Z,y)=>(e.openBlock(),e.createElementBlock("div",Fd,[y[18]||(y[18]=e.createElementVNode("h3",{class:"pd-divider"},"水印",-1)),e.createElementVNode("form",{class:"pd-form",onSubmit:y[8]||(y[8]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Od,[y[9]||(y[9]=e.createElementVNode("span",{class:"pd-label"},"水印表达式",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":y[0]||(y[0]=W=>m.value=W),placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onInput:p,onDblclick:B},null,544),[[e.vModelText,m.value]]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:B},"编辑表达式")]),R.value?(e.openBlock(),e.createElementBlock("div",Hd,[y[10]||(y[10]=e.createElementVNode("span",{class:"pd-label"},"测试值",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":y[1]||(y[1]=W=>c.value=W),placeholder:"表达式取不到值时预览显示",onInput:K},null,544),[[e.vModelText,c.value]])])):e.createCommentVNode("",!0),e.createVNode(Qe,{modelValue:f.value,"onUpdate:modelValue":y[2]||(y[2]=W=>f.value=W),fields:t.fields,expression:m.value,"onUpdate:expression":Q},null,8,["modelValue","fields","expression"]),e.createElementVNode("div",Wd,[y[11]||(y[11]=e.createElementVNode("span",{class:"pd-label"},"旋转角度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":y[3]||(y[3]=W=>b.rotate=W),min:-90,max:90,step:5,onChange:K},null,544),[[e.vModelText,b.rotate,void 0,{number:!0}]]),e.createElementVNode("span",Gd,e.toDisplayString(b.rotate)+"°",1)]),e.createElementVNode("div",Kd,[y[12]||(y[12]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ce,{"model-value":b.color,"onUpdate:modelValue":ae},null,8,["model-value"])]),e.createElementVNode("div",qd,[y[13]||(y[13]=e.createElementVNode("span",{class:"pd-label"},"透明度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":y[4]||(y[4]=W=>b.opacity=W),min:.05,max:.5,step:.05,onChange:K},null,544),[[e.vModelText,b.opacity,void 0,{number:!0}]]),e.createElementVNode("span",Yd,e.toDisplayString(b.opacity.toFixed(2)),1)]),e.createElementVNode("div",jd,[y[15]||(y[15]=e.createElementVNode("span",{class:"pd-label"},"密度",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":y[5]||(y[5]=W=>w.value=W),style:{width:"100%"},onChange:K},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),(W,X)=>(e.openBlock(),e.createElementBlock("option",{key:X,value:X},e.toDisplayString(W.label)+"("+e.toDisplayString(W.width)+"×"+e.toDisplayString(W.height)+")",9,Xd))),128)),y[14]||(y[14]=e.createElementVNode("option",{value:"custom"},"自定义",-1))],544),[[e.vModelSelect,w.value]])]),w.value==="custom"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Zd,[y[16]||(y[16]=e.createElementVNode("span",{class:"pd-label"},"瓦片宽",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":y[6]||(y[6]=W=>b.tileWidth=W),min:e.unref(l),step:10,onChange:K},null,40,Jd),[[e.vModelText,b.tileWidth,void 0,{number:!0}]])]),e.createElementVNode("div",Qd,[y[17]||(y[17]=e.createElementVNode("span",{class:"pd-label"},"瓦片高",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":y[7]||(y[7]=W=>b.tileHeight=W),min:e.unref(a),step:10,onChange:K},null,40,_d),[[e.vModelText,b.tileHeight,void 0,{number:!0}]])])],64)):e.createCommentVNode("",!0)],32)]))}}),tc=ce(ec,[["__scopeId","data-v-b55bfc50"]]),oc={class:"design-background-config"},nc=["title"],lc={class:"design-background-actions"},ac=["disabled"],ic=e.defineComponent({__name:"DesignBackgroundConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(!1),l=e.inject(ft,e.computed(()=>{})),a=e.computed(()=>n.value||!l.value),i=e.computed(()=>o.modelValue?.rotation??0);async function d(f){const g=f.target,b=g.files?.[0];if(b){if(!b.type.startsWith("image/")){alert("仅支持上传图片文件"),g.value="";return}if(!l.value){alert("设计背景上传能力未配置"),g.value="";return}n.value=!0;try{const R=await l.value(b);R?s("update:modelValue",{src:R,rotation:0}):alert("设计背景上传失败")}catch(R){alert(R instanceof Error?R.message:"设计背景上传失败")}finally{n.value=!1,g.value=""}}}function m(){if(!o.modelValue?.src)return;const f=(i.value+90)%360;s("update:modelValue",{src:o.modelValue.src,rotation:f})}function c(){s("update:modelValue",void 0)}return(f,g)=>(e.openBlock(),e.createElementBlock("div",oc,[g[0]||(g[0]=e.createElementVNode("h3",{class:"pd-divider"},"设计背景",-1)),g[1]||(g[1]=e.createElementVNode("p",{class:"design-background-tip"},"仅设计器显示,用于套打定位,不会出现在预览和打印中",-1)),t.modelValue?.src?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"design-background-path",title:t.modelValue.src},e.toDisplayString(t.modelValue.src),9,nc),e.createElementVNode("div",lc,[e.createElementVNode("button",{type:"button",class:"pd-button small rotate-btn",onClick:m}," 旋转("+e.toDisplayString(i.value)+"°) ",1),e.createElementVNode("button",{type:"button",class:"pd-button small remove-btn",onClick:c},"移除")])],64)):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[e.createTextVNode(e.toDisplayString(n.value?"上传中...":"上传背景图")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:d},null,40,ac)],2))]))}}),rc=ce(ic,[["__scopeId","data-v-3f4d2e32"]]),sc={class:"tiling-config","data-test":"tiling-config"},dc={class:"pd-field"},cc={class:"tiling-switch"},uc=["checked","disabled"],mc={key:0,class:"pd-hint tiling-error"},pc={class:"pd-field"},vc=["value"],fc=["value"],gc={key:0,class:"pd-field"},hc={class:"custom-size-grid"},bc={key:1,class:"pd-field"},Ec={class:"pd-radio-group",role:"radiogroup"},yc={class:"pd-radio"},kc=["checked"],Vc={class:"pd-radio"},Nc=["checked"],wc={class:"margin-grid"},Cc={class:"pd-field"},Sc={class:"pd-field"},xc={class:"pd-field"},$c={class:"pd-field"},Bc={class:"pd-field"},Dc={class:"pd-field"},Tc={class:"pd-field"},Mc={key:2,class:"pd-hint tiling-summary"},zc=e.defineComponent({__name:"TilingConfig",props:{modelValue:{},templateData:{}},emits:["update:modelValue"],setup(t,{emit:r}){const o=t,s=r,n=Object.keys(E.PAPER_PRESETS).filter(v=>v!=="CUSTOM"&&!E.PAPER_PRESETS[v]?.continuous),l=e.computed(()=>E.isContinuousPaperSize(o.templateData?.paperSize)),a=e.computed(()=>({...be.TILE_DEFAULTS,...o.modelValue??{},enabled:o.modelValue?.enabled??!1,sheetMargin:{...be.TILE_DEFAULTS.sheetMargin,...o.modelValue?.sheetMargin??{}}})),i=e.computed(()=>o.templateData?{...o.templateData,tiling:a.value}:void 0),d=e.computed(()=>i.value?be.validateTiling(i.value):[]),m=e.computed(()=>{const v=i.value;return v?Math.max(be.computeMaxColumns(v),1):1}),c=e.computed(()=>{const v=i.value;if(!(!v||d.value.length))try{return be.computeTileLayout(v)}catch{return}}),f=e.computed(()=>{const v=c.value,p=i.value;if(!v||!p)return"";const B=be.resolveSheetMm(p),Q=a.value.sheetPaperSize==="CUSTOM"?"自定义":a.value.sheetPaperSize??"A4",ae=a.value.sheetPaperSize==="CUSTOM"?"":a.value.sheetOrientation==="landscape"?" 横向":" 纵向";return`目标纸 ${Q}${ae} ${B.width}×${B.height}mm · ${v.columns} 列 × ${v.rows} 行 = 每张 ${v.perSheet} 格`});function g(v){s("update:modelValue",{...a.value,...v})}function b(v,p){g({sheetMargin:{...a.value.sheetMargin,[v]:p??0}})}function R(v){if(v!=="CUSTOM"){g({sheetPaperSize:v});return}const p=i.value,B=p?be.resolveSheetMm(p):{width:210,height:297};g({sheetPaperSize:"CUSTOM",sheetCustomWidth:a.value.sheetCustomWidth??B.width,sheetCustomHeight:a.value.sheetCustomHeight??B.height})}function w(v){if(!v){g({enabled:!1});return}const p=m.value,B=p>=1?Math.min(be.TILE_DEFAULTS.columns,p):1;g({...be.TILE_DEFAULTS,columns:B})}return(v,p)=>(e.openBlock(),e.createElementBlock("div",sc,[p[30]||(p[30]=e.createElementVNode("h3",{class:"pd-divider"},"拼版打印",-1)),p[31]||(p[31]=e.createElementVNode("p",{class:"pd-hint"},"把标签按「列 × 行」铺到一张大纸上批量打印",-1)),e.createElementVNode("div",dc,[e.createElementVNode("label",cc,[e.createElementVNode("input",{type:"checkbox",checked:a.value.enabled,disabled:l.value,onChange:p[0]||(p[0]=B=>w(B.target.checked))},null,40,uc),p[13]||(p[13]=e.createElementVNode("span",null,"启用拼版",-1))]),l.value?(e.openBlock(),e.createElementBlock("p",mc,"连续纸不支持拼版")):e.createCommentVNode("",!0)]),a.value.enabled&&!l.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",pc,[p[15]||(p[15]=e.createElementVNode("span",{class:"pd-label"},"目标纸张",-1)),e.createElementVNode("select",{class:"pd-select",style:{width:"100%"},value:a.value.sheetPaperSize??"A4",onChange:p[1]||(p[1]=B=>R(B.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),B=>(e.openBlock(),e.createElementBlock("option",{key:B,value:B},e.toDisplayString(e.unref(E.PAPER_PRESETS)[B]?.label??B),9,fc))),128)),p[14]||(p[14]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,vc)]),a.value.sheetPaperSize==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",gc,[p[17]||(p[17]=e.createElementVNode("span",{class:"pd-label"},"目标纸宽高 (mm)",-1)),e.createElementVNode("div",hc,[e.createVNode(de,{"model-value":a.value.sheetCustomWidth,min:25,max:2e3,"onUpdate:modelValue":p[2]||(p[2]=B=>g({sheetCustomWidth:B}))},null,8,["model-value"]),p[16]||(p[16]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(de,{"model-value":a.value.sheetCustomHeight,min:25,max:2e3,"onUpdate:modelValue":p[3]||(p[3]=B=>g({sheetCustomHeight:B}))},null,8,["model-value"])])])):(e.openBlock(),e.createElementBlock("div",bc,[p[20]||(p[20]=e.createElementVNode("span",{class:"pd-label"},"目标纸方向",-1)),e.createElementVNode("div",Ec,[e.createElementVNode("label",yc,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:(a.value.sheetOrientation??"portrait")==="portrait",onChange:p[4]||(p[4]=B=>g({sheetOrientation:"portrait"}))},null,40,kc),p[18]||(p[18]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",Vc,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:a.value.sheetOrientation==="landscape",onChange:p[5]||(p[5]=B=>g({sheetOrientation:"landscape"}))},null,40,Nc),p[19]||(p[19]=e.createElementVNode("span",null,"横向",-1))])])])),p[28]||(p[28]=e.createElementVNode("h3",{class:"pd-divider"},"拼版留白 (mm)",-1)),e.createElementVNode("div",wc,[e.createElementVNode("div",Cc,[p[21]||(p[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.top,min:0,max:100,"onUpdate:modelValue":p[6]||(p[6]=B=>b("top",B))},null,8,["model-value"])]),e.createElementVNode("div",Sc,[p[22]||(p[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.bottom,min:0,max:100,"onUpdate:modelValue":p[7]||(p[7]=B=>b("bottom",B))},null,8,["model-value"])]),e.createElementVNode("div",xc,[p[23]||(p[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.left,min:0,max:100,"onUpdate:modelValue":p[8]||(p[8]=B=>b("left",B))},null,8,["model-value"])]),e.createElementVNode("div",$c,[p[24]||(p[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.right,min:0,max:100,"onUpdate:modelValue":p[9]||(p[9]=B=>b("right",B))},null,8,["model-value"])])]),p[29]||(p[29]=e.createElementVNode("h3",{class:"pd-divider"},"格间距与列数",-1)),e.createElementVNode("div",Bc,[p[25]||(p[25]=e.createElementVNode("span",{class:"pd-label"},"横向间距",-1)),e.createVNode(de,{"model-value":a.value.gapX,min:0,max:50,"onUpdate:modelValue":p[10]||(p[10]=B=>g({gapX:B??0}))},null,8,["model-value"])]),e.createElementVNode("div",Dc,[p[26]||(p[26]=e.createElementVNode("span",{class:"pd-label"},"纵向间距",-1)),e.createVNode(de,{"model-value":a.value.gapY,min:0,max:50,"onUpdate:modelValue":p[11]||(p[11]=B=>g({gapY:B??0}))},null,8,["model-value"])]),e.createElementVNode("div",Tc,[p[27]||(p[27]=e.createElementVNode("span",{class:"pd-label"},"列数",-1)),e.createVNode(de,{"model-value":a.value.columns,min:1,max:m.value,"onUpdate:modelValue":p[12]||(p[12]=B=>g({columns:B??1}))},null,8,["model-value","max"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,B=>(e.openBlock(),e.createElementBlock("p",{key:B.code,class:"pd-hint tiling-error"},e.toDisplayString(B.message),1))),128)),!d.value.length&&f.value?(e.openBlock(),e.createElementBlock("p",Mc,e.toDisplayString(f.value),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]))}}),Ac=ce(zc,[["__scopeId","data-v-aa278268"]]),Pc={key:0,class:"prop-collapsed"},Rc={class:"prop-head"},Lc={class:"pd-tabs prop-tabs"},Uc={class:"pd-tab-bar",role:"tablist"},Ic={class:"pd-tab-pane",role:"tabpanel"},Fc={class:"property-content"},Oc={key:1,class:"pd-empty"},Hc={class:"pd-tab-pane",role:"tabpanel"},Wc={class:"pd-field"},Gc=["value"],Kc=["label"],qc=["value"],Yc={key:0,class:"pd-hint"},jc={key:1,class:"pd-field"},Xc={class:"pd-label"},Zc={class:"custom-size-grid"},Jc={key:2,class:"pd-field"},Qc={class:"pd-radio-group",role:"radiogroup"},_c={class:"pd-radio"},eu=["checked"],tu={class:"pd-radio"},ou=["checked"],nu={key:3,class:"pd-field"},lu={class:"pd-radio-group pd-radio-group--2col",role:"radiogroup"},au={class:"pd-radio"},iu=["checked"],ru={class:"pd-radio"},su=["checked"],du={class:"pd-radio"},cu=["checked"],uu={class:"pd-radio"},mu=["checked"],pu={class:"pd-field"},vu={class:"page-bg-row"},fu={key:5,class:"pd-hint"},gu={class:"margin-grid"},hu={class:"pd-field"},bu={class:"pd-field"},Eu={class:"pd-field"},yu={class:"pd-field"},ku={class:"pd-field"},Vu={class:"pd-field"},Nu={class:"pd-field"},wu=e.defineComponent({__name:"PropertyPanel",props:{element:{},templateData:{},fields:{},activeTab:{},tableSelection:{},recordHistory:{type:Function},collapsed:{type:Boolean},multiPage:{type:Boolean}},emits:["delete-element","update:templateData","update:activeTab","toggle-collapse"],setup(t,{emit:r}){const o=t,s=r,n=e.computed(()=>{const O=[];for(const[z,te]of Object.entries(E.PAPER_PRESETS)){if(o.multiPage&&E.isContinuousPaperSize(z))continue;const pe=te.group??"其他";let ke=O.find(Ve=>Ve.group===pe);ke||(ke={group:pe,items:[]},O.push(ke)),ke.items.push({key:z,label:te.label??z})}return O}),l=e.ref(""),a=e.computed(()=>o.element?["text","longText"].includes(o.element.printElementType.type):!1),i=e.computed(()=>o.element?o.element.printElementType.type==="image":!1),d=e.computed(()=>o.element?["barcode","qrcode"].includes(o.element.printElementType.type):!1),m=e.computed(()=>!o.element||o.element.printElementType.type!=="table"?!1:!!o.tableSelection&&o.tableSelection.elementId===o.element.id),c=e.computed(()=>o.element?o.element.printElementType.type==="table":!1),f=e.computed(()=>E.searchProperties(l.value)),g=e.computed(()=>f.value.groups),b=e.computed(()=>f.value.itemKeys),R=e.computed(()=>!!l.value.trim()),w=e.computed(()=>{if(!o.element)return[];if(o.element.printElementType.type==="table"&&o.tableSelection){const{r1:O,c1:z}=o.tableSelection,te=o.element.options.tableRows;if(te&&te[O]){const pe=te[O],ke=o.element.options.fields?.[0]?.dataSource;return E.getTableCellBindings(pe.type,O,z,ke)}}return E.getElementBindings(o.element)});function v(O){return O.split(".").flatMap(z=>{const te=z.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!te)return[z];const pe=te[1],ke=[...te[2].matchAll(/\[(\d+)\]/g)].map(Ve=>Number(Ve[1]));return[pe,...ke]})}function p(O){return o.element?v(O).reduce((pe,ke)=>pe==null?"":pe[ke],o.element)??"":""}function B(O,z){if(!o.element)return;const te=v(O),pe=te.pop(),ke=te.reduce((Ve,De)=>((Ve[De]===void 0||Ve[De]===null)&&(Ve[De]={}),Ve[De]),o.element);ke[pe]=z||void 0,o.recordHistory?.()}function Q(O){l.value=O}function ae(O){o.element&&B("options.src",O)}const K=e.computed(()=>o.templateData?.paperSize||"A4"),Z=e.computed(()=>!o.multiPage&&E.isContinuousPaperSize(K.value)),y=e.computed(()=>E.isLabelPaperSize(K.value)),W=e.computed(()=>o.templateData?.orientation||"portrait"),X=e.computed(()=>!!o.templateData?.tiling?.enabled),U=e.computed(()=>o.templateData?.outputRotation??0),k=e.computed({get:()=>o.templateData?.pageBackground||"#ffffff",set:O=>h(O)}),D=e.computed(()=>o.templateData?.margins.top??10),N=e.computed(()=>o.templateData?.margins.bottom??10),F=e.computed(()=>o.templateData?.margins.left??10),A=e.computed(()=>o.templateData?.margins.right??10),V=e.computed(()=>o.templateData?.header.height??10),T=e.computed(()=>o.templateData?.footer.height??10),u=e.computed(()=>o.templateData?.firstPageOverlay.height??0),S=e.computed(()=>o.templateData?.customWidth??E.PAPER_PRESETS[K.value]?.width??210),Y=e.computed(()=>o.templateData?.customHeight??297),Ee=e.computed(()=>o.templateData?.designBackground);function fe(O){if(o.templateData){if(!O){const z={...o.templateData};delete z.designBackground,s("update:templateData",z);return}L({designBackground:O})}}const me=e.computed(()=>o.templateData?.watermark??{});function ge(O){L({watermark:O})}function L(O){if(!o.templateData)return;const z={...o.templateData,...O};s("update:templateData",z)}function x(O){if(o.templateData){if(E.isContinuousPaperSize(O)){L({paperSize:O,customWidth:O==="CONTINUOUS"?o.templateData?.customWidth??80:void 0,orientation:"portrait",margins:{...o.templateData.margins,bottom:o.templateData?.margins.bottom??0}});return}if(O==="CUSTOM"){L({paperSize:"CUSTOM"});return}if(E.PAPER_PRESETS[O]){if(E.isLabelPaperSize(O)){L({paperSize:O,...E.labelPaperDefaults(o.templateData)});return}L({paperSize:O})}}}function $(O){L({orientation:String(O)})}function G(O){L({outputRotation:Number(O)})}function h(O){const z=O&&O.toLowerCase()!=="#ffffff"&&O.toLowerCase()!=="#fff"?O:void 0;L(z===void 0?{pageBackground:void 0}:{pageBackground:z})}function C(){L({pageBackground:void 0})}function M(O){O!==void 0&&L({customWidth:O})}function ee(O){O!==void 0&&L({customHeight:O})}function oe(O){O!==void 0&&L({margins:{...o.templateData.margins,top:O}})}function ie(O){O!==void 0&&L({margins:{...o.templateData.margins,bottom:O}})}function ve(O){O!==void 0&&L({margins:{...o.templateData.margins,left:O}})}function P(O){O!==void 0&&L({margins:{...o.templateData.margins,right:O}})}function H(O){O!==void 0&&L({header:{...o.templateData.header,height:O}})}function j(O){O!==void 0&&L({footer:{...o.templateData.footer,height:O}})}function ne(O){O!==void 0&&L({firstPageOverlay:{...o.templateData.firstPageOverlay,height:O}})}const _=e.computed(()=>o.activeTab||"page");function he(O){s("update:activeTab",O),s("toggle-collapse")}return(O,z)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",Pc,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:z[0]||(z[0]=te=>he(_.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:_.value==="element"}]),title:"元素属性",onClick:z[1]||(z[1]=te=>he("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:_.value==="page"}]),title:"页面属性",onClick:z[2]||(z[2]=te=>he("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Rc,[z[18]||(z[18]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:z[3]||(z[3]=te=>O.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",Lc,[e.createElementVNode("div",Uc,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="element"}]),onClick:z[4]||(z[4]=te=>O.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="page"}]),onClick:z[5]||(z[5]=te=>O.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",Ic,[t.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(qa,{onSearch:Q}),e.createElementVNode("div",Fc,[g.value.includes("position-size")&&!m.value?(e.openBlock(),e.createBlock(li,{key:0,element:t.element,"matched-keys":b.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("appearance")?(e.openBlock(),e.createBlock(Di,{key:1,element:t.element,"is-text-type":a.value,"matched-keys":b.value,searching:R.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("code")&&d.value?(e.openBlock(),e.createBlock(Yi,{key:2,element:t.element,"matched-keys":b.value,searching:R.value,onChange:z[6]||(z[6]=te=>t.recordHistory?.())},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("binding")?(e.openBlock(),e.createBlock($e,{key:3,title:"内容",icon:"Document","default-expanded":"","group-key":"binding"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,te=>(e.openBlock(),e.createBlock(Lr,{key:te.targetPath,descriptor:te,fields:t.fields,"model-value":p(te.targetPath),"onUpdate:modelValue":pe=>B(te.targetPath,pe)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),i.value?(e.openBlock(),e.createBlock(gs,{key:0,onSuccess:ae})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),c.value&&t.tableSelection&&t.tableSelection.elementId===t.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createVNode(Vs,{element:t.element,selection:t.tableSelection},null,8,["element","selection"]),e.createVNode(Id,{element:t.element,selection:t.tableSelection,fields:t.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),c.value&&g.value.includes("content")?(e.openBlock(),e.createBlock(Yr,{key:5,element:t.element,fields:t.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),g.value.includes("border-bg")?(e.openBlock(),e.createBlock(_r,{key:6,element:t.element,"matched-keys":b.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&c.value?(e.openBlock(),e.createBlock(Dt,{key:7,element:t.element,"matched-keys":b.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&!c.value?(e.openBlock(),e.createBlock(Dt,{key:8,element:t.element,"matched-keys":b.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("advanced")?(e.openBlock(),e.createBlock(is,{key:9,element:t.element,"matched-keys":b.value,searching:R.value,onDeleteElement:z[7]||(z[7]=te=>O.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",Oc,"请在画布中选择一个元素"))],512),[[e.vShow,(t.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",Hc,[e.createElementVNode("form",{class:"pd-form",onSubmit:z[17]||(z[17]=e.withModifiers(()=>{},["prevent"]))},[z[40]||(z[40]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",Wc,[z[20]||(z[20]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:K.value,class:"pd-select",onChange:z[8]||(z[8]=te=>x(te.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,te=>(e.openBlock(),e.createElementBlock("optgroup",{key:te.group,label:te.group},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.items,pe=>(e.openBlock(),e.createElementBlock("option",{key:pe.key,value:pe.key},e.toDisplayString(pe.label),9,qc))),128))],8,Kc))),128)),z[19]||(z[19]=e.createElementVNode("option",{value:"CUSTOM"},"自定义宽高",-1))],40,Gc)]),y.value?(e.openBlock(),e.createElementBlock("p",Yc,"标签纸默认整张给内容区:已取消页边距与页眉页脚,可在下方自行改回")):e.createCommentVNode("",!0),Z.value||K.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",jc,[e.createElementVNode("span",Xc,e.toDisplayString(Z.value?"纸宽 (mm)":"自定义宽高 (mm)"),1),e.createElementVNode("div",Zc,[e.createVNode(de,{"model-value":S.value,min:25,max:2e3,"onUpdate:modelValue":M},null,8,["model-value"]),K.value==="CUSTOM"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[z[21]||(z[21]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(de,{"model-value":Y.value,min:25,max:2e3,"onUpdate:modelValue":ee},null,8,["model-value"])],64)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),Z.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Jc,[z[24]||(z[24]=e.createElementVNode("span",{class:"pd-label"},"纸张方向",-1)),e.createElementVNode("div",Qc,[e.createElementVNode("label",_c,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:W.value==="portrait",onChange:z[9]||(z[9]=te=>$(te.target.value))},null,40,eu),z[22]||(z[22]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",tu,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:W.value==="landscape",onChange:z[10]||(z[10]=te=>$(te.target.value))},null,40,ou),z[23]||(z[23]=e.createElementVNode("span",null,"横向",-1))])]),z[25]||(z[25]=e.createElementVNode("p",{class:"pd-hint"},"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)",-1))])),!Z.value&&!X.value?(e.openBlock(),e.createElementBlock("div",nu,[z[30]||(z[30]=e.createElementVNode("span",{class:"pd-label"},"内容旋转角度",-1)),e.createElementVNode("div",lu,[e.createElementVNode("label",au,[e.createElementVNode("input",{type:"radio",value:"0",checked:U.value===0,onChange:z[11]||(z[11]=te=>G(te.target.value))},null,40,iu),z[26]||(z[26]=e.createElementVNode("span",null,"0°",-1))]),e.createElementVNode("label",ru,[e.createElementVNode("input",{type:"radio",value:"90",checked:U.value===90,onChange:z[12]||(z[12]=te=>G(te.target.value))},null,40,su),z[27]||(z[27]=e.createElementVNode("span",null,"90°",-1))]),e.createElementVNode("label",du,[e.createElementVNode("input",{type:"radio",value:"180",checked:U.value===180,onChange:z[13]||(z[13]=te=>G(te.target.value))},null,40,cu),z[28]||(z[28]=e.createElementVNode("span",null,"180°",-1))]),e.createElementVNode("label",uu,[e.createElementVNode("input",{type:"radio",value:"270",checked:U.value===270,onChange:z[14]||(z[14]=te=>G(te.target.value))},null,40,mu),z[29]||(z[29]=e.createElementVNode("span",null,"270°",-1))])]),z[31]||(z[31]=e.createElementVNode("p",{class:"pd-hint"},"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)",-1))])):e.createCommentVNode("",!0),e.createElementVNode("div",pu,[z[32]||(z[32]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",vu,[e.createVNode(Ce,{modelValue:k.value,"onUpdate:modelValue":z[15]||(z[15]=te=>k.value=te),class:"page-bg-picker"},null,8,["modelValue"]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:C},"默认")])]),e.createVNode(rc,{"model-value":Ee.value,"onUpdate:modelValue":fe},null,8,["model-value"]),t.multiPage?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Ac,{key:4,"model-value":t.templateData?.tiling,"template-data":t.templateData,"onUpdate:modelValue":z[16]||(z[16]=te=>L({tiling:te}))},null,8,["model-value","template-data"])),z[41]||(z[41]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),Z.value?(e.openBlock(),e.createElementBlock("p",fu,"底部边距即连续纸走纸留白")):e.createCommentVNode("",!0),e.createElementVNode("div",gu,[e.createElementVNode("div",hu,[z[33]||(z[33]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(de,{"model-value":D.value,min:0,max:50,"onUpdate:modelValue":oe},null,8,["model-value"])]),e.createElementVNode("div",bu,[z[34]||(z[34]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(de,{"model-value":N.value,min:0,max:100,"onUpdate:modelValue":ie},null,8,["model-value"])]),e.createElementVNode("div",Eu,[z[35]||(z[35]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(de,{"model-value":F.value,min:0,max:50,"onUpdate:modelValue":ve},null,8,["model-value"])]),e.createElementVNode("div",yu,[z[36]||(z[36]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(de,{"model-value":A.value,min:0,max:50,"onUpdate:modelValue":P},null,8,["model-value"])])]),z[42]||(z[42]=e.createElementVNode("h3",{class:"pd-divider"},"三区高度 (mm)",-1)),e.createElementVNode("div",ku,[z[37]||(z[37]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(de,{"model-value":V.value,min:0,max:100,step:.1,"onUpdate:modelValue":H},null,8,["model-value"])]),e.createElementVNode("div",Vu,[z[38]||(z[38]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(de,{"model-value":T.value,min:0,max:100,step:.1,"onUpdate:modelValue":j},null,8,["model-value"])]),e.createElementVNode("div",Nu,[z[39]||(z[39]=e.createElementVNode("span",{class:"pd-label"},"首页叠加高度",-1)),e.createVNode(de,{"model-value":u.value,min:0,max:200,"onUpdate:modelValue":ne},null,8,["model-value"])])],32),e.createVNode(tc,{"model-value":me.value,fields:t.fields,"onUpdate:modelValue":ge},null,8,["model-value","fields"])],512),[[e.vShow,(t.activeTab||"page")==="page"]])])],64))],2))}}),Cu=ce(wu,[["__scopeId","data-v-f7152fc4"]]),Su={class:"status-bar"},xu={key:0,class:"status-item coord"},$u={class:"status-item"},Bu={class:"status-item"},Du={class:"status-item status-paper"},Tu=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(t){return(r,o)=>(e.openBlock(),e.createElementBlock("div",Su,[t.coordinate?(e.openBlock(),e.createElementBlock("span",xu," x:"+e.toDisplayString(t.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(t.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",$u,"缩放 "+e.toDisplayString(t.scale)+"%",1),e.createElementVNode("span",Bu,"元素 "+e.toDisplayString(t.elementCount)+e.toDisplayString(t.selectedCount?` (选中 ${t.selectedCount})`:""),1),e.createElementVNode("span",{class:e.normalizeClass(["status-dirty",{on:t.dirty}])},[o[0]||(o[0]=e.createElementVNode("span",{class:"dirty-dot"},null,-1)),e.createTextVNode(e.toDisplayString(t.dirty?"未保存":"已保存"),1)],2),e.createElementVNode("span",Du,e.toDisplayString(t.paper),1)]))}}),Mu=ce(Tu,[["__scopeId","data-v-a91952ff"]]),zu={id:"getting-started",title:"快速入门",content:`
|
|
2
2
|
<h2>界面布局</h2>
|
|
3
3
|
<p>打印模板设计器采用三栏布局:</p>
|
|
4
4
|
<ul>
|
|
@@ -399,6 +399,18 @@
|
|
|
399
399
|
<p><strong>提示</strong>:水印配置保存在模板 JSON 的 <code>watermark</code> 字段中,仅对当前模板生效。</p>
|
|
400
400
|
</blockquote>
|
|
401
401
|
`},Lu={id:"changelog",title:"更新记录",content:`
|
|
402
|
+
<h2>v1.3.4 <small>2026-09-27</small></h2>
|
|
403
|
+
|
|
404
|
+
<h3>修复</h3>
|
|
405
|
+
<ul>
|
|
406
|
+
<li><strong>页脚打印位置与设计台一致</strong>:此前页脚内容打印或导出 PDF 时会整体左移一个「左边距」的宽度(设计台上看着正常)。现在浏览器打印、服务端 PDF、桌面客户端静默打印三条出纸方式都与设计台所见一致,纸张旋转出纸与连续纸同样生效。</li>
|
|
407
|
+
</ul>
|
|
408
|
+
|
|
409
|
+
<h3>注意</h3>
|
|
410
|
+
<ul>
|
|
411
|
+
<li>如果此前为补偿这个偏移、手动把页脚元素的「左位置」调大过,升级后会变成双重偏移,请在设计台上把它调回想要的位置。</li>
|
|
412
|
+
</ul>
|
|
413
|
+
|
|
402
414
|
<h2>v1.3.3 <small>2026-09-27</small></h2>
|
|
403
415
|
|
|
404
416
|
<h3>新增</h3>
|
|
@@ -581,5 +593,5 @@
|
|
|
581
593
|
<blockquote>
|
|
582
594
|
<p>完整更新记录请查阅仓库 <code>docs/中文/CHANGELOG.md</code> 与 <code>docs/en/CHANGELOG.en.md</code>。</p>
|
|
583
595
|
</blockquote>
|
|
584
|
-
`},Uu=[zu,Au,Pu,Ru,Lu],Iu={class:"help-modal"},Fu={class:"help-modal-header"},Ou={class:"help-modal-body"},Hu={class:"help-modal-sidebar"},Wu=["onClick"],Gu={class:"help-modal-content"},Ku=["innerHTML"],ut="worm-print-help-tab",qu=e.defineComponent({__name:"HelpModal",props:{visible:{type:Boolean},initialTab:{default:"getting-started"}},emits:["close","update:tab"],setup(t,{emit:r}){const o=t,s=r,n=Uu,l=e.ref(o.initialTab);e.onMounted(()=>{const m=localStorage.getItem(ut);m&&n.some(c=>c.id===m)&&(l.value=m)}),e.watch(()=>o.visible,m=>{if(m){const c=localStorage.getItem(ut);c&&n.some(f=>f.id===c)&&(l.value=c)}});function a(m){l.value=m,localStorage.setItem(ut,m),s("update:tab",m)}const i=e.computed(()=>n.find(c=>c.id===l.value)?.content||"");function d(m){m.key==="Escape"&&o.visible&&s("close")}return e.onMounted(()=>{document.addEventListener("keydown",d)}),e.onUnmounted(()=>{document.removeEventListener("keydown",d)}),(m,c)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"help-modal"},{default:e.withCtx(()=>[t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"help-modal-overlay",onClick:c[1]||(c[1]=e.withModifiers(f=>m.$emit("close"),["self"]))},[e.createElementVNode("div",Iu,[e.createElementVNode("div",Fu,[c[2]||(c[2]=e.createElementVNode("div",{class:"help-modal-title-wrap"},[e.createElementVNode("h2",{class:"help-modal-title"},"帮助文档"),e.createElementVNode("span",{class:"help-modal-project"},"worm-vue3-print")],-1)),e.createElementVNode("button",{class:"help-modal-close",title:"关闭",onClick:c[0]||(c[0]=f=>m.$emit("close"))}," × ")]),e.createElementVNode("div",Ou,[e.createElementVNode("div",Hu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),f=>(e.openBlock(),e.createElementBlock("button",{key:f.id,class:e.normalizeClass(["help-tab",{active:l.value===f.id}]),onClick:g=>a(f.id)},e.toDisplayString(f.title),11,Wu))),128))]),e.createElementVNode("div",Gu,[e.createElementVNode("div",{class:"help-content",innerHTML:i.value},null,8,Ku)])])])])):e.createCommentVNode("",!0)]),_:1})]))}}),Yu=ce(qu,[["__scopeId","data-v-31115934"]]),ju={class:"page-tabs-list"},Xu=["onBlur","onKeydown"],Zu=["data-tip","onClick","onDblclick"],Ju={class:"page-tabs-actions"},Qu=["data-tip","disabled"],_u=["data-tip","disabled"],em=["data-tip","disabled"],tm=["data-tip","disabled"],om=["data-tip","disabled"],nm=e.defineComponent({__name:"PageTabs",props:{pages:{},activeIndex:{},multi:{type:Boolean},tilingEnabled:{type:Boolean}},emits:["select","add","duplicate","delete","rename","move"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(-1),l=e.ref(""),a=e.computed(()=>o.pages[o.activeIndex]?.name||`页面 ${o.activeIndex+1}`),i=e.computed(()=>o.tilingEnabled?mt:"新增页面(在当前页后追加空白页)"),d=e.computed(()=>o.tilingEnabled?mt:`复制当前页「${a.value}」`);function m(B){n.value=B,l.value=o.pages[B]?.name??""}function c(B){if(n.value!==B)return;const Q=l.value.trim();Q&&s("rename",B,Q),n.value=-1}function f(){n.value=-1}const g=e.ref(null);let h=null;function R(B){const Q=B.dataset.tip;if(!Q)return;const ae=B.getBoundingClientRect(),K=Math.min(Math.max(ae.left+ae.width/2,80),window.innerWidth-80);g.value={text:Q,x:K,y:ae.bottom+6}}function w(B){const Q=B.target.closest?.("[data-tip]");Q&&(h&&clearTimeout(h),h=setTimeout(()=>R(Q),300))}function v(B){const Q=B.target.closest?.("[data-tip]");Q&&B.relatedTarget?.closest?.("[data-tip]")===Q||p()}function p(){h&&(clearTimeout(h),h=null),g.value=null}return e.onUnmounted(p),(B,Q)=>(e.openBlock(),e.createElementBlock("div",{class:"page-tabs",onMouseover:w,onMouseout:v,onMouseleave:p},[e.createElementVNode("div",ju,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.pages,(ae,K)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:K},[n.value===K?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":Q[0]||(Q[0]=Z=>l.value=Z),class:"page-tab-rename","data-test":"page-rename-input",onBlur:Z=>c(K),onKeydown:[e.withKeys(Z=>c(K),["enter"]),e.withKeys(f,["esc"])]},null,40,Xu)),[[e.vModelText,l.value]]):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["page-tab",{active:K===t.activeIndex}]),"data-tip":ae.name?`${ae.name}(双击重命名)`:"双击重命名",onClick:Z=>B.$emit("select",K),onDblclick:Z=>m(K)},e.toDisplayString(ae.name||`页面 ${K+1}`),43,Zu))],64))),128))]),e.createElementVNode("div",Ju,[e.createElementVNode("button",{"data-test":"add-page","data-tip":i.value,disabled:t.tilingEnabled,onClick:Q[1]||(Q[1]=ae=>B.$emit("add"))},"+",8,Qu),e.createElementVNode("button",{"data-test":"duplicate-page","data-tip":d.value,disabled:t.tilingEnabled,onClick:Q[2]||(Q[2]=ae=>B.$emit("duplicate"))},"⧉",8,_u),e.createElementVNode("button",{"data-test":"delete-page","data-tip":t.multi?`删除当前页「${a.value}」`:"仅多页面模板可删除页面",disabled:!t.multi,onClick:Q[3]||(Q[3]=ae=>B.$emit("delete",t.activeIndex))},"✕",8,em),e.createElementVNode("button",{"data-test":"move-left","data-tip":`前移「${a.value}」`,disabled:t.activeIndex<=0,onClick:Q[4]||(Q[4]=ae=>B.$emit("move",t.activeIndex,t.activeIndex-1))},"←",8,tm),e.createElementVNode("button",{"data-test":"move-right","data-tip":`后移「${a.value}」`,disabled:t.activeIndex>=t.pages.length-1,onClick:Q[5]||(Q[5]=ae=>B.$emit("move",t.activeIndex,t.activeIndex+1))},"→",8,om)]),g.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"page-tabs-tip",style:e.normalizeStyle({left:`${g.value.x}px`,top:`${g.value.y}px`})},e.toDisplayString(g.value.text),5)):e.createCommentVNode("",!0)],32))}}),lm=ce(nm,[["__scopeId","data-v-f1c7a18e"]]),Tt="print-studio:left",Mt="print-studio:right";function zt(t,r){try{const o=localStorage.getItem(t);return o===null?r:o==="1"}catch{return r}}function am(){const t=e.ref(zt(Tt,!1)),r=e.ref(zt(Mt,!1)),o=e.ref(!1);e.watch(t,a=>{try{localStorage.setItem(Tt,a?"1":"0")}catch{}},{flush:"sync"}),e.watch(r,a=>{try{localStorage.setItem(Mt,a?"1":"0")}catch{}},{flush:"sync"});function s(){t.value=!t.value}function n(){r.value=!r.value}function l(){o.value=!1}return{leftCollapsed:t,rightCollapsed:r,toggleLeft:s,toggleRight:n,dirty:o,markSaved:l}}const im={class:"designer-body"},rm=e.defineComponent({__name:"PrintDesigner",props:{initialTemplate:{},initialElements:{},fields:{},isEdit:{type:Boolean},requestScreenshot:{type:Function},uploadImage:{type:Function},uploadDesignBackground:{type:Function},showHelp:{type:Boolean},fonts:{}},emits:["preview","save"],setup(t,{expose:r,emit:o}){const s=t,n=o,l=e.ref(!1);e.watch(()=>s.showHelp,q=>{q===!1&&(l.value=!1)});const{leftCollapsed:a,rightCollapsed:i,toggleLeft:d,toggleRight:m,dirty:c,markSaved:f}=am(),{scale:g,showRuler:h,showGrid:R,snapToGrid:w,showTableGhostBorder:v,templateData:p,elements:B,fields:Q,tilingEnabled:ae,selectedIds:K,selectedElement:Z,selectedElements:y,select:W,selectElement:X,clearSelection:U,selectAll:k,previewIds:D,setPreview:N,commitPreview:F,hasClipboard:A,copy:V,paste:T,cutSelected:u,canUndo:S,canRedo:Y,undo:Ee,redo:fe,alignSelected:me,groupSelected:ge,ungroupSelected:L,deleteSelected:x,dragStart:$,dragStop:G,addElement:b,addFieldElement:C,moveLayer:M,updateTemplateData:ee,getTemplateJson:oe,loadTemplate:ie,pages:ve,activePageIndex:P,switchPage:H,addPage:j,duplicatePage:ne,deletePage:_,renamePage:be,movePage:O,tableSelection:z,setTableSelection:te,recordHistory:pe}=Qt({initialTemplate:s.initialTemplate,initialElements:s.initialElements,initialFields:s.fields}),ke=_t({elements:B,selectedIds:K,tableSelection:z,recordHistory:pe}),Ve=to({elements:B,selectedIds:K,recordHistory:pe}),De=e.computed(()=>Ve.active.value);e.watch([B,p],()=>{c.value=!0},{deep:!0});const _e=e.computed(()=>y.value.some(q=>!!q.options.groupId)),{guides:Ke,addGuide:et,moveGuide:tt,removeGuide:ot}=no(p,pe),nt=e.computed(()=>{const q=p.value,{width:J}=E.getPaperDimensions(q);return J-q.margins.left-q.margins.right});e.provide(Ge,{tableSelection:z,setTableSelection:te,recordHistory:pe,maxTableWidth:nt}),e.provide(Rt,K),e.provide(Lt,D),e.provide(vt,e.computed(()=>s.uploadImage)),e.provide(ft,e.computed(()=>s.uploadDesignBackground));const{catalog:lt}=ao(e.computed(()=>s.fonts));e.provide(gt,lt),uo(e.computed(()=>he.buildFontFaceCss(s.fonts)));function Ie(){const q=oe();return s.fonts?.length?Array.isArray(q.pages)?{...q,pages:q.pages.map(J=>({...J,fonts:[...s.fonts]}))}:{...q,fonts:[...s.fonts]}:q}e.watch(Z,q=>{(!q||q.printElementType.type!=="table")&&te(null)});const Ae=e.ref(null),ze=e.ref(!1),Pe=e.ref(""),at=e.ref(.5);async function it(){if(ze.value){ze.value=!1;return}const q=Ie();if(!q){alert("模板数据为空");return}if(!s.requestScreenshot){alert("截图服务未配置");return}try{const J=q,ue=Array.isArray(J.pages)?J.pages[P.value]:q,we=await s.requestScreenshot({templateJson:ue,printData:E.DEFAULT_DEMO_DATA});Pe.value&&URL.revokeObjectURL(Pe.value),Pe.value=URL.createObjectURL(we),ze.value=!0}catch{alert("截图生成失败")}}const qe=e.ref(null);function rt(q){qe.value=q}const I=e.computed(()=>{const q=p.value,J=E.getPaperDimensions(q),ue=q.orientation==="landscape"?"横向":"纵向",Te=`${E.PAPER_PRESETS[q.paperSize]?.label??q.paperSize} ${ue} ${Math.round(J.width)}×${Math.round(J.height)}mm`,Me=q.outputRotation;return Me?`${Te}(旋转${Me}°)`:Te});function le(){const q=Ae.value?.$el;if(q){const J=getComputedStyle(q),ue=parseFloat(J.paddingLeft)+parseFloat(J.paddingRight),we=parseFloat(J.paddingTop)+parseFloat(J.paddingBottom),Te=E.getPaperDimensions(p.value),Me=96/25.4,Oe=E.computeFitScale(q.clientWidth-ue,q.clientHeight-we,Te.width*Me,Te.height*Me);Ae.value?.fitToWindow(Oe)}}function re(q){g.value=Math.max(E.FIT_SCALE_MIN_PERCENT,g.value+q)}function Ne(q){Ae.value?.zoomByStep(q>0?1:-1)}function xe(q){const J=q.target.tagName;J==="INPUT"||J==="TEXTAREA"||J==="SELECT"||(q.ctrlKey||q.metaKey)&&q.key==="0"&&(q.preventDefault(),le())}e.onMounted(()=>document.addEventListener("keydown",xe)),e.onUnmounted(()=>document.removeEventListener("keydown",xe));function ye(q){const J=p.value.header.height,ue=p.value.footer.height;ee(q),q.header.height<J&&st("header"),q.footer.height<ue&&st("footer")}function Be(q,J){p.value={...p.value,[q]:{...p.value[q],height:J}}}function Re(q){ee({...p.value}),st(q)}function st(q){const J=E.getZoneRects(p.value)[q];B.value.some(we=>we.zone===q&&(we.options.top+we.options.height>J.height||we.options.left+we.options.width>J.width))&&alert(`${q==="header"?"页眉":"页脚"}高度已小于区域内元素,请手动调整元素位置`)}function Ut(){const q=p.value.firstPageOverlay,J={options:{left:0,top:0,width:50,height:10,title:"首页叠加"},printElementType:{type:"text",title:"首页叠加"}};p.value={...p.value,firstPageOverlay:{...q,elements:[...q.elements,J]}}}const Et=X;function It(q){const J=B.value.find(ue=>ue.id===q);J&&(J.options.visible=J.options.visible===!1)}function Ft(q){const J=B.value.find(ue=>ue.id===q);J&&(J.options.locked=!J.options.locked)}const Le=e.ref("page");e.watch(Z,q=>{Le.value=q?"element":"page"});const Ot={text:"formatter",longText:"formatter",barcode:"formatter",qrcode:"formatter",image:"src"},Fe=e.ref(!1),Ye=e.ref(null),dt=e.ref("");function Ht(q){const J=B.value.find(we=>we.id===q);if(!J||(W(q,!1),Le.value="element",J.options.locked))return;const ue=Ot[J.printElementType.type];ue&&(Ye.value={kind:"element",element:J,field:ue},dt.value=J.options[ue]||"",Fe.value=!0)}function Wt(q,J,ue){const we=B.value.find(Yt=>Yt.id===q);if(!we||(W(q,!1),Le.value="element",we.options.locked))return;const Te=we.options.tableRows??[],Me=E.findMainCell(Te,J,ue),Oe=Te[Me.r]?.cells[Me.c];Oe&&(Ye.value={kind:"cell",cell:Oe},dt.value=Oe.formatter||"",Fe.value=!0)}function Gt(q){const J=Ye.value;J?.kind==="element"?J.element.options[J.field]=q||void 0:J?.kind==="cell"&&(J.cell.formatter=q||void 0),pe(),Fe.value=!1,Ye.value=null}function Kt(q,J){B.value.push(q),W(q.id,!1),pe()}e.watch(()=>s.initialTemplate,q=>{q&&ie(q,s.initialElements)}),e.watch(()=>s.initialElements,q=>{q&&!s.initialTemplate&&(p.value={...p.value,elements:q.map(J=>({...J,options:{...J.options},printElementType:{...J.printElementType}}))})}),e.watch(()=>s.fields,q=>{Q.value=q||[]});const yt=e.computed(()=>{const q=p.value;return q?.tiling?.enabled!==!0?[]:he.validateTiling(q)});r({getTemplateJson:Ie,validateTemplate:()=>yt.value});function qt(){const q=yt.value;if(q.length){alert(q[0].message),Le.value="page";return}const J=Ie();if(Array.isArray(J.pages))try{he.normalizeTemplate(J)}catch(ue){alert(ue instanceof Error?ue.message:String(ue));return}n("save",JSON.stringify(J)),f()}return(q,J)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["designer-container",{"format-painting":De.value}])},[e.createVNode(Qo,{"is-edit":t.isEdit,"can-undo":e.unref(S),"can-redo":e.unref(Y),"has-multi-selection":e.unref(K).size>=2,"has-selection":e.unref(K).size>=1,"show-ruler":e.unref(h),"show-grid":e.unref(R),"snap-to-grid":e.unref(w),"show-table-ghost-border":e.unref(v),"selected-element-has-group":_e.value,"overlay-visible":ze.value,"show-help":t.showHelp!==!1,"clipboard-disabled":e.unref(ke).context.value!=="elements","has-clipboard":e.unref(A),scale:e.unref(g),"onUpdate:scale":J[0]||(J[0]=ue=>e.isRef(g)?g.value=ue:null),onPreview:J[1]||(J[1]=ue=>q.$emit("preview")),onSave:qt,onUndo:e.unref(Ee),onRedo:e.unref(fe),onAlign:J[2]||(J[2]=ue=>e.unref(me)(ue)),onMoveLayer:e.unref(M),onToggleRuler:J[3]||(J[3]=ue=>h.value=!e.unref(h)),onToggleGrid:J[4]||(J[4]=ue=>R.value=!e.unref(R)),onToggleSnap:J[5]||(J[5]=ue=>w.value=!e.unref(w)),onToggleTableGhostBorder:J[6]||(J[6]=ue=>v.value=!e.unref(v)),onToggleOverlay:it,onGroup:e.unref(ge),onUngroup:e.unref(L),onAddOverlayElement:Ut,onFitWindow:le,onZoom:Ne,onHelp:J[7]||(J[7]=ue=>l.value=!0),onCopy:e.unref(V),onPaste:e.unref(T),onDelete:e.unref(x)},{default:e.withCtx(()=>[e.createVNode(Wn,{format:e.unref(ke),painter:e.unref(Ve)},null,8,["format","painter"])]),_:1},8,["is-edit","can-undo","can-redo","has-multi-selection","has-selection","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","selected-element-has-group","overlay-visible","show-help","clipboard-disabled","has-clipboard","scale","onUndo","onRedo","onMoveLayer","onGroup","onUngroup","onCopy","onPaste","onDelete"]),e.createVNode(lm,{pages:e.unref(ve),"active-index":e.unref(P),multi:e.unref(ve).length>1,"tiling-enabled":e.unref(ae),onSelect:e.unref(H),onAdd:e.unref(j),onDuplicate:e.unref(ne),onDelete:e.unref(_),onRename:e.unref(be),onMove:e.unref(O)},null,8,["pages","active-index","multi","tiling-enabled","onSelect","onAdd","onDuplicate","onDelete","onRename","onMove"]),e.createElementVNode("div",im,[e.createVNode(Nl,{fields:e.unref(Q),elements:e.unref(B),"selected-ids":e.unref(K),collapsed:e.unref(a),onSelect:e.unref(Et),onMoveLayer:e.unref(M),onGroup:e.unref(ge),onUngroup:e.unref(L),onToggleVisible:It,onToggleLocked:Ft,onToggleCollapse:e.unref(d)},null,8,["fields","elements","selected-ids","collapsed","onSelect","onMoveLayer","onGroup","onUngroup","onToggleCollapse"]),e.createVNode(Wa,{ref_key:"canvasAreaRef",ref:Ae,"template-data":e.unref(p),elements:e.unref(B),scale:e.unref(g)/100,"show-ruler":e.unref(h),"show-grid":e.unref(R),"snap-to-grid":e.unref(w),"show-table-ghost-border":e.unref(v),"has-clipboard":e.unref(A),guides:e.unref(Ke),"overlay-visible":ze.value,"screenshot-url":Pe.value,"overlay-opacity":at.value,onSelect:e.unref(Et),onDropElement:e.unref(b),onDropField:e.unref(C),onDragStart:e.unref($),onDragStop:e.unref(G),onDblclickElement:Ht,onDblclickCell:Wt,onZoneHeightChange:Be,onZoneHeightCommit:Re,onSelectAll:e.unref(k),onClearSelection:e.unref(U),onPreview:e.unref(N),onCommitPreview:e.unref(F),onPaste:e.unref(T),onCopy:e.unref(V),onCut:e.unref(u),onDelete:e.unref(x),onMoveLayer:e.unref(M),onCoordinate:rt,onAddGuide:e.unref(et),onGuideMove:e.unref(tt),onGuideRemove:e.unref(ot),onZoom:re,onCloneElement:Kt},null,8,["template-data","elements","scale","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","has-clipboard","guides","overlay-visible","screenshot-url","overlay-opacity","onSelect","onDropElement","onDropField","onDragStart","onDragStop","onSelectAll","onClearSelection","onPreview","onCommitPreview","onPaste","onCopy","onCut","onDelete","onMoveLayer","onAddGuide","onGuideMove","onGuideRemove"]),e.createVNode(Cu,{element:e.unref(Z),"template-data":e.unref(p),fields:e.unref(Q),"table-selection":e.unref(z),"record-history":e.unref(pe),collapsed:e.unref(i),"multi-page":e.unref(ve).length>1,"active-tab":Le.value,"onUpdate:activeTab":J[8]||(J[8]=ue=>Le.value=ue),onDeleteElement:e.unref(x),"onUpdate:templateData":ye,onToggleCollapse:e.unref(m)},null,8,["element","template-data","fields","table-selection","record-history","collapsed","multi-page","active-tab","onDeleteElement","onToggleCollapse"])]),e.createVNode(Mu,{coordinate:qe.value,scale:e.unref(g),"element-count":e.unref(B).length,"selected-count":e.unref(K).size,paper:I.value,dirty:e.unref(c)},null,8,["coordinate","scale","element-count","selected-count","paper","dirty"]),e.createVNode(Qe,{modelValue:Fe.value,"onUpdate:modelValue":J[9]||(J[9]=ue=>Fe.value=ue),fields:e.unref(Q),expression:dt.value,"onUpdate:expression":Gt},null,8,["modelValue","fields","expression"]),e.createVNode(Yu,{visible:l.value,onClose:J[10]||(J[10]=ue=>l.value=!1)},null,8,["visible"])],2))}}),sm=ce(rm,[["__scopeId","data-v-fbba4a1c"]]),dm={class:"print-html-preview"},cm={key:0,class:"print-html-preview-error"},um={key:1,class:"print-html-preview-loading"},mm=e.defineComponent({__name:"PrintHtmlPreview",props:{templateJson:{},printData:{},baseUrl:{},fontBaseUrl:{}},emits:["rendered","error"],setup(t,{expose:r,emit:o}){const s=t,n=o,l=e.ref(),a=e.ref(!1),i=e.ref("");let d=0;async function m(){if(!s.templateJson){i.value="",a.value=!1;return}const f=++d;a.value=!0,i.value="";try{const{html:g,pageCount:h,copies:R}=await He.renderHtmlPages(s.templateJson,s.printData,s.baseUrl,He.browserCodeRenderer,{fontBaseUrl:s.fontBaseUrl});if(f!==d)return;const w=l.value?.contentWindow?.document;w&&(w.open(),w.write(g),w.close()),n("rendered",h,R)}catch(g){if(f!==d)return;i.value=g instanceof Error?g.message:"未知错误",n("error",i.value)}finally{f===d&&(a.value=!1)}}function c(){const f=l.value?.contentWindow;f&&(f.focus(),f.print())}return e.watch(()=>[s.templateJson,s.printData,s.baseUrl,s.fontBaseUrl],()=>{m()},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{d++}),r({print:c,rerender:m}),(f,g)=>(e.openBlock(),e.createElementBlock("div",dm,[i.value?(e.openBlock(),e.createElementBlock("div",cm,[e.createElementVNode("span",null,"预览渲染失败:"+e.toDisplayString(i.value),1)])):a.value?(e.openBlock(),e.createElementBlock("div",um,"预览渲染中…")):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("iframe",{ref_key:"iframeRef",ref:l,class:"print-html-preview-iframe",title:"打印预览"},null,512),[[e.vShow,!a.value&&!i.value]])]))}}),pm=ce(mm,[["__scopeId","data-v-ff7de2b5"]]);Object.defineProperty(exports,"DEFAULT_DEMO_DATA",{enumerable:!0,get:()=>E.DEFAULT_DEMO_DATA});Object.defineProperty(exports,"getDemoData",{enumerable:!0,get:()=>E.getDemoData});Object.defineProperty(exports,"browserCodeRenderer",{enumerable:!0,get:()=>He.browserCodeRenderer});Object.defineProperty(exports,"renderHtmlPages",{enumerable:!0,get:()=>He.renderHtmlPages});exports.FONT_CATALOG_KEY=gt;exports.PrintDesigner=sm;exports.PrintHtmlPreview=pm;exports.UPLOAD_DESIGN_BACKGROUND_KEY=ft;exports.UPLOAD_IMAGE_KEY=vt;exports.createDefaultTemplate=Ue;exports.toRuntimePool=Ze;
|
|
596
|
+
`},Uu=[zu,Au,Pu,Ru,Lu],Iu={class:"help-modal"},Fu={class:"help-modal-header"},Ou={class:"help-modal-body"},Hu={class:"help-modal-sidebar"},Wu=["onClick"],Gu={class:"help-modal-content"},Ku=["innerHTML"],ut="worm-print-help-tab",qu=e.defineComponent({__name:"HelpModal",props:{visible:{type:Boolean},initialTab:{default:"getting-started"}},emits:["close","update:tab"],setup(t,{emit:r}){const o=t,s=r,n=Uu,l=e.ref(o.initialTab);e.onMounted(()=>{const m=localStorage.getItem(ut);m&&n.some(c=>c.id===m)&&(l.value=m)}),e.watch(()=>o.visible,m=>{if(m){const c=localStorage.getItem(ut);c&&n.some(f=>f.id===c)&&(l.value=c)}});function a(m){l.value=m,localStorage.setItem(ut,m),s("update:tab",m)}const i=e.computed(()=>n.find(c=>c.id===l.value)?.content||"");function d(m){m.key==="Escape"&&o.visible&&s("close")}return e.onMounted(()=>{document.addEventListener("keydown",d)}),e.onUnmounted(()=>{document.removeEventListener("keydown",d)}),(m,c)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"help-modal"},{default:e.withCtx(()=>[t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"help-modal-overlay",onClick:c[1]||(c[1]=e.withModifiers(f=>m.$emit("close"),["self"]))},[e.createElementVNode("div",Iu,[e.createElementVNode("div",Fu,[c[2]||(c[2]=e.createElementVNode("div",{class:"help-modal-title-wrap"},[e.createElementVNode("h2",{class:"help-modal-title"},"帮助文档"),e.createElementVNode("span",{class:"help-modal-project"},"worm-vue3-print")],-1)),e.createElementVNode("button",{class:"help-modal-close",title:"关闭",onClick:c[0]||(c[0]=f=>m.$emit("close"))}," × ")]),e.createElementVNode("div",Ou,[e.createElementVNode("div",Hu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),f=>(e.openBlock(),e.createElementBlock("button",{key:f.id,class:e.normalizeClass(["help-tab",{active:l.value===f.id}]),onClick:g=>a(f.id)},e.toDisplayString(f.title),11,Wu))),128))]),e.createElementVNode("div",Gu,[e.createElementVNode("div",{class:"help-content",innerHTML:i.value},null,8,Ku)])])])])):e.createCommentVNode("",!0)]),_:1})]))}}),Yu=ce(qu,[["__scopeId","data-v-31115934"]]),ju={class:"page-tabs-list"},Xu=["onBlur","onKeydown"],Zu=["data-tip","onClick","onDblclick"],Ju={class:"page-tabs-actions"},Qu=["data-tip","disabled"],_u=["data-tip","disabled"],em=["data-tip","disabled"],tm=["data-tip","disabled"],om=["data-tip","disabled"],nm=e.defineComponent({__name:"PageTabs",props:{pages:{},activeIndex:{},multi:{type:Boolean},tilingEnabled:{type:Boolean}},emits:["select","add","duplicate","delete","rename","move"],setup(t,{emit:r}){const o=t,s=r,n=e.ref(-1),l=e.ref(""),a=e.computed(()=>o.pages[o.activeIndex]?.name||`页面 ${o.activeIndex+1}`),i=e.computed(()=>o.tilingEnabled?mt:"新增页面(在当前页后追加空白页)"),d=e.computed(()=>o.tilingEnabled?mt:`复制当前页「${a.value}」`);function m(B){n.value=B,l.value=o.pages[B]?.name??""}function c(B){if(n.value!==B)return;const Q=l.value.trim();Q&&s("rename",B,Q),n.value=-1}function f(){n.value=-1}const g=e.ref(null);let b=null;function R(B){const Q=B.dataset.tip;if(!Q)return;const ae=B.getBoundingClientRect(),K=Math.min(Math.max(ae.left+ae.width/2,80),window.innerWidth-80);g.value={text:Q,x:K,y:ae.bottom+6}}function w(B){const Q=B.target.closest?.("[data-tip]");Q&&(b&&clearTimeout(b),b=setTimeout(()=>R(Q),300))}function v(B){const Q=B.target.closest?.("[data-tip]");Q&&B.relatedTarget?.closest?.("[data-tip]")===Q||p()}function p(){b&&(clearTimeout(b),b=null),g.value=null}return e.onUnmounted(p),(B,Q)=>(e.openBlock(),e.createElementBlock("div",{class:"page-tabs",onMouseover:w,onMouseout:v,onMouseleave:p},[e.createElementVNode("div",ju,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.pages,(ae,K)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:K},[n.value===K?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":Q[0]||(Q[0]=Z=>l.value=Z),class:"page-tab-rename","data-test":"page-rename-input",onBlur:Z=>c(K),onKeydown:[e.withKeys(Z=>c(K),["enter"]),e.withKeys(f,["esc"])]},null,40,Xu)),[[e.vModelText,l.value]]):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["page-tab",{active:K===t.activeIndex}]),"data-tip":ae.name?`${ae.name}(双击重命名)`:"双击重命名",onClick:Z=>B.$emit("select",K),onDblclick:Z=>m(K)},e.toDisplayString(ae.name||`页面 ${K+1}`),43,Zu))],64))),128))]),e.createElementVNode("div",Ju,[e.createElementVNode("button",{"data-test":"add-page","data-tip":i.value,disabled:t.tilingEnabled,onClick:Q[1]||(Q[1]=ae=>B.$emit("add"))},"+",8,Qu),e.createElementVNode("button",{"data-test":"duplicate-page","data-tip":d.value,disabled:t.tilingEnabled,onClick:Q[2]||(Q[2]=ae=>B.$emit("duplicate"))},"⧉",8,_u),e.createElementVNode("button",{"data-test":"delete-page","data-tip":t.multi?`删除当前页「${a.value}」`:"仅多页面模板可删除页面",disabled:!t.multi,onClick:Q[3]||(Q[3]=ae=>B.$emit("delete",t.activeIndex))},"✕",8,em),e.createElementVNode("button",{"data-test":"move-left","data-tip":`前移「${a.value}」`,disabled:t.activeIndex<=0,onClick:Q[4]||(Q[4]=ae=>B.$emit("move",t.activeIndex,t.activeIndex-1))},"←",8,tm),e.createElementVNode("button",{"data-test":"move-right","data-tip":`后移「${a.value}」`,disabled:t.activeIndex>=t.pages.length-1,onClick:Q[5]||(Q[5]=ae=>B.$emit("move",t.activeIndex,t.activeIndex+1))},"→",8,om)]),g.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"page-tabs-tip",style:e.normalizeStyle({left:`${g.value.x}px`,top:`${g.value.y}px`})},e.toDisplayString(g.value.text),5)):e.createCommentVNode("",!0)],32))}}),lm=ce(nm,[["__scopeId","data-v-f1c7a18e"]]),Tt="print-studio:left",Mt="print-studio:right";function zt(t,r){try{const o=localStorage.getItem(t);return o===null?r:o==="1"}catch{return r}}function am(){const t=e.ref(zt(Tt,!1)),r=e.ref(zt(Mt,!1)),o=e.ref(!1);e.watch(t,a=>{try{localStorage.setItem(Tt,a?"1":"0")}catch{}},{flush:"sync"}),e.watch(r,a=>{try{localStorage.setItem(Mt,a?"1":"0")}catch{}},{flush:"sync"});function s(){t.value=!t.value}function n(){r.value=!r.value}function l(){o.value=!1}return{leftCollapsed:t,rightCollapsed:r,toggleLeft:s,toggleRight:n,dirty:o,markSaved:l}}const im={class:"designer-body"},rm=e.defineComponent({__name:"PrintDesigner",props:{initialTemplate:{},initialElements:{},fields:{},isEdit:{type:Boolean},requestScreenshot:{type:Function},uploadImage:{type:Function},uploadDesignBackground:{type:Function},showHelp:{type:Boolean},fonts:{}},emits:["preview","save"],setup(t,{expose:r,emit:o}){const s=t,n=o,l=e.ref(!1);e.watch(()=>s.showHelp,q=>{q===!1&&(l.value=!1)});const{leftCollapsed:a,rightCollapsed:i,toggleLeft:d,toggleRight:m,dirty:c,markSaved:f}=am(),{scale:g,showRuler:b,showGrid:R,snapToGrid:w,showTableGhostBorder:v,templateData:p,elements:B,fields:Q,tilingEnabled:ae,selectedIds:K,selectedElement:Z,selectedElements:y,select:W,selectElement:X,clearSelection:U,selectAll:k,previewIds:D,setPreview:N,commitPreview:F,hasClipboard:A,copy:V,paste:T,cutSelected:u,canUndo:S,canRedo:Y,undo:Ee,redo:fe,alignSelected:me,groupSelected:ge,ungroupSelected:L,deleteSelected:x,dragStart:$,dragStop:G,addElement:h,addFieldElement:C,moveLayer:M,updateTemplateData:ee,getTemplateJson:oe,loadTemplate:ie,pages:ve,activePageIndex:P,switchPage:H,addPage:j,duplicatePage:ne,deletePage:_,renamePage:he,movePage:O,tableSelection:z,setTableSelection:te,recordHistory:pe}=Qt({initialTemplate:s.initialTemplate,initialElements:s.initialElements,initialFields:s.fields}),ke=_t({elements:B,selectedIds:K,tableSelection:z,recordHistory:pe}),Ve=to({elements:B,selectedIds:K,recordHistory:pe}),De=e.computed(()=>Ve.active.value);e.watch([B,p],()=>{c.value=!0},{deep:!0});const _e=e.computed(()=>y.value.some(q=>!!q.options.groupId)),{guides:Ke,addGuide:et,moveGuide:tt,removeGuide:ot}=no(p,pe),nt=e.computed(()=>{const q=p.value,{width:J}=E.getPaperDimensions(q);return J-q.margins.left-q.margins.right});e.provide(Ge,{tableSelection:z,setTableSelection:te,recordHistory:pe,maxTableWidth:nt}),e.provide(Rt,K),e.provide(Lt,D),e.provide(vt,e.computed(()=>s.uploadImage)),e.provide(ft,e.computed(()=>s.uploadDesignBackground));const{catalog:lt}=ao(e.computed(()=>s.fonts));e.provide(gt,lt),uo(e.computed(()=>be.buildFontFaceCss(s.fonts)));function Ie(){const q=oe();return s.fonts?.length?Array.isArray(q.pages)?{...q,pages:q.pages.map(J=>({...J,fonts:[...s.fonts]}))}:{...q,fonts:[...s.fonts]}:q}e.watch(Z,q=>{(!q||q.printElementType.type!=="table")&&te(null)});const Ae=e.ref(null),ze=e.ref(!1),Pe=e.ref(""),at=e.ref(.5);async function it(){if(ze.value){ze.value=!1;return}const q=Ie();if(!q){alert("模板数据为空");return}if(!s.requestScreenshot){alert("截图服务未配置");return}try{const J=q,ue=Array.isArray(J.pages)?J.pages[P.value]:q,we=await s.requestScreenshot({templateJson:ue,printData:E.DEFAULT_DEMO_DATA});Pe.value&&URL.revokeObjectURL(Pe.value),Pe.value=URL.createObjectURL(we),ze.value=!0}catch{alert("截图生成失败")}}const qe=e.ref(null);function rt(q){qe.value=q}const I=e.computed(()=>{const q=p.value,J=E.getPaperDimensions(q),ue=q.orientation==="landscape"?"横向":"纵向",Te=`${E.PAPER_PRESETS[q.paperSize]?.label??q.paperSize} ${ue} ${Math.round(J.width)}×${Math.round(J.height)}mm`,Me=q.outputRotation;return Me?`${Te}(旋转${Me}°)`:Te});function le(){const q=Ae.value?.$el;if(q){const J=getComputedStyle(q),ue=parseFloat(J.paddingLeft)+parseFloat(J.paddingRight),we=parseFloat(J.paddingTop)+parseFloat(J.paddingBottom),Te=E.getPaperDimensions(p.value),Me=96/25.4,Oe=E.computeFitScale(q.clientWidth-ue,q.clientHeight-we,Te.width*Me,Te.height*Me);Ae.value?.fitToWindow(Oe)}}function re(q){g.value=Math.max(E.FIT_SCALE_MIN_PERCENT,g.value+q)}function Ne(q){Ae.value?.zoomByStep(q>0?1:-1)}function xe(q){const J=q.target.tagName;J==="INPUT"||J==="TEXTAREA"||J==="SELECT"||(q.ctrlKey||q.metaKey)&&q.key==="0"&&(q.preventDefault(),le())}e.onMounted(()=>document.addEventListener("keydown",xe)),e.onUnmounted(()=>document.removeEventListener("keydown",xe));function ye(q){const J=p.value.header.height,ue=p.value.footer.height;ee(q),q.header.height<J&&st("header"),q.footer.height<ue&&st("footer")}function Be(q,J){p.value={...p.value,[q]:{...p.value[q],height:J}}}function Re(q){ee({...p.value}),st(q)}function st(q){const J=E.getZoneRects(p.value)[q];B.value.some(we=>we.zone===q&&(we.options.top+we.options.height>J.height||we.options.left+we.options.width>J.width))&&alert(`${q==="header"?"页眉":"页脚"}高度已小于区域内元素,请手动调整元素位置`)}function Ut(){const q=p.value.firstPageOverlay,J={options:{left:0,top:0,width:50,height:10,title:"首页叠加"},printElementType:{type:"text",title:"首页叠加"}};p.value={...p.value,firstPageOverlay:{...q,elements:[...q.elements,J]}}}const Et=X;function It(q){const J=B.value.find(ue=>ue.id===q);J&&(J.options.visible=J.options.visible===!1)}function Ft(q){const J=B.value.find(ue=>ue.id===q);J&&(J.options.locked=!J.options.locked)}const Le=e.ref("page");e.watch(Z,q=>{Le.value=q?"element":"page"});const Ot={text:"formatter",longText:"formatter",barcode:"formatter",qrcode:"formatter",image:"src"},Fe=e.ref(!1),Ye=e.ref(null),dt=e.ref("");function Ht(q){const J=B.value.find(we=>we.id===q);if(!J||(W(q,!1),Le.value="element",J.options.locked))return;const ue=Ot[J.printElementType.type];ue&&(Ye.value={kind:"element",element:J,field:ue},dt.value=J.options[ue]||"",Fe.value=!0)}function Wt(q,J,ue){const we=B.value.find(Yt=>Yt.id===q);if(!we||(W(q,!1),Le.value="element",we.options.locked))return;const Te=we.options.tableRows??[],Me=E.findMainCell(Te,J,ue),Oe=Te[Me.r]?.cells[Me.c];Oe&&(Ye.value={kind:"cell",cell:Oe},dt.value=Oe.formatter||"",Fe.value=!0)}function Gt(q){const J=Ye.value;J?.kind==="element"?J.element.options[J.field]=q||void 0:J?.kind==="cell"&&(J.cell.formatter=q||void 0),pe(),Fe.value=!1,Ye.value=null}function Kt(q,J){B.value.push(q),W(q.id,!1),pe()}e.watch(()=>s.initialTemplate,q=>{q&&ie(q,s.initialElements)}),e.watch(()=>s.initialElements,q=>{q&&!s.initialTemplate&&(p.value={...p.value,elements:q.map(J=>({...J,options:{...J.options},printElementType:{...J.printElementType}}))})}),e.watch(()=>s.fields,q=>{Q.value=q||[]});const yt=e.computed(()=>{const q=p.value;return q?.tiling?.enabled!==!0?[]:be.validateTiling(q)});r({getTemplateJson:Ie,validateTemplate:()=>yt.value});function qt(){const q=yt.value;if(q.length){alert(q[0].message),Le.value="page";return}const J=Ie();if(Array.isArray(J.pages))try{be.normalizeTemplate(J)}catch(ue){alert(ue instanceof Error?ue.message:String(ue));return}n("save",JSON.stringify(J)),f()}return(q,J)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["designer-container",{"format-painting":De.value}])},[e.createVNode(Qo,{"is-edit":t.isEdit,"can-undo":e.unref(S),"can-redo":e.unref(Y),"has-multi-selection":e.unref(K).size>=2,"has-selection":e.unref(K).size>=1,"show-ruler":e.unref(b),"show-grid":e.unref(R),"snap-to-grid":e.unref(w),"show-table-ghost-border":e.unref(v),"selected-element-has-group":_e.value,"overlay-visible":ze.value,"show-help":t.showHelp!==!1,"clipboard-disabled":e.unref(ke).context.value!=="elements","has-clipboard":e.unref(A),scale:e.unref(g),"onUpdate:scale":J[0]||(J[0]=ue=>e.isRef(g)?g.value=ue:null),onPreview:J[1]||(J[1]=ue=>q.$emit("preview")),onSave:qt,onUndo:e.unref(Ee),onRedo:e.unref(fe),onAlign:J[2]||(J[2]=ue=>e.unref(me)(ue)),onMoveLayer:e.unref(M),onToggleRuler:J[3]||(J[3]=ue=>b.value=!e.unref(b)),onToggleGrid:J[4]||(J[4]=ue=>R.value=!e.unref(R)),onToggleSnap:J[5]||(J[5]=ue=>w.value=!e.unref(w)),onToggleTableGhostBorder:J[6]||(J[6]=ue=>v.value=!e.unref(v)),onToggleOverlay:it,onGroup:e.unref(ge),onUngroup:e.unref(L),onAddOverlayElement:Ut,onFitWindow:le,onZoom:Ne,onHelp:J[7]||(J[7]=ue=>l.value=!0),onCopy:e.unref(V),onPaste:e.unref(T),onDelete:e.unref(x)},{default:e.withCtx(()=>[e.createVNode(Wn,{format:e.unref(ke),painter:e.unref(Ve)},null,8,["format","painter"])]),_:1},8,["is-edit","can-undo","can-redo","has-multi-selection","has-selection","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","selected-element-has-group","overlay-visible","show-help","clipboard-disabled","has-clipboard","scale","onUndo","onRedo","onMoveLayer","onGroup","onUngroup","onCopy","onPaste","onDelete"]),e.createVNode(lm,{pages:e.unref(ve),"active-index":e.unref(P),multi:e.unref(ve).length>1,"tiling-enabled":e.unref(ae),onSelect:e.unref(H),onAdd:e.unref(j),onDuplicate:e.unref(ne),onDelete:e.unref(_),onRename:e.unref(he),onMove:e.unref(O)},null,8,["pages","active-index","multi","tiling-enabled","onSelect","onAdd","onDuplicate","onDelete","onRename","onMove"]),e.createElementVNode("div",im,[e.createVNode(Nl,{fields:e.unref(Q),elements:e.unref(B),"selected-ids":e.unref(K),collapsed:e.unref(a),onSelect:e.unref(Et),onMoveLayer:e.unref(M),onGroup:e.unref(ge),onUngroup:e.unref(L),onToggleVisible:It,onToggleLocked:Ft,onToggleCollapse:e.unref(d)},null,8,["fields","elements","selected-ids","collapsed","onSelect","onMoveLayer","onGroup","onUngroup","onToggleCollapse"]),e.createVNode(Wa,{ref_key:"canvasAreaRef",ref:Ae,"template-data":e.unref(p),elements:e.unref(B),scale:e.unref(g)/100,"show-ruler":e.unref(b),"show-grid":e.unref(R),"snap-to-grid":e.unref(w),"show-table-ghost-border":e.unref(v),"has-clipboard":e.unref(A),guides:e.unref(Ke),"overlay-visible":ze.value,"screenshot-url":Pe.value,"overlay-opacity":at.value,onSelect:e.unref(Et),onDropElement:e.unref(h),onDropField:e.unref(C),onDragStart:e.unref($),onDragStop:e.unref(G),onDblclickElement:Ht,onDblclickCell:Wt,onZoneHeightChange:Be,onZoneHeightCommit:Re,onSelectAll:e.unref(k),onClearSelection:e.unref(U),onPreview:e.unref(N),onCommitPreview:e.unref(F),onPaste:e.unref(T),onCopy:e.unref(V),onCut:e.unref(u),onDelete:e.unref(x),onMoveLayer:e.unref(M),onCoordinate:rt,onAddGuide:e.unref(et),onGuideMove:e.unref(tt),onGuideRemove:e.unref(ot),onZoom:re,onCloneElement:Kt},null,8,["template-data","elements","scale","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","has-clipboard","guides","overlay-visible","screenshot-url","overlay-opacity","onSelect","onDropElement","onDropField","onDragStart","onDragStop","onSelectAll","onClearSelection","onPreview","onCommitPreview","onPaste","onCopy","onCut","onDelete","onMoveLayer","onAddGuide","onGuideMove","onGuideRemove"]),e.createVNode(Cu,{element:e.unref(Z),"template-data":e.unref(p),fields:e.unref(Q),"table-selection":e.unref(z),"record-history":e.unref(pe),collapsed:e.unref(i),"multi-page":e.unref(ve).length>1,"active-tab":Le.value,"onUpdate:activeTab":J[8]||(J[8]=ue=>Le.value=ue),onDeleteElement:e.unref(x),"onUpdate:templateData":ye,onToggleCollapse:e.unref(m)},null,8,["element","template-data","fields","table-selection","record-history","collapsed","multi-page","active-tab","onDeleteElement","onToggleCollapse"])]),e.createVNode(Mu,{coordinate:qe.value,scale:e.unref(g),"element-count":e.unref(B).length,"selected-count":e.unref(K).size,paper:I.value,dirty:e.unref(c)},null,8,["coordinate","scale","element-count","selected-count","paper","dirty"]),e.createVNode(Qe,{modelValue:Fe.value,"onUpdate:modelValue":J[9]||(J[9]=ue=>Fe.value=ue),fields:e.unref(Q),expression:dt.value,"onUpdate:expression":Gt},null,8,["modelValue","fields","expression"]),e.createVNode(Yu,{visible:l.value,onClose:J[10]||(J[10]=ue=>l.value=!1)},null,8,["visible"])],2))}}),sm=ce(rm,[["__scopeId","data-v-fbba4a1c"]]),dm={class:"print-html-preview"},cm={key:0,class:"print-html-preview-error"},um={key:1,class:"print-html-preview-loading"},mm=e.defineComponent({__name:"PrintHtmlPreview",props:{templateJson:{},printData:{},baseUrl:{},fontBaseUrl:{}},emits:["rendered","error"],setup(t,{expose:r,emit:o}){const s=t,n=o,l=e.ref(),a=e.ref(!1),i=e.ref("");let d=0;async function m(){if(!s.templateJson){i.value="",a.value=!1;return}const f=++d;a.value=!0,i.value="";try{const{html:g,pageCount:b,copies:R}=await He.renderHtmlPages(s.templateJson,s.printData,s.baseUrl,He.browserCodeRenderer,{fontBaseUrl:s.fontBaseUrl});if(f!==d)return;const w=l.value?.contentWindow?.document;w&&(w.open(),w.write(g),w.close()),n("rendered",b,R)}catch(g){if(f!==d)return;i.value=g instanceof Error?g.message:"未知错误",n("error",i.value)}finally{f===d&&(a.value=!1)}}function c(){const f=l.value?.contentWindow;f&&(f.focus(),f.print())}return e.watch(()=>[s.templateJson,s.printData,s.baseUrl,s.fontBaseUrl],()=>{m()},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{d++}),r({print:c,rerender:m}),(f,g)=>(e.openBlock(),e.createElementBlock("div",dm,[i.value?(e.openBlock(),e.createElementBlock("div",cm,[e.createElementVNode("span",null,"预览渲染失败:"+e.toDisplayString(i.value),1)])):a.value?(e.openBlock(),e.createElementBlock("div",um,"预览渲染中…")):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("iframe",{ref_key:"iframeRef",ref:l,class:"print-html-preview-iframe",title:"打印预览"},null,512),[[e.vShow,!a.value&&!i.value]])]))}}),pm=ce(mm,[["__scopeId","data-v-ff7de2b5"]]);Object.defineProperty(exports,"DEFAULT_DEMO_DATA",{enumerable:!0,get:()=>E.DEFAULT_DEMO_DATA});Object.defineProperty(exports,"getDemoData",{enumerable:!0,get:()=>E.getDemoData});Object.defineProperty(exports,"browserCodeRenderer",{enumerable:!0,get:()=>He.browserCodeRenderer});Object.defineProperty(exports,"renderHtmlPages",{enumerable:!0,get:()=>He.renderHtmlPages});exports.FONT_CATALOG_KEY=gt;exports.PrintDesigner=sm;exports.PrintHtmlPreview=pm;exports.UPLOAD_DESIGN_BACKGROUND_KEY=ft;exports.UPLOAD_IMAGE_KEY=vt;exports.createDefaultTemplate=Ue;exports.toRuntimePool=Ze;
|
|
585
597
|
//# sourceMappingURL=index.cjs.map
|