@worm-vue3-print/canvas 1.3.2 → 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/canvas.css +1 -1
- package/dist/components/CanvasArea.vue.d.ts +2 -2
- package/dist/components/DesignerToolbar.vue.d.ts +23 -1
- package/dist/components/FormatToolbar.vue.d.ts +10 -0
- package/dist/components/ToolbarDropdown.vue.d.ts +25 -0
- package/dist/components/property/FontSelect.vue.d.ts +3 -0
- package/dist/components/property/StepperInput.vue.d.ts +3 -0
- package/dist/composables/useClipboard.d.ts +44 -0
- package/dist/composables/useDesignerState.d.ts +352 -0
- package/dist/composables/useFormatPainter.d.ts +16 -0
- package/dist/composables/useFormatToolbar.d.ts +54 -0
- package/dist/index.cjs +55 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5679 -4747
- 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"),b=require("@worm-vue3-print/core/designer"),Ee=require("lucide-vue-next"),Oe=require("@worm-vue3-print/core/browser"),$t=require("jsbarcode"),xt=require("qrcode"),Ht=require("dompurify"),Dt=Symbol("selected-ids"),Tt=Symbol("preview-ids");function Wt(o){const i=e.ref(new Set),t=e.ref(new Set),n=e.computed(()=>o.value.filter(g=>i.value.has(g.id))),l=e.computed(()=>i.value.size>0);function c(g,E=!1){if(E){const R=new Set(i.value);R.has(g)?R.delete(g):R.add(g),i.value=R}else i.value=new Set([g])}function r(){i.value=new Set}function a(g){i.value=new Set(g)}function s(g){t.value=new Set(g)}function m(){t.value=new Set}function d(){i.value=new Set(t.value),t.value=new Set}function p(){const g=n.value;if(g.length===0)return null;let E=1/0,R=1/0,S=-1/0,h=-1/0;return g.forEach(v=>{E=Math.min(E,v.options.left),R=Math.min(R,v.options.top),S=Math.max(S,v.options.left+v.options.width),h=Math.max(h,v.options.top+v.options.height)}),{left:E,top:R,width:S-E,height:h-R}}return{selectedIds:i,selectedElements:n,hasSelection:l,select:c,clearSelection:r,selectAll:a,getSelectionBounds:p,previewIds:t,setPreview:s,clearPreview:m,commitPreview:d}}function Gt(){const o=e.ref(null);function i(l){o.value=l.map(c=>({options:{...c.options},printElementType:{...c.printElementType}}))}function t(l=10){if(!o.value)return null;const c=new Map;for(const a of o.value){const s=a.options.groupId;s&&c.set(s,(c.get(s)??0)+1)}const r=new Map;for(const[a,s]of c)r.set(a,s>=2?b.generateGroupId():void 0);return o.value.map(a=>({id:b.generateId(),options:{...a.options,left:a.options.left+l,top:a.options.top+l,groupId:a.options.groupId?r.get(a.options.groupId):void 0},printElementType:{...a.printElementType}}))}function n(){return o.value!==null&&o.value.length>0}return{clipboard:o,copy:i,paste:t,hasData:n}}function Kt(o){const t=e.ref([]),n=e.ref([]),l=e.ref(!1),c=e.ref(!1);function r(){l.value=t.value.length>0,c.value=n.value.length>0}function a(E){const R={elements:JSON.parse(JSON.stringify(E?.elements??[])),templateData:JSON.parse(JSON.stringify(E?.templateData??{}))};return E?.pages&&(R.pages=JSON.parse(JSON.stringify(E.pages)),E.activePageIndex!==void 0&&(R.activePageIndex=E.activePageIndex)),R}function s(E){return a(E)}function m(E){t.value.push(s(E)),n.value=[],t.value.length>50&&t.value.shift(),r()}function d(E){if(t.value.length===0)return null;const R=t.value.pop();return n.value.push(E?s(E):a(R)),r(),t.value.length>0?a(t.value[t.value.length-1]):null}function p(E){if(n.value.length===0)return null;const R=n.value.pop();return t.value.push(E?s(E):a(R)),r(),a(R)}function g(){t.value=[],n.value=[],r()}return{push:m,undo:d,redo:p,canUndo:l,canRedo:c,clear:g}}const dt="开启拼版后只能有一个设计页面";function Le(){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(o){const i=(t,n)=>(t??[]).map(l=>{const c={...l.options};return(l.printElementType?.type??l.type)==="table"&&b.syncTableElementSize(c),{id:l.id||b.generateId(),zone:n,options:c,printElementType:{...l.printElementType}}});return{...o,margins:{...o.margins},header:{height:o.header?.height??10,elements:[]},footer:{height:o.footer?.height??10,elements:[]},firstPageOverlay:{height:o.firstPageOverlay?.height??0,elements:[...o.firstPageOverlay?.elements??[]]},guides:[...o.guides??[]],elements:[...i(o.elements??[],"content"),...i(o.header?.elements??[],"header"),...i(o.footer?.elements??[],"footer")]}}function ft(o){const i=(n,l)=>{const c=Ze(b.normalizeTemplateUnits(n));return c.name||(c.name=`页面 ${l+1}`),c};if(!o)return[i(Le(),0)];const t=Array.isArray(o.pages)?o.pages:[o];return t.length?t.map(i):[i(Le(),0)]}function gt(o){const i=o.elements,t=n=>i.filter(l=>(l.zone||"content")===n).map(l=>({id:l.id,type:l.printElementType.type,options:{...l.options},printElementType:{...l.printElementType}}));return{unit:"mm",...o,header:{...o.header,elements:t("header")},footer:{...o.footer,elements:t("footer")},firstPageOverlay:{...o.firstPageOverlay,elements:(o.firstPageOverlay?.elements??[]).map(n=>({id:n.id||b.generateId(),type:n.printElementType?.type||"text",options:{...n.options},printElementType:{...n.printElementType}}))},elements:t("content"),guides:[...o.guides??[]]}}function qt(o={}){const i=e.ref(100),t=e.ref(!0),n=e.ref(!0),l=e.ref(!1),c=e.ref(!0),r=e.ref(ft(o.initialTemplate)),a=e.ref(0),s=e.ref(r.value[0]??Ze(Le())),m=e.computed(()=>r.value.some(P=>P.tiling?.enabled===!0));function d(){return m.value?(alert(dt),!0):!1}function p(){r.value[a.value]=s.value}function g(P){P<0||P>=r.value.length||(p(),a.value=P,s.value=r.value[P],ue())}const E=e.computed({get:()=>s.value.elements,set:P=>{s.value.elements=P}}),R=e.ref(o.initialFields||[]),{selectedIds:S,selectedElements:h,select:v,clearSelection:x,selectAll:Z,previewIds:le,setPreview:O,clearPreview:K,commitPreview:y}=Wt(E),{group:F,ungroup:q,getGroupedIds:z}=b.useGroup(),{copy:k,paste:T,hasData:X}=Gt(),{align:ne}=b.useAlign(),{push:ae,undo:ce,redo:J,canUndo:u,canRedo:w}=Kt(),W=e.computed(()=>{if(S.value.size===0)return null;const P=S.value.values().next().value;return E.value.find(te=>te.id===P)||null}),be=e.ref(null);function ve(P){be.value=P}function ue(){x(),ve(null)}function fe(){return{elements:E.value.map(P=>({id:P.id,zone:P.zone,options:JSON.parse(JSON.stringify(P.options)),printElementType:{...P.printElementType}})),templateData:{paperSize:s.value.paperSize,orientation:s.value.orientation,outputRotation:s.value.outputRotation,margins:{...s.value.margins},header:{height:s.value.header.height,elements:[]},footer:{height:s.value.footer.height,elements:[]},firstPageOverlay:{height:s.value.firstPageOverlay.height,elements:[]},elements:[],customWidth:s.value.customWidth,customHeight:s.value.customHeight,watermark:s.value.watermark?{...s.value.watermark}:void 0,guides:[...s.value.guides??[]]},pages:JSON.parse(JSON.stringify(r.value)),activePageIndex:a.value}}function M(){ae(fe())}function N(P){return P.pages?.[P.activePageIndex??0]?.elements??P.elements}function C(){const P=ce(fe());P?.pages?(r.value=P.pages,a.value=P.activePageIndex??0,s.value=r.value[a.value]??r.value[0],ue()):P?.templateData&&(s.value={...P.templateData,elements:P.elements})}function U(){const P=J(fe());P?.pages?(r.value=P.pages,a.value=P.activePageIndex??0,s.value=r.value[a.value]??r.value[0],ue()):P?.templateData&&(s.value={...P.templateData,elements:P.elements})}function f(){k(h.value)}function V(){k(h.value),Q()}function B(){const P=T();P&&P.length>0&&(E.value.push(...P),M())}function j(){k(h.value);const P=T();P&&P.length>0&&(P.forEach(te=>{te.options.left+=5,te.options.top+=5}),E.value.push(...P),v(P[0].id,!1),M())}function _(){i.value=100}const oe=e.computed(()=>X());let me=!1,D=null;const L=300;function H(P,te){const ie=h.value.filter(ke=>!ke.options.locked);ie.length!==0&&(ie.forEach(ke=>{ke.options.left+=P,ke.options.top+=te}),me||(me=!0,M()),D&&clearTimeout(D),D=setTimeout(()=>{me=!1,D=null},L))}function ee(){Z(E.value.map(P=>P.id))}function Y(P){ne(h.value,P),M()}function ge(P,te=!1){if(te){v(P,!0);return}S.value=new Set(z(E.value,P))}function A(){E.value=F(E.value,S.value),M()}function $(){E.value=q(E.value,S.value),M()}function Q(){S.value.size!==0&&(E.value=E.value.filter(P=>!S.value.has(P.id)),x(),M())}const{setup:pe,cleanup:Ve}=b.useKeyboard({onMove:H,onDelete:Q,onCopy:f,onPaste:B,onSelectAll:ee,onUndo:C,onRedo:U,onDuplicate:j,onResetZoom:_,onAlignLeft:()=>Y("left"),onAlignRight:()=>Y("right"),onAlignCenterH:()=>Y("vertical"),onAlignTop:()=>Y("top"),onAlignBottom:()=>Y("bottom"),onGroup:A,onUngroup:$});let Ne=null;function xe(){Ne=fe()}function Qe(){if(!Ne)return;const P=new Map(Ne.elements.map(ye=>[ye.id,ye]));let te=!1;for(const ye of E.value){const $e=P.get(ye.id);if(!$e)continue;($e.options.left!==ye.options.left||$e.options.top!==ye.options.top||$e.options.width!==ye.options.width||$e.options.height!==ye.options.height)&&b.finalizeElementZone(ye,s.value).rejected&&(te=!0)}te&&alert("该元素类型不能放入页眉/页脚");const ie=ye=>`${ye.id}:${ye.zone||"content"}:${ye.options.left},${ye.options.top},${ye.options.width},${ye.options.height}`,ke=N(Ne).map(ie).join("|"),Be=N(fe()).map(ie).join("|");Ne=null,ke!==Be&&M()}function Ge(P,te){const ie=b.zoneFromPaperPoint(s.value,te.x,te.y);if(ie!=="content"&&!b.ZONE_ALLOWED_TYPES.includes(P.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const ke=b.getZoneRects(s.value)[ie];return P.zone=ie,P.options.left=te.x-ke.left,P.options.top=te.y-ke.top,ie!=="content"&&b.clampToZone(P,ke),!0}function _e(P,te){const ie=b.createRuntimeElement(P);te&&!Ge(ie,te)||(E.value.push(ie),v(ie.id,!1),M())}function et(P,te){const ie=b.createFieldElement(P);te&&!Ge(ie,te)||(E.value.push(ie),v(ie.id,!1),M())}function Ue(P){if(S.value.size===0)return;const te=S.value.values().next().value,ie=E.value.find(ze=>ze.id===te);if(!ie)return;const ke=ie.options.zIndex??0,Be=E.value.map(ze=>ze.options.zIndex??0),ye=Math.max(...Be,0),$e=Math.min(...Be,0);switch(P){case"top":ie.options.zIndex=ye+1;break;case"bottom":ie.options.zIndex=$e-1;break;case"up":ie.options.zIndex=ke+1;break;case"down":ie.options.zIndex=ke-1;break}M()}function Pe(P,te){const{width:ie,height:ke}=b.getPaperDimensions(s.value),Be=96/25.4;i.value=b.computeFitScale(P,te,ie*Be,ke*Be)}function Me(P){if(s.value={...P},r.value[a.value]=s.value,r.value.length>1){const te={paperSize:P.paperSize,orientation:P.orientation,outputRotation:P.outputRotation,customWidth:P.customWidth,customHeight:P.customHeight};for(const ie of r.value)Object.assign(ie,te)}M()}function Re(){return p(),r.value.length<=1?gt(r.value[0]):{version:1,pages:r.value.map(gt)}}function tt(P,te){r.value=ft(P),a.value=0,s.value=r.value[0],te&&(s.value={...s.value,elements:te.map(ie=>({...ie,id:ie.id||b.generateId(),zone:ie.zone||"content",options:{...ie.options},printElementType:{...ie.printElementType}}))},r.value[a.value]=s.value),ae(fe())}function ot(){const P=new Set(r.value.map(ie=>ie.name));let te=r.value.length+1;for(;P.has(`页面 ${te}`);)te++;return`页面 ${te}`}function Ke(){if(d())return;p();const P=r.value[a.value]??Le(),te=Ze({...Le(),paperSize:P.paperSize,orientation:P.orientation,customWidth:P.customWidth,customHeight:P.customHeight,name:ot()});r.value.push(te),a.value=r.value.length-1,s.value=te,ue(),M()}function nt(){if(d())return;p();const P=r.value[a.value],te=JSON.parse(JSON.stringify(P));te.name=`${P.name??`页面 ${a.value+1}`} 副本`,te.elements=te.elements.map(ie=>({...ie,id:b.generateId()})),te.firstPageOverlay={...te.firstPageOverlay,elements:(te.firstPageOverlay?.elements??[]).map(ie=>({...ie,id:b.generateId()}))},r.value.splice(a.value+1,0,te),g(a.value+1),M()}function lt(P){r.value.length<=1||(p(),r.value.splice(P,1),P<a.value?a.value--:P===a.value&&a.value>=r.value.length&&(a.value=r.value.length-1),s.value=r.value[a.value],ue(),M())}function qe(P,te){r.value[P]&&(r.value[P].name=te)}function at(P,te){if(P===te)return;p();const[ie]=r.value.splice(P,1);r.value.splice(te,0,ie),a.value=te,s.value=ie,ue(),M()}return ae(fe()),e.onMounted(()=>pe()),e.onUnmounted(()=>{Ve(),D&&(clearTimeout(D),D=null)}),{scale:i,showRuler:t,showGrid:n,snapToGrid:l,showTableGhostBorder:c,templateData:s,elements:E,fields:R,tilingEnabled:m,pages:r,activePageIndex:a,switchPage:g,addPage:Ke,duplicatePage:nt,deletePage:lt,renamePage:qe,movePage:at,selectedIds:S,selectedElements:h,selectedElement:W,select:v,selectElement:ge,clearSelection:x,selectAll:ee,previewIds:le,setPreview:O,clearPreview:K,commitPreview:y,hasClipboard:oe,copy:f,paste:B,cutSelected:V,tableSelection:be,setTableSelection:ve,canUndo:u,canRedo:w,undo:C,redo:U,recordHistory:M,alignSelected:Y,groupSelected:A,ungroupSelected:$,deleteSelected:Q,duplicateSelected:j,resetZoom:_,dragStart:xe,dragStop:Qe,addElement:_e,addFieldElement:et,moveLayer:Ue,fitToWindow:Pe,updateTemplateData:Me,getTemplateJson:Re,loadTemplate:tt}}let ht=0;function Yt(){return ht+=1,`guide-${ht}`}function jt(o,i){const t=e.computed(()=>o.value.guides??[]);function n(s){o.value={...o.value,guides:s([...o.value.guides??[]])},i()}function l(s,m){n(d=>(d.push({type:s,position:m,id:Yt()}),d))}function c(s,m){n(d=>d.map(p=>p.id===s?{...p,position:m}:p))}function r(s){n(m=>m.filter(d=>d.id!==s))}function a(){const s=[],m=[];for(const d of t.value)d.type==="vertical"?s.push(d.position):m.push(d.position);return{vertical:s,horizontal:m}}return{guides:t,addGuide:l,moveGuide:c,removeGuide:r,getGuidePositions:a}}const We=Symbol("table-edit"),ct=Symbol("print-upload-image"),ut=Symbol("print-upload-design-background"),mt=Symbol("print-font-catalog"),Xt=e.computed(()=>[]);function Zt(o){return{catalog:e.computed(()=>{const t=[],n=new Set;for(const l of e.toValue(o)??[]){const c=l?.family?.trim();if(!c)continue;const r=c.toLowerCase();if(n.has(r))continue;n.add(r);const a=l.label?.trim();t.push(a?{family:c,label:a}:{family:c})}return t})}}function Jt(){return e.inject(mt,Xt)}function bt(o,i){const t=i?.trim().toLowerCase();if(t)return o.find(n=>n.family.trim().toLowerCase()===t)}function Et(o){return o.label?`${o.label}(${o.family})`:o.family}function He(o){return o.toLowerCase().replace(/\s+/g,"")}function yt(o,i){if(o===i)return 0;if(o.startsWith(i))return 1;if(o.includes(i))return 2;let t=0;for(const n of o)if(n===i[t]&&t++,t===i.length)return 3;return-1}function Qt(o,i){const t=He(i.trim());return t?o.map((n,l)=>({font:n,index:l,rank:_t(n,t)})).filter(n=>n.rank>=0).sort((n,l)=>n.rank-l.rank||n.index-l.index).map(n=>n.font):[...o]}function _t(o,i){const t=yt(He(o.family),i);if(!o.label)return t;const n=yt(He(o.label),i);return t<0?n:n<0?t:Math.min(t,n)}const eo="print-designer-font-face";function to(o){const i=`${eo}-${e.useId()}`;let t;e.watchEffect(()=>{const n=e.toValue(o);if(!n){t?.remove(),t=void 0;return}t||(t=document.createElement("style"),t.id=i,document.head.appendChild(t)),t.textContent=n}),e.onUnmounted(()=>{t?.remove(),t=void 0})}const oo=e.defineComponent({__name:"HelpButton",emits:["click"],setup(o){return(i,t)=>(e.openBlock(),e.createElementBlock("button",{class:"help-button",title:"帮助文档",onClick:t[0]||(t[0]=n=>i.$emit("click"))},[...t[1]||(t[1]=[e.createElementVNode("span",{class:"help-icon"},"?",-1)])]))}}),se=(o,i)=>{const t=o.__vccOpts||o;for(const[n,l]of i)t[n]=l;return t},no=se(oo,[["__scopeId","data-v-80ccab03"]]),lo={class:"designer-toolbar"},ao={class:"tb-group"},io={class:"tb-title"},ro={class:"tb-title-name"},so={class:"tb-group"},co=["disabled"],uo=["disabled"],mo={key:0,class:"tb-group"},po={key:1,class:"tb-group"},vo={key:2,class:"tb-group"},fo={class:"tb-group"},go={class:"tb-zoom"},ho={key:3,class:"tb-group"},bo={class:"tb-group"},Eo={class:"tb-group"},yo=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}},{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"],["update:scale"]),setup(o){const i=e.useModel(o,"scale");return(t,n)=>(e.openBlock(),e.createElementBlock("div",lo,[e.createElementVNode("div",ao,[n[29]||(n[29]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-d3362eaa><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d3362eaa><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-d3362eaa></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-d3362eaa></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-d3362eaa></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-d3362eaa></line></svg></span>',1)),e.createElementVNode("div",io,[e.createElementVNode("span",ro,e.toDisplayString(o.isEdit?"编辑模板":"新建模板"),1),n[28]||(n[28]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",so,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canUndo,onClick:n[0]||(n[0]=l=>t.$emit("undo")),"data-tip":"撤销"},[e.createVNode(e.unref(Ee.Undo2),{size:15})],8,co),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canRedo,onClick:n[1]||(n[1]=l=>t.$emit("redo")),"data-tip":"重做"},[e.createVNode(e.unref(Ee.Redo2),{size:15})],8,uo)]),o.hasMultiSelection?(e.openBlock(),e.createElementBlock("div",mo,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[2]||(n[2]=l=>t.$emit("align","left")),"data-tip":"左对齐"},[e.createVNode(e.unref(Ee.AlignStartVertical),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[3]||(n[3]=l=>t.$emit("align","right")),"data-tip":"右对齐"},[e.createVNode(e.unref(Ee.AlignEndVertical),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[4]||(n[4]=l=>t.$emit("align","top")),"data-tip":"顶对齐"},[e.createVNode(e.unref(Ee.AlignStartHorizontal),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[5]||(n[5]=l=>t.$emit("align","bottom")),"data-tip":"底对齐"},[e.createVNode(e.unref(Ee.AlignEndHorizontal),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[6]||(n[6]=l=>t.$emit("align","vertical")),"data-tip":"水平居中"},[e.createVNode(e.unref(Ee.AlignCenterVertical),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[7]||(n[7]=l=>t.$emit("align","horizontal")),"data-tip":"垂直居中"},[e.createVNode(e.unref(Ee.AlignCenterHorizontal),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[8]||(n[8]=l=>t.$emit("align","distributeHor")),"data-tip":"水平分布"},[e.createVNode(e.unref(Ee.AlignHorizontalSpaceBetween),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[9]||(n[9]=l=>t.$emit("align","distributeVer")),"data-tip":"垂直分布"},[e.createVNode(e.unref(Ee.AlignVerticalSpaceBetween),{size:15})])])):e.createCommentVNode("",!0),o.hasMultiSelection||o.selectedElementHasGroup?(e.openBlock(),e.createElementBlock("div",po,[o.hasMultiSelection?(e.openBlock(),e.createElementBlock("button",{key:0,class:"tb-btn tb-icon",onClick:n[10]||(n[10]=l=>t.$emit("group")),"data-tip":"组合 (Ctrl+G)"},[e.createVNode(e.unref(Ee.Group),{size:15})])):e.createCommentVNode("",!0),o.selectedElementHasGroup?(e.openBlock(),e.createElementBlock("button",{key:1,class:"tb-btn tb-icon",onClick:n[11]||(n[11]=l=>t.$emit("ungroup")),"data-tip":"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(Ee.Ungroup),{size:15})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),o.hasSelection?(e.openBlock(),e.createElementBlock("div",vo,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[12]||(n[12]=l=>t.$emit("move-layer","top")),"data-tip":"置顶"},[e.createVNode(e.unref(Ee.ArrowUpToLine),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[13]||(n[13]=l=>t.$emit("move-layer","up")),"data-tip":"上移一层"},[e.createVNode(e.unref(Ee.ArrowUp),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[14]||(n[14]=l=>t.$emit("move-layer","down")),"data-tip":"下移一层"},[e.createVNode(e.unref(Ee.ArrowDown),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[15]||(n[15]=l=>t.$emit("move-layer","bottom")),"data-tip":"置底"},[e.createVNode(e.unref(Ee.ArrowDownToLine),{size:15})])])):e.createCommentVNode("",!0),e.createElementVNode("div",fo,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.showRuler}]),"data-tip":"显示/隐藏标尺",onClick:n[16]||(n[16]=l=>t.$emit("toggle-ruler"))},[...n[30]||(n[30]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 标尺 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.showGrid}]),"data-tip":"显示/隐藏网格背景",onClick:n[17]||(n[17]=l=>t.$emit("toggle-grid"))},[...n[31]||(n[31]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.showTableGhostBorder}]),"data-tip":"显示/隐藏无边框表格的虚拟虚线",onClick:n[18]||(n[18]=l=>t.$emit("toggle-table-ghost-border"))},[...n[32]||(n[32]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.snapToGrid}]),"data-tip":"开启/关闭元素吸附到网格",onClick:n[19]||(n[19]=l=>t.$emit("toggle-snap"))},[...n[33]||(n[33]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[20]||(n[20]=l=>t.$emit("fit-window")),"data-tip":"适应窗口"},[e.createVNode(e.unref(Ee.Maximize),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[21]||(n[21]=l=>t.$emit("zoom",-10)),"data-tip":"缩小"},[e.createVNode(e.unref(Ee.ZoomOut),{size:15})]),e.createElementVNode("span",go,e.toDisplayString(i.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[22]||(n[22]=l=>t.$emit("zoom",10)),"data-tip":"放大"},[e.createVNode(e.unref(Ee.ZoomIn),{size:15})])]),n[34]||(n[34]=e.createElementVNode("div",{class:"tb-spacer"},null,-1)),o.showHelp?(e.openBlock(),e.createElementBlock("div",ho,[e.createVNode(no,{onClick:n[23]||(n[23]=l=>t.$emit("help"))})])):e.createCommentVNode("",!0),e.createElementVNode("div",bo,[e.createElementVNode("button",{class:"tb-btn","data-tip":"添加一个仅在首页叠加显示的页眉/页脚元素",onClick:n[24]||(n[24]=l=>t.$emit("add-overlay-element"))},"首页专属"),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{warn:o.overlayVisible}]),"data-tip":"叠加显示渲染截图,与设计稿对比效果",onClick:n[25]||(n[25]=l=>t.$emit("toggle-overlay"))},"叠层对比",2)]),e.createElementVNode("div",Eo,[e.createElementVNode("button",{class:"btn-secondary",onClick:n[26]||(n[26]=l=>t.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary",onClick:n[27]||(n[27]=l=>t.$emit("save"))},"保存")])]))}}),ko=se(yo,[["__scopeId","data-v-d3362eaa"]]),Vo={class:"layer-panel"},No=["onClick"],wo={class:"layer-icon"},Co={class:"layer-name"},So={key:0,class:"layer-zone"},Bo={class:"layer-zindex"},$o={key:0,class:"layer-actions"},xo={key:1,class:"layer-actions"},Do=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer","group","ungroup"],setup(o){const i=o,t=e.computed(()=>i.elements.filter(d=>i.selectedIds.has(d.id))),n=e.computed(()=>t.value.length>=2),l=e.computed(()=>t.value.some(d=>!!d.options.groupId)),c=e.computed(()=>[...i.elements].sort((d,p)=>(p.options.zIndex??0)-(d.options.zIndex??0))),r={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function a(d){return r[d.printElementType.type]||"?"}function s(d){return d.options.title||d.printElementType.title||d.printElementType.type}function m(d){return d.zone==="header"?"页眉":d.zone==="footer"?"页脚":""}return(d,p)=>(e.openBlock(),e.createElementBlock("div",Vo,[p[6]||(p[6]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:e.normalizeClass(["layer-item",{active:o.selectedIds.has(g.id)}]),onClick:E=>d.$emit("select",g.id,E.ctrlKey||E.metaKey)},[e.createElementVNode("span",wo,e.toDisplayString(a(g)),1),e.createElementVNode("span",Co,e.toDisplayString(s(g)),1),m(g)?(e.openBlock(),e.createElementBlock("span",So,e.toDisplayString(m(g)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Bo,"z:"+e.toDisplayString(g.options.zIndex??0),1)],10,No))),128)),c.value.length>0?(e.openBlock(),e.createElementBlock("div",$o,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:p[0]||(p[0]=g=>d.$emit("move-layer","top")),title:"置顶"},[e.createVNode(e.unref(Ee.ArrowUpToLine),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:p[1]||(p[1]=g=>d.$emit("move-layer","up")),title:"上移"},[e.createVNode(e.unref(Ee.ArrowUp),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:p[2]||(p[2]=g=>d.$emit("move-layer","down")),title:"下移"},[e.createVNode(e.unref(Ee.ArrowDown),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:p[3]||(p[3]=g=>d.$emit("move-layer","bottom")),title:"置底"},[e.createVNode(e.unref(Ee.ArrowDownToLine),{size:14})])])):e.createCommentVNode("",!0),n.value||l.value?(e.openBlock(),e.createElementBlock("div",xo,[n.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"pd-button small",onClick:p[4]||(p[4]=g=>d.$emit("group")),title:"组合 (Ctrl+G)"},[e.createVNode(e.unref(Ee.Group),{size:14})])):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"pd-button small",onClick:p[5]||(p[5]=g=>d.$emit("ungroup")),title:"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(Ee.Ungroup),{size:14})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),To=se(Do,[["__scopeId","data-v-567d273e"]]),Mo={class:"field-tree-panel"},zo={class:"tree-container"},Po=["onClick"],Ro={class:"expand-icon"},Ao={class:"node-icon"},Lo={class:"group-label"},Uo=["onDragstart"],Io={class:"node-label"},Fo={class:"node-key"},Oo={key:0,class:"pd-empty"},Ho=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(""),c=e.ref(new Set),r=e.computed(()=>!!l.value.trim()),a=e.computed(()=>b.filterGroups(b.groupFields(t.fields),l.value));function s(d){const p=new Set(c.value);p.has(d)?p.delete(d):p.add(d),c.value=p}function m(d,p){d.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:p.fieldKey,fieldLabel:p.fieldLabel})),d.dataTransfer&&(d.dataTransfer.effectAllowed="copy"),n("field-drag",p)}return(d,p)=>(e.openBlock(),e.createElementBlock("div",Mo,[p[2]||(p[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[0]||(p[0]=g=>l.value=g),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,l.value]]),e.createElementVNode("div",zo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.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:E=>s(g.key)},[e.createElementVNode("span",Ro,e.toDisplayString(c.value.has(g.key)&&!r.value?"▶":"▼"),1),e.createElementVNode("span",Ao,e.toDisplayString(g.isList?"📋":"📁"),1),e.createElementVNode("span",Lo,e.toDisplayString(g.label),1)],10,Po)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.fields,E=>(e.openBlock(),e.createElementBlock("div",{key:E.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(g.key?22:8)+"px"}),onDragstart:R=>m(R,E)},[p[1]||(p[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",Io,e.toDisplayString(E.fieldLabel),1),e.createElementVNode("span",Fo,"("+e.toDisplayString(E.fieldKey)+")",1)],44,Uo))),128))],512),[[e.vShow,!g.key||r.value||!c.value.has(g.key)]])],64))),128))]),a.value.length===0?(e.openBlock(),e.createElementBlock("p",Oo,"暂无字段")):e.createCommentVNode("",!0)]))}}),Wo=se(Ho,[["__scopeId","data-v-9b326f07"]]),Go={key:0,class:"left-collapsed"},Ko={class:"left-head"},qo={class:"pd-tabs left-tabs"},Yo={class:"pd-tab-bar",role:"tablist"},jo={class:"pd-tab-pane",role:"tabpanel"},Xo=["onDragstart"],Zo={class:"material-icon"},Jo={class:"material-label"},Qo={class:"pd-tab-pane",role:"tabpanel"},_o={class:"pd-tab-pane",role:"tabpanel"},en=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(o,{emit:i}){const t=i,n=e.ref("elements"),l=[{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 c(s,m){s.dataTransfer?.setData("elementType",m)}function r(s){t("field-drag",s)}function a(s){n.value=s,t("toggle-collapse")}return(s,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",Go,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:m[0]||(m[0]=d=>a(n.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="elements"}]),title:"元素",onClick:m[1]||(m[1]=d=>a("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="fields"}]),title:"字段",onClick:m[2]||(m[2]=d=>a("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="layers"}]),title:"图层",onClick:m[3]||(m[3]=d=>a("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Ko,[m[14]||(m[14]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:m[4]||(m[4]=d=>s.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",qo,[e.createElementVNode("div",Yo,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="elements"}]),onClick:m[5]||(m[5]=d=>n.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="fields"}]),onClick:m[6]||(m[6]=d=>n.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="layers"}]),onClick:m[7]||(m[7]=d=>n.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",jo,[m[15]||(m[15]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(l,d=>e.createElementVNode("div",{key:d.type,class:"material-card",draggable:"true",onDragstart:p=>c(p,d.type)},[e.createElementVNode("span",Zo,e.toDisplayString(d.icon),1),e.createElementVNode("span",Jo,e.toDisplayString(d.label),1)],40,Xo)),64))],512),[[e.vShow,n.value==="elements"]]),e.withDirectives(e.createElementVNode("div",Qo,[e.createVNode(Wo,{fields:o.fields,onFieldDrag:r},null,8,["fields"])],512),[[e.vShow,n.value==="fields"]]),e.withDirectives(e.createElementVNode("div",_o,[e.createVNode(To,{elements:o.elements,"selected-ids":o.selectedIds,onSelect:m[8]||(m[8]=(d,p)=>s.$emit("select",d,p)),onMoveLayer:m[9]||(m[9]=d=>s.$emit("move-layer",d)),onGroup:m[10]||(m[10]=d=>s.$emit("group")),onUngroup:m[11]||(m[11]=d=>s.$emit("ungroup")),onToggleVisible:m[12]||(m[12]=d=>s.$emit("toggle-visible",d)),onToggleLocked:m[13]||(m[13]=d=>s.$emit("toggle-locked",d))},null,8,["elements","selected-ids"])],512),[[e.vShow,n.value==="layers"]])])],64))],2))}}),tn=se(en,[["__scopeId","data-v-4501eea7"]]);function on(o,i){const t=e.ref(!1),n=e.ref(null);let l=0,c=0,r=0,a=0,s=!1;function m(S){if(i.disabled||S.button!==0)return;const h=S.target;if(!(h instanceof Element)||h.classList.contains("resize-handle"))return;t.value=!0,s=S.altKey,l=S.clientX,c=S.clientY;const v=o.value;v&&(r=parseFloat(v.style.left)||0,a=parseFloat(v.style.top)||0,n.value={left:r,top:a,width:parseFloat(v.style.width)||0,height:parseFloat(v.style.height)||0},i.onStart?.({altKey:s}),document.addEventListener("mousemove",p),document.addEventListener("mouseup",g),S.preventDefault())}function d(S){const h=i.getScale?.()??1;let v=r+(S.clientX-l)/h,x=a+(S.clientY-c)/h;if(i.axis==="x"&&(x=a),i.axis==="y"&&(v=r),i.onAdsorb){const Z=o.value;if(Z){const le=parseFloat(Z.style.width)||0,O=parseFloat(Z.style.height)||0,K=i.onAdsorb({left:v,top:x,width:le,height:O});v=K.left,x=K.top}}return{left:v,top:x}}function p(S){const h=d(S);n.value&&(n.value.left=h.left,n.value.top=h.top),i.onDrag(h)}function g(S){t.value=!1;const h=d(S);i.onDragEnd?.(h,{altKey:s}),i.onStop?.(),n.value=null,document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",g)}function E(){const S=o.value;S&&S.removeEventListener("mousedown",m),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",g)}function R(){E();const S=o.value;S&&S.addEventListener("mousedown",m)}return{isDragging:t,dragPreview:n,setup:R,cleanup:E}}function nn(o){const i=[];return o.getAttribute("data-fit")==="shrink"&&i.push(o),o.querySelectorAll('[data-fit="shrink"]').forEach(t=>i.push(t)),i}function ln(o){o.querySelectorAll("[data-fit-size]").forEach(i=>{if(i.getAttribute("data-fit")==="shrink")return;i.removeAttribute("data-fit-size");const t=i.getAttribute("data-fit-base");t?i.style.fontSize=`${t}pt`:i.style.removeProperty("font-size")})}function pt(o,i){const t=()=>{const n=o.value;n&&(nn(n).forEach(Oe.fitTextNode),ln(n))};e.watchEffect(()=>{i(),e.nextTick(t)},{flush:"post"}),e.onMounted(()=>{e.nextTick(t)})}const an=["data-fit","data-fit-base","data-fit-min"],rn=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},l=e.ref(null),c=e.computed(()=>b.resolveElementTextFit("text",i.element.options)),r=e.computed(()=>i.element.options.fontSize||12),a=e.computed(()=>b.resolveShrinkMinFontSize(i.element.options.shrinkMinFontSize)),s=e.computed(()=>{const d=i.element.options,p=c.value==="autoHeight";return{fontSize:r.value+"pt",fontWeight:d.fontWeight||"normal",fontFamily:d.fontFamily||"inherit",color:d.color||"#333",backgroundColor:d.backgroundColor||"transparent",textAlign:d.textAlign||"left",lineHeight:d.lineHeight?d.lineHeight+"pt":"normal",letterSpacing:d.letterSpacing?d.letterSpacing+"pt":"normal",textDecoration:d.textDecoration||"none",padding:`${d.contentPaddingTop||0}pt ${d.contentPaddingRight||0}pt ${d.contentPaddingBottom||0}pt ${d.contentPaddingLeft||0}pt`,width:"100%",height:p?"auto":"100%",boxSizing:"border-box",overflow:p?"visible":"hidden",...d.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...d.verticalAlign?{display:"flex",alignItems:t[d.verticalAlign]??"flex-start",justifyContent:n[d.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>i.designMode?i.element.options.testData?i.element.options.testData:i.element.options.formatter||"文本":b.resolveTextBinding(i.element.options,i.data));return pt(l,()=>[c.value,r.value,a.value,i.element.options.width,i.element.options.height,i.element.options.wordWrap,i.element.options.letterSpacing,i.element.options.lineHeight,m.value]),(d,p)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:l,class:"print-text",style:e.normalizeStyle(s.value),"data-fit":c.value==="shrink"?"shrink":void 0,"data-fit-base":String(r.value),"data-fit-min":String(a.value)},e.toDisplayString(m.value),13,an))}}),sn={class:"print-image"},dn=["src"],cn={key:1,class:"image-placeholder"},un=e.defineComponent({__name:"ImageElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.computed(()=>{const r=i.element.options.src||"";return r?r.includes("{")?i.designMode?b.evaluateTemplate(r,b.DEFAULT_DEMO_DATA):b.evaluateTemplate(r,i.data?.[0]||{}):r:""}),n=e.ref(!1);function l(){n.value=!0}e.watch(t,()=>{n.value=!1});const c=e.computed(()=>({objectFit:i.element.options.fit||"contain"}));return(r,a)=>(e.openBlock(),e.createElementBlock("div",sn,[t.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(c.value),onError:l},null,44,dn)):(e.openBlock(),e.createElementBlock("div",cn,"图片"))]))}}),mn=se(un,[["__scopeId","data-v-007a2979"]]),pn=["data-fit","data-fit-base","data-fit-min"],vn=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},l=e.ref(null),c=e.computed(()=>b.resolveElementTextFit("longText",i.element.options)),r=e.computed(()=>i.element.options.fontSize||12),a=e.computed(()=>b.resolveShrinkMinFontSize(i.element.options.shrinkMinFontSize)),s=e.computed(()=>{const d=i.element.options,p=c.value==="autoHeight";return{fontSize:r.value+"pt",fontWeight:d.fontWeight||"normal",fontFamily:d.fontFamily||"inherit",color:d.color||"#333",backgroundColor:d.backgroundColor||"transparent",textAlign:d.textAlign||"left",lineHeight:d.lineHeight?d.lineHeight+"pt":"1.5",letterSpacing:d.letterSpacing?d.letterSpacing+"pt":"normal",textIndent:d.longTextIndent?d.longTextIndent+"pt":"0",width:"100%",height:p?"auto":"100%",overflow:p?"visible":"hidden",wordBreak:"break-all",boxSizing:"border-box",...d.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...d.verticalAlign?{display:"flex",alignItems:t[d.verticalAlign]??"flex-start",justifyContent:n[d.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>i.designMode?i.element.options.formatter?i.element.options.formatter:"长文本内容":b.resolveTextBinding(i.element.options,i.data));return pt(l,()=>[c.value,r.value,a.value,i.element.options.width,i.element.options.height,i.element.options.wordWrap,i.element.options.lineHeight,m.value]),(d,p)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:l,class:"print-longtext",style:e.normalizeStyle(s.value),"data-fit":c.value==="shrink"?"shrink":void 0,"data-fit-base":String(r.value),"data-fit-min":String(a.value)},e.toDisplayString(m.value),13,pn))}}),fn=["title"],gn=["title","onClick"],hn=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(o,{emit:i}){const t=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],n=i;function l(c,r){n("action",c,r)}return(c,r)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"table-ctx-menu",style:e.normalizeStyle({left:o.x+"px",top:o.y+"px"}),onMousedown:r[8]||(r[8]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"menu-item",onClick:r[0]||(r[0]=a=>l("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:r[1]||(r[1]=a=>l("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteRow}]),onClick:r[2]||(r[2]=a=>o.canDeleteRow&&l("delete-row"))}," 删除行 ",2),r[9]||(r[9]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:"menu-item",onClick:r[3]||(r[3]=a=>l("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:r[4]||(r[4]=a=>l("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteCol}]),onClick:r[5]||(r[5]=a=>o.canDeleteCol&&l("delete-col"))}," 删除列 ",2),r[10]||(r[10]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!!o.mergeDisabledReason}]),title:o.mergeDisabledReason||"",onClick:r[6]||(r[6]=a=>!o.mergeDisabledReason&&l("merge"))}," 合并单元格 ",10,fn),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canSplit}]),onClick:r[7]||(r[7]=a=>o.canSplit&&l("split"))}," 拆分单元格 ",2),r[11]||(r[11]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),r[12]||(r[12]=e.createElementVNode("div",{class:"menu-group-title"},"行类型",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(t,a=>e.createElementVNode("div",{key:a.value,class:e.normalizeClass(["menu-item",{disabled:!!o.rowTypeDisabledReason(a.value),active:o.currentRowType===a.value}]),title:o.rowTypeDisabledReason(a.value)||"",onClick:s=>!o.rowTypeDisabledReason(a.value)&&l("set-row-type",a.value)},e.toDisplayString(a.label),11,gn)),64))],36)):e.createCommentVNode("",!0)]))}}),bn=se(hn,[["__scopeId","data-v-44e319c1"]]),En={class:"cell-barcode"},yn=["preserveAspectRatio"],kn=["src"],Vn={key:1,class:"cell-barcode-fallback"},Nn=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{},printerDpi:{},targetWidthMm:{},targetHeightMm:{},barWidth:{},barFontSize:{}},setup(o){const i=o,t=e.ref(null),n=e.ref(!1),l=e.ref(""),c=e.ref(null),r={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},a=e.computed(()=>r[i.fit||"contain"]??"xMidYMid meet"),s=e.computed(()=>c.value?{width:c.value.width,height:c.value.height}:{maxWidth:i.maxWidth?`${i.maxWidth}mm`:"100%",maxHeight:i.maxHeight?`${i.maxHeight}mm`:"100%"}),m=e.computed(()=>({objectFit:i.fit||"contain",maxWidth:i.maxWidth?`${i.maxWidth}mm`:"100%",maxHeight:i.maxHeight?`${i.maxHeight}mm`:"100%"}));function d(){if(n.value=!1,c.value=null,!t.value)return;const R=b.barcodeUnitsPerModule(i.barWidth);try{$t(t.value,i.value,{format:i.barcodeType||"CODE128",width:R,height:b.BARCODE_BAR_HEIGHT_MODULES*R,displayValue:i.showText!==!1,fontSize:(i.barFontSize??b.BARCODE_TEXT_FONT_SIZE_MODULES)*R,margin:0,marginLeft:b.BARCODE_QUIET_ZONE_MODULES*R,marginRight:b.BARCODE_QUIET_ZONE_MODULES*R,marginTop:0,marginBottom:b.BARCODE_MARGIN_BOTTOM_MODULES*R})}catch{return}n.value=!0;const S=p(t.value),h=S?b.resolveBarcodeSize({unitWidth:S.width/R,unitHeight:S.height/R,boxWidthMm:b.barcodeAvailableBoxMm(i.targetWidthMm,i.maxWidth),boxHeightMm:b.barcodeAvailableBoxMm(i.targetHeightMm,i.maxHeight),dpi:i.printerDpi,barWidth:i.barWidth}):null;c.value=h?{width:`${h.widthMm}mm`,height:`${h.heightMm}mm`}:null,t.value.setAttribute("shape-rendering","crispEdges")}function p(R){const S=(R.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return S.length!==4||S.some(h=>!Number.isFinite(h))?null:{width:S[2],height:S[3]}}async function g(){if(!i.value){l.value="";return}try{l.value=await xt.toDataURL(i.value,{width:96,margin:1,errorCorrectionLevel:i.qrCodeLevel||"M"})}catch{l.value=""}}function E(){i.cellType==="barcode"?d():g()}return e.onMounted(E),e.watch(()=>[i.cellType,i.value,i.barcodeType,i.qrCodeLevel,i.showText,i.printerDpi,i.targetWidthMm,i.targetHeightMm,i.barWidth,i.barFontSize,i.maxWidth,i.maxHeight],E),(R,S)=>(e.openBlock(),e.createElementBlock("div",En,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:t,preserveAspectRatio:a.value,style:e.normalizeStyle(s.value)},null,12,yn)),[[e.vShow,o.cellType==="barcode"&&n.value]]),o.cellType==="qrcode"&&l.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:l.value,alt:"qrcode",style:e.normalizeStyle(m.value)},null,12,kn)):e.createCommentVNode("",!0),!n.value&&o.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",Vn,e.toDisplayString(o.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),wn=se(Nn,[["__scopeId","data-v-81e37239"]]),Cn={class:"cell-image"},Sn=["src"],Bn={key:1,class:"image-placeholder"},$n=e.defineComponent({__name:"CellImage",props:{value:{},fit:{},maxWidth:{},maxHeight:{},designMode:{type:Boolean},data:{}},setup(o){const i=o,t=e.computed(()=>{const r=i.value||"";return r?r.includes("{")?i.designMode?b.evaluateTemplate(r,b.DEFAULT_DEMO_DATA):b.evaluateTemplate(r,i.data?.[0]||{}):r:""}),n=e.ref(!1);function l(){n.value=!0}e.watch(t,()=>{n.value=!1});const c=e.computed(()=>({objectFit:i.fit||"contain",maxWidth:i.maxWidth?`${i.maxWidth}mm`:"100%",maxHeight:i.maxHeight?`${i.maxHeight}mm`:"100%"}));return(r,a)=>(e.openBlock(),e.createElementBlock("div",Cn,[t.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(c.value),onError:l},null,44,Sn)):(e.openBlock(),e.createElementBlock("div",Bn,"图片"))]))}}),xn=se($n,[["__scopeId","data-v-d5bc444b"]]),Dn=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],Tn=["data-fit","data-fit-base","data-fit-min","data-fit-mm"],Mn={key:0,class:"data-placeholder"},zn={key:3,class:"data-placeholder"},Pn={key:0,class:"col-resize-layer"},Rn=["aria-label","onMousedown"],An={key:1,class:"row-badges"},je=3.7795275591,Ln=.1,Un=e.defineComponent({__name:"TableElement",props:{element:{},designMode:{type:Boolean},isSelected:{type:Boolean},showTableGhostBorder:{type:Boolean},scale:{},data:{}},emits:["dblclick-element","dblclick-cell"],setup(o,{emit:i}){const t={header:"题",data:"数",subtotal:"小",summary:"汇"},n=o,l=i,c=e.inject(We,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),r=e.computed(()=>n.element.options.tableRows??[]),a=e.computed(()=>n.element.options.tableColWidths??[]),s=e.computed(()=>n.element.options.tableDefaultFontSize??10),m=e.computed(()=>n.element.options.tableDefaultColor??"#333333"),d=e.computed(()=>{const D=c.tableSelection.value;return D&&D.elementId===n.element.id?D:null});function p(D){let L=0;for(let H=0;H<D;H++)L+=r.value[H].height;return L}const g=e.ref(null),E=e.ref(null),R=e.ref([]);function S(){if(!n.designMode)return;const D=g.value;if(!D)return;const L=D.offsetHeight;if(L<=0)return;const H=n.element.options,ee=L/je;Math.abs(ee-(H.height??0))>Ln&&(H.height=Math.round(ee*100)/100);const Y=D.offsetTop;R.value=Array.from(D.rows).map(ge=>({top:(ge.offsetTop-Y)/je,height:ge.offsetHeight/je}))}function h(D){return R.value[D]?.top??p(D)}function v(D){return R.value[D]?.height??r.value[D]?.height??0}e.watch(()=>[n.element.options,n.designMode],()=>S(),{deep:!0,flush:"post"}),e.onMounted(()=>{S(),document.fonts?.ready.then(()=>S())});const x=e.computed(()=>{const D=n.element.options.dataSource;if(D&&Array.isArray(b.DEFAULT_DEMO_DATA[D]))return b.DEFAULT_DEMO_DATA[D];for(const L of Object.values(b.DEFAULT_DEMO_DATA))if(Array.isArray(L))return L}),Z=e.computed(()=>{if(n.data)return n.data});function le(D){return D.cellType==="barcode"||D.cellType==="qrcode"}function O(D,L){return le(L)?b.resolveBarcodeDesignValue(L.formatter,x.value):L.formatter||""}function K(D,L){const H=n.element.options,ee={designMode:n.designMode,showGhostBorder:n.showTableGhostBorder};return{fontFamily:L.fontFamily||"inherit",textAlign:L.align??"left",verticalAlign:L.valign??"middle",fontSize:(L.fontSize??s.value)+"pt",fontWeight:L.fontWeight??"normal",color:L.color??m.value,backgroundColor:L.backgroundColor??"transparent",borderTop:b.resolveCellBorderCss(L.borders?.top,ee),borderRight:b.resolveCellBorderCss(L.borders?.right,ee),borderBottom:b.resolveCellBorderCss(L.borders?.bottom,ee),borderLeft:b.resolveCellBorderCss(L.borders?.left,ee),padding:(L.padding??H.tableDefaultPadding??1)+"mm",whiteSpace:L.wordWrap??!0?"normal":"nowrap",overflow:L.wordWrap??!0?"visible":"hidden"}}function y(D){return b.resolveCellTextFit(D)}function F(D){return y(D)!=="autoHeight"}function q(D){return D.fontSize??s.value}function z(D,L){return b.cellFitCapMm(r.value,D,L,n.element.options.tableDefaultPadding??1)}function k(D,L){return b.cellFitWidthMm(a.value,D,L,n.element.options.tableDefaultPadding??1)}function T(D,L){return{maxHeight:z(L,D)+"mm",overflow:"hidden",...D.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}pt(E,()=>[n.designMode,n.data?.length,a.value.join(","),s.value,n.element.options.tableDefaultPadding,r.value.map(D=>`${D.height}:${D.cells.map(L=>`${L.formatter??""}|${L.fontSize??""}|${L.wordWrap??""}|${L.textFit??""}|${L.colspan??1}`).join("~")}`).join(",")]);function X(D,L){const H=d.value;return{"cell-selected":!!H&&D>=H.r1&&D<=H.r2&&L>=H.c1&&L<=H.c2,"row-data-bg":r.value[D].type==="data"}}const ne=e.ref(null);function ae(D,L){const H=b.normalizeSelection(r.value,D,L);c.setTableSelection({elementId:n.element.id,...H})}function ce(D,L,H){!n.designMode||!n.isSelected||(H.stopPropagation(),H.shiftKey&&d.value?ae({r:d.value.r1,c:d.value.c1},{r:D,c:L}):(ne.value={r:D,c:L},ae({r:D,c:L},{r:D,c:L})),window.addEventListener("mouseup",()=>{ne.value=null},{once:!0}))}function J(D,L){ne.value&&ae(ne.value,{r:D,c:L})}function u(D,L){n.designMode&&l("dblclick-cell",n.element.id,D,L)}const w=e.reactive({visible:!1,x:0,y:0});function W(D,L,H){if(!n.designMode||!n.isSelected)return;const ee=d.value;ee&&D>=ee.r1&&D<=ee.r2&&L>=ee.c1&&L<=ee.c2||ae({r:D,c:L},{r:D,c:L}),w.x=H.clientX,w.y=H.clientY,w.visible=!0,window.addEventListener("mousedown",()=>{w.visible=!1},{once:!0})}const be=e.computed(()=>{const D=d.value;return D?b.canMergeReason(r.value,D):"未选择单元格"}),ve=e.computed(()=>{const D=d.value;if(!D)return!1;for(let L=D.r1;L<=D.r2;L++)for(let H=D.c1;H<=D.c2;H++){const ee=r.value[L].cells[H];if(!ee.merged&&((ee.rowspan??1)>1||(ee.colspan??1)>1))return!0}return!1});function ue(D){const L=d.value;if(!L)return"未选择单元格";if(L.r1!==L.r2)return"行类型仅支持单行设置";const H=JSON.parse(JSON.stringify(r.value));return b.setRowType(H,L.r1,D)}function fe(){b.syncTableElementSize(n.element.options)}function M(D,L){const H=c.maxTableWidth.value,ee=D.reduce((Y,ge)=>Y+ge,0)+D[L];return ee>H?`插入后表格总宽 ${Math.round(ee*10)/10}mm 超过打印范围宽度 ${H}mm,请先缩小列宽`:null}function N(D,L){const H=d.value;if(!H)return;w.visible=!1;const ee=n.element.options,Y=ee.tableRows,ge=ee.tableColWidths;let A=null;switch(D){case"insert-row-above":b.insertRow(Y,H.r1,"above");break;case"insert-row-below":b.insertRow(Y,H.r2,"below");break;case"delete-row":A=b.deleteRow(Y,H.r1);break;case"insert-col-left":A=M(ge,H.c1),A||b.insertCol(Y,ge,H.c1,"left");break;case"insert-col-right":A=M(ge,H.c2),A||b.insertCol(Y,ge,H.c2,"right");break;case"delete-col":A=b.deleteCol(Y,ge,H.c1);break;case"merge":b.mergeCells(Y,H);break;case"split":b.splitCells(Y,H);break;case"set-row-type":A=b.setRowType(Y,H.r1,L);break}if(A){alert(A);return}c.setTableSelection(null),fe(),c.recordHistory()}const C=e.computed(()=>n.designMode&&!!n.isSelected&&!n.element.options.locked&&a.value.length>=1),U=e.computed(()=>Array.from({length:a.value.length},(D,L)=>L+1));function f(D){return a.value.slice(0,D).reduce((L,H)=>L+H,0)}const V=e.ref(null);let B=0,j=0;function _(D,L){C.value&&L.button===0&&(V.value=D,B=L.clientX,j=a.value[D-1],document.addEventListener("mousemove",oe),document.addEventListener("mouseup",me))}function oe(D){if(V.value===null)return;const L=n.scale||1,H=(D.clientX-B)/(L*je),ee=V.value-1,Y=n.element.options.tableColWidths;Y[ee]=b.clampResizedColumnWidth(Y,ee,j+H,c.maxTableWidth.value),fe()}function me(){document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",me),V.value!==null&&(V.value=null,fe(),c.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",me)}),(D,L)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:E,class:e.normalizeClass(["print-table",{"design-mode":o.designMode}]),onContextmenu:L[0]||(L[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:g,style:e.normalizeStyle({fontSize:s.value+"pt",color:m.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(H,ee)=>(e.openBlock(),e.createElementBlock("col",{key:ee,style:e.normalizeStyle({width:H+"mm"})},null,4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(H,ee)=>(e.openBlock(),e.createElementBlock("tr",{key:H.id,style:e.normalizeStyle({height:H.height+"mm"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(H.cells,(Y,ge)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:Y.id},[Y.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:Y.rowspan||1,colspan:Y.colspan||1,class:e.normalizeClass(X(ee,ge)),style:e.normalizeStyle(K(H,Y)),onMousedown:e.withModifiers(A=>ce(ee,ge,A),["left"]),onMouseenter:A=>J(ee,ge),onDblclick:e.withModifiers(A=>u(ee,ge),["stop"]),onContextmenu:e.withModifiers(A=>W(ee,ge,A),["prevent","stop"])},[le(Y)?(e.openBlock(),e.createBlock(wn,{key:0,"cell-type":Y.cellType,value:O(H,Y),"barcode-type":Y.barcodeType,"qr-code-level":Y.qrCodeLevel,"show-text":Y.showBarcodeText!==!1,fit:Y.fit,"max-width":Y.maxWidth,"max-height":Y.maxHeight,"printer-dpi":Y.printerDpi,"target-width-mm":k(ge,Y),"target-height-mm":z(ee,Y),"bar-width":Y.barWidth,"bar-font-size":Y.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"])):Y.cellType==="image"?(e.openBlock(),e.createBlock(xn,{key:1,value:Y.formatter||"",fit:Y.fit,"max-width":Y.maxWidth,"max-height":Y.maxHeight,"design-mode":o.designMode,data:Z.value},null,8,["value","fit","max-width","max-height","design-mode","data"])):F(Y)?(e.openBlock(),e.createElementBlock("div",{key:2,class:"cell-fit",style:e.normalizeStyle(T(Y,ee)),"data-fit":y(Y)==="shrink"?"shrink":void 0,"data-fit-base":String(q(Y)),"data-fit-min":String(e.unref(b.resolveShrinkMinFontSize)(Y.shrinkMinFontSize)),"data-fit-mm":z(ee,Y)},[H.type==="data"?(e.openBlock(),e.createElementBlock("span",Mn,e.toDisplayString(O(H,Y)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(O(H,Y)),1)],64))],12,Tn)):H.type==="data"?(e.openBlock(),e.createElementBlock("span",zn,e.toDisplayString(O(H,Y)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createTextVNode(e.toDisplayString(O(H,Y)),1)],64))],46,Dn))],64))),128))],4))),128))])],4),C.value?(e.openBlock(),e.createElementBlock("div",Pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(U.value,H=>(e.openBlock(),e.createElementBlock("div",{key:H,class:e.normalizeClass(["col-resize-handle",{dragging:V.value===H}]),role:"separator","aria-label":"列宽手柄"+H,style:e.normalizeStyle({left:f(H)+"mm"}),onMousedown:e.withModifiers(ee=>_(H,ee),["stop","prevent"])},null,46,Rn))),128))])):e.createCommentVNode("",!0),o.designMode&&o.isSelected?(e.openBlock(),e.createElementBlock("div",An,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(H,ee)=>(e.openBlock(),e.createElementBlock("span",{key:H.id,class:"row-badge",style:e.normalizeStyle({top:h(ee)+"mm",height:v(ee)+"mm"})},e.toDisplayString(t[H.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(bn,{visible:w.visible,x:w.x,y:w.y,"can-delete-row":r.value.length>1,"can-delete-col":a.value.length>1,"merge-disabled-reason":be.value,"can-split":ve.value,"current-row-type":d.value?r.value[d.value.r1]?.type??null:null,"row-type-disabled-reason":ue,onAction:N},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),In=se(Un,[["__scopeId","data-v-4531a154"]]),kt=e.defineComponent({__name:"LineElement",props:{element:{}},setup(o){const i=o,t=e.computed(()=>i.element.printElementType.type==="hline"),n=e.computed(()=>{const l=i.element.options,c=(l.borderWidth||.75)+"pt",r=l.borderStyle||"solid",a=l.borderColor||"#333";return t.value?{width:"100%",height:"0",borderTop:`${c} ${r} ${a}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${c} ${r} ${a}`,boxSizing:"border-box"}});return(l,c)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(n.value)},null,4))}}),Vt=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(o){const i=o,t=e.computed(()=>i.element.printElementType.type==="oval"),n=e.computed(()=>{const l=i.element.options;return{width:"100%",height:"100%",borderWidth:(l.borderWidth||1)+"pt",borderStyle:l.borderStyle||"solid",borderColor:l.borderColor||"#333",backgroundColor:l.backgroundColor||"transparent",borderRadius:t.value?"50%":"0",boxSizing:"border-box"}});return(l,c)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(n.value)},null,4))}}),Fn={class:"print-barcode",ref:"containerRef"},On=["preserveAspectRatio"],Hn=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.ref(null),n=e.ref(null),l={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},c=e.computed(()=>l[i.element.options.fit||"contain"]??"xMidYMid meet"),r=e.computed(()=>n.value?{width:n.value.width,height:n.value.height}:{maxWidth:"100%",maxHeight:"100%"});function a(){if(!t.value)return;const m=i.element.options,d=(i.designMode?m.testData||m.formatter:b.resolveTextBinding(m,i.data))||"条码",p=b.barcodeUnitsPerModule(m.barWidth);try{$t(t.value,d,{format:m.barcodeType||"CODE128",width:p,height:b.BARCODE_BAR_HEIGHT_MODULES*p,displayValue:!m.hideTitle,fontSize:(m.fontSize??b.BARCODE_TEXT_FONT_SIZE_MODULES)*p,margin:0,marginLeft:b.BARCODE_QUIET_ZONE_MODULES*p,marginRight:b.BARCODE_QUIET_ZONE_MODULES*p,marginTop:0,marginBottom:b.BARCODE_MARGIN_BOTTOM_MODULES*p})}catch{n.value=null;return}const g=s(t.value),E=g?b.resolveBarcodeSize({unitWidth:g.width/p,unitHeight:g.height/p,boxWidthMm:b.barcodeAvailableBoxMm(m.width,m.maxWidth),boxHeightMm:b.barcodeAvailableBoxMm(m.height,m.maxHeight),dpi:m.printerDpi,barWidth:m.barWidth}):null;n.value=E?{width:`${E.widthMm}mm`,height:`${E.heightMm}mm`}:null,t.value.setAttribute("shape-rendering","crispEdges")}function s(m){const d=(m.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return d.length!==4||d.some(p=>!Number.isFinite(p))?null:{width:d[2],height:d[3]}}return e.onMounted(a),e.watch(()=>[i.element.options.formatter,i.element.options.testData,i.element.options.barcodeType,i.element.options.width,i.element.options.height,i.element.options.barWidth,i.element.options.printerDpi,i.element.options.hideTitle,i.element.options.fontSize,i.element.options.maxWidth,i.element.options.maxHeight],a),(m,d)=>(e.openBlock(),e.createElementBlock("div",Fn,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:t,preserveAspectRatio:c.value,style:e.normalizeStyle(r.value)},null,12,On))],512))}}),Wn=se(Hn,[["__scopeId","data-v-6eb95a40"]]),Gn={class:"print-qrcode"},Kn=["src"],qn=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.ref(""),n=e.computed(()=>{const c=i.element.options;return{objectFit:c.fit||"contain",maxWidth:c.maxWidth?`${c.maxWidth}mm`:"100%",maxHeight:c.maxHeight?`${c.maxHeight}mm`:"100%"}});async function l(){const c=i.element.options,r=(i.designMode?c.testData||c.formatter:b.resolveTextBinding(c,i.data))||"二维码",a=Math.min(c.width||80,c.height||80);try{t.value=await xt.toDataURL(r,{width:a,margin:1,errorCorrectionLevel:String(c.qrCodeLevel??"M")})}catch{t.value=""}}return e.onMounted(l),e.watch(()=>[i.element.options.formatter,i.element.options.testData,i.element.options.qrCodeLevel],l),(c,r)=>(e.openBlock(),e.createElementBlock("div",Gn,[t.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,alt:"qrcode",style:e.normalizeStyle(n.value)},null,12,Kn)):e.createCommentVNode("",!0)]))}}),Yn=se(qn,[["__scopeId","data-v-3454544f"]]),jn=["innerHTML"],Xn=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.computed(()=>{if(i.element.options.formatter){const n=i.data&&i.data.length>0?i.data[0]:{},l=b.evaluateTemplate(i.element.options.formatter,n??{});return l?Ht.sanitize(l):""}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(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:t.value},null,8,jn))}}),Zn=se(Xn,[["__scopeId","data-v-880bbde5"]]),Jn=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.computed(()=>{const l=i.element.options;return{fontSize:(l.fontSize||12)+"pt",fontWeight:l.fontWeight||"normal",fontFamily:l.fontFamily||"inherit",color:l.color||"#333",textAlign:l.textAlign||"left",lineHeight:l.lineHeight?l.lineHeight+"pt":"normal",letterSpacing:l.letterSpacing?l.letterSpacing+"pt":"normal"}}),n=e.computed(()=>i.designMode?i.element.options.title||"{pageIndex}/{totalPages}":i.element.options.title||"");return(l,c)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(t.value)},e.toDisplayString(n.value),5))}}),Qn=se(Jn,[["__scopeId","data-v-38f1d7df"]]),_n={key:0,class:"drag-preview"},el={key:1,class:"resize-handles"},tl=["onMousedown"],ol={key:2,class:"selected-indicator"},nl={class:"position-label"},ll=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(o,{emit:i}){const t=o,n=i,l=e.ref(null),c=e.inject(Dt,null),r=e.computed(()=>c?.value?c.value.has(t.element.id):t.isSelected??!1),a=e.inject(Tt,null),s=e.computed(()=>a?.value.has(t.element.id)??!1),m={text:e.markRaw(rn),image:e.markRaw(mn),longText:e.markRaw(vn),table:e.markRaw(In),hline:e.markRaw(kt),vline:e.markRaw(kt),rect:e.markRaw(Vt),oval:e.markRaw(Vt),barcode:e.markRaw(Wn),qrcode:e.markRaw(Yn),html:e.markRaw(Zn),pageNumber:e.markRaw(Qn)},d=e.computed(()=>m[t.element.printElementType.type]),p=e.computed(()=>t.element.printElementType.type==="table"?{showTableGhostBorder:t.showTableGhostBorder,scale:t.scale}:{}),g=e.computed(()=>{const k=t.element.options;return{position:"absolute",left:k.left+"mm",top:k.top+"mm",width:k.width+"mm",height:k.height+"mm",zIndex:k.zIndex||"auto"}}),E=e.computed(()=>{const k=t.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,S=0;const h=e.reactive({disabled:!t.designMode||!!t.element.options.locked,getScale:()=>(t.scale||1)*b.mmToPx(1),onDrag:k=>{const T=k.left-R,X=k.top-S;l.value&&(l.value.style.transform=`translate(${T}mm, ${X}mm)`)},onDragEnd:(k,T)=>{if(T.altKey){const ae=JSON.parse(JSON.stringify(t.element));ae.id=b.generateId(),ae.options.left=k.left,ae.options.top=k.top,ae.options.groupId=void 0,n("clone-element",ae,{left:k.left,top:k.top}),l.value&&(l.value.style.transform="");return}const X=k.left-R,ne=k.top-S;if(t.element.options.left=k.left,t.element.options.top=k.top,l.value&&(l.value.style.transform=""),t.element.options.groupId&&t.allElements)for(const ae of t.allElements)ae.id!==t.element.id&&ae.options.groupId===t.element.options.groupId&&(ae.options.left+=X,ae.options.top+=ne)},onStart:()=>{R=t.element.options.left,S=t.element.options.top,n("drag-start")},onStop:()=>{t.clearAdsorbGuides?.(),n("drag-stop")},onAdsorb:k=>{let T=k.left,X=k.top;return t.snapToGrid&&(T=Math.round(k.left/5)*5,X=Math.round(k.top/5)*5),t.adsorbHandler?t.adsorbHandler({id:t.element.id,left:T,top:X,width:t.element.options.width,height:t.element.options.height}):{left:T,top:X,lines:[]}}}),{setup:v,cleanup:x,isDragging:Z}=on(l,h);e.watchEffect(()=>{h.disabled=!t.designMode||!!t.element.options.locked});const le=e.computed(()=>r.value&&!!t.designMode&&!t.element.options.locked&&t.element.printElementType.type!=="table"),{startResize:O,cleanup:K}=b.useResize({minWidth:3.5,minHeight:3.5,getScale:()=>(t.scale||1)*b.mmToPx(1),getRect:()=>({left:t.element.options.left,top:t.element.options.top,width:t.element.options.width,height:t.element.options.height}),onResize:k=>{t.element.options.left=k.left,t.element.options.top=k.top,t.element.options.width=k.width,t.element.options.height=k.height},onStart:()=>{n("drag-start")},onStop:()=>{n("drag-stop")}});function y(k){t.designMode&&k.button===0&&n("select",t.element.id,k.ctrlKey||k.metaKey)}function F(){t.designMode&&n("dblclick-element",t.element.id)}function q(k,T,X){t.designMode&&n("dblclick-cell",k,T,X)}e.onMounted(()=>{t.designMode&&v()});function z(){x(),K(),t.clearAdsorbGuides?.()}return e.onUnmounted(()=>{z()}),(k,T)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:l,class:e.normalizeClass(["print-element",{selected:r.value,previewed:s.value,"design-mode":o.designMode,locked:o.element.options.locked,hidden:o.element.options.visible===!1,"drag-ghost":e.unref(Z),[`type-${o.element.printElementType.type}`]:!0,[`zone-${o.zone||"content"}`]:!0}]),style:e.normalizeStyle(g.value),onMousedown:e.withModifiers(y,["stop"]),onDblclick:e.withModifiers(F,["stop"]),onContextmenu:T[0]||(T[0]=e.withModifiers(X=>k.$emit("contextmenu",o.element.id,X),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps({element:o.element,data:o.printData,"design-mode":o.designMode,"is-selected":r.value},p.value,{onDblclickCell:q}),null,16,["element","data","design-mode","is-selected"])),e.unref(Z)?(e.openBlock(),e.createElementBlock("div",_n)):e.createCommentVNode("",!0),le.value?(e.openBlock(),e.createElementBlock("div",el,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b.RESIZE_POINTS),X=>(e.openBlock(),e.createElementBlock("div",{key:X,class:e.normalizeClass(["resize-handle",`handle-${X}`]),onMousedown:e.withModifiers(ne=>e.unref(O)(X,ne),["stop"])},null,42,tl))),128))])):e.createCommentVNode("",!0),r.value&&o.designMode?(e.openBlock(),e.createElementBlock("div",ol,[e.createElementVNode("div",nl,e.toDisplayString(E.value),1)])):e.createCommentVNode("",!0)],38))}}),rt=se(ll,[["__scopeId","data-v-5f1145ee"]]);function al(o={}){const i=e.ref([]),t=e.ref({width:0,height:0});function n(r,a,s){return b.computeAdsorb(r,a,s,o)}function l(r,a,s){i.value=r,t.value={width:a,height:s}}function c(){i.value=[]}return{check:n,renderLines:l,clearLines:c,guideLines:i,paperSize:t}}function il(o){const{check:i,renderLines:t,clearLines:n,guideLines:l,paperSize:c}=al(o.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function r(s){const m=o.getElements().filter(g=>g.id!==s.id).map(g=>({id:g.id,left:g.options.left,top:g.options.top,width:g.options.width,height:g.options.height})),d=i(s,m,o.getGuides?.()),p=o.getPaperSize();return t(d.lines,p.width,p.height),d}function a(){n()}return{requestAdsorb:r,clearGuides:a,guideLines:l,paperSize:c}}const rl=["src"],sl=["width","height","viewBox"],dl=["x","y","font-size","fill","transform"],cl={key:0,class:"zone-label"},ul={key:0,class:"zone-height-tip"},ml={key:0,class:"zone-label"},pl={key:0,class:"zone-height-tip"},vl=["onMousedown","onDblclick"],fl=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(o,{expose:i,emit:t}){const n=o,l=t,c=e.ref(null),r=e.computed(()=>b.getPaperDimensions(n.templateData).width),a=e.computed(()=>b.getPaperDimensions(n.templateData).height),s=e.computed(()=>n.templateData.designBackground),m=e.ref(!1);e.watch(()=>s.value?.src,()=>{m.value=!1});const d=e.computed(()=>{const N=s.value?.rotation;return N===90||N===180||N===270?N:0}),p=e.computed(()=>{const N=d.value,C=N===90||N===270,U=C?a.value:r.value,f=C?r.value:a.value,V={width:U+"mm",height:f+"mm",left:(r.value-U)/2+"mm",top:(a.value-f)/2+"mm"};return N!==0&&(V.transform=`rotate(${N}deg)`),V});function g(){m.value=!0,console.warn("[print-designer] 设计背景图加载失败:",s.value?.src)}const E=e.computed(()=>`${8/(n.scale||1)}px`),R=e.computed(()=>{const N=n.scale||1,C=b.mmToPx(r.value)*N,U=b.mmToPx(a.value)*N;return{width:C+"px",height:U+"px",position:"relative"}}),S=e.computed(()=>{const N=n.templateData.margins,C=n.templateData.header.height,U=n.templateData.footer.height,f=r.value-N.left-N.right;return{header:{left:N.left,top:N.top,width:f,height:C},content:{left:N.left,top:N.top+C,width:f,height:a.value-N.top-N.bottom-C-U},footer:{left:N.left,top:a.value-N.bottom-U,width:f,height:U}}});function h(N){return{position:"absolute",left:N.left+"mm",top:N.top+"mm",width:N.width+"mm",height:N.height+"mm"}}const v=e.computed(()=>{const N={header:[],footer:[],content:[]};for(const C of n.runtimeElements)C.zone==="header"?N.header.push(C):C.zone==="footer"?N.footer.push(C):N.content.push(C);return N}),x=e.computed(()=>v.value.header),Z=e.computed(()=>v.value.footer),le=e.computed(()=>v.value.content);let O="content";const{requestAdsorb:K,clearGuides:y,guideLines:F,paperSize:q}=il({getElements:()=>v.value[O],getPaperSize:()=>{const N=S.value[O];return{width:N.width,height:N.height}},getGuides:()=>{const N=[],C=[];for(const U of n.guides??[])U.type==="vertical"?N.push(U.position):C.push(U.position);return{vertical:N,horizontal:C}}});function z(N){O=n.runtimeElements.find(f=>f.id===N.id)?.zone||"content";const U=K(N);return(U.left!==N.left||U.top!==N.top)&&u(U.left+N.width/2,U.top+N.height/2),U}function k(N,C){if(N.button!==0)return;const U=C.position,f=N.clientX,V=N.clientY,B=n.scale??1,j=25.4/96,_=me=>{const D=(C.type==="vertical"?me.clientX-f:me.clientY-V)/B*j,L=C.type==="vertical"?r.value:a.value,H=Math.min(Math.max(U+D,0),L);l("guide-move",C.id,H)},oe=()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",oe)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",oe)}const T=e.computed(()=>({width:r.value+"mm",minHeight:a.value+"mm",background:n.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:n.scale?`scale(${n.scale})`:void 0,transformOrigin:"0 0"})),X=e.computed(()=>{const N=n.templateData.margins;return{padding:`${N.top}mm ${N.right}mm ${N.bottom}mm ${N.left}mm`,position:"relative",boxSizing:"border-box",minHeight:a.value+"mm"}}),ne=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 ae=0,ce=null;const J=e.ref(null);function u(N,C){ae+=1,J.value={left:N,top:C,key:ae},ce&&clearTimeout(ce),ce=setTimeout(()=>{J.value=null},300)}const w=e.computed(()=>he.resolveWatermarkLayout(n.templateData.watermark,n.printData,{width:r.value,height:a.value})),W=e.ref(null);function be(N,C){C.button===0&&(fe(),W.value={zone:N,startY:C.clientY,startH:n.templateData[N].height},window.addEventListener("mousemove",ve),window.addEventListener("mouseup",ue))}function ve(N){if(!W.value)return;const{zone:C,startY:U,startH:f}=W.value,B=(N.clientY-U)/(n.scale||1)*25.4/96,j=C==="header"?B:-B,_=Math.min(100,a.value-n.templateData.margins.top-n.templateData.margins.bottom-(C==="header"?n.templateData.footer.height:n.templateData.header.height)-10),oe=Math.min(_,Math.max(0,Math.round((f+j)*10)/10));l("zone-height-change",C,oe)}function ue(){if(!W.value)return;const N=W.value.zone;W.value=null,window.removeEventListener("mousemove",ve),window.removeEventListener("mouseup",ue),l("zone-height-commit",N)}function fe(){window.removeEventListener("mousemove",ve),window.removeEventListener("mouseup",ue),W.value=null}e.onUnmounted(()=>{fe(),ce&&clearTimeout(ce)});function M(N,C){l("select",N,C)}return i({contentRef:c}),(N,C)=>(e.openBlock(),e.createElementBlock("div",{class:"paper-wrapper",style:e.normalizeStyle(R.value)},[e.createElementVNode("div",{class:"hiprint-printPaper",style:e.normalizeStyle(T.value)},[o.designMode&&s.value?.src&&!m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"design-background",style:e.normalizeStyle(p.value)},[e.createElementVNode("img",{src:s.value.src,draggable:"false",alt:"",onError:g},null,40,rl)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:c,style:e.normalizeStyle(X.value)},[o.showGrid&&o.designMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"grid-bg",style:e.normalizeStyle(ne.value)},null,4)):e.createCommentVNode("",!0),J.value?(e.openBlock(),e.createElementBlock("div",{key:J.value.key,class:"snap-indicator",style:e.normalizeStyle({left:J.value.left+"mm",top:J.value.top+"mm"})},null,4)):e.createCommentVNode("",!0),w.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"watermark-layer",style:e.normalizeStyle({opacity:String(w.value.opacity)})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value.tiles,(U,f)=>(e.openBlock(),e.createElementBlock("svg",{key:f,class:"watermark-tile",width:U.widthMm+"mm",height:U.heightMm+"mm",viewBox:`0 0 ${w.value.tileWidthPx} ${w.value.tileHeightPx}`,style:e.normalizeStyle({left:U.leftMm+"mm",top:U.topMm+"mm"}),xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("text",{x:w.value.tileWidthPx/2,y:w.value.tileHeightPx/2,"font-size":w.value.fontSizePx,fill:w.value.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${w.value.rotate},${w.value.tileWidthPx/2},${w.value.tileHeightPx/2})`},e.toDisplayString(w.value.text),9,dl)],12,sl))),128))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-header",{"design-mode":o.designMode}]),style:e.normalizeStyle(h(S.value.header))},[o.designMode?(e.openBlock(),e.createElementBlock("span",cl,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,U=>(e.openBlock(),e.createBlock(rt,{key:U.id,element:U,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":x.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"header","adsorb-handler":z,"clear-adsorb-guides":e.unref(y),onSelect:M,onDragStart:C[0]||(C[0]=f=>N.$emit("drag-start")),onDragStop:C[1]||(C[1]=f=>N.$emit("drag-stop")),onDblclickElement:C[2]||(C[2]=f=>N.$emit("dblclick-element",f)),onDblclickCell:C[3]||(C[3]=(f,V,B)=>N.$emit("dblclick-cell",f,V,B)),onContextmenu:C[4]||(C[4]=(f,V)=>N.$emit("contextmenu",f,V)),onCloneElement:(f,V)=>N.$emit("clone-element",f,V)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-bottom",onMousedown:C[5]||(C[5]=e.withModifiers(U=>be("header",U),["prevent","stop"]))},[W.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",ul,e.toDisplayString(o.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":o.designMode}]),style:e.normalizeStyle(h(S.value.content))},[o.designMode&&o.templateData.firstPageOverlay.height>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:"zone-overlay",style:e.normalizeStyle({height:o.templateData.firstPageOverlay.height+"mm"})},[...C[17]||(C[17]=[e.createElementVNode("span",{class:"zone-label"},"首页叠加",-1)])],4)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(le.value,U=>(e.openBlock(),e.createBlock(rt,{key:U.id,element:U,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":le.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"content","adsorb-handler":z,"clear-adsorb-guides":e.unref(y),onSelect:M,onDragStart:C[6]||(C[6]=f=>N.$emit("drag-start")),onDragStop:C[7]||(C[7]=f=>N.$emit("drag-stop")),onDblclickElement:C[8]||(C[8]=f=>N.$emit("dblclick-element",f)),onDblclickCell:C[9]||(C[9]=(f,V,B)=>N.$emit("dblclick-cell",f,V,B)),onContextmenu:C[10]||(C[10]=(f,V)=>N.$emit("contextmenu",f,V)),onCloneElement:(f,V)=>N.$emit("clone-element",f,V)},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":o.designMode}]),style:e.normalizeStyle(h(S.value.footer))},[o.designMode?(e.openBlock(),e.createElementBlock("span",ml,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,U=>(e.openBlock(),e.createBlock(rt,{key:U.id,element:U,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":Z.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"footer","adsorb-handler":z,"clear-adsorb-guides":e.unref(y),onSelect:M,onDragStart:C[11]||(C[11]=f=>N.$emit("drag-start")),onDragStop:C[12]||(C[12]=f=>N.$emit("drag-stop")),onDblclickElement:C[13]||(C[13]=f=>N.$emit("dblclick-element",f)),onDblclickCell:C[14]||(C[14]=(f,V,B)=>N.$emit("dblclick-cell",f,V,B)),onContextmenu:C[15]||(C[15]=(f,V)=>N.$emit("contextmenu",f,V)),onCloneElement:(f,V)=>N.$emit("clone-element",f,V)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-top",onMousedown:C[16]||(C[16]=e.withModifiers(U=>be("footer",U),["prevent","stop"]))},[W.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",pl,e.toDisplayString(o.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(F),(U,f)=>(e.openBlock(),e.createElementBlock("div",{key:f,class:e.normalizeClass(["adsorb-guide",[`guide-${U.type}`]]),style:e.normalizeStyle(U.type==="vertical"?{left:U.position+"mm",top:"0",height:e.unref(q).height+"mm",borderLeftColor:U.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:U.position+"mm",left:"0",width:e.unref(q).width+"mm",borderTopColor:U.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.guides,U=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+U.id,class:e.normalizeClass(["manual-guide",[`guide-${U.type}`]]),style:e.normalizeStyle(U.type==="vertical"?{left:U.position+"mm",top:"0",height:a.value+"mm","--guide-hit":E.value}:{top:U.position+"mm",left:"0",width:r.value+"mm","--guide-hit":E.value}),onMousedown:e.withModifiers(f=>k(f,U),["prevent","stop"]),onDblclick:e.withModifiers(f=>U.id&&l("guide-remove",U.id),["prevent","stop"])},null,46,vl))),128))],4)],4)],4))}}),gl=se(fl,[["__scopeId","data-v-38b3a452"]]),hl=e.defineComponent({__name:"Ruler",props:{orientation:{},viewportPx:{},originPx:{},paperLengthMM:{},scale:{},cursorPx:{}},emits:["add-guide","guide-dragging"],setup(o,{emit:i}){const t=o,n=i,l=e.computed(()=>t.orientation==="horizontal"),c=e.computed(()=>l.value?"vertical":"horizontal"),r=e.ref(null),a=e.ref(null),s=e.computed(()=>a.value??t.cursorPx??null),m=e.computed(()=>l.value?{width:t.viewportPx+"px",height:b.RULER_THICKNESS+"px"}:{width:b.RULER_THICKNESS+"px",height:t.viewportPx+"px"});let d=0;function p(){d||(d=requestAnimationFrame(()=>{d=0,g()}))}function g(){const y=r.value;if(!y)return;const F=y.getContext("2d");if(!F)return;const q=window.devicePixelRatio||1,z=Math.max(0,Math.round(t.viewportPx)),k=b.RULER_THICKNESS;y.width=(l.value?z:k)*q,y.height=(l.value?k:z)*q,F.setTransform(q,0,0,q,0,0);const T=getComputedStyle(y),X=T.getPropertyValue("--pd-ruler-bg").trim()||"#F8F9FC",ne=T.getPropertyValue("--pd-ruler").trim()||"#9AA1AF",ae=T.getPropertyValue("--pd-accent").trim()||"#165DFF";F.fillStyle=X,F.fillRect(0,0,l.value?z:k,l.value?k:z);const ce=t.scale>0?t.scale:1,J=b.mmToPx(1)*ce;if(J<=0)return;const u=-t.originPx/J,w=(z-t.originPx)/J,W=b.chooseMajorStepMM(ce),be=b.buildRulerTicks(u,w,W);E(F,be,J,ne,!0),E(F,be,J,ne,!1),R(F,0,ae),R(F,t.paperLengthMM,ae);const ve=s.value;if(ve!==null&&ve>=0&&ve<=z){if(F.strokeStyle=ae,F.lineWidth=1.5,F.beginPath(),l.value){const ue=Math.round(ve)+.5;F.moveTo(ue,0),F.lineTo(ue,k)}else{const ue=Math.round(ve)+.5;F.moveTo(0,ue),F.lineTo(k,ue)}F.stroke()}}function E(y,F,q,z,k){y.strokeStyle=z,y.fillStyle=z,y.globalAlpha=k?.32:1,y.lineWidth=1,y.font="9px ui-monospace, Menlo, monospace",y.textBaseline="top";for(const T of F){if((T.mm<0||T.mm>t.paperLengthMM)!==k)continue;const ne=Math.round(t.originPx+T.mm*q)+.5,ae=T.major?8:4;y.beginPath(),l.value?(y.moveTo(ne,0),y.lineTo(ne,ae)):(y.moveTo(0,ne),y.lineTo(ae,ne)),y.stroke(),T.major&&T.label&&(l.value?y.fillText(T.label,ne+2,11):(y.save(),y.translate(11,ne+2),y.rotate(-Math.PI/2),y.fillText(T.label,0,0),y.restore()))}y.globalAlpha=1}function R(y,F,q){const z=b.mmToPx(1)*(t.scale>0?t.scale:1),k=Math.round(t.originPx+F*z)+.5;k<=0||k>=t.viewportPx||(y.strokeStyle=q,y.globalAlpha=.55,y.lineWidth=1,y.beginPath(),l.value?(y.moveTo(k,0),y.lineTo(k,b.RULER_THICKNESS)):(y.moveTo(0,k),y.lineTo(b.RULER_THICKNESS,k)),y.stroke(),y.globalAlpha=1)}e.watch(()=>[t.viewportPx,t.originPx,t.paperLengthMM,t.scale,t.cursorPx,t.orientation],p),e.onMounted(p),e.onBeforeUnmount(()=>{d&&cancelAnimationFrame(d)});let S=!1;function h(y){const F=r.value;if(!F)return null;const q=F.getBoundingClientRect(),z=l.value?y.clientX-q.left:y.clientY-q.top;if(z<0||z>t.viewportPx)return null;const k=b.mmToPx(1)*(t.scale>0?t.scale:1);return(z-t.originPx)/k}function v(y){y.button===0&&(S=!0,y.preventDefault(),window.addEventListener("mousemove",O),window.addEventListener("mouseup",K),le(y))}function x(y){const F=r.value;if(!F)return;const q=F.getBoundingClientRect();a.value=l.value?y.clientX-q.left:y.clientY-q.top,p()}function Z(){a.value=null,p()}function le(y){const F=h(y);n("guide-dragging",F)}function O(y){S&&le(y)}function K(y){if(!S)return;S=!1,window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",K);const F=h(y);F!==null&&F>=0&&F<=t.paperLengthMM&&n("add-guide",c.value,F),n("guide-dragging",null)}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",K)}),(y,F)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:r,class:e.normalizeClass(["pd-ruler",`is-${o.orientation}`]),style:e.normalizeStyle(m.value),onMousedown:v,onMousemove:x,onMouseleave:Z},null,38))}}),Nt=se(hl,[["__scopeId","data-v-1e7d0633"]]),bl={class:"canvas-scroll"},El={key:0,class:"overlay-layer"},yl=["src"],Xe=96/25.4,kl=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(o,{expose:i,emit:t}){const n=o,l=t;function c(f,V){l("select",f,V)}const r=e.ref(null),a=e.computed(()=>b.getPaperDimensions(n.templateData).width),s=e.computed(()=>b.getPaperDimensions(n.templateData).height),m=e.reactive({originX:0,originY:0,viewW:0,viewH:0,paperScale:1}),d=e.reactive({x:null,y:null}),p=e.reactive({x:0,y:0}),g=e.computed(()=>({transform:`translate(${p.x}px, ${p.y}px)`}));function E(){const f=r.value,V=f?.querySelector(".hiprint-printPaper");if(!f||!V)return;const B=f.getBoundingClientRect(),j=V.getBoundingClientRect(),_=n.scale||1,oe=j.width/b.mmToPx(a.value);m.paperScale=Math.abs(oe-_)<.002?_:oe,m.originX=j.left-B.left-b.RULER_THICKNESS,m.originY=j.top-B.top-b.RULER_THICKNESS,m.viewW=f.clientWidth-b.RULER_THICKNESS,m.viewH=f.clientHeight-b.RULER_THICKNESS}function R(){p.x=r.value?.scrollLeft??0,p.y=r.value?.scrollTop??0,E()}let S=null,h=0;function v(){cancelAnimationFrame(h);const f=performance.now()+220,V=()=>{E(),performance.now()<f&&(h=requestAnimationFrame(V))};h=requestAnimationFrame(V)}const x=e.ref(null);function Z(f,V){x.value=V===null?null:{type:f,mm:V}}const le=e.computed(()=>{const f=x.value,V=r.value?.querySelector(".hiprint-printPaper");if(!f||!V)return{};const B=V.getBoundingClientRect(),j=B.width/b.mmToPx(a.value),_=b.mmToPx(f.mm)*(j>0?j:n.scale||1);return f.type==="vertical"?{left:B.left+_+"px",top:B.top+"px",height:B.height+"px"}:{left:B.left+"px",top:B.top+_+"px",width:B.width+"px"}});function O(f){const V=r.value?.querySelector(".hiprint-printPaper");if(!V)return;const B=V.getBoundingClientRect(),j=n.scale||1,_=b.pxToMm((f.clientX-B.left)/j),oe=b.pxToMm((f.clientY-B.top)/j);if(!(_<0||oe<0))return{x:_,y:oe}}function K(f){const V=O(f),B=f.dataTransfer?.getData("fieldData");if(B)try{const _=JSON.parse(B);l("drop-field",_,V);return}catch{}const j=f.dataTransfer?.getData("elementType");j&&l("drop-element",j,V)}const y=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let F={x:0,y:0};function q(f){return!f||!(f instanceof HTMLElement)?!1:!!(f===r.value||f.classList.contains("canvas-scroll")||f.classList.contains("hiprint-printPaper")||f.classList.contains("hiprint-printPaper-content")||f.classList.contains("zone-layer")||f.classList.contains("grid-bg")||f.classList.contains("watermark-layer"))}function z(f){const V=r.value,B=V?.querySelector(".hiprint-printPaper");if(!V||!B)return;const j=V.getBoundingClientRect();d.x=f.clientX-j.left-b.RULER_THICKNESS,d.y=f.clientY-j.top-b.RULER_THICKNESS;const _=B.getBoundingClientRect(),oe=n.scale||1,me=b.pxToMm((f.clientX-_.left)/oe),D=b.pxToMm((f.clientY-_.top)/oe);if(me<0||D<0){l("coordinate",null);return}l("coordinate",{x:me,y:D})}function k(){l("coordinate",null),d.x=null,d.y=null}function T(f,V,B,j){const _=r.value;if(!_)return;const oe=Math.max(j,Math.round(f)),me=Math.round((n.scale||1)*100);if(oe===me)return;const D=n.scale||1,L=oe/100/D,H=getComputedStyle(_),ee=parseFloat(H.paddingLeft)||0,Y=parseFloat(H.paddingTop)||0,ge=_.scrollLeft+V-ee,A=_.scrollTop+B-Y;l("zoom",oe-me),e.nextTick(()=>{const $=getComputedStyle(_),Q=parseFloat($.paddingLeft)||0,pe=parseFloat($.paddingTop)||0;_.scrollLeft=ge*L-V+Q,_.scrollTop=A*L-B+pe})}function X(f){if(!(f.ctrlKey||f.metaKey))return;f.preventDefault();const V=r.value;if(!V)return;const B=Math.round((n.scale||1)*100),j=b.nextWheelScale(B,f.deltaY>0?-1:1);if(j===B)return;const _=V.getBoundingClientRect();T(j,f.clientX-_.left,f.clientY-_.top,b.MIN_SCALE_PERCENT)}function ne(f){const V=r.value;if(!V)return;const B=Math.round((n.scale||1)*100),j=b.nextWheelScale(B,f);T(j,V.clientWidth/2,V.clientHeight/2,b.MIN_SCALE_PERCENT)}function ae(f){const V=r.value;if(!V)return;const B=V.querySelector(".hiprint-printPaper"),j=B?.style.transition??"";B&&(B.style.transition="none"),T(f,V.clientWidth/2,V.clientHeight/2,b.FIT_SCALE_MIN_PERCENT),e.nextTick(()=>{B&&(B.style.transition=j)})}function ce(f){f.button!==2&&q(f.target)&&(l("clear-selection"),F={x:f.clientX,y:f.clientY},y.visible=!0,y.x=f.clientX,y.y=f.clientY,y.w=0,y.h=0,window.addEventListener("mousemove",u),window.addEventListener("mouseup",w))}function J(){if(y.w<3||y.h<3)return[];const f=r.value?.querySelector(".hiprint-printPaper");if(!f)return[];const V=f.getBoundingClientRect(),B=n.scale||1,j=y.x<F.x,_=[];for(const oe of n.elements){if(oe.options.visible===!1||oe.options.locked)continue;const me=V.left+oe.options.left*Xe*B,D=V.top+oe.options.top*Xe*B,L=me+oe.options.width*Xe*B,H=D+oe.options.height*Xe*B,ee=me<y.x+y.w&&L>y.x&&D<y.y+y.h&&H>y.y,Y=me>=y.x&&L<=y.x+y.w&&D>=y.y&&H<=y.y+y.h;(j?Y:ee)&&_.push(oe.id)}return _}function u(f){const V=f.clientX-F.x,B=f.clientY-F.y;y.x=V>=0?F.x:f.clientX,y.y=B>=0?F.y:f.clientY,y.w=Math.abs(V),y.h=Math.abs(B),l("preview",J())}function w(){window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",w);const f=J();l("preview",f),f.length>0?l("commit-preview"):l("clear-selection"),l("preview",[]),y.visible=!1}const W=e.reactive({visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null}),be=e.ref(null);function ve(f,V){!V&&!q(f.target)||(W.targetId=V??null,W.visible=!0,W.x=f.clientX,W.y=f.clientY,W.flipX=0,W.flipY=0,e.nextTick(()=>{const B=be.value;if(!B)return;const j=B.getBoundingClientRect(),_=4;f.clientX+j.width+_>window.innerWidth&&(W.flipX=-j.width),f.clientY+j.height+_>window.innerHeight&&(W.flipY=-j.height)}),window.removeEventListener("mousedown",ue),setTimeout(()=>{window.addEventListener("mousedown",ue,{once:!0})},0))}function ue(){W.visible=!1,window.removeEventListener("mousedown",ue)}function fe(){W.visible=!1,n.hasClipboard&&l("paste")}function M(){W.visible=!1,l("select-all")}function N(){W.visible=!1,l("clear-selection")}function C(f,V){W.visible=!1,f==="copy"?l("copy"):f==="cut"?l("cut"):f==="paste"?l("paste"):f==="delete"?l("delete"):f==="move-layer"&&l("move-layer",V)}e.onMounted(()=>{e.nextTick(E),r.value&&typeof ResizeObserver<"u"&&(S=new ResizeObserver(E),S.observe(r.value))}),e.watch(()=>n.scale,v),e.watch([a,s],()=>e.nextTick(E));function U(){const f=r.value;if(!f)return;let V=0,B=0,j=0;const _=performance.now()+800,oe=()=>{const{scrollWidth:me,scrollHeight:D}=f;if(me===B&&D===j?V++:V=0,B=me,j=D,V>=2||performance.now()>_){const L=f.scrollWidth,H=f.scrollHeight,ee=f.clientWidth,Y=f.clientHeight;f.scrollLeft=Math.max(0,(L-ee)/2),f.scrollTop=Math.max(0,(H-Y)/2);return}requestAnimationFrame(oe)};requestAnimationFrame(oe)}return i({centerScroll:U,fitToWindow:ae,zoomByStep:ne}),e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",w),S?.disconnect(),cancelAnimationFrame(h)}),(f,V)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"canvas-area",onDragover:V[22]||(V[22]=e.withModifiers(()=>{},["prevent"])),onDrop:K,onMousedown:ce,onMousemove:z,onMouseleave:k,onWheel:X,onScroll:R,onContextmenu:e.withModifiers(ve,["prevent"])},[e.createElementVNode("div",bl,[e.createVNode(gl,{"template-data":o.templateData,"runtime-elements":o.elements,"design-mode":!0,"print-data":[],scale:o.scale,"show-grid":o.showGrid,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,guides:o.guides,onSelect:c,onGuideMove:V[0]||(V[0]=(B,j)=>f.$emit("guide-move",B,j)),onGuideRemove:V[1]||(V[1]=B=>f.$emit("guide-remove",B)),onDragStart:V[2]||(V[2]=B=>f.$emit("drag-start")),onDragStop:V[3]||(V[3]=B=>f.$emit("drag-stop")),onDblclickElement:V[4]||(V[4]=B=>f.$emit("dblclick-element",B)),onDblclickCell:V[5]||(V[5]=(B,j,_)=>f.$emit("dblclick-cell",B,j,_)),onContextmenu:V[6]||(V[6]=(B,j)=>ve(j,B)),onZoneHeightChange:V[7]||(V[7]=(B,j)=>f.$emit("zone-height-change",B,j)),onZoneHeightCommit:V[8]||(V[8]=B=>f.$emit("zone-height-commit",B)),onCloneElement:V[9]||(V[9]=(B,j)=>f.$emit("clone-element",B,j))},null,8,["template-data","runtime-elements","scale","show-grid","snap-to-grid","show-table-ghost-border","guides"]),o.overlayVisible&&o.screenshotUrl?(e.openBlock(),e.createElementBlock("div",El,[e.createElementVNode("img",{src:o.screenshotUrl,class:"overlay-image",style:e.normalizeStyle({opacity:o.overlayOpacity??.5})},null,12,yl)])):e.createCommentVNode("",!0)]),o.showRuler?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ruler-overlay",style:e.normalizeStyle(g.value)},[V[23]||(V[23]=e.createElementVNode("div",{class:"ruler-corner"},null,-1)),e.createVNode(Nt,{orientation:"horizontal","viewport-px":m.viewW,"origin-px":m.originX,"paper-length-m-m":a.value,scale:m.paperScale,"cursor-px":d.x,onAddGuide:V[10]||(V[10]=(B,j)=>l("add-guide",B,j)),onGuideDragging:V[11]||(V[11]=B=>Z("vertical",B))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"]),e.createVNode(Nt,{orientation:"vertical","viewport-px":m.viewH,"origin-px":m.originY,"paper-length-m-m":s.value,scale:m.paperScale,"cursor-px":d.y,onAddGuide:V[12]||(V[12]=(B,j)=>l("add-guide",B,j)),onGuideDragging:V[13]||(V[13]=B=>Z("horizontal",B))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"])],4)):e.createCommentVNode("",!0),x.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ruler-guide-preview",`guide-${x.value.type}`]),style:e.normalizeStyle(le.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),W.visible?(e.openBlock(),e.createElementBlock("div",{key:3,ref_key:"contextMenuRef",ref:be,class:"context-menu",style:e.normalizeStyle({left:W.x+W.flipX+"px",top:W.y+W.flipY+"px"})},[W.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:V[14]||(V[14]=B=>C("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:V[15]||(V[15]=B=>C("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:V[16]||(V[16]=B=>C("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:V[17]||(V[17]=B=>C("delete"))},"删除"),V[24]||(V[24]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:V[18]||(V[18]=B=>C("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:V[19]||(V[19]=B=>C("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:V[20]||(V[20]=B=>C("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:V[21]||(V[21]=B=>C("move-layer","bottom"))},"置底")],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:fe},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:M},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:N},"取消选择")],64))],4)):e.createCommentVNode("",!0)],544))}}),Vl=se(kl,[["__scopeId","data-v-50127da1"]]),Nl={class:"property-search"},wl=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(o,{emit:i}){const t=e.ref(""),n=i;function l(){n("search",t.value)}return(c,r)=>(e.openBlock(),e.createElementBlock("div",Nl,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=a=>t.value=a),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:l},null,544),[[e.vModelText,t.value]])]))}}),Cl=se(wl,[["__scopeId","data-v-10ab6c84"]]),Sl={class:"group-icon"},Bl={class:"group-title"},$l={class:"expand-icon"},xl={class:"group-content"},Dl=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(o){const i=o,t=e.ref(i.defaultExpanded??!0),l={Document:"≡",Brush:"◧",Setting:"⚙"}[i.icon]||"•";function c(){t.value=!t.value,r()}function r(){const s=`property-group-${i.groupKey}`;try{localStorage.setItem(s,String(t.value))}catch{}}function a(){const s=`property-group-${i.groupKey}`;try{const m=localStorage.getItem(s);m!==null&&(t.value=m==="true")}catch{}}return e.onMounted(()=>{a()}),(s,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":t.value}])},[e.createElementVNode("div",{class:"group-header",onClick:c},[e.createElementVNode("span",Sl,e.toDisplayString(e.unref(l)),1),e.createElementVNode("span",Bl,e.toDisplayString(o.title),1),e.createElementVNode("span",$l,e.toDisplayString(t.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",xl,[e.renderSlot(s.$slots,"default",{},void 0,!0)],512),[[e.vShow,t.value]])],2))}}),Se=se(Dl,[["__scopeId","data-v-2ba57031"]]),Tl={class:"pd-stepper"},Ml=["disabled"],zl=["value","placeholder","min","max","step"],Pl=["disabled"],Rl=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=e.computed(()=>{const S=String(t.step),h=S.indexOf(".");return h===-1?0:S.length-h-1});function c(S){return Number.isFinite(S)?Number(S.toFixed(l.value)):0}const r=e.computed(()=>{const S=t.modelValue;if(!(S==null||!Number.isFinite(S)))return c(S)}),a=e.ref(r.value===void 0?"":String(r.value));e.watch(r,S=>{a.value=S===void 0?"":String(S)});const s=e.computed(()=>r.value!==void 0?r.value:t.min!==void 0?t.min:0),m=e.computed(()=>t.min!==void 0&&s.value<=t.min),d=e.computed(()=>t.max!==void 0&&s.value>=t.max);function p(S){let h=c(S);return t.min!==void 0&&h<t.min&&(h=t.min),t.max!==void 0&&h>t.max&&(h=t.max),h}function g(S){if(S<0&&m.value||S>0&&d.value)return;const h=p(s.value+S*t.step);a.value=String(h),n("update:modelValue",h)}function E(S){a.value=S.target.value}function R(){const S=a.value.trim();if(S===""){r.value!==void 0&&(a.value=String(r.value));return}const h=Number(S);if(!Number.isFinite(h)){a.value=r.value===void 0?"":String(r.value);return}const v=p(h);a.value=String(v),v!==r.value&&n("update:modelValue",v)}return(S,h)=>(e.openBlock(),e.createElementBlock("div",Tl,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:m.value,title:"减小","aria-label":"减小",onClick:h[0]||(h[0]=v=>g(-1))},"−",8,Ml),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:a.value,placeholder:o.placeholder,min:o.min,max:o.max,step:o.step,onInput:E,onChange:R,onBlur:R,onKeydown:h[1]||(h[1]=e.withKeys(e.withModifiers(v=>v.target.blur(),["prevent"]),["enter"]))},null,40,zl),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:d.value,title:"增大","aria-label":"增大",onClick:h[2]||(h[2]=v=>g(1))},"+",8,Pl)]))}}),re=se(Rl,[["__scopeId","data-v-9722a7cf"]]),Al={class:"position-grid"},Ll={class:"pd-field"},Ul={class:"pd-field"},Il={class:"pd-field"},Fl={class:"pd-field"},Ol=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const i=o;function t(n){return i.searching?i.matchedKeys?.has(n)??!0:!0}return(n,l)=>(e.openBlock(),e.createBlock(Se,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:l[4]||(l[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Al,[e.withDirectives(e.createElementVNode("div",Ll,[l[5]||(l[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(re,{modelValue:o.element.options.left,"onUpdate:modelValue":l[0]||(l[0]=c=>o.element.options.left=c),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-left")]]),e.withDirectives(e.createElementVNode("div",Ul,[l[6]||(l[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(re,{modelValue:o.element.options.top,"onUpdate:modelValue":l[1]||(l[1]=c=>o.element.options.top=c),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-top")]]),e.withDirectives(e.createElementVNode("div",Il,[l[7]||(l[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(re,{modelValue:o.element.options.width,"onUpdate:modelValue":l[2]||(l[2]=c=>o.element.options.width=c),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-width")]]),e.withDirectives(e.createElementVNode("div",Fl,[l[8]||(l[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(re,{modelValue:o.element.options.height,"onUpdate:modelValue":l[3]||(l[3]=c=>o.element.options.height=c),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-height")]])])],32)]),_:1}))}}),Hl=se(Ol,[["__scopeId","data-v-bc364679"]]),Wl=["aria-expanded","title"],Gl={class:"picker-preview"},Kl={class:"picker-heading"},ql=["disabled"],Yl={class:"preset-color-grid"},jl=["title","aria-label","onClick"],Xl=e.defineComponent({__name:"PresetColorPicker",props:{modelValue:{},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(!1),c=e.ref(),r=e.ref(),a=e.ref(),s=e.ref({}),m=e.ref(0),d=e.ref(0),p=e.ref(0),g=e.ref("#000000"),E=e.ref(!1),R=e.computed(()=>t.modelValue||"#000000"),S=e.computed(()=>t.modelValue?{background:t.modelValue}:{background:"transparent"}),h=e.computed(()=>W(ve(m.value,d.value,p.value))),v=e.computed({get:()=>Math.round(m.value),set:M=>K(ue(M),d.value,p.value)});e.watch(()=>t.modelValue,M=>{if(!M){g.value="";return}O(M)},{immediate:!0});function x(M){g.value=M.toUpperCase(),O(M),n("update:modelValue",M)}function Z(){t.clearable&&n("update:modelValue","")}function le(M){const C=M.target.value.trim();if(!C){t.clearable&&n("update:modelValue","");return}u(C)&&(O(C),n("update:modelValue",w(C)))}function O(M){const N=u(M);if(!N)return;const C=be(N.r,N.g,N.b);m.value=C.h,d.value=C.s,p.value=C.v,g.value=w(M).toUpperCase()}function K(M,N,C){m.value=ue(M),d.value=fe(N),p.value=fe(C),g.value=h.value.toUpperCase(),n("update:modelValue",h.value)}function y(M){M.currentTarget.setPointerCapture(M.pointerId),E.value=!0,z(M)}function F(M){E.value&&z(M)}function q(M){E.value=!1;const N=M.currentTarget;N.hasPointerCapture(M.pointerId)&&N.releasePointerCapture(M.pointerId)}function z(M){const N=a.value;if(!N)return;const C=N.getBoundingClientRect(),U=fe((M.clientX-C.left)/C.width),f=fe(1-(M.clientY-C.top)/C.height);K(m.value,U,f)}function k(M){const N=M.shiftKey?.1:.02;let C=!0;M.key==="ArrowLeft"?K(m.value,d.value-N,p.value):M.key==="ArrowRight"?K(m.value,d.value+N,p.value):M.key==="ArrowUp"?K(m.value,d.value,p.value+N):M.key==="ArrowDown"?K(m.value,d.value,p.value-N):C=!1,C&&M.preventDefault()}function T(){l.value?ne():X()}async function X(){const M=c.value;if(!M)return;t.modelValue&&O(R.value),l.value=!0,await e.nextTick();const N=M.getBoundingClientRect(),C=190,U=r.value?.offsetHeight??216,f=8,V=Math.min(N.left,window.innerWidth-C-f),B=N.bottom+6,j=B+U>window.innerHeight-f?Math.max(f,N.top-U-6):B;s.value={left:`${Math.max(f,V)}px`,top:`${j}px`}}function ne(){l.value=!1}function ae(M){const N=M.target;c.value?.contains(N)||r.value?.contains(N)||ne()}function ce(){l.value&&ne()}function J(M){M.key==="Escape"&&l.value&&ne()}function u(M){const N=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(M.trim());if(!N)return null;const C=N[1],U=C.length===3?C.split("").map(f=>f+f).join(""):C;return{r:Number.parseInt(U.slice(0,2),16),g:Number.parseInt(U.slice(2,4),16),b:Number.parseInt(U.slice(4,6),16)}}function w(M){const N=u(M);return N?W(N):"#000000"}function W({r:M,g:N,b:C}){return`#${[M,N,C].map(U=>Math.round(fe(U/255)*255).toString(16).padStart(2,"0")).join("")}`}function be(M,N,C){const U=M/255,f=N/255,V=C/255,B=Math.max(U,f,V),j=Math.min(U,f,V),_=B-j;let oe=0;return _!==0&&(B===U?oe=(f-V)/_%6:B===f?oe=(V-U)/_+2:oe=(U-f)/_+4,oe*=60,oe<0&&(oe+=360)),{h:oe,s:B===0?0:_/B,v:B}}function ve(M,N,C){const U=C*N,f=(M%360+360)%360/60,V=U*(1-Math.abs(f%2-1)),[B,j,_]=f<1?[U,V,0]:f<2?[V,U,0]:f<3?[0,U,V]:f<4?[0,V,U]:f<5?[V,0,U]:[U,0,V],oe=C-U;return{r:(B+oe)*255,g:(j+oe)*255,b:(_+oe)*255}}function ue(M){return((Number.isFinite(M)?M:0)%360+360)%360}function fe(M){return Math.min(1,Math.max(0,Number.isFinite(M)?M:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",ae,!0),window.addEventListener("scroll",ce,!0),window.addEventListener("resize",ce),document.addEventListener("keydown",J)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ae,!0),window.removeEventListener("scroll",ce,!0),window.removeEventListener("resize",ce),document.removeEventListener("keydown",J)}),(M,N)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{ref_key:"triggerRef",ref:c,type:"button",class:"preset-color-trigger","aria-expanded":l.value,"aria-haspopup":"dialog",title:o.modelValue||"自动",onClick:T},[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle(S.value)},null,4)],8,Wl),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:r,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(s.value),onPointerdown:N[2]||(N[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",Gl,[e.createElementVNode("span",{class:e.normalizeClass(["picker-current",{"is-empty":!o.modelValue}]),style:e.normalizeStyle(o.modelValue?{background:h.value}:void 0)},null,6),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":N[0]||(N[0]=C=>g.value=C),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:le},null,544),[[e.vModelText,g.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:a,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(m.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:y,onPointermove:F,onPointerup:q,onPointercancel:q,onKeydown:k},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${d.value*100}%`,top:`${(1-p.value)*100}%`,background:h.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":N[1]||(N[1]=C=>v.value=C),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,v.value,void 0,{number:!0}]]),e.createElementVNode("div",Kl,[N[4]||(N[4]=e.createElementVNode("span",null,"常用颜色",-1)),o.clearable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"picker-clear",disabled:!o.modelValue,title:"清除选中的颜色",onClick:Z},[...N[3]||(N[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,ql)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Yl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b.PRESET_COLORS),C=>(e.openBlock(),e.createElementBlock("button",{key:C,type:"button",class:e.normalizeClass(["preset-color-item",{active:!!o.modelValue&&C.toLowerCase()===o.modelValue.toLowerCase()}]),style:e.normalizeStyle({background:C}),title:C,"aria-label":C,onClick:U=>x(C)},null,14,jl))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),Ce=se(Xl,[["__scopeId","data-v-12290e7e"]]),Zl={class:"font-select"},Jl=["placeholder","aria-expanded","aria-activedescendant","onKeydown"],Ql=["id","aria-selected","onMousedown"],_l=e.defineComponent({__name:"FontSelect",props:{modelValue:{},placeholder:{default:"默认"}},emits:["update:model-value"],setup(o,{emit:i}){const t=o,n=i,l=Jt(),c=`font-select-list-${e.useId()}`,r=e.ref(null),a=e.ref(R(t.modelValue)),s=e.ref(""),m=e.ref(!1),d=e.ref(-1),p=e.computed(()=>{const q=t.modelValue?.trim();return q?bt(l.value,q)?"":q:""}),g=e.computed(()=>{const q=(t.modelValue??"").trim(),z=(X,ne,ae,ce)=>({kind:X,key:ne,label:ae,value:ce,selected:(ce??"")===q}),k=s.value.trim();if(!k){const X=[z("clear","__clear__",t.placeholder)];p.value&&X.push(z("unknown","__unknown__",`${p.value}(未知)`,p.value));for(const ne of l.value)X.push(z("font",ne.family,Et(ne),ne.family));return X}const T=Qt(l.value,k).map(X=>z("font",X.family,Et(X),X.family));if(!T.length){const X=E(k);T.push(z("free","__free__",`使用「${X}」`,X))}return T});function E(q){const z=He(q);return l.value.find(T=>T.label&&He(T.label)===z)?.family??q}function R(q){const z=q?.trim();return z?bt(l.value,z)?.label??z:""}const S=e.computed(()=>m.value&&d.value>=0?`${c}-${d.value}`:void 0);function h(){const q=(t.modelValue??"").trim();return g.value.findIndex(z=>(z.value??"")===q)}function v(){m.value||(m.value=!0,s.value="",d.value=h())}function x(){m.value=!0}function Z(){m.value=!0,s.value=a.value,d.value=g.value.length?0:-1}function le(q){if(!m.value){v();return}const z=g.value.length-1;z<0||(d.value=Math.min(Math.max(d.value+q,0),z),O())}function O(){e.nextTick(()=>{r.value?.children[d.value]?.scrollIntoView?.({block:"nearest"})})}function K(){if(!m.value)return;const q=g.value[d.value];if(q){y(q);return}const z=s.value.trim();if(z){const k=E(z);y({value:k})}}function y(q){a.value=R(q.value),s.value="",m.value=!1,d.value=-1,n("update:model-value",q.value)}function F(){m.value=!1,s.value="",d.value=-1,a.value=R(t.modelValue)}return e.watch(()=>t.modelValue,q=>{a.value=R(q)}),(q,z)=>(e.openBlock(),e.createElementBlock("div",Zl,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":z[0]||(z[0]=k=>a.value=k),class:"pd-input font-select-input",type:"text",role:"combobox","aria-autocomplete":"list",autocomplete:"off",placeholder:o.placeholder,"aria-expanded":m.value,"aria-controls":c,"aria-activedescendant":S.value,onFocus:v,onClick:x,onInput:Z,onKeydown:[z[1]||(z[1]=e.withKeys(e.withModifiers(k=>le(1),["prevent"]),["down"])),z[2]||(z[2]=e.withKeys(e.withModifiers(k=>le(-1),["prevent"]),["up"])),e.withKeys(e.withModifiers(K,["prevent"]),["enter"]),e.withKeys(e.withModifiers(F,["prevent"]),["esc"])],onBlur:F},null,40,Jl),[[e.vModelText,a.value]]),m.value?(e.openBlock(),e.createElementBlock("ul",{key:0,id:c,ref_key:"listRef",ref:r,class:"font-select-list",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(k,T)=>(e.openBlock(),e.createElementBlock("li",{id:`${c}-${T}`,key:k.key,class:e.normalizeClass(["font-select-option",{"is-active":T===d.value,"is-muted":k.kind==="unknown"||k.kind==="free"}]),role:"option","aria-selected":k.selected,onMousedown:e.withModifiers(X=>y(k),["prevent"])},e.toDisplayString(k.label),43,Ql))),128))],512)):e.createCommentVNode("",!0)]))}}),Mt=se(_l,[["__scopeId","data-v-c559b167"]]),ea={class:"pd-field"},ta={class:"pd-field"},oa={class:"pd-field"},na={class:"pd-field"},la={class:"pd-radio-group",role:"radiogroup"},aa={class:"pd-radio"},ia={class:"pd-radio"},ra={class:"pd-radio"},sa={class:"pd-field"},da={class:"pd-radio-group",role:"radiogroup"},ca={class:"pd-radio"},ua={class:"pd-radio"},ma={class:"pd-radio"},pa={class:"color-row"},va={class:"pd-field"},fa={class:"pd-field"},ga={class:"pd-field"},ha={class:"pd-field"},ba={class:"pd-field"},Ea=["value"],ya={key:0,class:"pd-field"},ka={class:"pd-field"},Va=["checked"],Na={key:1,class:"pd-empty"},wa=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(o){const i=o;function t(r){return i.searching?i.matchedKeys?.has(r)??!0:!0}const n=e.computed(()=>i.element.printElementType.type==="table"),l=e.computed(()=>b.resolveElementTextFit(i.element.printElementType.type||"text",i.element.options));function c(r){i.element.options.textFit=r.target.value}return(r,a)=>(e.openBlock(),e.createBlock(Se,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[15]||(a[15]=e.withModifiers(()=>{},["prevent"]))},[o.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",ea,[a[16]||(a[16]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(Mt,{modelValue:o.element.options.fontFamily,"onUpdate:modelValue":a[0]||(a[0]=s=>o.element.options.fontFamily=s)},null,8,["modelValue"])],512),[[e.vShow,t("ap-font-family")]]),e.withDirectives(e.createElementVNode("div",ta,[a[17]||(a[17]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(re,{modelValue:o.element.options.fontSize,"onUpdate:modelValue":a[1]||(a[1]=s=>o.element.options.fontSize=s),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,t("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",oa,[a[19]||(a[19]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":a[2]||(a[2]=s=>o.element.options.fontWeight=s),style:{width:"100%"}},[...a[18]||(a[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,o.element.options.fontWeight]])],512),[[e.vShow,t("ap-font-weight")]]),e.withDirectives(e.createElementVNode("div",na,[a[23]||(a[23]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",la,[e.createElementVNode("label",aa,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[3]||(a[3]=s=>o.element.options.textAlign=s),value:"left"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),a[20]||(a[20]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",ia,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[4]||(a[4]=s=>o.element.options.textAlign=s),value:"center"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),a[21]||(a[21]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ra,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[5]||(a[5]=s=>o.element.options.textAlign=s),value:"right"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),a[22]||(a[22]=e.createElementVNode("span",null,"右",-1))])])],512),[[e.vShow,t("ap-align")]]),e.withDirectives(e.createElementVNode("div",sa,[a[27]||(a[27]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",da,[e.createElementVNode("label",ca,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[6]||(a[6]=s=>o.element.options.verticalAlign=s),value:"top"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),a[24]||(a[24]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",ua,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[7]||(a[7]=s=>o.element.options.verticalAlign=s),value:"middle"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),a[25]||(a[25]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ma,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[8]||(a[8]=s=>o.element.options.verticalAlign=s),value:"bottom"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),a[26]||(a[26]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,t("ap-vertical-align")]]),e.createElementVNode("div",pa,[e.withDirectives(e.createElementVNode("div",va,[a[28]||(a[28]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ce,{modelValue:o.element.options.color,"onUpdate:modelValue":a[9]||(a[9]=s=>o.element.options.color=s)},null,8,["modelValue"])],512),[[e.vShow,t("ap-color")]]),e.withDirectives(e.createElementVNode("div",fa,[a[29]||(a[29]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ce,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":a[10]||(a[10]=s=>o.element.options.backgroundColor=s)},null,8,["modelValue"])],512),[[e.vShow,t("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",ga,[a[30]||(a[30]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(re,{modelValue:o.element.options.lineHeight,"onUpdate:modelValue":a[11]||(a[11]=s=>o.element.options.lineHeight=s),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,t("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",ha,[a[31]||(a[31]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(re,{modelValue:o.element.options.letterSpacing,"onUpdate:modelValue":a[12]||(a[12]=s=>o.element.options.letterSpacing=s),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,t("ap-letter-spacing")]]),e.withDirectives(e.createElementVNode("div",ba,[a[33]||(a[33]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:l.value,style:{width:"100%"},onChange:c},[...a[32]||(a[32]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,Ea)],512),[[e.vShow,t("ap-text-fit")]]),l.value==="shrink"?e.withDirectives((e.openBlock(),e.createElementBlock("div",ya,[a[34]||(a[34]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(re,{"model-value":o.element.options.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":a[13]||(a[13]=s=>o.element.options.shrinkMinFontSize=s??void 0)},null,8,["model-value"])],512)),[[e.vShow,t("ap-shrink-min")]]):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",ka,[a[35]||(a[35]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:o.element.options.wordWrap!==!1,type:"checkbox",class:"pd-switch",onInput:a[14]||(a[14]=s=>o.element.options.wordWrap=s.target.checked?void 0:!1)},null,40,Va)],512),[[e.vShow,t("ap-word-wrap")]])],64)):e.createCommentVNode("",!0),!o.isTextType&&!n.value?(e.openBlock(),e.createElementBlock("p",Na,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),Ca=se(wa,[["__scopeId","data-v-ec9e5cb7"]]),Sa={class:"pd-field"},Ba=["value"],$a={class:"pd-field"},xa=["value"],Da={class:"pd-hint"},Ta={class:"pd-field"},Ma={class:"pd-field"},za=["checked"],Pa={class:"pd-field"},Ra={key:1,class:"pd-field"},Aa=["value"],La={key:2,class:"pd-hint"},Ua={key:3,class:"pd-field"},Ia=["value"],Fa={class:"pd-field"},Oa={class:"pd-field"},Ha=e.defineComponent({__name:"CodeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["change"],setup(o,{emit:i}){const t=o,n=i,l=e.computed(()=>t.element.printElementType.type==="barcode"),c=e.computed(()=>t.element.printElementType.type==="qrcode"),r=e.computed(()=>(t.element.options.barcodeType||"CODE128").toUpperCase()),a=e.computed(()=>t.element.options.printerDpi?String(t.element.options.printerDpi):""),s=e.computed(()=>!!t.element.options.printerDpi),m=e.computed(()=>l.value&&s.value);function d(S){const h=Number(S.target.value);t.element.options.printerDpi=h>0?h:void 0,R()}function p(S){const h=S.target.value;t.element.options.barcodeType=h==="CODE128"?void 0:h,R()}function g(S){t.element.options.fit=S.target.value||void 0,R()}function E(S){return t.searching?t.matchedKeys?.has(S)??!0:!0}function R(){n("change")}return(S,h)=>(e.openBlock(),e.createBlock(Se,{title:"条码设置",icon:"Postcard","default-expanded":"","group-key":"code"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:h[6]||(h[6]=e.withModifiers(()=>{},["prevent"]))},[l.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Sa,[h[8]||(h[8]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{class:"pd-select",value:r.value,onChange:p},[...h[7]||(h[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,Ba)],512),[[e.vShow,E("cd-type")]]),e.withDirectives(e.createElementVNode("div",$a,[h[10]||(h[10]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{class:"pd-select",value:a.value,onChange:d},[...h[9]||(h[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,xa)],512),[[e.vShow,E("cd-dpi")]]),e.withDirectives(e.createElementVNode("p",Da,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小",512),[[e.vShow,E("cd-dpi")]]),e.withDirectives(e.createElementVNode("div",Ta,[h[11]||(h[11]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(re,{"model-value":o.element.options.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":h[0]||(h[0]=v=>{o.element.options.barWidth=v,R()})},null,8,["model-value"])],512),[[e.vShow,E("cd-bar-width")]]),e.withDirectives(e.createElementVNode("p",{class:"pd-hint"},e.toDisplayString(m.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),513),[[e.vShow,E("cd-bar-width")]]),e.withDirectives(e.createElementVNode("div",Ma,[h[12]||(h[12]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:o.element.options.hideTitle!==!0,type:"checkbox",class:"pd-switch",onInput:h[1]||(h[1]=v=>{o.element.options.hideTitle=v.target.checked?void 0:!0,R()})},null,40,za)],512),[[e.vShow,E("cd-show-text")]]),e.withDirectives(e.createElementVNode("div",Pa,[h[13]||(h[13]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(re,{"model-value":o.element.options.fontSize,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":h[2]||(h[2]=v=>{o.element.options.fontSize=v??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,E("cd-font-size")]])],64)):c.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",Ra,[h[15]||(h[15]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{class:"pd-select",value:String(o.element.options.qrCodeLevel??"M"),onChange:h[3]||(h[3]=v=>{o.element.options.qrCodeLevel=v.target.value,R()})},[...h[14]||(h[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,Aa)],512)),[[e.vShow,E("cd-ec-level")]]):e.createCommentVNode("",!0),h[20]||(h[20]=e.createElementVNode("h3",{class:"pd-divider"},"自定义设置",-1)),l.value?(e.openBlock(),e.createElementBlock("p",La,"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),l.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("div",Ua,[h[17]||(h[17]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{class:"pd-select",value:o.element.options.fit||"contain",onChange:g},[...h[16]||(h[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,Ia)],512)),[[e.vShow,E("cd-fit")]]),e.withDirectives(e.createElementVNode("div",Fa,[h[18]||(h[18]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(re,{"model-value":o.element.options.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":h[4]||(h[4]=v=>{o.element.options.maxWidth=v??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,E("cd-max-width")]]),e.withDirectives(e.createElementVNode("div",Oa,[h[19]||(h[19]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(re,{"model-value":o.element.options.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":h[5]||(h[5]=v=>{o.element.options.maxHeight=v??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,E("cd-max-height")]])],32)]),_:1}))}}),Wa={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},Ga={class:"pd-dialog-header"},Ka={class:"expression-editor"},qa={class:"ee-nav"},Ya={class:"ee-nav-tabs"},ja={class:"ee-content"},Xa={class:"ee-content-search"},Za=["placeholder"],Ja={class:"ee-content-list"},Qa={class:"ee-field-group-icon"},_a=["onDblclick"],ei={class:"ee-field-info"},ti={class:"ee-item-label"},oi={class:"ee-item-key"},ni={key:0,class:"pd-empty"},li=["onDblclick"],ai={class:"ee-field-info"},ii={class:"ee-item-label"},ri={class:"ee-item-key"},si={class:"ee-func-group"},di=["onDblclick"],ci={class:"ee-field-info"},ui={class:"ee-item-label"},mi={class:"ee-item-key"},pi={class:"ee-func-group"},vi=["onDblclick"],fi={class:"ee-field-info"},gi={class:"ee-item-label"},hi={class:"ee-item-key"},bi={class:"ee-func-group"},Ei=["onDblclick"],yi={class:"ee-field-info"},ki={class:"ee-item-label"},Vi={class:"ee-item-key"},Ni={class:"ee-editor"},wi={class:"ee-editor-section"},Ci={class:"ee-editor-section"},Si={class:"pd-dialog-footer"},Bi=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(o,{emit:i}){const t=o,n=i,l=e.computed({get:()=>t.modelValue,set:z=>n("update:modelValue",z)}),c=e.ref("field"),r=e.computed(()=>{switch(c.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),a=e.ref(""),s=e.computed(()=>b.filterGroups(b.groupFields(t.fields??[]),a.value));e.watch(l,z=>{z&&(v.value=t.expression||"")});function m(z){const{insideParens:k}=g();F(k?z.fieldKey:`{${z.fieldKey}}`)}function d(z){const{insideParens:k}=g();F(k?z.template.replace(/^\{|\}$/g,""):z.template)}function p(z){const{insideBlock:k}=g(),T=k?z.template:`{${z.template}}`,X=T.indexOf("(")+1;F(T,X)}function g(){const k=x.value?.selectionStart??v.value.length,T=v.value.substring(0,k);let X=!1;const ne=T.lastIndexOf("{");ne!==-1&&!T.slice(ne+1).includes("}")&&(X=!0);let ae=!1;const ce=T.lastIndexOf("(");return ce!==-1&&!T.slice(ce+1).includes(")")&&(ae=!0),{insideBlock:X,insideParens:ae}}const E=e.computed(()=>{if(!a.value.trim())return K;const z=a.value.trim().toLowerCase();return K.filter(k=>k.label.toLowerCase().includes(z)||k.name.toLowerCase().includes(z))}),R=e.computed(()=>{if(!a.value.trim())return Z;const z=a.value.trim().toLowerCase();return Z.filter(k=>k.label.toLowerCase().includes(z)||k.name.toLowerCase().includes(z))}),S=e.computed(()=>{if(!a.value.trim())return le;const z=a.value.trim().toLowerCase();return le.filter(k=>k.label.toLowerCase().includes(z)||k.name.toLowerCase().includes(z))}),h=e.computed(()=>{if(!a.value.trim())return O;const z=a.value.trim().toLowerCase();return O.filter(k=>k.label.toLowerCase().includes(z)||k.name.toLowerCase().includes(z))}),v=e.ref(t.expression||""),x=e.ref(null);e.watch(()=>t.expression,z=>{v.value=z||""});const Z=[{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()"}],le=[{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()"}],O=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],K=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],y=e.computed(()=>{if(!v.value.trim())return"(输入表达式后预览)";try{const z={...b.DEFAULT_DEMO_DATA,...he.resolveSystemVariables()},k=b.evaluateTemplate(v.value,z);return k==null?"(无法计算)":String(k)}catch{return"(表达式错误)"}});function F(z,k=z.length){const T=x.value;if(!T){v.value+=z;return}const X=T.selectionStart,ne=T.selectionEnd,ae=v.value.substring(0,X),ce=v.value.substring(ne);v.value=ae+z+ce;const J=X+k;e.nextTick(()=>{T.focus(),T.selectionStart=T.selectionEnd=J})}function q(){n("update:expression",v.value),l.value=!1}return(z,k)=>l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:k[7]||(k[7]=e.withKeys(T=>l.value=!1,["esc"]))},[e.createElementVNode("section",Wa,[e.createElementVNode("header",Ga,[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]=T=>l.value=!1)},"×")]),e.createElementVNode("div",Ka,[e.createElementVNode("div",qa,[k[9]||(k[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",Ya,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:c.value==="field"}]),onClick:k[1]||(k[1]=T=>c.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:c.value==="variable"}]),onClick:k[2]||(k[2]=T=>c.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:c.value==="function"}]),onClick:k[3]||(k[3]=T=>c.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",ja,[e.createElementVNode("div",Xa,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":k[4]||(k[4]=T=>a.value=T),placeholder:r.value},null,8,Za),[[e.vModelText,a.value]])]),e.createElementVNode("div",Ja,[c.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,T=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:T.key||"_top"},[T.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":T.isList}])},[e.createElementVNode("span",Qa,e.toDisplayString(T.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(T.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.fields,X=>(e.openBlock(),e.createElementBlock("div",{key:X.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:T.key?"22px":"10px"}),onDblclick:ne=>m(X)},[e.createElementVNode("div",ei,[e.createElementVNode("span",ti,e.toDisplayString(X.fieldLabel),1),e.createElementVNode("span",oi,e.toDisplayString(X.fieldKey),1)])],44,_a))),128))],64))),128)),s.value.length===0?(e.openBlock(),e.createElementBlock("p",ni,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),c.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(E.value,T=>(e.openBlock(),e.createElementBlock("div",{key:T.name,class:"ee-list-item",onDblclick:X=>d(T)},[e.createElementVNode("div",ai,[e.createElementVNode("span",ii,e.toDisplayString(T.label),1),e.createElementVNode("span",ri,e.toDisplayString(T.template),1)])],40,li))),128)):e.createCommentVNode("",!0),c.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",si,[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,T=>(e.openBlock(),e.createElementBlock("div",{key:T.name,class:"ee-list-item",onDblclick:X=>p(T)},[e.createElementVNode("div",ci,[e.createElementVNode("span",ui,e.toDisplayString(T.label),1),e.createElementVNode("span",mi,e.toDisplayString(T.name)+"()",1)])],40,di))),128))]),e.createElementVNode("div",pi,[k[11]||(k[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"数值运算",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,T=>(e.openBlock(),e.createElementBlock("div",{key:T.name,class:"ee-list-item",onDblclick:X=>p(T)},[e.createElementVNode("div",fi,[e.createElementVNode("span",gi,e.toDisplayString(T.label),1),e.createElementVNode("span",hi,e.toDisplayString(T.name)+"()",1)])],40,vi))),128))]),e.createElementVNode("div",bi,[k[12]||(k[12]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,T=>(e.openBlock(),e.createElementBlock("div",{key:T.name,class:"ee-list-item",onDblclick:X=>p(T)},[e.createElementVNode("div",yi,[e.createElementVNode("span",ki,e.toDisplayString(T.label),1),e.createElementVNode("span",Vi,e.toDisplayString(T.name)+"()",1)])],40,Ei))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ni,[e.createElementVNode("div",wi,[k[13]||(k[13]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:x,"onUpdate:modelValue":k[5]||(k[5]=T=>v.value=T),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,v.value]])]),e.createElementVNode("div",Ci,[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",Si,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:k[6]||(k[6]=T=>l.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:q},"确定")])])],32)):e.createCommentVNode("",!0)}}),Je=se(Bi,[["__scopeId","data-v-3fb017fe"]]),$i={class:"pd-field"},xi={class:"pd-label"},Di=["value","placeholder"],Ti=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=i,n=e.ref(!1);function l(){n.value=!0}return(c,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",$i,[e.createElementVNode("span",xi,e.toDisplayString(o.descriptor.label),1),e.createElementVNode("input",{value:o.modelValue,class:"pd-input",placeholder:o.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:r[0]||(r[0]=a=>t("update:modelValue",a.target.value)),onDblclick:l},null,40,Di)]),e.createVNode(Je,{modelValue:n.value,"onUpdate:modelValue":r[1]||(r[1]=a=>n.value=a),fields:o.fields,expression:o.modelValue,"onUpdate:expression":r[2]||(r[2]=a=>t("update:modelValue",a))},null,8,["modelValue","fields","expression"])],64))}}),Mi=se(Ti,[["__scopeId","data-v-40a99329"]]),zi={class:"pd-field"},Pi=["value"],Ri=["value"],Ai={class:"pd-field"},Li={class:"pd-field"},Ui={class:"pd-field"},Ii={class:"pd-field"},Fi={style:{width:"60px"}},Oi=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(o){const i=o,t=e.inject(We,null),n=e.computed(()=>i.fields.filter(r=>r.fieldType==="list").map(r=>({label:r.fieldLabel,value:r.fieldKey})));function l(r){i.element.options.dataSource=r||void 0,t?.recordHistory()}function c(r,a){if(a===void 0)return;const s=i.element.options.tableColWidths,m=t?.maxTableWidth.value??1/0,d=s.reduce((p,g,E)=>E===r?p:p+g,0);if(d+a>m){const p=Math.max(5,Math.round((m-d)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${m}mm,列${r+1} 已调整为 ${p}mm`),s[r]=p}else s[r]=a;b.syncTableElementSize(i.element.options),t?.recordHistory()}return(r,a)=>(e.openBlock(),e.createBlock(Se,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[4]||(a[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",zi,[a[5]||(a[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:o.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:a[0]||(a[0]=s=>l(s.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,s=>(e.openBlock(),e.createElementBlock("option",{key:s.value,value:s.value},e.toDisplayString(s.label),9,Ri))),128))],40,Pi)]),e.createElementVNode("div",Ai,[a[6]||(a[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(re,{modelValue:o.element.options.tableDefaultFontSize,"onUpdate:modelValue":a[1]||(a[1]=s=>o.element.options.tableDefaultFontSize=s),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Li,[a[7]||(a[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(Ce,{modelValue:o.element.options.tableDefaultColor,"onUpdate:modelValue":a[2]||(a[2]=s=>o.element.options.tableDefaultColor=s)},null,8,["modelValue"])]),e.createElementVNode("div",Ui,[a[8]||(a[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(re,{modelValue:o.element.options.tableDefaultPadding,"onUpdate:modelValue":a[3]||(a[3]=s=>o.element.options.tableDefaultPadding=s),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Ii,[a[9]||(a[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.element.options.tableColWidths,(s,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"col-width-row"},[e.createElementVNode("span",Fi,"列"+e.toDisplayString(m+1),1),e.createVNode(re,{"model-value":s,min:5,max:200,"onUpdate:modelValue":d=>c(m,d)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),Hi=se(Oi,[["__scopeId","data-v-b5fdc7ff"]]),Wi={class:"border-row"},Gi={class:"pd-field"},Ki={class:"pd-field"},qi={class:"pd-field"},Yi=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const i=o;function t(n){return i.searching?i.matchedKeys?.has(n)??!0:!0}return(n,l)=>(e.openBlock(),e.createBlock(Se,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:l[3]||(l[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Wi,[e.withDirectives(e.createElementVNode("div",Gi,[l[4]||(l[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(re,{modelValue:o.element.options.borderWidth,"onUpdate:modelValue":l[0]||(l[0]=c=>o.element.options.borderWidth=c),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",Ki,[l[5]||(l[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(Ce,{modelValue:o.element.options.borderColor,"onUpdate:modelValue":l[1]||(l[1]=c=>o.element.options.borderColor=c)},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",qi,[l[6]||(l[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ce,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":l[2]||(l[2]=c=>o.element.options.backgroundColor=c)},null,8,["modelValue"])],512),[[e.vShow,t("bb-bg-color")]])],32)]),_:1}))}}),ji=se(Yi,[["__scopeId","data-v-e0e6d714"]]),Xi={class:"advanced-row"},Zi={class:"pd-field"},Ji={class:"pd-field"},Qi={class:"pd-field"},_i={class:"pd-field"},er=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(o){const i=o;function t(n){return i.searching?i.matchedKeys?.has(n)??!0:!0}return(n,l)=>(e.openBlock(),e.createBlock(Se,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:l[4]||(l[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Xi,[e.withDirectives(e.createElementVNode("div",Zi,[l[5]||(l[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":l[0]||(l[0]=c=>o.element.options.locked=c)},null,512),[[e.vModelCheckbox,o.element.options.locked]])],512),[[e.vShow,t("ad-locked")]]),e.withDirectives(e.createElementVNode("div",Ji,[l[6]||(l[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":l[1]||(l[1]=c=>o.element.options.fixed=c)},null,512),[[e.vModelCheckbox,o.element.options.fixed]])],512),[[e.vShow,t("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",Qi,[l[7]||(l[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(re,{modelValue:o.element.options.zIndex,"onUpdate:modelValue":l[2]||(l[2]=c=>o.element.options.zIndex=c),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,t("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",_i,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:l[3]||(l[3]=c=>n.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,t("ad-delete")]])],32)]),_:1}))}}),tr=se(er,[["__scopeId","data-v-14924be2"]]),or={key:0,class:"pd-field"},nr=["checked"],lr={class:"pd-field"},ar=["checked"],ir={class:"pd-field"},rr=["checked"],wt=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const i=o,t=e.computed(()=>i.element.printElementType.type==="table"),n=e.computed({get:()=>i.element.options.tablePagination?.enabled??!0,set:()=>{}});function l(d){i.element.options.tablePagination={enabled:d}}const c=e.computed({get:()=>i.element.options.pagination?.pageable??!0,set:()=>{}}),r=e.computed({get:()=>i.element.options.pagination?.keepWithNext??!1,set:()=>{}});function a(d){i.element.options.pagination={pageable:d,keepWithNext:r.value}}function s(d){i.element.options.pagination={pageable:c.value,keepWithNext:d}}function m(d){return i.searching?i.matchedKeys?.has(d)??!0:!0}return(d,p)=>(e.openBlock(),e.createBlock(Se,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:p[3]||(p[3]=e.withModifiers(()=>{},["prevent"]))},[t.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",or,[p[4]||(p[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:n.value,onChange:p[0]||(p[0]=g=>l(g.target.checked))},null,40,nr)],512)),[[e.vShow,m("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",lr,[p[5]||(p[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:c.value,onChange:p[1]||(p[1]=g=>a(g.target.checked))},null,40,ar)],512),[[e.vShow,m("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",ir,[p[6]||(p[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:r.value,onChange:p[2]||(p[2]=g=>s(g.target.checked))},null,40,rr)],512),[[e.vShow,m("pg-keep-with-next")]])],64))],32)]),_:1}))}}),sr={class:"image-content-upload"},dr=["disabled"],cr=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(!1),c=e.inject(ct,e.computed(()=>{})),r=e.computed(()=>t.disabled||l.value||!c.value);async function a(s){const m=s.target,d=m.files?.[0];if(d){if(!d.type.startsWith("image/")){alert("仅支持上传图片文件"),m.value="";return}if(!c.value){alert("图片上传能力未配置"),m.value="";return}l.value=!0;try{const p=await c.value(d);p?n("success",p):alert("图片上传失败")}catch(p){alert(p instanceof Error?p.message:"图片上传失败")}finally{l.value=!1,m.value=""}}}return(s,m)=>(e.openBlock(),e.createElementBlock("div",sr,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:r.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(l.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:r.value,onChange:a},null,40,dr)],2),m[1]||(m[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),ur=se(cr,[["__scopeId","data-v-b730e8e6"]]),mr={class:"pd-field"},pr=["value"],vr={class:"pd-field"},fr={key:0,class:"pd-field"},gr=["checked"],hr=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(o){const i=o,t=e.inject(We),n=e.computed(()=>i.element.options.tableRows[i.selection.r1]);function l(a){const s=b.setRowType(i.element.options.tableRows,i.selection.r1,a);if(s){alert(s);return}t.recordHistory()}function c(a){a!==void 0&&(n.value.height=a,b.syncTableElementSize(i.element.options),t.recordHistory())}function r(a){b.setHeaderRepeat(i.element.options.tableRows,a),t.recordHistory()}return(a,s)=>(e.openBlock(),e.createBlock(Se,{title:"行属性",icon:"Grid","default-expanded":"","group-key":"table-row"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:s[2]||(s[2]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",mr,[s[4]||(s[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:n.value.type,class:"pd-select",style:{width:"100%"},onChange:s[0]||(s[0]=m=>l(m.target.value))},[...s[3]||(s[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,pr)]),e.createElementVNode("div",vr,[s[5]||(s[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(re,{"model-value":n.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":c},null,8,["model-value"])]),n.value.type==="header"?(e.openBlock(),e.createElementBlock("div",fr,[s[6]||(s[6]=e.createElementVNode("span",{class:"pd-label",title:"多级表头作为一个结构整体重复,勾选后表头区所有行都会在每页顶部重复"},"表头每页重复",-1)),e.createElementVNode("input",{checked:n.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:s[1]||(s[1]=m=>r(!!m.target.checked))},null,40,gr)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),br={class:"pd-field"},Er={class:"pd-radio-group",role:"radiogroup"},yr={class:"pd-radio"},kr=["checked"],Vr={class:"pd-radio"},Nr=["checked"],wr={class:"pd-radio"},Cr=["checked"],Sr={class:"pd-radio"},Br=["checked"],$r={key:0,class:"pd-field"},xr=["value"],Dr={key:1,class:"pd-field"},Tr=["checked"],Mr={key:2,class:"pd-field"},zr={key:3,class:"pd-hint"},Pr={key:4,class:"pd-field"},Rr={key:5,class:"pd-field"},Ar=["value"],Lr={key:6,class:"pd-hint"},Ur={key:7,class:"pd-field"},Ir=["value"],Fr={key:8,class:"pd-hint"},Or={key:9,class:"pd-field"},Hr=["value"],Wr={key:10,class:"pd-field"},Gr={key:11,class:"pd-field"},Kr={class:"pd-field"},qr=["value"],Yr={class:"pd-field"},jr={class:"pd-radio-group",role:"radiogroup"},Xr={class:"pd-radio"},Zr=["checked"],Jr={class:"pd-radio"},Qr=["checked"],_r={class:"pd-radio"},es=["checked"],ts={class:"pd-field"},os={class:"pd-radio-group",role:"radiogroup"},ns={class:"pd-radio"},ls=["checked"],as={class:"pd-radio"},is=["checked"],rs={class:"pd-radio"},ss=["checked"],ds={class:"cell-style-grid"},cs={class:"pd-field cell-font-field"},us={class:"pd-field"},ms={class:"pd-field"},ps=["checked"],vs={class:"pd-field"},fs={class:"pd-field"},gs={class:"border-style-row"},hs={style:{width:"112px","flex-shrink":"0"}},bs={class:"pd-button-group border-presets"},Es={class:"pd-checkbox-group"},ys={class:"pd-checkbox"},ks={class:"pd-checkbox"},Vs={class:"pd-checkbox"},Ns={class:"pd-checkbox"},ws={class:"pd-field"},Cs={class:"pd-field"},Ss=["checked"],Bs={key:12,class:"pd-field"},$s=["value"],xs={key:13,class:"pd-field"},Ds={class:"merge-btns"},Ts=["disabled","title"],Ms=["disabled"],zs=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(o,{expose:i}){const t=o,n=e.inject(We),l=e.computed(()=>t.element.options.tableRows),c=e.computed(()=>{const J=b.findMainCell(l.value,t.selection.r1,t.selection.c1);return l.value[J.r].cells[J.c]}),r=e.ref(!1),a=e.ref(""),s=e.computed(()=>c.value.cellType==="barcode"),m=e.computed(()=>c.value.cellType==="qrcode"),d=e.computed(()=>c.value.cellType==="image"),p=e.computed(()=>s.value&&!!c.value.printerDpi),g=e.computed(()=>!s.value&&!m.value&&!d.value),E=e.computed(()=>b.resolveCellTextFit(c.value));function R(J){const u=J.target.value;O(w=>{w.textFit=u})}function S(J){O(u=>{u.align=J})}function h(J){O(u=>{u.valign=J})}function v(J){const u=Number(J);O(w=>{w.printerDpi=u>0?u:void 0})}function x(J){O(u=>{u.cellType=J==="text"?void 0:J,J!=="barcode"&&(u.barcodeType=void 0,u.showBarcodeText=void 0,u.printerDpi=void 0),J!=="qrcode"&&(u.qrCodeLevel=void 0)})}function Z(){a.value=c.value.formatter||"",r.value=!0}function le(J){O(u=>{u.formatter=J||void 0})}function O(J){const u=t.selection;for(let w=u.r1;w<=u.r2;w++)for(let W=u.c1;W<=u.c2;W++){const be=l.value[w].cells[W];be.merged||J(be)}n.recordHistory()}const K=e.ref("solid"),y=e.ref(.75),F=e.ref("#333333"),q=e.ref([]);function z(){return{width:y.value,style:K.value,color:F.value}}function k(J){b.applyBorderPreset(l.value,t.selection,J,z()),n.recordHistory()}function T(J){const u=J.target,w=new Set(q.value);u.checked?w.add(u.value):w.delete(u.value),q.value=[...w];const W=z();O(be=>{const ve={...be.borders??{}};for(const ue of["top","right","bottom","left"])w.has(ue)?ve[ue]={...W}:delete ve[ue];be.borders=ve})}const X=e.computed(()=>b.canMergeReason(l.value,t.selection)),ne=e.computed(()=>{const J=t.selection;for(let u=J.r1;u<=J.r2;u++)for(let w=J.c1;w<=J.c2;w++){const W=l.value[u].cells[w];if(!W.merged&&((W.rowspan??1)>1||(W.colspan??1)>1))return!0}return!1});function ae(){b.mergeCells(l.value,t.selection),n.recordHistory()}function ce(){b.splitCells(l.value,t.selection),n.recordHistory()}return i({openFormatterEditor:Z}),(J,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Se,{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",br,[u[49]||(u[49]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",Er,[e.createElementVNode("label",yr,[e.createElementVNode("input",{type:"radio",value:"text",checked:(c.value.cellType||"text")==="text",onChange:u[0]||(u[0]=w=>x(w.target.value))},null,40,kr),u[45]||(u[45]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",Vr,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:c.value.cellType==="barcode",onChange:u[1]||(u[1]=w=>x(w.target.value))},null,40,Nr),u[46]||(u[46]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",wr,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:c.value.cellType==="qrcode",onChange:u[2]||(u[2]=w=>x(w.target.value))},null,40,Cr),u[47]||(u[47]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",Sr,[e.createElementVNode("input",{type:"radio",value:"image",checked:c.value.cellType==="image",onChange:u[3]||(u[3]=w=>x(w.target.value))},null,40,Br),u[48]||(u[48]=e.createElementVNode("span",null,"图片",-1))])])]),s.value?(e.openBlock(),e.createElementBlock("div",$r,[u[51]||(u[51]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:c.value.barcodeType||"CODE128",class:"pd-select",onChange:u[4]||(u[4]=w=>O(W=>{W.barcodeType=w.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,xr)])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",Dr,[u[52]||(u[52]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:c.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:u[5]||(u[5]=w=>O(W=>{W.showBarcodeText=!!w.target.checked}))},null,40,Tr)])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",Mr,[u[53]||(u[53]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(re,{"model-value":c.value.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":u[6]||(u[6]=w=>O(W=>{W.barWidth=w}))},null,8,["model-value"])])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("p",zr,e.toDisplayString(p.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),1)):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",Pr,[u[54]||(u[54]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(re,{"model-value":c.value.barFontSize??10,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":u[7]||(u[7]=w=>O(W=>{W.barFontSize=w??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",Rr,[u[56]||(u[56]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{value:c.value.printerDpi?String(c.value.printerDpi):"",class:"pd-select",onChange:u[8]||(u[8]=w=>v(w.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,Ar)])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("p",Lr,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小")):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",Ur,[u[58]||(u[58]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:c.value.qrCodeLevel||"M",class:"pd-select",onChange:u[9]||(u[9]=w=>O(W=>{W.qrCodeLevel=w.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,Ir)])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("p",Fr,"单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),m.value||d.value?(e.openBlock(),e.createElementBlock("div",Or,[u[60]||(u[60]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:c.value.fit||"contain",class:"pd-select",onChange:u[10]||(u[10]=w=>O(W=>{W.fit=w.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,Hr)])):e.createCommentVNode("",!0),s.value||m.value||d.value?(e.openBlock(),e.createElementBlock("div",Wr,[u[61]||(u[61]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(re,{"model-value":c.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[11]||(u[11]=w=>O(W=>{W.maxWidth=w??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),s.value||m.value||d.value?(e.openBlock(),e.createElementBlock("div",Gr,[u[62]||(u[62]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(re,{"model-value":c.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[12]||(u[12]=w=>O(W=>{W.maxHeight=w??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Kr,[u[63]||(u[63]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:c.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:u[13]||(u[13]=w=>O(W=>{W.formatter=w.target.value||void 0})),onDblclick:Z},null,40,qr)]),e.createElementVNode("div",Yr,[u[67]||(u[67]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",jr,[e.createElementVNode("label",Xr,[e.createElementVNode("input",{type:"radio",value:"left",checked:c.value.align==="left",onChange:u[14]||(u[14]=w=>S(w.target.value))},null,40,Zr),u[64]||(u[64]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",Jr,[e.createElementVNode("input",{type:"radio",value:"center",checked:c.value.align==="center",onChange:u[15]||(u[15]=w=>S(w.target.value))},null,40,Qr),u[65]||(u[65]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",_r,[e.createElementVNode("input",{type:"radio",value:"right",checked:c.value.align==="right",onChange:u[16]||(u[16]=w=>S(w.target.value))},null,40,es),u[66]||(u[66]=e.createElementVNode("span",null,"右",-1))])])]),e.createElementVNode("div",ts,[u[71]||(u[71]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",os,[e.createElementVNode("label",ns,[e.createElementVNode("input",{type:"radio",value:"top",checked:c.value.valign==="top",onChange:u[17]||(u[17]=w=>h(w.target.value))},null,40,ls),u[68]||(u[68]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",as,[e.createElementVNode("input",{type:"radio",value:"middle",checked:c.value.valign==="middle",onChange:u[18]||(u[18]=w=>h(w.target.value))},null,40,is),u[69]||(u[69]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",rs,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:c.value.valign==="bottom",onChange:u[19]||(u[19]=w=>h(w.target.value))},null,40,ss),u[70]||(u[70]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",ds,[e.createElementVNode("div",cs,[u[72]||(u[72]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(Mt,{"model-value":c.value.fontFamily,placeholder:"继承默认","onUpdate:modelValue":u[20]||(u[20]=w=>O(W=>{W.fontFamily=w}))},null,8,["model-value"])]),e.createElementVNode("div",us,[u[73]||(u[73]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(re,{"model-value":c.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":u[21]||(u[21]=w=>O(W=>{W.fontSize=w??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",ms,[u[74]||(u[74]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:c.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:u[22]||(u[22]=w=>O(W=>{W.fontWeight=w.target.checked?"bold":void 0}))},null,40,ps)]),e.createElementVNode("div",vs,[u[75]||(u[75]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(Ce,{"model-value":c.value.color,"onUpdate:modelValue":u[23]||(u[23]=w=>O(W=>{W.color=w}))},null,8,["model-value"])]),e.createElementVNode("div",fs,[u[76]||(u[76]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ce,{"model-value":c.value.backgroundColor,"onUpdate:modelValue":u[24]||(u[24]=w=>O(W=>{W.backgroundColor=w}))},null,8,["model-value"])])]),u[87]||(u[87]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",gs,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":u[25]||(u[25]=w=>K.value=w),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,K.value]]),e.createElementVNode("div",hs,[e.createVNode(re,{modelValue:y.value,"onUpdate:modelValue":u[26]||(u[26]=w=>y.value=w),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(Ce,{modelValue:F.value,"onUpdate:modelValue":u[27]||(u[27]=w=>F.value=w),clearable:!1},null,8,["modelValue"])]),e.createElementVNode("div",bs,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[28]||(u[28]=w=>k("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[29]||(u[29]=w=>k("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[30]||(u[30]=w=>k("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[31]||(u[31]=w=>k("none"))},"无")]),e.createElementVNode("div",Es,[e.createElementVNode("label",ys,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[32]||(u[32]=w=>q.value=w),value:"top",onChange:u[33]||(u[33]=w=>T(w))},null,544),[[e.vModelCheckbox,q.value]]),u[78]||(u[78]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",ks,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[34]||(u[34]=w=>q.value=w),value:"right",onChange:u[35]||(u[35]=w=>T(w))},null,544),[[e.vModelCheckbox,q.value]]),u[79]||(u[79]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",Vs,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[36]||(u[36]=w=>q.value=w),value:"bottom",onChange:u[37]||(u[37]=w=>T(w))},null,544),[[e.vModelCheckbox,q.value]]),u[80]||(u[80]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",Ns,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[38]||(u[38]=w=>q.value=w),value:"left",onChange:u[39]||(u[39]=w=>T(w))},null,544),[[e.vModelCheckbox,q.value]]),u[81]||(u[81]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",ws,[u[82]||(u[82]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(re,{"model-value":c.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":u[40]||(u[40]=w=>O(W=>{W.padding=w??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",Cs,[u[83]||(u[83]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:c.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:u[41]||(u[41]=w=>O(W=>{W.wordWrap=!!w.target.checked}))},null,40,Ss)]),g.value?(e.openBlock(),e.createElementBlock("div",Bs,[u[85]||(u[85]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:E.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,$s)])):e.createCommentVNode("",!0),g.value&&E.value==="shrink"?(e.openBlock(),e.createElementBlock("div",xs,[u[86]||(u[86]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(re,{"model-value":c.value.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":u[42]||(u[42]=w=>O(W=>{W.shrinkMinFontSize=w??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Ds,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!X.value,title:X.value||"",onClick:ae}," 合并单元格 ",8,Ts),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!ne.value,onClick:ce},"拆分单元格",8,Ms)])],32)]),_:1}),e.createVNode(Je,{modelValue:r.value,"onUpdate:modelValue":u[44]||(u[44]=w=>r.value=w),fields:o.fields,expression:a.value,"onUpdate:expression":le},null,8,["modelValue","fields","expression"])],64))}}),Ps=se(zs,[["__scopeId","data-v-8a66df60"]]),Rs={class:"watermark-config"},As={class:"pd-field"},Ls={key:0,class:"pd-field"},Us={class:"pd-field"},Is={class:"pd-hint"},Fs={class:"pd-field"},Os={class:"pd-field"},Hs={class:"pd-hint"},Ws={class:"pd-field"},Gs=["value"],Ks={class:"pd-field"},qs=["min"],Ys={class:"pd-field"},js=["min"],Xs=e.defineComponent({__name:"WatermarkConfig",props:{modelValue:{},fields:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=he.WATERMARK_DENSITY_PRESETS,c=he.WATERMARK_DEFAULTS.minTileWidth,r=he.WATERMARK_DEFAULTS.minTileHeight;function a(K){const y=K.trim();return y?/[{}]/.test(y)||/^[A-Za-z_$][\w$]*\s*\(/.test(y)?!0:/^[A-Za-z_$][\w$]*(\.[\w$]+)+$/.test(y):!1}function s(K){return K?K.mode==="binding"?K.binding??"":K.content??"":""}const m=e.ref(s(t.modelValue)),d=e.ref(t.modelValue?.testData||""),p=e.ref(!1),g=e.ref(t.modelValue?.mode==="binding"?"binding":"fixed"),E=e.reactive({rotate:t.modelValue?.rotate??he.WATERMARK_DEFAULTS.rotate,color:t.modelValue?.color||he.WATERMARK_DEFAULTS.color,opacity:t.modelValue?.opacity??he.WATERMARK_DEFAULTS.opacity,tileWidth:t.modelValue?.tileWidth??he.WATERMARK_DEFAULTS.tileWidth,tileHeight:t.modelValue?.tileHeight??he.WATERMARK_DEFAULTS.tileHeight}),R=e.computed(()=>g.value==="binding");e.watch(()=>t.modelValue,K=>{K&&(m.value=s(K),g.value=K.mode==="binding"?"binding":"fixed",d.value=K.testData||"",E.rotate=K.rotate??he.WATERMARK_DEFAULTS.rotate,E.color=K.color||he.WATERMARK_DEFAULTS.color,E.opacity=K.opacity??he.WATERMARK_DEFAULTS.opacity,E.tileWidth=K.tileWidth??he.WATERMARK_DEFAULTS.tileWidth,E.tileHeight=K.tileHeight??he.WATERMARK_DEFAULTS.tileHeight)},{deep:!0});const S=e.computed({get(){const{tileWidth:K,tileHeight:y}=E;for(const[F,q]of Object.entries(l))if(K===q.width&&y===q.height)return F;return"custom"},set(K){const y=l[K];y&&(E.tileWidth=y.width,E.tileHeight=y.height)}});function h(){g.value=a(m.value)?"binding":"fixed",O()}function v(){h()}function x(){p.value=!0}function Z(K){m.value=K,h()}function le(K){E.color=K,O()}function O(){const K={testData:d.value,rotate:E.rotate,color:E.color,opacity:E.opacity,tileWidth:E.tileWidth,tileHeight:E.tileHeight};n("update:modelValue",g.value==="binding"?{...K,mode:"binding",binding:m.value,content:""}:{...K,mode:"fixed",content:m.value,binding:""})}return(K,y)=>(e.openBlock(),e.createElementBlock("div",Rs,[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",As,[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]=F=>m.value=F),placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onInput:v,onDblclick:x},null,544),[[e.vModelText,m.value]]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:x},"编辑表达式")]),R.value?(e.openBlock(),e.createElementBlock("div",Ls,[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]=F=>d.value=F),placeholder:"表达式取不到值时预览显示",onInput:O},null,544),[[e.vModelText,d.value]])])):e.createCommentVNode("",!0),e.createVNode(Je,{modelValue:p.value,"onUpdate:modelValue":y[2]||(y[2]=F=>p.value=F),fields:o.fields,expression:m.value,"onUpdate:expression":Z},null,8,["modelValue","fields","expression"]),e.createElementVNode("div",Us,[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]=F=>E.rotate=F),min:-90,max:90,step:5,onChange:O},null,544),[[e.vModelText,E.rotate,void 0,{number:!0}]]),e.createElementVNode("span",Is,e.toDisplayString(E.rotate)+"°",1)]),e.createElementVNode("div",Fs,[y[12]||(y[12]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ce,{"model-value":E.color,"onUpdate:modelValue":le},null,8,["model-value"])]),e.createElementVNode("div",Os,[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]=F=>E.opacity=F),min:.05,max:.5,step:.05,onChange:O},null,544),[[e.vModelText,E.opacity,void 0,{number:!0}]]),e.createElementVNode("span",Hs,e.toDisplayString(E.opacity.toFixed(2)),1)]),e.createElementVNode("div",Ws,[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]=F=>S.value=F),style:{width:"100%"},onChange:O},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),(F,q)=>(e.openBlock(),e.createElementBlock("option",{key:q,value:q},e.toDisplayString(F.label)+"("+e.toDisplayString(F.width)+"×"+e.toDisplayString(F.height)+")",9,Gs))),128)),y[14]||(y[14]=e.createElementVNode("option",{value:"custom"},"自定义",-1))],544),[[e.vModelSelect,S.value]])]),S.value==="custom"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Ks,[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]=F=>E.tileWidth=F),min:e.unref(c),step:10,onChange:O},null,40,qs),[[e.vModelText,E.tileWidth,void 0,{number:!0}]])]),e.createElementVNode("div",Ys,[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]=F=>E.tileHeight=F),min:e.unref(r),step:10,onChange:O},null,40,js),[[e.vModelText,E.tileHeight,void 0,{number:!0}]])])],64)):e.createCommentVNode("",!0)],32)]))}}),Zs=se(Xs,[["__scopeId","data-v-b55bfc50"]]),Js={class:"design-background-config"},Qs=["title"],_s={class:"design-background-actions"},ed=["disabled"],td=e.defineComponent({__name:"DesignBackgroundConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(!1),c=e.inject(ut,e.computed(()=>{})),r=e.computed(()=>l.value||!c.value),a=e.computed(()=>t.modelValue?.rotation??0);async function s(p){const g=p.target,E=g.files?.[0];if(E){if(!E.type.startsWith("image/")){alert("仅支持上传图片文件"),g.value="";return}if(!c.value){alert("设计背景上传能力未配置"),g.value="";return}l.value=!0;try{const R=await c.value(E);R?n("update:modelValue",{src:R,rotation:0}):alert("设计背景上传失败")}catch(R){alert(R instanceof Error?R.message:"设计背景上传失败")}finally{l.value=!1,g.value=""}}}function m(){if(!t.modelValue?.src)return;const p=(a.value+90)%360;n("update:modelValue",{src:t.modelValue.src,rotation:p})}function d(){n("update:modelValue",void 0)}return(p,g)=>(e.openBlock(),e.createElementBlock("div",Js,[g[0]||(g[0]=e.createElementVNode("h3",{class:"pd-divider"},"设计背景",-1)),g[1]||(g[1]=e.createElementVNode("p",{class:"design-background-tip"},"仅设计器显示,用于套打定位,不会出现在预览和打印中",-1)),o.modelValue?.src?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"design-background-path",title:o.modelValue.src},e.toDisplayString(o.modelValue.src),9,Qs),e.createElementVNode("div",_s,[e.createElementVNode("button",{type:"button",class:"pd-button small rotate-btn",onClick:m}," 旋转("+e.toDisplayString(a.value)+"°) ",1),e.createElementVNode("button",{type:"button",class:"pd-button small remove-btn",onClick:d},"移除")])],64)):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["pd-button small upload-label",{disabled:r.value}])},[e.createTextVNode(e.toDisplayString(l.value?"上传中...":"上传背景图")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:r.value,onChange:s},null,40,ed)],2))]))}}),od=se(td,[["__scopeId","data-v-3f4d2e32"]]),nd={class:"tiling-config","data-test":"tiling-config"},ld={class:"pd-field"},ad={class:"tiling-switch"},id=["checked","disabled"],rd={key:0,class:"pd-hint tiling-error"},sd={class:"pd-field"},dd=["value"],cd=["value"],ud={key:0,class:"pd-field"},md={class:"custom-size-grid"},pd={key:1,class:"pd-field"},vd={class:"pd-radio-group",role:"radiogroup"},fd={class:"pd-radio"},gd=["checked"],hd={class:"pd-radio"},bd=["checked"],Ed={class:"margin-grid"},yd={class:"pd-field"},kd={class:"pd-field"},Vd={class:"pd-field"},Nd={class:"pd-field"},wd={class:"pd-field"},Cd={class:"pd-field"},Sd={class:"pd-field"},Bd={key:2,class:"pd-hint tiling-summary"},$d=e.defineComponent({__name:"TilingConfig",props:{modelValue:{},templateData:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=Object.keys(b.PAPER_PRESETS).filter(h=>h!=="CUSTOM"&&!b.PAPER_PRESETS[h]?.continuous),c=e.computed(()=>b.isContinuousPaperSize(t.templateData?.paperSize)),r=e.computed(()=>({...he.TILE_DEFAULTS,...t.modelValue??{},enabled:t.modelValue?.enabled??!1,sheetMargin:{...he.TILE_DEFAULTS.sheetMargin,...t.modelValue?.sheetMargin??{}}})),a=e.computed(()=>t.templateData?{...t.templateData,tiling:r.value}:void 0),s=e.computed(()=>a.value?he.validateTiling(a.value):[]),m=e.computed(()=>{const h=a.value;return h?Math.max(he.computeMaxColumns(h),1):1}),d=e.computed(()=>{const h=a.value;if(!(!h||s.value.length))try{return he.computeTileLayout(h)}catch{return}}),p=e.computed(()=>{const h=d.value,v=a.value;if(!h||!v)return"";const x=he.resolveSheetMm(v),Z=r.value.sheetPaperSize==="CUSTOM"?"自定义":r.value.sheetPaperSize??"A4",le=r.value.sheetPaperSize==="CUSTOM"?"":r.value.sheetOrientation==="landscape"?" 横向":" 纵向";return`目标纸 ${Z}${le} ${x.width}×${x.height}mm · ${h.columns} 列 × ${h.rows} 行 = 每张 ${h.perSheet} 格`});function g(h){n("update:modelValue",{...r.value,...h})}function E(h,v){g({sheetMargin:{...r.value.sheetMargin,[h]:v??0}})}function R(h){if(h!=="CUSTOM"){g({sheetPaperSize:h});return}const v=a.value,x=v?he.resolveSheetMm(v):{width:210,height:297};g({sheetPaperSize:"CUSTOM",sheetCustomWidth:r.value.sheetCustomWidth??x.width,sheetCustomHeight:r.value.sheetCustomHeight??x.height})}function S(h){if(!h){g({enabled:!1});return}const v=m.value,x=v>=1?Math.min(he.TILE_DEFAULTS.columns,v):1;g({...he.TILE_DEFAULTS,columns:x})}return(h,v)=>(e.openBlock(),e.createElementBlock("div",nd,[v[30]||(v[30]=e.createElementVNode("h3",{class:"pd-divider"},"拼版打印",-1)),v[31]||(v[31]=e.createElementVNode("p",{class:"pd-hint"},"把标签按「列 × 行」铺到一张大纸上批量打印",-1)),e.createElementVNode("div",ld,[e.createElementVNode("label",ad,[e.createElementVNode("input",{type:"checkbox",checked:r.value.enabled,disabled:c.value,onChange:v[0]||(v[0]=x=>S(x.target.checked))},null,40,id),v[13]||(v[13]=e.createElementVNode("span",null,"启用拼版",-1))]),c.value?(e.openBlock(),e.createElementBlock("p",rd,"连续纸不支持拼版")):e.createCommentVNode("",!0)]),r.value.enabled&&!c.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",sd,[v[15]||(v[15]=e.createElementVNode("span",{class:"pd-label"},"目标纸张",-1)),e.createElementVNode("select",{class:"pd-select",style:{width:"100%"},value:r.value.sheetPaperSize??"A4",onChange:v[1]||(v[1]=x=>R(x.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),x=>(e.openBlock(),e.createElementBlock("option",{key:x,value:x},e.toDisplayString(e.unref(b.PAPER_PRESETS)[x]?.label??x),9,cd))),128)),v[14]||(v[14]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,dd)]),r.value.sheetPaperSize==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",ud,[v[17]||(v[17]=e.createElementVNode("span",{class:"pd-label"},"目标纸宽高 (mm)",-1)),e.createElementVNode("div",md,[e.createVNode(re,{"model-value":r.value.sheetCustomWidth,min:25,max:2e3,"onUpdate:modelValue":v[2]||(v[2]=x=>g({sheetCustomWidth:x}))},null,8,["model-value"]),v[16]||(v[16]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(re,{"model-value":r.value.sheetCustomHeight,min:25,max:2e3,"onUpdate:modelValue":v[3]||(v[3]=x=>g({sheetCustomHeight:x}))},null,8,["model-value"])])])):(e.openBlock(),e.createElementBlock("div",pd,[v[20]||(v[20]=e.createElementVNode("span",{class:"pd-label"},"目标纸方向",-1)),e.createElementVNode("div",vd,[e.createElementVNode("label",fd,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:(r.value.sheetOrientation??"portrait")==="portrait",onChange:v[4]||(v[4]=x=>g({sheetOrientation:"portrait"}))},null,40,gd),v[18]||(v[18]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",hd,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:r.value.sheetOrientation==="landscape",onChange:v[5]||(v[5]=x=>g({sheetOrientation:"landscape"}))},null,40,bd),v[19]||(v[19]=e.createElementVNode("span",null,"横向",-1))])])])),v[28]||(v[28]=e.createElementVNode("h3",{class:"pd-divider"},"拼版留白 (mm)",-1)),e.createElementVNode("div",Ed,[e.createElementVNode("div",yd,[v[21]||(v[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(re,{"model-value":r.value.sheetMargin.top,min:0,max:100,"onUpdate:modelValue":v[6]||(v[6]=x=>E("top",x))},null,8,["model-value"])]),e.createElementVNode("div",kd,[v[22]||(v[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(re,{"model-value":r.value.sheetMargin.bottom,min:0,max:100,"onUpdate:modelValue":v[7]||(v[7]=x=>E("bottom",x))},null,8,["model-value"])]),e.createElementVNode("div",Vd,[v[23]||(v[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(re,{"model-value":r.value.sheetMargin.left,min:0,max:100,"onUpdate:modelValue":v[8]||(v[8]=x=>E("left",x))},null,8,["model-value"])]),e.createElementVNode("div",Nd,[v[24]||(v[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(re,{"model-value":r.value.sheetMargin.right,min:0,max:100,"onUpdate:modelValue":v[9]||(v[9]=x=>E("right",x))},null,8,["model-value"])])]),v[29]||(v[29]=e.createElementVNode("h3",{class:"pd-divider"},"格间距与列数",-1)),e.createElementVNode("div",wd,[v[25]||(v[25]=e.createElementVNode("span",{class:"pd-label"},"横向间距",-1)),e.createVNode(re,{"model-value":r.value.gapX,min:0,max:50,"onUpdate:modelValue":v[10]||(v[10]=x=>g({gapX:x??0}))},null,8,["model-value"])]),e.createElementVNode("div",Cd,[v[26]||(v[26]=e.createElementVNode("span",{class:"pd-label"},"纵向间距",-1)),e.createVNode(re,{"model-value":r.value.gapY,min:0,max:50,"onUpdate:modelValue":v[11]||(v[11]=x=>g({gapY:x??0}))},null,8,["model-value"])]),e.createElementVNode("div",Sd,[v[27]||(v[27]=e.createElementVNode("span",{class:"pd-label"},"列数",-1)),e.createVNode(re,{"model-value":r.value.columns,min:1,max:m.value,"onUpdate:modelValue":v[12]||(v[12]=x=>g({columns:x??1}))},null,8,["model-value","max"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,x=>(e.openBlock(),e.createElementBlock("p",{key:x.code,class:"pd-hint tiling-error"},e.toDisplayString(x.message),1))),128)),!s.value.length&&p.value?(e.openBlock(),e.createElementBlock("p",Bd,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]))}}),xd=se($d,[["__scopeId","data-v-aa278268"]]),Dd={key:0,class:"prop-collapsed"},Td={class:"prop-head"},Md={class:"pd-tabs prop-tabs"},zd={class:"pd-tab-bar",role:"tablist"},Pd={class:"pd-tab-pane",role:"tabpanel"},Rd={class:"property-content"},Ad={key:1,class:"pd-empty"},Ld={class:"pd-tab-pane",role:"tabpanel"},Ud={class:"pd-field"},Id=["value"],Fd=["label"],Od=["value"],Hd={key:0,class:"pd-hint"},Wd={key:1,class:"pd-field"},Gd={class:"pd-label"},Kd={class:"custom-size-grid"},qd={key:2,class:"pd-field"},Yd={class:"pd-radio-group",role:"radiogroup"},jd={class:"pd-radio"},Xd=["checked"],Zd={class:"pd-radio"},Jd=["checked"],Qd={key:3,class:"pd-field"},_d={class:"pd-radio-group pd-radio-group--2col",role:"radiogroup"},ec={class:"pd-radio"},tc=["checked"],oc={class:"pd-radio"},nc=["checked"],lc={class:"pd-radio"},ac=["checked"],ic={class:"pd-radio"},rc=["checked"],sc={class:"pd-field"},dc={class:"page-bg-row"},cc={key:5,class:"pd-hint"},uc={class:"margin-grid"},mc={class:"pd-field"},pc={class:"pd-field"},vc={class:"pd-field"},fc={class:"pd-field"},gc={class:"pd-field"},hc={class:"pd-field"},bc={class:"pd-field"},Ec=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(o,{emit:i}){const t=o,n=i,l=e.computed(()=>{const A=[];for(const[$,Q]of Object.entries(b.PAPER_PRESETS)){if(t.multiPage&&b.isContinuousPaperSize($))continue;const pe=Q.group??"其他";let Ve=A.find(Ne=>Ne.group===pe);Ve||(Ve={group:pe,items:[]},A.push(Ve)),Ve.items.push({key:$,label:Q.label??$})}return A}),c=e.ref(""),r=e.computed(()=>t.element?["text","longText"].includes(t.element.printElementType.type):!1),a=e.computed(()=>t.element?t.element.printElementType.type==="image":!1),s=e.computed(()=>t.element?["barcode","qrcode"].includes(t.element.printElementType.type):!1),m=e.computed(()=>!t.element||t.element.printElementType.type!=="table"?!1:!!t.tableSelection&&t.tableSelection.elementId===t.element.id),d=e.computed(()=>t.element?t.element.printElementType.type==="table":!1),p=e.computed(()=>b.searchProperties(c.value)),g=e.computed(()=>p.value.groups),E=e.computed(()=>p.value.itemKeys),R=e.computed(()=>!!c.value.trim()),S=e.computed(()=>{if(!t.element)return[];if(t.element.printElementType.type==="table"&&t.tableSelection){const{r1:A,c1:$}=t.tableSelection,Q=t.element.options.tableRows;if(Q&&Q[A]){const pe=Q[A],Ve=t.element.options.fields?.[0]?.dataSource;return b.getTableCellBindings(pe.type,A,$,Ve)}}return b.getElementBindings(t.element)});function h(A){return A.split(".").flatMap($=>{const Q=$.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!Q)return[$];const pe=Q[1],Ve=[...Q[2].matchAll(/\[(\d+)\]/g)].map(Ne=>Number(Ne[1]));return[pe,...Ve]})}function v(A){return t.element?h(A).reduce((pe,Ve)=>pe==null?"":pe[Ve],t.element)??"":""}function x(A,$){if(!t.element)return;const Q=h(A),pe=Q.pop(),Ve=Q.reduce((Ne,xe)=>((Ne[xe]===void 0||Ne[xe]===null)&&(Ne[xe]={}),Ne[xe]),t.element);Ve[pe]=$||void 0,t.recordHistory?.()}function Z(A){c.value=A}function le(A){t.element&&x("options.src",A)}const O=e.computed(()=>t.templateData?.paperSize||"A4"),K=e.computed(()=>!t.multiPage&&b.isContinuousPaperSize(O.value)),y=e.computed(()=>b.isLabelPaperSize(O.value)),F=e.computed(()=>t.templateData?.orientation||"portrait"),q=e.computed(()=>!!t.templateData?.tiling?.enabled),z=e.computed(()=>t.templateData?.outputRotation??0),k=e.computed({get:()=>t.templateData?.pageBackground||"#ffffff",set:A=>f(A)}),T=e.computed(()=>t.templateData?.margins.top??10),X=e.computed(()=>t.templateData?.margins.bottom??10),ne=e.computed(()=>t.templateData?.margins.left??10),ae=e.computed(()=>t.templateData?.margins.right??10),ce=e.computed(()=>t.templateData?.header.height??10),J=e.computed(()=>t.templateData?.footer.height??10),u=e.computed(()=>t.templateData?.firstPageOverlay.height??0),w=e.computed(()=>t.templateData?.customWidth??b.PAPER_PRESETS[O.value]?.width??210),W=e.computed(()=>t.templateData?.customHeight??297),be=e.computed(()=>t.templateData?.designBackground);function ve(A){if(t.templateData){if(!A){const $={...t.templateData};delete $.designBackground,n("update:templateData",$);return}M({designBackground:A})}}const ue=e.computed(()=>t.templateData?.watermark??{});function fe(A){M({watermark:A})}function M(A){if(!t.templateData)return;const $={...t.templateData,...A};n("update:templateData",$)}function N(A){if(t.templateData){if(b.isContinuousPaperSize(A)){M({paperSize:A,customWidth:A==="CONTINUOUS"?t.templateData?.customWidth??80:void 0,orientation:"portrait",margins:{...t.templateData.margins,bottom:t.templateData?.margins.bottom??0}});return}if(A==="CUSTOM"){M({paperSize:"CUSTOM"});return}if(b.PAPER_PRESETS[A]){if(b.isLabelPaperSize(A)){M({paperSize:A,...b.labelPaperDefaults(t.templateData)});return}M({paperSize:A})}}}function C(A){M({orientation:String(A)})}function U(A){M({outputRotation:Number(A)})}function f(A){const $=A&&A.toLowerCase()!=="#ffffff"&&A.toLowerCase()!=="#fff"?A:void 0;M($===void 0?{pageBackground:void 0}:{pageBackground:$})}function V(){M({pageBackground:void 0})}function B(A){A!==void 0&&M({customWidth:A})}function j(A){A!==void 0&&M({customHeight:A})}function _(A){A!==void 0&&M({margins:{...t.templateData.margins,top:A}})}function oe(A){A!==void 0&&M({margins:{...t.templateData.margins,bottom:A}})}function me(A){A!==void 0&&M({margins:{...t.templateData.margins,left:A}})}function D(A){A!==void 0&&M({margins:{...t.templateData.margins,right:A}})}function L(A){A!==void 0&&M({header:{...t.templateData.header,height:A}})}function H(A){A!==void 0&&M({footer:{...t.templateData.footer,height:A}})}function ee(A){A!==void 0&&M({firstPageOverlay:{...t.templateData.firstPageOverlay,height:A}})}const Y=e.computed(()=>t.activeTab||"page");function ge(A){n("update:activeTab",A),n("toggle-collapse")}return(A,$)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",Dd,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:$[0]||($[0]=Q=>ge(Y.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:Y.value==="element"}]),title:"元素属性",onClick:$[1]||($[1]=Q=>ge("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:Y.value==="page"}]),title:"页面属性",onClick:$[2]||($[2]=Q=>ge("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Td,[$[18]||($[18]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:$[3]||($[3]=Q=>A.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",Md,[e.createElementVNode("div",zd,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="element"}]),onClick:$[4]||($[4]=Q=>A.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="page"}]),onClick:$[5]||($[5]=Q=>A.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",Pd,[o.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Cl,{onSearch:Z}),e.createElementVNode("div",Rd,[g.value.includes("position-size")&&!m.value?(e.openBlock(),e.createBlock(Hl,{key:0,element:o.element,"matched-keys":E.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("appearance")?(e.openBlock(),e.createBlock(Ca,{key:1,element:o.element,"is-text-type":r.value,"matched-keys":E.value,searching:R.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("code")&&s.value?(e.openBlock(),e.createBlock(Ha,{key:2,element:o.element,"matched-keys":E.value,searching:R.value,onChange:$[6]||($[6]=Q=>o.recordHistory?.())},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("binding")?(e.openBlock(),e.createBlock(Se,{key:3,title:"内容",icon:"Document","default-expanded":"","group-key":"binding"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,Q=>(e.openBlock(),e.createBlock(Mi,{key:Q.targetPath,descriptor:Q,fields:o.fields,"model-value":v(Q.targetPath),"onUpdate:modelValue":pe=>x(Q.targetPath,pe)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),a.value?(e.openBlock(),e.createBlock(ur,{key:0,onSuccess:le})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),d.value&&o.tableSelection&&o.tableSelection.elementId===o.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createVNode(hr,{element:o.element,selection:o.tableSelection},null,8,["element","selection"]),e.createVNode(Ps,{element:o.element,selection:o.tableSelection,fields:o.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),d.value&&g.value.includes("content")?(e.openBlock(),e.createBlock(Hi,{key:5,element:o.element,fields:o.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),g.value.includes("border-bg")?(e.openBlock(),e.createBlock(ji,{key:6,element:o.element,"matched-keys":E.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&d.value?(e.openBlock(),e.createBlock(wt,{key:7,element:o.element,"matched-keys":E.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&!d.value?(e.openBlock(),e.createBlock(wt,{key:8,element:o.element,"matched-keys":E.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("advanced")?(e.openBlock(),e.createBlock(tr,{key:9,element:o.element,"matched-keys":E.value,searching:R.value,onDeleteElement:$[7]||($[7]=Q=>A.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",Ad,"请在画布中选择一个元素"))],512),[[e.vShow,(o.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",Ld,[e.createElementVNode("form",{class:"pd-form",onSubmit:$[17]||($[17]=e.withModifiers(()=>{},["prevent"]))},[$[40]||($[40]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",Ud,[$[20]||($[20]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:O.value,class:"pd-select",onChange:$[8]||($[8]=Q=>N(Q.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,Q=>(e.openBlock(),e.createElementBlock("optgroup",{key:Q.group,label:Q.group},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.items,pe=>(e.openBlock(),e.createElementBlock("option",{key:pe.key,value:pe.key},e.toDisplayString(pe.label),9,Od))),128))],8,Fd))),128)),$[19]||($[19]=e.createElementVNode("option",{value:"CUSTOM"},"自定义宽高",-1))],40,Id)]),y.value?(e.openBlock(),e.createElementBlock("p",Hd,"标签纸默认整张给内容区:已取消页边距与页眉页脚,可在下方自行改回")):e.createCommentVNode("",!0),K.value||O.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",Wd,[e.createElementVNode("span",Gd,e.toDisplayString(K.value?"纸宽 (mm)":"自定义宽高 (mm)"),1),e.createElementVNode("div",Kd,[e.createVNode(re,{"model-value":w.value,min:25,max:2e3,"onUpdate:modelValue":B},null,8,["model-value"]),O.value==="CUSTOM"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[$[21]||($[21]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(re,{"model-value":W.value,min:25,max:2e3,"onUpdate:modelValue":j},null,8,["model-value"])],64)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),K.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",qd,[$[24]||($[24]=e.createElementVNode("span",{class:"pd-label"},"纸张方向",-1)),e.createElementVNode("div",Yd,[e.createElementVNode("label",jd,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:F.value==="portrait",onChange:$[9]||($[9]=Q=>C(Q.target.value))},null,40,Xd),$[22]||($[22]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",Zd,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:F.value==="landscape",onChange:$[10]||($[10]=Q=>C(Q.target.value))},null,40,Jd),$[23]||($[23]=e.createElementVNode("span",null,"横向",-1))])]),$[25]||($[25]=e.createElementVNode("p",{class:"pd-hint"},"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)",-1))])),!K.value&&!q.value?(e.openBlock(),e.createElementBlock("div",Qd,[$[30]||($[30]=e.createElementVNode("span",{class:"pd-label"},"内容旋转角度",-1)),e.createElementVNode("div",_d,[e.createElementVNode("label",ec,[e.createElementVNode("input",{type:"radio",value:"0",checked:z.value===0,onChange:$[11]||($[11]=Q=>U(Q.target.value))},null,40,tc),$[26]||($[26]=e.createElementVNode("span",null,"0°",-1))]),e.createElementVNode("label",oc,[e.createElementVNode("input",{type:"radio",value:"90",checked:z.value===90,onChange:$[12]||($[12]=Q=>U(Q.target.value))},null,40,nc),$[27]||($[27]=e.createElementVNode("span",null,"90°",-1))]),e.createElementVNode("label",lc,[e.createElementVNode("input",{type:"radio",value:"180",checked:z.value===180,onChange:$[13]||($[13]=Q=>U(Q.target.value))},null,40,ac),$[28]||($[28]=e.createElementVNode("span",null,"180°",-1))]),e.createElementVNode("label",ic,[e.createElementVNode("input",{type:"radio",value:"270",checked:z.value===270,onChange:$[14]||($[14]=Q=>U(Q.target.value))},null,40,rc),$[29]||($[29]=e.createElementVNode("span",null,"270°",-1))])]),$[31]||($[31]=e.createElementVNode("p",{class:"pd-hint"},"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)",-1))])):e.createCommentVNode("",!0),e.createElementVNode("div",sc,[$[32]||($[32]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",dc,[e.createVNode(Ce,{modelValue:k.value,"onUpdate:modelValue":$[15]||($[15]=Q=>k.value=Q),class:"page-bg-picker"},null,8,["modelValue"]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:V},"默认")])]),e.createVNode(od,{"model-value":be.value,"onUpdate:modelValue":ve},null,8,["model-value"]),o.multiPage?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(xd,{key:4,"model-value":o.templateData?.tiling,"template-data":o.templateData,"onUpdate:modelValue":$[16]||($[16]=Q=>M({tiling:Q}))},null,8,["model-value","template-data"])),$[41]||($[41]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),K.value?(e.openBlock(),e.createElementBlock("p",cc,"底部边距即连续纸走纸留白")):e.createCommentVNode("",!0),e.createElementVNode("div",uc,[e.createElementVNode("div",mc,[$[33]||($[33]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(re,{"model-value":T.value,min:0,max:50,"onUpdate:modelValue":_},null,8,["model-value"])]),e.createElementVNode("div",pc,[$[34]||($[34]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(re,{"model-value":X.value,min:0,max:100,"onUpdate:modelValue":oe},null,8,["model-value"])]),e.createElementVNode("div",vc,[$[35]||($[35]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(re,{"model-value":ne.value,min:0,max:50,"onUpdate:modelValue":me},null,8,["model-value"])]),e.createElementVNode("div",fc,[$[36]||($[36]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(re,{"model-value":ae.value,min:0,max:50,"onUpdate:modelValue":D},null,8,["model-value"])])]),$[42]||($[42]=e.createElementVNode("h3",{class:"pd-divider"},"三区高度 (mm)",-1)),e.createElementVNode("div",gc,[$[37]||($[37]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(re,{"model-value":ce.value,min:0,max:100,step:.1,"onUpdate:modelValue":L},null,8,["model-value"])]),e.createElementVNode("div",hc,[$[38]||($[38]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(re,{"model-value":J.value,min:0,max:100,step:.1,"onUpdate:modelValue":H},null,8,["model-value"])]),e.createElementVNode("div",bc,[$[39]||($[39]=e.createElementVNode("span",{class:"pd-label"},"首页叠加高度",-1)),e.createVNode(re,{"model-value":u.value,min:0,max:200,"onUpdate:modelValue":ee},null,8,["model-value"])])],32),e.createVNode(Zs,{"model-value":ue.value,fields:o.fields,"onUpdate:modelValue":fe},null,8,["model-value","fields"])],512),[[e.vShow,(o.activeTab||"page")==="page"]])])],64))],2))}}),yc=se(Ec,[["__scopeId","data-v-f7152fc4"]]),kc={class:"status-bar"},Vc={key:0,class:"status-item coord"},Nc={class:"status-item"},wc={class:"status-item"},Cc={class:"status-item status-paper"},Sc=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(o){return(i,t)=>(e.openBlock(),e.createElementBlock("div",kc,[o.coordinate?(e.openBlock(),e.createElementBlock("span",Vc," x:"+e.toDisplayString(o.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(o.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",Nc,"缩放 "+e.toDisplayString(o.scale)+"%",1),e.createElementVNode("span",wc,"元素 "+e.toDisplayString(o.elementCount)+e.toDisplayString(o.selectedCount?` (选中 ${o.selectedCount})`:""),1),e.createElementVNode("span",{class:e.normalizeClass(["status-dirty",{on:o.dirty}])},[t[0]||(t[0]=e.createElementVNode("span",{class:"dirty-dot"},null,-1)),e.createTextVNode(e.toDisplayString(o.dirty?"未保存":"已保存"),1)],2),e.createElementVNode("span",Cc,e.toDisplayString(o.paper),1)]))}}),Bc=se(Sc,[["__scopeId","data-v-a91952ff"]]),$c={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>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<p><strong>项目名称:</strong>worm-vue3-print</p>
|
|
39
39
|
<p><strong>仓库地址:</strong><a href="https://gitee.com/liulong_oschina/worm-vue3-print" target="_blank" rel="noopener noreferrer">https://gitee.com/liulong_oschina/worm-vue3-print</a></p>
|
|
40
40
|
<p>基于 Vue 3 的可视化打印模板设计器,支持拖拽式模板编辑、表达式数据绑定和浏览器端打印预览。</p>
|
|
41
|
-
`},
|
|
41
|
+
`},Au={id:"features",title:"功能说明",content:`
|
|
42
42
|
<h2>元素类型</h2>
|
|
43
43
|
<table>
|
|
44
44
|
<thead>
|
|
@@ -136,6 +136,24 @@
|
|
|
136
136
|
<li><strong>单元格图片处理</strong>:若单元格中图片无法缩小,请将图片处理方式设置为"缩小保持比例"</li>
|
|
137
137
|
</ul>
|
|
138
138
|
|
|
139
|
+
<h2>格式工具栏与格式刷</h2>
|
|
140
|
+
<h3>格式工具栏</h3>
|
|
141
|
+
<ul>
|
|
142
|
+
<li>位于顶部工具栏,选中元素或表格单元格后可用;不适用的按钮置灰,悬停可见原因</li>
|
|
143
|
+
<li>可设置:字体、字号、加粗 / 下划线 / 删除线、文字颜色、背景颜色、水平与垂直对齐、边框</li>
|
|
144
|
+
<li>多选时样式不一致的项目显示「混合」,重新设置后统一为所选值</li>
|
|
145
|
+
<li>边框面板提供「所有 / 外侧 / 内部 / 无」预设与上、下、左、右逐边开关,可指定线型、线宽、颜色;「内部」仅表格单元格可用</li>
|
|
146
|
+
<li>矩形、椭圆、线条本身用边框绘制,表格走单元格边框,因此不提供元素级边框</li>
|
|
147
|
+
</ul>
|
|
148
|
+
<h3>格式刷</h3>
|
|
149
|
+
<ul>
|
|
150
|
+
<li>先选中<strong>单个</strong>元素作为格式来源,点击格式刷(双击为连续刷)</li>
|
|
151
|
+
<li>再点选或框选目标元素即完成刷取;单击模式刷一次后自动退出</li>
|
|
152
|
+
<li>按 <code>Esc</code>、取消选中或再次点击格式刷按钮均可退出待刷态</li>
|
|
153
|
+
<li>按目标类型自动过滤:字体等文本样式只刷给文本 / 长文本,边框只刷给支持元素级边框的类型,背景颜色对所有元素生效</li>
|
|
154
|
+
<li>锁定元素不会被刷;源元素自身不会被改写</li>
|
|
155
|
+
</ul>
|
|
156
|
+
|
|
139
157
|
<h2>对齐与吸附</h2>
|
|
140
158
|
<h3>自动对齐</h3>
|
|
141
159
|
<p>拖拽元素时自动显示对齐引导线:</p>
|
|
@@ -183,7 +201,7 @@
|
|
|
183
201
|
<li>支持调节水印密度(密/中/疏/自定义瓦片尺寸),以及设置水印颜色</li>
|
|
184
202
|
<li>水印在画布、浏览器预览、服务端 PDF、静默打印四端渲染一致</li>
|
|
185
203
|
</ul>
|
|
186
|
-
`},
|
|
204
|
+
`},Pu={id:"shortcuts",title:"快捷键",content:`
|
|
187
205
|
<h2>常用操作</h2>
|
|
188
206
|
<table>
|
|
189
207
|
<thead>
|
|
@@ -253,7 +271,7 @@
|
|
|
253
271
|
<blockquote>
|
|
254
272
|
<p><strong>注意</strong>:当焦点在输入框、文本框、下拉框内时,快捷键不生效。</p>
|
|
255
273
|
</blockquote>
|
|
256
|
-
`},
|
|
274
|
+
`},Ru={id:"faq",title:"常见问题",content:`
|
|
257
275
|
<h2>如何调整纸张大小?</h2>
|
|
258
276
|
<ol>
|
|
259
277
|
<li>在右侧面板选择"页面设置"</li>
|
|
@@ -380,7 +398,38 @@
|
|
|
380
398
|
<blockquote>
|
|
381
399
|
<p><strong>提示</strong>:水印配置保存在模板 JSON 的 <code>watermark</code> 字段中,仅对当前模板生效。</p>
|
|
382
400
|
</blockquote>
|
|
383
|
-
`},
|
|
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
|
+
|
|
414
|
+
<h2>v1.3.3 <small>2026-09-27</small></h2>
|
|
415
|
+
|
|
416
|
+
<h3>新增</h3>
|
|
417
|
+
<ul>
|
|
418
|
+
<li><strong>格式工具栏</strong>:顶部工具栏新增常用排版控件——字体、字号、加粗 / 下划线 / 删除线、文字颜色、背景颜色、对齐方式、边框。选中多个元素或多个单元格后可一次性批量设置;样式不一致时显示「混合」,用法与 Word 一致。</li>
|
|
419
|
+
<li><strong>边框可以只加某几条边</strong>:边框面板提供「所有 / 外侧 / 内部 / 无」预设和上、下、左、右单独开关,并可指定线型、线宽与颜色。文本、长文本、图片、条码、二维码、HTML、页码等元素现在也能加边框(矩形、椭圆、线条、表格仍按各自原有方式绘制)。</li>
|
|
420
|
+
<li><strong>格式刷</strong>:选中一个元素后点格式刷,再点选或框选目标即可把格式刷过去。单击刷一次后自动退出,双击可连续刷,按 <code>Esc</code> 或点空白处取消;鼠标变成「复制」样式即表示正在待刷。</li>
|
|
421
|
+
</ul>
|
|
422
|
+
|
|
423
|
+
<h3>改进</h3>
|
|
424
|
+
<ul>
|
|
425
|
+
<li><strong>工具栏不再跳动</strong>:排版控件收进顶部一行,次要分组改为下拉;用不上的按钮改为置灰,悬停可以看到具体原因。</li>
|
|
426
|
+
</ul>
|
|
427
|
+
|
|
428
|
+
<h3>注意</h3>
|
|
429
|
+
<ul>
|
|
430
|
+
<li>以前给文本、图片等元素设置过边框但看不见效果的老模板,升级后边框会真的显示出来(画布与打印一致)。如不需要,把边框宽度改成 0 或选「无」即可。</li>
|
|
431
|
+
</ul>
|
|
432
|
+
|
|
384
433
|
<h2>v1.3.2 <small>2026-09-26</small></h2>
|
|
385
434
|
|
|
386
435
|
<h3>修复</h3>
|
|
@@ -544,5 +593,5 @@
|
|
|
544
593
|
<blockquote>
|
|
545
594
|
<p>完整更新记录请查阅仓库 <code>docs/中文/CHANGELOG.md</code> 与 <code>docs/en/CHANGELOG.en.md</code>。</p>
|
|
546
595
|
</blockquote>
|
|
547
|
-
`},zc=[$c,xc,Dc,Tc,Mc],Pc={class:"help-modal"},Rc={class:"help-modal-header"},Ac={class:"help-modal-body"},Lc={class:"help-modal-sidebar"},Uc=["onClick"],Ic={class:"help-modal-content"},Fc=["innerHTML"],st="worm-print-help-tab",Oc=e.defineComponent({__name:"HelpModal",props:{visible:{type:Boolean},initialTab:{default:"getting-started"}},emits:["close","update:tab"],setup(o,{emit:i}){const t=o,n=i,l=zc,c=e.ref(t.initialTab);e.onMounted(()=>{const m=localStorage.getItem(st);m&&l.some(d=>d.id===m)&&(c.value=m)}),e.watch(()=>t.visible,m=>{if(m){const d=localStorage.getItem(st);d&&l.some(p=>p.id===d)&&(c.value=d)}});function r(m){c.value=m,localStorage.setItem(st,m),n("update:tab",m)}const a=e.computed(()=>l.find(d=>d.id===c.value)?.content||"");function s(m){m.key==="Escape"&&t.visible&&n("close")}return e.onMounted(()=>{document.addEventListener("keydown",s)}),e.onUnmounted(()=>{document.removeEventListener("keydown",s)}),(m,d)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"help-modal"},{default:e.withCtx(()=>[o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"help-modal-overlay",onClick:d[1]||(d[1]=e.withModifiers(p=>m.$emit("close"),["self"]))},[e.createElementVNode("div",Pc,[e.createElementVNode("div",Rc,[d[2]||(d[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:d[0]||(d[0]=p=>m.$emit("close"))}," × ")]),e.createElementVNode("div",Ac,[e.createElementVNode("div",Lc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),p=>(e.openBlock(),e.createElementBlock("button",{key:p.id,class:e.normalizeClass(["help-tab",{active:c.value===p.id}]),onClick:g=>r(p.id)},e.toDisplayString(p.title),11,Uc))),128))]),e.createElementVNode("div",Ic,[e.createElementVNode("div",{class:"help-content",innerHTML:a.value},null,8,Fc)])])])])):e.createCommentVNode("",!0)]),_:1})]))}}),Hc=se(Oc,[["__scopeId","data-v-31115934"]]),Wc={class:"page-tabs-list"},Gc=["onBlur","onKeydown"],Kc=["data-tip","onClick","onDblclick"],qc={class:"page-tabs-actions"},Yc=["data-tip","disabled"],jc=["data-tip","disabled"],Xc=["data-tip","disabled"],Zc=["data-tip","disabled"],Jc=["data-tip","disabled"],Qc=e.defineComponent({__name:"PageTabs",props:{pages:{},activeIndex:{},multi:{type:Boolean},tilingEnabled:{type:Boolean}},emits:["select","add","duplicate","delete","rename","move"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(-1),c=e.ref(""),r=e.computed(()=>t.pages[t.activeIndex]?.name||`页面 ${t.activeIndex+1}`),a=e.computed(()=>t.tilingEnabled?dt:"新增页面(在当前页后追加空白页)"),s=e.computed(()=>t.tilingEnabled?dt:`复制当前页「${r.value}」`);function m(x){l.value=x,c.value=t.pages[x]?.name??""}function d(x){if(l.value!==x)return;const Z=c.value.trim();Z&&n("rename",x,Z),l.value=-1}function p(){l.value=-1}const g=e.ref(null);let E=null;function R(x){const Z=x.dataset.tip;if(!Z)return;const le=x.getBoundingClientRect(),O=Math.min(Math.max(le.left+le.width/2,80),window.innerWidth-80);g.value={text:Z,x:O,y:le.bottom+6}}function S(x){const Z=x.target.closest?.("[data-tip]");Z&&(E&&clearTimeout(E),E=setTimeout(()=>R(Z),300))}function h(x){const Z=x.target.closest?.("[data-tip]");Z&&x.relatedTarget?.closest?.("[data-tip]")===Z||v()}function v(){E&&(clearTimeout(E),E=null),g.value=null}return e.onUnmounted(v),(x,Z)=>(e.openBlock(),e.createElementBlock("div",{class:"page-tabs",onMouseover:S,onMouseout:h,onMouseleave:v},[e.createElementVNode("div",Wc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.pages,(le,O)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:O},[l.value===O?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":Z[0]||(Z[0]=K=>c.value=K),class:"page-tab-rename","data-test":"page-rename-input",onBlur:K=>d(O),onKeydown:[e.withKeys(K=>d(O),["enter"]),e.withKeys(p,["esc"])]},null,40,Gc)),[[e.vModelText,c.value]]):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["page-tab",{active:O===o.activeIndex}]),"data-tip":le.name?`${le.name}(双击重命名)`:"双击重命名",onClick:K=>x.$emit("select",O),onDblclick:K=>m(O)},e.toDisplayString(le.name||`页面 ${O+1}`),43,Kc))],64))),128))]),e.createElementVNode("div",qc,[e.createElementVNode("button",{"data-test":"add-page","data-tip":a.value,disabled:o.tilingEnabled,onClick:Z[1]||(Z[1]=le=>x.$emit("add"))},"+",8,Yc),e.createElementVNode("button",{"data-test":"duplicate-page","data-tip":s.value,disabled:o.tilingEnabled,onClick:Z[2]||(Z[2]=le=>x.$emit("duplicate"))},"⧉",8,jc),e.createElementVNode("button",{"data-test":"delete-page","data-tip":o.multi?`删除当前页「${r.value}」`:"仅多页面模板可删除页面",disabled:!o.multi,onClick:Z[3]||(Z[3]=le=>x.$emit("delete",o.activeIndex))},"✕",8,Xc),e.createElementVNode("button",{"data-test":"move-left","data-tip":`前移「${r.value}」`,disabled:o.activeIndex<=0,onClick:Z[4]||(Z[4]=le=>x.$emit("move",o.activeIndex,o.activeIndex-1))},"←",8,Zc),e.createElementVNode("button",{"data-test":"move-right","data-tip":`后移「${r.value}」`,disabled:o.activeIndex>=o.pages.length-1,onClick:Z[5]||(Z[5]=le=>x.$emit("move",o.activeIndex,o.activeIndex+1))},"→",8,Jc)]),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))}}),_c=se(Qc,[["__scopeId","data-v-f1c7a18e"]]),Ct="print-studio:left",St="print-studio:right";function Bt(o,i){try{const t=localStorage.getItem(o);return t===null?i:t==="1"}catch{return i}}function eu(){const o=e.ref(Bt(Ct,!1)),i=e.ref(Bt(St,!1)),t=e.ref(!1);e.watch(o,r=>{try{localStorage.setItem(Ct,r?"1":"0")}catch{}},{flush:"sync"}),e.watch(i,r=>{try{localStorage.setItem(St,r?"1":"0")}catch{}},{flush:"sync"});function n(){o.value=!o.value}function l(){i.value=!i.value}function c(){t.value=!1}return{leftCollapsed:o,rightCollapsed:i,toggleLeft:n,toggleRight:l,dirty:t,markSaved:c}}const tu={class:"designer-container"},ou={class:"designer-body"},nu=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(o,{expose:i,emit:t}){const n=o,l=t,c=e.ref(!1);e.watch(()=>n.showHelp,I=>{I===!1&&(c.value=!1)});const{leftCollapsed:r,rightCollapsed:a,toggleLeft:s,toggleRight:m,dirty:d,markSaved:p}=eu(),{scale:g,showRuler:E,showGrid:R,snapToGrid:S,showTableGhostBorder:h,templateData:v,elements:x,fields:Z,tilingEnabled:le,selectedIds:O,selectedElement:K,selectedElements:y,select:F,selectElement:q,clearSelection:z,selectAll:k,previewIds:T,setPreview:X,commitPreview:ne,hasClipboard:ae,copy:ce,paste:J,cutSelected:u,canUndo:w,canRedo:W,undo:be,redo:ve,alignSelected:ue,groupSelected:fe,ungroupSelected:M,deleteSelected:N,dragStart:C,dragStop:U,addElement:f,addFieldElement:V,moveLayer:B,updateTemplateData:j,getTemplateJson:_,loadTemplate:oe,pages:me,activePageIndex:D,switchPage:L,addPage:H,duplicatePage:ee,deletePage:Y,renamePage:ge,movePage:A,tableSelection:$,setTableSelection:Q,recordHistory:pe}=qt({initialTemplate:n.initialTemplate,initialElements:n.initialElements,initialFields:n.fields});e.watch([x,v],()=>{d.value=!0},{deep:!0});const Ve=e.computed(()=>y.value.some(I=>!!I.options.groupId)),{guides:Ne,addGuide:xe,moveGuide:Qe,removeGuide:Ge}=jt(v,pe),_e=e.computed(()=>{const I=v.value,{width:G}=b.getPaperDimensions(I);return G-I.margins.left-I.margins.right});e.provide(We,{tableSelection:$,setTableSelection:Q,recordHistory:pe,maxTableWidth:_e}),e.provide(Dt,O),e.provide(Tt,T),e.provide(ct,e.computed(()=>n.uploadImage)),e.provide(ut,e.computed(()=>n.uploadDesignBackground));const{catalog:et}=Zt(e.computed(()=>n.fonts));e.provide(mt,et),to(e.computed(()=>he.buildFontFaceCss(n.fonts)));function Ue(){const I=_();return n.fonts?.length?Array.isArray(I.pages)?{...I,pages:I.pages.map(G=>({...G,fonts:[...n.fonts]}))}:{...I,fonts:[...n.fonts]}:I}e.watch(K,I=>{(!I||I.printElementType.type!=="table")&&Q(null)});const Pe=e.ref(null),Me=e.ref(!1),Re=e.ref(""),tt=e.ref(.5);async function ot(){if(Me.value){Me.value=!1;return}const I=Ue();if(!I){alert("模板数据为空");return}if(!n.requestScreenshot){alert("截图服务未配置");return}try{const G=I,de=Array.isArray(G.pages)?G.pages[D.value]:I,we=await n.requestScreenshot({templateJson:de,printData:b.DEFAULT_DEMO_DATA});Re.value&&URL.revokeObjectURL(Re.value),Re.value=URL.createObjectURL(we),Me.value=!0}catch{alert("截图生成失败")}}const Ke=e.ref(null);function nt(I){Ke.value=I}const lt=e.computed(()=>{const I=v.value,G=b.getPaperDimensions(I),de=I.orientation==="landscape"?"横向":"纵向",De=`${b.PAPER_PRESETS[I.paperSize]?.label??I.paperSize} ${de} ${Math.round(G.width)}×${Math.round(G.height)}mm`,Te=I.outputRotation;return Te?`${De}(旋转${Te}°)`:De});function qe(){const I=Pe.value?.$el;if(I){const G=getComputedStyle(I),de=parseFloat(G.paddingLeft)+parseFloat(G.paddingRight),we=parseFloat(G.paddingTop)+parseFloat(G.paddingBottom),De=b.getPaperDimensions(v.value),Te=96/25.4,Fe=b.computeFitScale(I.clientWidth-de,I.clientHeight-we,De.width*Te,De.height*Te);Pe.value?.fitToWindow(Fe)}}function at(I){g.value=Math.max(b.FIT_SCALE_MIN_PERCENT,g.value+I)}function P(I){Pe.value?.zoomByStep(I>0?1:-1)}function te(I){const G=I.target.tagName;G==="INPUT"||G==="TEXTAREA"||G==="SELECT"||(I.ctrlKey||I.metaKey)&&I.key==="0"&&(I.preventDefault(),qe())}e.onMounted(()=>document.addEventListener("keydown",te)),e.onUnmounted(()=>document.removeEventListener("keydown",te));function ie(I){const G=v.value.header.height,de=v.value.footer.height;j(I),I.header.height<G&&ye("header"),I.footer.height<de&&ye("footer")}function ke(I,G){v.value={...v.value,[I]:{...v.value[I],height:G}}}function Be(I){j({...v.value}),ye(I)}function ye(I){const G=b.getZoneRects(v.value)[I];x.value.some(we=>we.zone===I&&(we.options.top+we.options.height>G.height||we.options.left+we.options.width>G.width))&&alert(`${I==="header"?"页眉":"页脚"}高度已小于区域内元素,请手动调整元素位置`)}function $e(){const I=v.value.firstPageOverlay,G={options:{left:0,top:0,width:50,height:10,title:"首页叠加"},printElementType:{type:"text",title:"首页叠加"}};v.value={...v.value,firstPageOverlay:{...I,elements:[...I.elements,G]}}}const ze=q;function zt(I){const G=x.value.find(de=>de.id===I);G&&(G.options.visible=G.options.visible===!1)}function Pt(I){const G=x.value.find(de=>de.id===I);G&&(G.options.locked=!G.options.locked)}const Ae=e.ref("page");e.watch(K,I=>{Ae.value=I?"element":"page"});const Rt={text:"formatter",longText:"formatter",barcode:"formatter",qrcode:"formatter",image:"src"},Ie=e.ref(!1),Ye=e.ref(null),it=e.ref("");function At(I){const G=x.value.find(we=>we.id===I);if(!G||(F(I,!1),Ae.value="element",G.options.locked))return;const de=Rt[G.printElementType.type];de&&(Ye.value={kind:"element",element:G,field:de},it.value=G.options[de]||"",Ie.value=!0)}function Lt(I,G,de){const we=x.value.find(Ot=>Ot.id===I);if(!we||(F(I,!1),Ae.value="element",we.options.locked))return;const De=we.options.tableRows??[],Te=b.findMainCell(De,G,de),Fe=De[Te.r]?.cells[Te.c];Fe&&(Ye.value={kind:"cell",cell:Fe},it.value=Fe.formatter||"",Ie.value=!0)}function Ut(I){const G=Ye.value;G?.kind==="element"?G.element.options[G.field]=I||void 0:G?.kind==="cell"&&(G.cell.formatter=I||void 0),pe(),Ie.value=!1,Ye.value=null}function It(I,G){x.value.push(I),F(I.id,!1),pe()}e.watch(()=>n.initialTemplate,I=>{I&&oe(I,n.initialElements)}),e.watch(()=>n.initialElements,I=>{I&&!n.initialTemplate&&(v.value={...v.value,elements:I.map(G=>({...G,options:{...G.options},printElementType:{...G.printElementType}}))})}),e.watch(()=>n.fields,I=>{Z.value=I||[]});const vt=e.computed(()=>{const I=v.value;return I?.tiling?.enabled!==!0?[]:he.validateTiling(I)});i({getTemplateJson:Ue,validateTemplate:()=>vt.value});function Ft(){const I=vt.value;if(I.length){alert(I[0].message),Ae.value="page";return}const G=Ue();if(Array.isArray(G.pages))try{he.normalizeTemplate(G)}catch(de){alert(de instanceof Error?de.message:String(de));return}l("save",JSON.stringify(G)),p()}return(I,G)=>(e.openBlock(),e.createElementBlock("div",tu,[e.createVNode(ko,{"is-edit":o.isEdit,"can-undo":e.unref(w),"can-redo":e.unref(W),"has-multi-selection":e.unref(O).size>=2,"has-selection":e.unref(O).size>=1,"show-ruler":e.unref(E),"show-grid":e.unref(R),"snap-to-grid":e.unref(S),"show-table-ghost-border":e.unref(h),"selected-element-has-group":Ve.value,"overlay-visible":Me.value,"show-help":o.showHelp!==!1,scale:e.unref(g),"onUpdate:scale":G[0]||(G[0]=de=>e.isRef(g)?g.value=de:null),onPreview:G[1]||(G[1]=de=>I.$emit("preview")),onSave:Ft,onUndo:e.unref(be),onRedo:e.unref(ve),onAlign:G[2]||(G[2]=de=>e.unref(ue)(de)),onMoveLayer:e.unref(B),onToggleRuler:G[3]||(G[3]=de=>E.value=!e.unref(E)),onToggleGrid:G[4]||(G[4]=de=>R.value=!e.unref(R)),onToggleSnap:G[5]||(G[5]=de=>S.value=!e.unref(S)),onToggleTableGhostBorder:G[6]||(G[6]=de=>h.value=!e.unref(h)),onToggleOverlay:ot,onGroup:e.unref(fe),onUngroup:e.unref(M),onAddOverlayElement:$e,onFitWindow:qe,onZoom:P,onHelp:G[7]||(G[7]=de=>c.value=!0)},null,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","scale","onUndo","onRedo","onMoveLayer","onGroup","onUngroup"]),e.createVNode(_c,{pages:e.unref(me),"active-index":e.unref(D),multi:e.unref(me).length>1,"tiling-enabled":e.unref(le),onSelect:e.unref(L),onAdd:e.unref(H),onDuplicate:e.unref(ee),onDelete:e.unref(Y),onRename:e.unref(ge),onMove:e.unref(A)},null,8,["pages","active-index","multi","tiling-enabled","onSelect","onAdd","onDuplicate","onDelete","onRename","onMove"]),e.createElementVNode("div",ou,[e.createVNode(tn,{fields:e.unref(Z),elements:e.unref(x),"selected-ids":e.unref(O),collapsed:e.unref(r),onSelect:e.unref(ze),onMoveLayer:e.unref(B),onGroup:e.unref(fe),onUngroup:e.unref(M),onToggleVisible:zt,onToggleLocked:Pt,onToggleCollapse:e.unref(s)},null,8,["fields","elements","selected-ids","collapsed","onSelect","onMoveLayer","onGroup","onUngroup","onToggleCollapse"]),e.createVNode(Vl,{ref_key:"canvasAreaRef",ref:Pe,"template-data":e.unref(v),elements:e.unref(x),scale:e.unref(g)/100,"show-ruler":e.unref(E),"show-grid":e.unref(R),"snap-to-grid":e.unref(S),"show-table-ghost-border":e.unref(h),"has-clipboard":e.unref(ae),guides:e.unref(Ne),"overlay-visible":Me.value,"screenshot-url":Re.value,"overlay-opacity":tt.value,onSelect:e.unref(ze),onDropElement:e.unref(f),onDropField:e.unref(V),onDragStart:e.unref(C),onDragStop:e.unref(U),onDblclickElement:At,onDblclickCell:Lt,onZoneHeightChange:ke,onZoneHeightCommit:Be,onSelectAll:e.unref(k),onClearSelection:e.unref(z),onPreview:e.unref(X),onCommitPreview:e.unref(ne),onPaste:e.unref(J),onCopy:e.unref(ce),onCut:e.unref(u),onDelete:e.unref(N),onMoveLayer:e.unref(B),onCoordinate:nt,onAddGuide:e.unref(xe),onGuideMove:e.unref(Qe),onGuideRemove:e.unref(Ge),onZoom:at,onCloneElement:It},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(yc,{element:e.unref(K),"template-data":e.unref(v),fields:e.unref(Z),"table-selection":e.unref($),"record-history":e.unref(pe),collapsed:e.unref(a),"multi-page":e.unref(me).length>1,"active-tab":Ae.value,"onUpdate:activeTab":G[8]||(G[8]=de=>Ae.value=de),onDeleteElement:e.unref(N),"onUpdate:templateData":ie,onToggleCollapse:e.unref(m)},null,8,["element","template-data","fields","table-selection","record-history","collapsed","multi-page","active-tab","onDeleteElement","onToggleCollapse"])]),e.createVNode(Bc,{coordinate:Ke.value,scale:e.unref(g),"element-count":e.unref(x).length,"selected-count":e.unref(O).size,paper:lt.value,dirty:e.unref(d)},null,8,["coordinate","scale","element-count","selected-count","paper","dirty"]),e.createVNode(Je,{modelValue:Ie.value,"onUpdate:modelValue":G[9]||(G[9]=de=>Ie.value=de),fields:e.unref(Z),expression:it.value,"onUpdate:expression":Ut},null,8,["modelValue","fields","expression"]),e.createVNode(Hc,{visible:c.value,onClose:G[10]||(G[10]=de=>c.value=!1)},null,8,["visible"])]))}}),lu=se(nu,[["__scopeId","data-v-2cfe4ceb"]]),au={class:"print-html-preview"},iu={key:0,class:"print-html-preview-error"},ru={key:1,class:"print-html-preview-loading"},su=e.defineComponent({__name:"PrintHtmlPreview",props:{templateJson:{},printData:{},baseUrl:{},fontBaseUrl:{}},emits:["rendered","error"],setup(o,{expose:i,emit:t}){const n=o,l=t,c=e.ref(),r=e.ref(!1),a=e.ref("");let s=0;async function m(){if(!n.templateJson){a.value="",r.value=!1;return}const p=++s;r.value=!0,a.value="";try{const{html:g,pageCount:E,copies:R}=await Oe.renderHtmlPages(n.templateJson,n.printData,n.baseUrl,Oe.browserCodeRenderer,{fontBaseUrl:n.fontBaseUrl});if(p!==s)return;const S=c.value?.contentWindow?.document;S&&(S.open(),S.write(g),S.close()),l("rendered",E,R)}catch(g){if(p!==s)return;a.value=g instanceof Error?g.message:"未知错误",l("error",a.value)}finally{p===s&&(r.value=!1)}}function d(){const p=c.value?.contentWindow;p&&(p.focus(),p.print())}return e.watch(()=>[n.templateJson,n.printData,n.baseUrl,n.fontBaseUrl],()=>{m()},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{s++}),i({print:d,rerender:m}),(p,g)=>(e.openBlock(),e.createElementBlock("div",au,[a.value?(e.openBlock(),e.createElementBlock("div",iu,[e.createElementVNode("span",null,"预览渲染失败:"+e.toDisplayString(a.value),1)])):r.value?(e.openBlock(),e.createElementBlock("div",ru,"预览渲染中…")):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("iframe",{ref_key:"iframeRef",ref:c,class:"print-html-preview-iframe",title:"打印预览"},null,512),[[e.vShow,!r.value&&!a.value]])]))}}),du=se(su,[["__scopeId","data-v-ff7de2b5"]]);Object.defineProperty(exports,"DEFAULT_DEMO_DATA",{enumerable:!0,get:()=>b.DEFAULT_DEMO_DATA});Object.defineProperty(exports,"getDemoData",{enumerable:!0,get:()=>b.getDemoData});Object.defineProperty(exports,"browserCodeRenderer",{enumerable:!0,get:()=>Oe.browserCodeRenderer});Object.defineProperty(exports,"renderHtmlPages",{enumerable:!0,get:()=>Oe.renderHtmlPages});exports.FONT_CATALOG_KEY=mt;exports.PrintDesigner=lu;exports.PrintHtmlPreview=du;exports.UPLOAD_DESIGN_BACKGROUND_KEY=ut;exports.UPLOAD_IMAGE_KEY=ct;exports.createDefaultTemplate=Le;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;
|
|
548
597
|
//# sourceMappingURL=index.cjs.map
|