@worm-vue3-print/canvas 1.1.0 → 1.2.0
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 +7 -3
- package/dist/components/CanvasPaper.vue.d.ts +0 -3
- package/dist/components/DesignerToolbar.vue.d.ts +8 -1
- package/dist/components/HelpButton.vue.d.ts +7 -0
- package/dist/components/HelpModal.vue.d.ts +15 -0
- package/dist/components/Ruler.vue.d.ts +11 -2
- package/dist/composables/useDesignerState.d.ts +1 -0
- package/dist/help-content/changelog.d.ts +6 -0
- package/dist/help-content/faq.d.ts +6 -0
- package/dist/help-content/features.d.ts +6 -0
- package/dist/help-content/getting-started.d.ts +6 -0
- package/dist/help-content/index.d.ts +7 -0
- package/dist/help-content/shortcuts.d.ts +6 -0
- package/dist/index.cjs +407 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3794 -3130
- package/dist/index.js.map +1 -1
- package/dist/utils/ruler.d.ts +24 -2
- package/dist/utils/scale.d.ts +12 -1
- package/dist/utils/units.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,408 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ce=require("@worm-vue3-print/core"),tt=require("jsbarcode"),nt=require("qrcode"),Qt=require("dompurify");function _t(){let t=0;return function(){return t+=1,`cell-${Date.now().toString(36)}-${t}`}}function en(){let t=0;return function(){return t+=1,`row-${Date.now().toString(36)}-${t}`}}const tn=_t(),nn=en(),ze={width:.75,style:"solid",color:"#333333"};function ot(t){return JSON.parse(JSON.stringify(t))}function lt(t){return{id:tn(),borders:{top:{...ze},right:{...ze},bottom:{...ze},left:{...ze}},...t}}function on(){const t=[50,50,50],l=(o,a)=>({id:nn(),type:o,height:8,...a!==void 0?{repeatOnPage:a}:{},cells:t.map(()=>lt())}),n=l("header",!0);return n.cells.forEach((o,a)=>{o.formatter=`列${a+1}`,o.align="center",o.fontWeight="bold"}),{rows:[n,l("data"),l("subtotal"),l("summary")],colWidths:t}}function at(t,l,n){if(!t[l].cells[n].merged)return{r:l,c:n};for(let o=l;o>=0;o--)for(let a=n;a>=0;a--){const i=t[o].cells[a];if(i.merged)continue;const r=i.rowspan??1,s=i.colspan??1;if(o+r-1>=l&&a+s-1>=n)return{r:o,c:a}}return{r:l,c:n}}function ke(t,l,n){const o=at(t,l,n),a=t[o.r].cells[o.c];return{r1:o.r,c1:o.c,r2:o.r+(a.rowspan??1)-1,c2:o.c+(a.colspan??1)-1}}function Ct(t,l,n){let o={r1:Math.min(l.r,n.r),c1:Math.min(l.c,n.c),r2:Math.max(l.r,n.r),c2:Math.max(l.c,n.c)};for(;;){let a=!1;for(let i=o.r1;i<=o.r2;i++)for(let r=o.c1;r<=o.c2;r++){const s=ke(t,i,r),d={r1:Math.min(o.r1,s.r1),c1:Math.min(o.c1,s.c1),r2:Math.max(o.r2,s.r2),c2:Math.max(o.c2,s.c2)};(d.r1!==o.r1||d.c1!==o.c1||d.r2!==o.r2||d.c2!==o.c2)&&(o=d,a=!0)}if(!a)return o}}function St(t,l){if((l.r2-l.r1+1)*(l.c2-l.c1+1)<2)return"至少选择 2 个单元格";const o=new Set;for(let i=l.r1;i<=l.r2;i++)o.add(t[i].type);if(o.size>1)return"合并区域不能跨越不同类型的行";const a=Ct(t,{r:l.r1,c:l.c1},{r:l.r2,c:l.c2});return a.r1!==l.r1||a.c1!==l.c1||a.r2!==l.r2||a.c2!==l.c2?"选区与已有合并区域部分重叠":null}function $t(t,l){const n=t[l.r1].cells[l.c1],o=[];for(let a=l.r1;a<=l.r2;a++)for(let i=l.c1;i<=l.c2;i++){const r=t[a].cells[i];r.formatter&&o.push(r.formatter),!(a===l.r1&&i===l.c1)&&(r.merged=!0,r.rowspan=1,r.colspan=1,r.formatter="")}n.rowspan=l.r2-l.r1+1,n.colspan=l.c2-l.c1+1,n.formatter=o.join(" ")}function Mt(t,l){for(let n=l.r1;n<=l.r2;n++)for(let o=l.c1;o<=l.c2;o++){const a=t[n].cells[o];if(!a.merged&&((a.rowspan??1)>1||(a.colspan??1)>1)){const i=ke(t,n,o),r=a;for(let s=i.r1;s<=i.r2;s++)for(let d=i.c1;d<=i.c2;d++){const u=t[s].cells[d];u.merged=!1,u.rowspan=1,u.colspan=1,ln(r,u)}a.rowspan=1,a.colspan=1}}}function ln(t,l){t!==l&&(l.align=t.align,l.valign=t.valign,l.fontSize=t.fontSize,l.fontWeight=t.fontWeight,l.color=t.color,l.backgroundColor=t.backgroundColor,l.borders=t.borders?ot(t.borders):void 0,l.padding=t.padding,l.wordWrap=t.wordWrap)}function mt(t,l,n){const o=n==="above"?l:l+1,a=t[l],i=a.cells.length,r=a.type==="data"?"header":a.type,s={id:`row-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,type:r,height:a.height,cells:Array.from({length:i},()=>lt())};for(let d=0;d<i;d++)if(o>0&&o<t.length){const u=ke(t,o-1,d);if(u.r1<o&&u.r2>=o){const f=t[u.r1].cells[u.c1];f.rowspan=(f.rowspan??1)+1,s.cells[d].merged=!0}}t.splice(o,0,s)}function an(t,l){if(t.length<=1)return"不能删除最后一行";const n=t[l],o=n.cells.length;for(let a=0;a<o;a++){const i=n.cells[a];if(!i.merged&&(i.rowspan??1)>1){const r=t[l+1].cells[a];Object.assign(r,ot(i),{id:r.id}),r.rowspan=(i.rowspan??1)-1,r.merged=!1}else if(i.merged){const r=ke(t,l,a);if(r.r1<l&&r.c1===a){const s=t[r.r1].cells[r.c1];s.rowspan=(s.rowspan??1)-1}}}return t.splice(l,1),null}function pt(t,l,n,o){const a=o==="left"?n:n+1;l.splice(a,0,l[n]);for(const i of t){const r=lt();if(a>0&&a<i.cells.length){const s=t.indexOf(i),d=ke(t,s,a-1);if(d.c1<a&&d.c2>=a){const u=t[d.r1].cells[d.c1];s===d.r1&&(u.colspan=(u.colspan??1)+1),r.merged=!0}}i.cells.splice(a,0,r)}}function rn(t,l,n){if(l.length<=1)return"不能删除最后一列";for(let o=0;o<t.length;o++){const a=t[o].cells[n];if(!a.merged&&(a.colspan??1)>1){const i=t[o].cells[n+1];Object.assign(i,ot(a),{id:i.id}),i.colspan=(a.colspan??1)-1,i.merged=!1}else if(a.merged){const i=ke(t,o,n);if(i.c1<n&&i.r1===o){const r=t[i.r1].cells[i.c1];r.colspan=(r.colspan??1)-1}}}for(const o of t)o.cells.splice(n,1);return l.splice(n,1),null}function Ze(t,l,n){if(n==="data"){const o=t.findIndex((a,i)=>a.type==="data"&&i!==l);if(o>=0)return`数据行已存在(第 ${o+1} 行),全表最多一行`}if(n==="header"){for(let o=0;o<l;o++)if(t[o].type!=="header")return"标题行必须从表格顶部连续设置"}if(n==="subtotal"||n==="summary"){const o=t.findIndex(a=>a.type==="data");if(o<0)return"请先设置数据行,小计/汇总行必须位于数据行之后";if(l<o)return"小计/汇总行必须位于数据行之后"}if(n==="subtotal"&&t.slice(0,l).some(o=>o.type==="summary"))return"小计行必须位于汇总行之前";if(n==="summary"&&t.slice(l+1).some(o=>o.type==="subtotal"))return"汇总行必须位于小计行之后";if(t[l].type==="header"&&n!=="header"){for(let o=l+1;o<t.length;o++)if(t[o].type==="header")return"取消该标题行会导致标题行不连续,请先调整后续标题行"}return t[l].type=n,n!=="header"&&delete t[l].repeatOnPage,null}function sn(t,l,n,o){for(let a=l.r1;a<=l.r2;a++)for(let i=l.c1;i<=l.c2;i++){const r=t[a].cells[i];if(r.merged)continue;if(n==="none"){delete r.borders;continue}const s=ke(t,a,i),d=s.r1===l.r1,u=s.r2===l.r2,f=s.c1===l.c1,m=s.c2===l.c2,y={...r.borders??{}};n==="all"?(y.top={...o},y.bottom={...o},y.left={...o},y.right={...o}):n==="outer"?(d&&(y.top={...o}),u&&(y.bottom={...o}),f&&(y.left={...o}),m&&(y.right={...o})):n==="inner"&&(d||(y.top={...o}),u||(y.bottom={...o}),f||(y.left={...o}),m||(y.right={...o})),r.borders=y}}const dn="1px dashed rgba(0,0,0,0.18)";function Le(t,l={}){return t&&t.style!=="none"?`${t.width}pt ${t.style} ${t.color}`:l.designMode&&l.showGhostBorder!==!1?dn:"none"}function Re(t){const l=(t.tableColWidths??[]).reduce((o,a)=>o+a,0),n=(t.tableRows??[]).reduce((o,a)=>o+a.height,0);t.width=Math.round(l*100)/100,t.height=Math.round(n*100)/100}const ft=5;function cn(t,l,n,o){const a=t.reduce((s,d,u)=>u===l?s:s+d,0),i=o===1/0?1/0:Math.max(ft,o-a),r=Math.round(n*10)/10;return Math.min(Math.max(r,ft),i)}function Ne(){return`el-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function un(t){const l={left:7,top:17.6,width:42.3,height:7.1};switch(t){case"text":return{...l,formatter:"文本",fontSize:12,textAlign:"left",height:5.3};case"image":return{...l,width:28.2,height:28.2,fit:"contain"};case"longText":return{...l,width:141.1,height:28.2,fontSize:12,lineHeight:18};case"table":{const{rows:n,colWidths:o}=on(),a=o.reduce((r,s)=>r+s,0),i=n.reduce((r,s)=>r+s.height,0);return{...l,width:a,height:i,tableMode:"dynamic",tableRows:n,tableColWidths:o,tableDefaultFontSize:10,tableDefaultColor:"#333333",tableDefaultPadding:1,fields:[],tablePagination:{enabled:!0}}}case"hline":return{...l,width:70.6,height:1.8,borderWidth:.75};case"vline":return{...l,width:1.8,height:35.3,borderWidth:.75};case"rect":return{...l,width:28.2,height:28.2,borderWidth:1,borderColor:"#333"};case"oval":return{...l,width:28.2,height:28.2,borderWidth:1,borderColor:"#333"};case"barcode":return{...l,width:56.4,height:14.1,title:"条形码",barcodeType:"code128",testData:"12345678"};case"qrcode":return{...l,width:28.2,height:28.2,title:"二维码",testData:"qrcode"};case"html":return{...l,width:28.2,height:28.2};default:return l}}function Bt(t,l){const n={text:{title:"文本"},image:{title:"图片"},longText:{title:"长文"},table:{title:"表格"},hline:{title:"横线"},vline:{title:"竖线"},rect:{title:"矩形"},oval:{title:"椭圆"},barcode:{title:"条形码"},qrcode:{title:"二维码"},html:{title:"HTML"},pageNumber:{title:"页码"}};return{id:Ne(),options:{...un(t),...l},printElementType:{type:t,title:n[t]?.title||t}}}const it=new ce.TemplateEngine;function xt(){return fe}const fe={supplier:{name:"鑫达五金有限公司",phone:"0571-88776655",address:"杭州市萧山区经济开发区88号"},receiver:{name:"李四",phone:"13912345678",address:"杭州市余杭区文一西路998号"},order:{no:"PO20260801001",date:"2026-08-01",total:69543.75},goods:[{name:"碳钢螺丝 M8",spec:"M14×10",unit:"个",qty:100,price:.5,amount:50,remark:"A级"},{name:"不锈钢螺母 M10",spec:"M16×11",unit:"套",qty:117,price:.75,amount:87.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×12",unit:"盒",qty:134,price:1,amount:134,remark:""},{name:"六角螺栓 M14",spec:"M5×13",unit:"支",qty:151,price:1.25,amount:188.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×14",unit:"袋",qty:168,price:1.5,amount:252,remark:""},{name:"平垫圈 M6",spec:"M4×15",unit:"件",qty:185,price:1.75,amount:323.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×16",unit:"根",qty:202,price:2,amount:404,remark:""},{name:"双头螺柱 M20",spec:"M8×17",unit:"包",qty:219,price:2.25,amount:492.75,remark:"A级"},{name:"紧定螺钉 M4",spec:"M10×18",unit:"只",qty:236,price:2.5,amount:590,remark:""},{name:"十字盘头钉 M3",spec:"M12×19",unit:"组",qty:253,price:2.75,amount:695.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×20",unit:"个",qty:270,price:3,amount:810,remark:""},{name:"不锈钢螺母 M10",spec:"M16×21",unit:"套",qty:287,price:3.25,amount:932.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×22",unit:"盒",qty:304,price:3.5,amount:1064,remark:""},{name:"六角螺栓 M14",spec:"M5×23",unit:"支",qty:321,price:3.75,amount:1203.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×24",unit:"袋",qty:338,price:4,amount:1352,remark:"A级"},{name:"平垫圈 M6",spec:"M4×25",unit:"件",qty:355,price:4.25,amount:1508.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×26",unit:"根",qty:372,price:4.5,amount:1674,remark:""},{name:"双头螺柱 M20",spec:"M8×27",unit:"包",qty:389,price:4.75,amount:1847.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×28",unit:"只",qty:406,price:5,amount:2030,remark:""},{name:"十字盘头钉 M3",spec:"M12×29",unit:"组",qty:423,price:5.25,amount:2220.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×30",unit:"个",qty:440,price:.5,amount:220,remark:""},{name:"不锈钢螺母 M10",spec:"M16×31",unit:"套",qty:457,price:.75,amount:342.75,remark:"A级"},{name:"弹簧垫圈 M12",spec:"M6×32",unit:"盒",qty:474,price:1,amount:474,remark:""},{name:"六角螺栓 M14",spec:"M5×33",unit:"支",qty:491,price:1.25,amount:613.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×34",unit:"袋",qty:508,price:1.5,amount:762,remark:""},{name:"平垫圈 M6",spec:"M4×35",unit:"件",qty:525,price:1.75,amount:918.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×36",unit:"根",qty:542,price:2,amount:1084,remark:""},{name:"双头螺柱 M20",spec:"M8×37",unit:"包",qty:559,price:2.25,amount:1257.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×38",unit:"只",qty:576,price:2.5,amount:1440,remark:"A级"},{name:"十字盘头钉 M3",spec:"M12×39",unit:"组",qty:593,price:2.75,amount:1630.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×40",unit:"个",qty:610,price:3,amount:1830,remark:""},{name:"不锈钢螺母 M10",spec:"M16×41",unit:"套",qty:627,price:3.25,amount:2037.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×42",unit:"盒",qty:644,price:3.5,amount:2254,remark:""},{name:"六角螺栓 M14",spec:"M5×43",unit:"支",qty:661,price:3.75,amount:2478.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×44",unit:"袋",qty:678,price:4,amount:2712,remark:""},{name:"平垫圈 M6",spec:"M4×45",unit:"件",qty:695,price:4.25,amount:2953.75,remark:"A级"},{name:"自攻螺钉 M5",spec:"M3×46",unit:"根",qty:712,price:4.5,amount:3204,remark:""},{name:"双头螺柱 M20",spec:"M8×47",unit:"包",qty:729,price:4.75,amount:3462.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×48",unit:"只",qty:746,price:5,amount:3730,remark:""},{name:"十字盘头钉 M3",spec:"M12×49",unit:"组",qty:763,price:5.25,amount:4005.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×10",unit:"个",qty:780,price:.5,amount:390,remark:""},{name:"不锈钢螺母 M10",spec:"M16×11",unit:"套",qty:797,price:.75,amount:597.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×12",unit:"盒",qty:814,price:1,amount:814,remark:"A级"},{name:"六角螺栓 M14",spec:"M5×13",unit:"支",qty:831,price:1.25,amount:1038.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×14",unit:"袋",qty:848,price:1.5,amount:1272,remark:""},{name:"平垫圈 M6",spec:"M4×15",unit:"件",qty:865,price:1.75,amount:1513.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×16",unit:"根",qty:882,price:2,amount:1764,remark:""},{name:"双头螺柱 M20",spec:"M8×17",unit:"包",qty:899,price:2.25,amount:2022.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×18",unit:"只",qty:916,price:2.5,amount:2290,remark:""},{name:"十字盘头钉 M3",spec:"M12×19",unit:"组",qty:933,price:2.75,amount:2565.75,remark:"A级"}]},mn={MONEY:ce.formatMoney,CONCAT:(...t)=>t.filter(l=>l!=null).join(""),IF:ce.ifFn,FORMAT:t=>typeof t!="number"?String(t):t.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2}),SUBSTR:(t,l,n)=>String(t).slice(l,n?l+n:void 0),LEN:t=>String(t).length,ROUND:(t,l)=>Number(Number(t).toFixed(l)),NOW:()=>new Date().toISOString().split("T")[0],IFEMPTY:(t,l)=>t!=null&&t!==""?String(t):l,PAD:(t,l,n)=>String(t).padStart(l,n),REPLACE:(t,l,n)=>String(t).replace(new RegExp(l,"g"),n),JSON:t=>JSON.stringify(t,null,2),DATE:ce.formatDate,UPPER:ce.toUpperCaseAmount};for(const[t,l]of Object.entries(mn))it.registerFunction(t,l);function pn(t,l,n){switch(t.toUpperCase()){case"SUM":return ce.sum(n,l);case"AVG":return ce.avg(n,l);case"COUNT":return ce.count(n,l);case"MIN":return ce.min(n,l);case"MAX":return ce.max(n,l);default:return 0}}function Ce(t,l){if(!t)return"";if(!t.includes("{"))return t;const n=Array.isArray(l.rows)?l.rows:[];let o=t.replace(/\{([^}]+)\}/g,(a,i)=>{let r=i.trim();return r=r.replace(/\b(SUM|AVG|COUNT|MIN|MAX)\(([^)]+)\)/g,(s,d,u)=>{const f=u.trim().replace(/^['"]|['"]$/g,"");return String(pn(d,f,n))}),`{${r}}`});try{return it.render(o,l)}catch{return t}}function fn(t){return Bt("text",{formatter:`{${t.fieldKey}}`,title:t.fieldLabel})}function Ue(t,l){if(t.formatter){if(!l||l.length===0)return"";const n=l[0];try{return it.render(t.formatter,n??{})}catch{return t.formatter}}return""}function vt(t){let l=fe;for(const n of t.split(".")){if(l==null)return;l=Array.isArray(l)?l[0]?.[n]:l[n]}return l}function vn(t,l){const n=l?.[0];return(t??"").replace(/\{([^{}]+)\}/g,(a,i)=>{const r=i.trim(),s=r.includes(".")?vt(r):n?.[r]??vt(r);return s==null?"":String(s)}).trim()||"1234567890128"}function gn(t){return t/2.83464566929}function Pe(t){return t*(25.4/96)}const hn=["left","top","width","height"];function bn(t){const l={...t.options};for(const n of hn){const o=l[n];typeof o=="number"&&Number.isFinite(o)&&(l[n]=yn(gn(o)))}return{...t,options:l}}function yn(t){return Math.round(t*100)/100}function kn(t){if(t.unit==="mm")return t;const l=n=>n?.map(bn)??[];return{...t,unit:"mm",elements:l(t.elements),header:t.header?{...t.header,elements:l(t.header.elements)}:t.header,footer:t.footer?{...t.footer,elements:l(t.footer.elements)}:t.footer,firstPageOverlay:t.firstPageOverlay?{...t.firstPageOverlay,elements:l(t.firstPageOverlay.elements)}:t.firstPageOverlay}}const Qe={A4:{width:210,height:297},A3:{width:297,height:420},A5:{width:148,height:210},Letter:{width:216,height:279},Legal:{width:216,height:356}};function Se(t){let l;return t.paperSize==="CUSTOM"?l={width:t.customWidth??210,height:t.customHeight??297}:l=Qe[t.paperSize]||Qe.A4,t.orientation==="landscape"?{width:l.height,height:l.width}:l}function En(t,l,n,o,a=.9){if(n<=0||o<=0)return 100;const i=Math.min(t/n,l/o)*a,r=Math.round(i*100);return Math.min(200,Math.max(50,r))}const Dt=["text","image","hline","vline","rect","oval","barcode","qrcode"];function wn(t){return Se(t)}function Fe(t){const l=wn(t),n=t.margins,o=t.header.height,a=t.footer.height,i=l.width-n.left-n.right,r=l.height-n.top-n.bottom-o-a,s=(d,u,f,m)=>({left:d,top:u,width:f,height:m});return{header:s(n.left,n.top,i,o),content:s(n.left,n.top+o,i,r),footer:s(n.left,l.height-n.bottom-a,i,a)}}function Tt(t,l,n){const o=Fe(t);return o.footer.height>0&&n>=o.footer.top?"footer":o.header.height>0&&n<o.header.top+o.header.height?"header":"content"}function _e(t,l){const n=t.options;n.width=Math.min(n.width,l.width),n.height=Math.min(n.height,l.height),n.left=Math.min(Math.max(0,n.left),l.width-n.width),n.top=Math.min(Math.max(0,n.top),l.height-n.height)}function Vn(t,l){const n=Fe(l),o=t.zone||"content",a=n[o],i=a.left+t.options.left+t.options.width/2,r=a.top+t.options.top+t.options.height/2;let s=Tt(l,i,r),d=!1;if(s!=="content"&&!Dt.includes(t.printElementType.type)&&(s="content",d=!0),s!==o){const u=n[s];t.options.left=a.left+t.options.left-u.left,t.options.top=a.top+t.options.top-u.top,t.zone=s}return s!=="content"?_e(t,n[s]):d&&_e(t,n.content),{rejected:d}}const zt=Symbol("selected-ids"),Lt=Symbol("preview-ids");function Nn(t){const l=e.ref(new Set),n=e.ref(new Set),o=e.computed(()=>t.value.filter(y=>l.value.has(y.id))),a=e.computed(()=>l.value.size>0);function i(y,B=!1){if(B){const z=new Set(l.value);z.has(y)?z.delete(y):z.add(y),l.value=z}else l.value=new Set([y])}function r(){l.value=new Set}function s(y){l.value=new Set(y)}function d(y){n.value=new Set(y)}function u(){n.value=new Set}function f(){l.value=new Set(n.value),n.value=new Set}function m(){const y=o.value;if(y.length===0)return null;let B=1/0,z=1/0,E=-1/0,V=-1/0;return y.forEach(A=>{B=Math.min(B,A.options.left),z=Math.min(z,A.options.top),E=Math.max(E,A.options.left+A.options.width),V=Math.max(V,A.options.top+A.options.height)}),{left:B,top:z,width:E-B,height:V-z}}return{selectedIds:l,selectedElements:o,hasSelection:a,select:i,clearSelection:r,selectAll:s,getSelectionBounds:m,previewIds:n,setPreview:d,clearPreview:u,commitPreview:f}}function Cn(){const t=e.ref(null);function l(a){t.value=a.map(i=>({options:{...i.options},printElementType:{...i.printElementType}}))}function n(a=10){return t.value?t.value.map(i=>({id:Ne(),options:{...i.options,left:i.options.left+a,top:i.options.top+a},printElementType:{...i.printElementType}})):null}function o(){return t.value!==null&&t.value.length>0}return{clipboard:t,copy:l,paste:n,hasData:o}}function Sn(){function t(l,n){if(l.length<2)return;const o={minLeft:Math.min(...l.map(a=>a.options.left)),maxRight:Math.max(...l.map(a=>a.options.left+a.options.width)),minTop:Math.min(...l.map(a=>a.options.top)),maxBottom:Math.max(...l.map(a=>a.options.top+a.options.height))};switch(n){case"left":l.forEach(a=>{a.options.left=o.minLeft});break;case"right":l.forEach(a=>{a.options.left=o.maxRight-a.options.width});break;case"top":l.forEach(a=>{a.options.top=o.minTop});break;case"bottom":l.forEach(a=>{a.options.top=o.maxBottom-a.options.height});break;case"vertical":{const a=o.minLeft+(o.maxRight-o.minLeft)/2;l.forEach(i=>{i.options.left=a-i.options.width/2});break}case"horizontal":{const a=o.minTop+(o.maxBottom-o.minTop)/2;l.forEach(i=>{i.options.top=a-i.options.height/2});break}case"distributeHor":{const a=[...l].sort((d,u)=>d.options.left-u.options.left),i=a.reduce((d,u)=>d+u.options.width,0),r=(o.maxRight-o.minLeft-i)/(a.length-1);let s=o.minLeft;a.forEach(d=>{d.options.left=s,s+=d.options.width+r});break}case"distributeVer":{const a=[...l].sort((d,u)=>d.options.top-u.options.top),i=a.reduce((d,u)=>d+u.options.height,0),r=(o.maxBottom-o.minTop-i)/(a.length-1);let s=o.minTop;a.forEach(d=>{d.options.top=s,s+=d.options.height+r});break}}}return{align:t}}function $n(){return`grp-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function Mn(){function t(o,a){if(o.filter(s=>a.has(s.id)).length<2)return o;const r=$n();return o.map(s=>a.has(s.id)?{...s,options:{...s.options,groupId:r}}:s)}function l(o,a){const i=o.filter(s=>a.has(s.id)),r=new Set(i.map(s=>s.options.groupId).filter(Boolean));return o.map(s=>s.options.groupId&&r.has(s.options.groupId)?{...s,options:{...s.options,groupId:void 0}}:s)}function n(o,a){const i=o.find(s=>s.id===a);if(!i?.options.groupId)return new Set([a]);const r=new Set;for(const s of o)s.options.groupId===i.options.groupId&&r.add(s.id);return r}return{group:t,ungroup:l,getGroupedIds:n}}function Bn(t){const n=e.ref([]),o=e.ref([]),a=e.ref(!1),i=e.ref(!1);function r(){a.value=n.value.length>0,i.value=o.value.length>0}function s(B){return{elements:JSON.parse(JSON.stringify(B?.elements??[])),templateData:JSON.parse(JSON.stringify(B?.templateData??{}))}}function d(B){return s(B)}function u(B){n.value.push(d(B)),o.value=[],n.value.length>50&&n.value.shift(),r()}function f(B){if(n.value.length===0)return null;const z=n.value.pop();return o.value.push(B?d(B):s(z)),r(),n.value.length>0?s(n.value[n.value.length-1]):null}function m(B){if(o.value.length===0)return null;const z=o.value.pop();return n.value.push(B?d(B):s(z)),r(),s(z)}function y(){n.value=[],o.value=[],r()}return{push:u,undo:f,redo:m,canUndo:a,canRedo:i,clear:y}}const xn=1,Dn=10,Tn=.5;function zn(t){function l(a){const i=a.target.tagName;if(i==="INPUT"||i==="TEXTAREA"||i==="SELECT")return;const r=a.ctrlKey||a.metaKey;if(a.key.startsWith("Arrow")){a.preventDefault();const s=a.shiftKey?Dn:a.ctrlKey?Tn:xn,d=a.key==="ArrowLeft"?-s:a.key==="ArrowRight"?s:0,u=a.key==="ArrowUp"?-s:a.key==="ArrowDown"?s:0;t.onMove?.(d,u);return}if(a.key==="Delete"||a.key==="Backspace"){a.preventDefault(),t.onDelete?.();return}if(r){const s=a.key.toLowerCase();s==="c"?(a.preventDefault(),t.onCopy?.()):s==="v"?(a.preventDefault(),t.onPaste?.()):s==="a"?(a.preventDefault(),t.onSelectAll?.()):s==="d"?(a.preventDefault(),t.onDuplicate?.()):s==="z"?(a.preventDefault(),a.shiftKey?t.onRedo?.():t.onUndo?.()):s==="y"?(a.preventDefault(),t.onRedo?.()):s==="1"?(a.preventDefault(),t.onResetZoom?.()):s==="l"?(a.preventDefault(),t.onAlignLeft?.()):s==="r"?(a.preventDefault(),t.onAlignRight?.()):s==="e"?(a.preventDefault(),t.onAlignCenterH?.()):s==="t"?(a.preventDefault(),t.onAlignTop?.()):s==="b"?(a.preventDefault(),t.onAlignBottom?.()):s==="g"&&(a.preventDefault(),a.shiftKey?t.onUngroup?.():t.onGroup?.())}}function n(){document.addEventListener("keydown",l)}function o(){document.removeEventListener("keydown",l)}return{setup:n,cleanup:o}}function Pt(){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 et(t){const l=(n,o)=>(n??[]).map(a=>{const i={...a.options};return(a.printElementType?.type??a.type)==="table"&&Re(i),{id:a.id||Ne(),zone:o,options:i,printElementType:{...a.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:[...l(t.elements??[],"content"),...l(t.header?.elements??[],"header"),...l(t.footer?.elements??[],"footer")]}}function Ln(t={}){const l=e.ref(100),n=e.ref(!0),o=e.ref(!1),a=e.ref(!0),i=e.ref(et(t.initialTemplate||Pt())),r=e.computed({get:()=>i.value.elements,set:F=>{i.value.elements=F}}),s=e.ref(t.initialFields||[]),{selectedIds:d,selectedElements:u,select:f,clearSelection:m,selectAll:y,previewIds:B,setPreview:z,clearPreview:E,commitPreview:V}=Nn(r),{group:A,ungroup:H}=Mn(),{copy:W,paste:L,hasData:G}=Cn(),{align:Y}=Sn(),{push:J,undo:P,redo:v,canUndo:g,canRedo:M}=Bn(),x=e.computed(()=>{if(d.value.size===0)return null;const F=d.value.values().next().value;return r.value.find(Q=>Q.id===F)||null}),c=e.ref(null);function h(F){c.value=F}function T(){return{elements:r.value.map(F=>({id:F.id,zone:F.zone,options:JSON.parse(JSON.stringify(F.options)),printElementType:{...F.printElementType}})),templateData:{paperSize:i.value.paperSize,orientation:i.value.orientation,margins:{...i.value.margins},header:{height:i.value.header.height,elements:[]},footer:{height:i.value.footer.height,elements:[]},firstPageOverlay:{height:i.value.firstPageOverlay.height,elements:[]},elements:[],customWidth:i.value.customWidth,customHeight:i.value.customHeight,watermark:i.value.watermark?{...i.value.watermark}:void 0,guides:[...i.value.guides??[]]}}}function O(){J(T())}function X(){const F=P(T());F?.templateData&&(i.value={...F.templateData,elements:F.elements})}function oe(){const F=v(T());F?.templateData&&(i.value={...F.templateData,elements:F.elements})}function ie(){W(u.value)}function re(){W(u.value),k()}function se(){const F=L();F&&F.length>0&&(r.value.push(...F),O())}function ae(){W(u.value);const F=L();F&&F.length>0&&(F.forEach(Q=>{Q.options.left+=5,Q.options.top+=5}),r.value.push(...F),f(F[0].id,!1),O())}function p(){l.value=100}const b=e.computed(()=>G());let N=!1,S=null;const U=300;function K(F,Q){const j=u.value.filter(ee=>!ee.options.locked);j.length!==0&&(j.forEach(ee=>{ee.options.left+=F,ee.options.top+=Q}),N||(N=!0,O()),S&&clearTimeout(S),S=setTimeout(()=>{N=!1,S=null},U))}function C(){y(r.value.map(F=>F.id))}function $(F){Y(u.value,F),O()}function D(){r.value=A(r.value,d.value),O()}function w(){r.value=H(r.value,d.value),O()}function k(){d.value.size!==0&&(r.value=r.value.filter(F=>!d.value.has(F.id)),m(),O())}const{setup:q,cleanup:Z}=zn({onMove:K,onDelete:k,onCopy:ie,onPaste:se,onSelectAll:C,onUndo:X,onRedo:oe,onDuplicate:ae,onResetZoom:p,onAlignLeft:()=>$("left"),onAlignRight:()=>$("right"),onAlignCenterH:()=>$("vertical"),onAlignTop:()=>$("top"),onAlignBottom:()=>$("bottom"),onGroup:D,onUngroup:w});let de=null;function pe(){de=T()}function be(){if(!de)return;const F=new Map(de.elements.map(le=>[le.id,le]));let Q=!1;for(const le of r.value){const ue=F.get(le.id);if(!ue)continue;(ue.options.left!==le.options.left||ue.options.top!==le.options.top||ue.options.width!==le.options.width||ue.options.height!==le.options.height)&&Vn(le,i.value).rejected&&(Q=!0)}Q&&alert("该元素类型不能放入页眉/页脚");const j=le=>`${le.id}:${le.zone||"content"}:${le.options.left},${le.options.top},${le.options.width},${le.options.height}`,ee=de.elements.map(j).join("|"),ve=T().elements.map(j).join("|");de=null,ee!==ve&&O()}function $e(F,Q){const j=Tt(i.value,Q.x,Q.y);if(j!=="content"&&!Dt.includes(F.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const ee=Fe(i.value)[j];return F.zone=j,F.options.left=Q.x-ee.left,F.options.top=Q.y-ee.top,j!=="content"&&_e(F,ee),!0}function ye(F,Q){const j=Bt(F);Q&&!$e(j,Q)||(r.value.push(j),f(j.id,!1),O())}function Ee(F,Q){const j=fn(F);Q&&!$e(j,Q)||(r.value.push(j),f(j.id,!1),O())}function He(F){if(d.value.size===0)return;const Q=d.value.values().next().value,j=r.value.find(we=>we.id===Q);if(!j)return;const ee=j.options.zIndex??0,ve=r.value.map(we=>we.options.zIndex??0),le=Math.max(...ve,0),ue=Math.min(...ve,0);switch(F){case"top":j.options.zIndex=le+1;break;case"bottom":j.options.zIndex=ue-1;break;case"up":j.options.zIndex=ee+1;break;case"down":j.options.zIndex=ee-1;break}O()}function Oe(F,Q){const{width:j,height:ee}=Se(i.value),ve=96/25.4;l.value=En(F,Q,j*ve,ee*ve)}function De(F){i.value={...F},O()}function Ge(){const F=r.value,Q=j=>F.filter(ee=>(ee.zone||"content")===j).map(ee=>({id:ee.id,type:ee.printElementType.type,options:{...ee.options},printElementType:{...ee.printElementType}}));return{unit:"mm",...i.value,header:{...i.value.header,elements:Q("header")},footer:{...i.value.footer,elements:Q("footer")},firstPageOverlay:{...i.value.firstPageOverlay,elements:i.value.firstPageOverlay.elements.map(j=>({id:j.id||Ne(),type:j.printElementType?.type||"text",options:{...j.options},printElementType:{...j.printElementType}}))},elements:Q("content"),guides:[...i.value.guides??[]]}}function qe(F,Q){const j=kn(F);i.value=et(j),Q&&(i.value={...i.value,elements:Q.map(ee=>({...ee,id:ee.id||Ne(),zone:ee.zone||"content",options:{...ee.options},printElementType:{...ee.printElementType}}))}),J(T())}return J(T()),e.onMounted(()=>q()),e.onUnmounted(()=>{Z(),S&&(clearTimeout(S),S=null)}),{scale:l,showGrid:n,snapToGrid:o,showTableGhostBorder:a,templateData:i,elements:r,fields:s,selectedIds:d,selectedElements:u,selectedElement:x,select:f,clearSelection:m,selectAll:C,previewIds:B,setPreview:z,clearPreview:E,commitPreview:V,hasClipboard:b,copy:ie,paste:se,cutSelected:re,tableSelection:c,setTableSelection:h,canUndo:g,canRedo:M,undo:X,redo:oe,recordHistory:O,alignSelected:$,groupSelected:D,ungroupSelected:w,deleteSelected:k,duplicateSelected:ae,resetZoom:p,dragStart:pe,dragStop:be,addElement:ye,addFieldElement:Ee,moveLayer:He,fitToWindow:Oe,updateTemplateData:De,getTemplateJson:Ge,loadTemplate:qe}}let gt=0;function Pn(){return gt+=1,`guide-${gt}`}function In(t,l){const n=e.computed(()=>t.value.guides??[]);function o(d){t.value={...t.value,guides:d([...t.value.guides??[]])},l()}function a(d,u){o(f=>(f.push({type:d,position:u,id:Pn()}),f))}function i(d,u){o(f=>f.map(m=>m.id===d?{...m,position:u}:m))}function r(d){o(u=>u.filter(f=>f.id!==d))}function s(){const d=[],u=[];for(const f of n.value)f.type==="vertical"?d.push(f.position):u.push(f.position);return{vertical:d,horizontal:u}}return{guides:n,addGuide:a,moveGuide:i,removeGuide:r,getGuidePositions:s}}const xe=Symbol("table-edit"),rt=Symbol("print-upload-image"),An={class:"designer-toolbar"},Rn={class:"tb-group"},Un={class:"tb-title"},Fn={class:"tb-title-name"},Hn={class:"tb-group"},On=["disabled"],Gn=["disabled"],qn={key:0,class:"tb-group"},Wn={key:1,class:"tb-group"},Kn={key:2,class:"tb-group"},Yn={key:3,class:"tb-group"},Xn={class:"tb-group"},jn={class:"tb-zoom"},Jn={class:"tb-group"},Zn={class:"tb-group"},Qn=e.defineComponent({__name:"DesignerToolbar",props:e.mergeModels({isEdit:{type:Boolean},canUndo:{type:Boolean},canRedo:{type:Boolean},hasMultiSelection:{type:Boolean},hasSelection:{type:Boolean},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},selectedElementHasGroup:{type:Boolean},overlayVisible:{type:Boolean},showLoadDefault:{type:Boolean}},{scale:{default:100},scaleModifiers:{}}),emits:e.mergeModels(["preview","save","load-default","undo","redo","align","move-layer","toggle-grid","toggle-snap","toggle-table-ghost-border","toggle-overlay","group","ungroup","add-overlay-element","fit-window","zoom"],["update:scale"]),setup(t){const l=e.useModel(t,"scale");return(n,o)=>(e.openBlock(),e.createElementBlock("div",An,[e.createElementVNode("div",Rn,[o[28]||(o[28]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-76b4f0cc><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-76b4f0cc><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-76b4f0cc></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-76b4f0cc></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-76b4f0cc></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-76b4f0cc></line></svg></span>',1)),e.createElementVNode("div",Un,[e.createElementVNode("span",Fn,e.toDisplayString(t.isEdit?"编辑模板":"新建模板"),1),o[27]||(o[27]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",Hn,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canUndo,onClick:o[0]||(o[0]=a=>n.$emit("undo")),title:"撤销"},"↶",8,On),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canRedo,onClick:o[1]||(o[1]=a=>n.$emit("redo")),title:"重做"},"↷",8,Gn)]),t.hasMultiSelection?(e.openBlock(),e.createElementBlock("div",qn,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[2]||(o[2]=a=>n.$emit("align","left")),title:"左对齐"},"⇤"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[3]||(o[3]=a=>n.$emit("align","right")),title:"右对齐"},"⇥"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[4]||(o[4]=a=>n.$emit("align","top")),title:"顶对齐"},"⇡"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[5]||(o[5]=a=>n.$emit("align","bottom")),title:"底对齐"},"⇣"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[6]||(o[6]=a=>n.$emit("align","vertical")),title:"水平居中"},"↔"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[7]||(o[7]=a=>n.$emit("align","horizontal")),title:"垂直居中"},"↕"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[8]||(o[8]=a=>n.$emit("align","distributeHor")),title:"水平分布"},"⇔"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[9]||(o[9]=a=>n.$emit("align","distributeVer")),title:"垂直分布"},"⇕")])):e.createCommentVNode("",!0),t.hasMultiSelection?(e.openBlock(),e.createElementBlock("div",Wn,[e.createElementVNode("button",{class:"tb-btn",onClick:o[10]||(o[10]=a=>n.$emit("group")),title:"组合"},"组合")])):e.createCommentVNode("",!0),!t.hasMultiSelection&&t.selectedElementHasGroup?(e.openBlock(),e.createElementBlock("div",Kn,[e.createElementVNode("button",{class:"tb-btn",onClick:o[11]||(o[11]=a=>n.$emit("ungroup")),title:"取消组合"},"取消组合")])):e.createCommentVNode("",!0),t.hasSelection?(e.openBlock(),e.createElementBlock("div",Yn,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[12]||(o[12]=a=>n.$emit("move-layer","top")),"data-tip":"置顶"},"⤒"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[13]||(o[13]=a=>n.$emit("move-layer","up")),"data-tip":"上移一层"},"↑"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[14]||(o[14]=a=>n.$emit("move-layer","down")),"data-tip":"下移一层"},"↓"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[15]||(o[15]=a=>n.$emit("move-layer","bottom")),"data-tip":"置底"},"⤓")])):e.createCommentVNode("",!0),e.createElementVNode("div",Xn,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:t.showGrid}]),onClick:o[16]||(o[16]=a=>n.$emit("toggle-grid"))},[...o[29]||(o[29]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:t.showTableGhostBorder}]),title:"显示/隐藏无边框表格的虚拟虚线",onClick:o[17]||(o[17]=a=>n.$emit("toggle-table-ghost-border"))},[...o[30]||(o[30]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:t.snapToGrid}]),onClick:o[18]||(o[18]=a=>n.$emit("toggle-snap"))},[...o[31]||(o[31]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[19]||(o[19]=a=>n.$emit("fit-window")),title:"适应窗口"},"⤢"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[20]||(o[20]=a=>n.$emit("zoom",-10)),title:"缩小"},"−"),e.createElementVNode("span",jn,e.toDisplayString(l.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:o[21]||(o[21]=a=>n.$emit("zoom",10)),title:"放大"},"+")]),o[32]||(o[32]=e.createElementVNode("div",{class:"tb-spacer"},null,-1)),e.createElementVNode("div",Jn,[e.createElementVNode("button",{class:"tb-btn",onClick:o[22]||(o[22]=a=>n.$emit("add-overlay-element"))},"首页专属"),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{warn:t.overlayVisible}]),onClick:o[23]||(o[23]=a=>n.$emit("toggle-overlay"))},"叠层对比",2)]),e.createElementVNode("div",Zn,[t.showLoadDefault?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn-secondary",onClick:o[24]||(o[24]=a=>n.$emit("load-default"))},"加载默认布局")):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"btn-secondary",onClick:o[25]||(o[25]=a=>n.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary",onClick:o[26]||(o[26]=a=>n.$emit("save"))},"保存")])]))}}),_=(t,l)=>{const n=t.__vccOpts||t;for(const[o,a]of l)n[o]=a;return n},_n=_(Qn,[["__scopeId","data-v-76b4f0cc"]]),eo={class:"layer-panel"},to=["onClick"],no={class:"layer-icon"},oo={class:"layer-name"},lo={key:0,class:"layer-zone"},ao={class:"layer-zindex"},io={key:0,class:"layer-actions"},ro=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer"],setup(t){const l=t,n=e.computed(()=>[...l.elements].sort((s,d)=>(d.options.zIndex??0)-(s.options.zIndex??0))),o={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function a(s){return o[s.printElementType.type]||"?"}function i(s){return s.options.title||s.printElementType.title||s.printElementType.type}function r(s){return s.zone==="header"?"页眉":s.zone==="footer"?"页脚":""}return(s,d)=>(e.openBlock(),e.createElementBlock("div",eo,[d[4]||(d[4]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:e.normalizeClass(["layer-item",{active:t.selectedIds.has(u.id)}]),onClick:f=>s.$emit("select",u.id,!1)},[e.createElementVNode("span",no,e.toDisplayString(a(u)),1),e.createElementVNode("span",oo,e.toDisplayString(i(u)),1),r(u)?(e.openBlock(),e.createElementBlock("span",lo,e.toDisplayString(r(u)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",ao,"z:"+e.toDisplayString(u.options.zIndex??0),1)],10,to))),128)),n.value.length>0?(e.openBlock(),e.createElementBlock("div",io,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:d[0]||(d[0]=u=>s.$emit("move-layer","top")),title:"置顶"}," ⤒ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:d[1]||(d[1]=u=>s.$emit("move-layer","up")),title:"上移"}," ↑ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:d[2]||(d[2]=u=>s.$emit("move-layer","down")),title:"下移"}," ↓ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:d[3]||(d[3]=u=>s.$emit("move-layer","bottom")),title:"置底"}," ⤓ ")])):e.createCommentVNode("",!0)]))}}),so=_(ro,[["__scopeId","data-v-d091c3fa"]]);function It(t){const l=[...t].sort((r,s)=>(r.sortOrder??0)-(s.sortOrder??0)),n=new Map,o=[];for(const r of l){const s=r.fieldKey.indexOf(".");if(s===-1)continue;const d=r.fieldKey.slice(0,s);let u=n.get(d);u||(u={key:d,label:d,isList:!1,fields:[]},n.set(d,u),o.push(d)),u.fields.push(r)}const a=[],i=[];for(const r of l){if(r.fieldKey.includes("."))continue;const s=n.get(r.fieldKey);s?(s.label=r.fieldLabel,s.isList=r.fieldType==="list"):i.push(r)}i.length&&a.push({key:"",label:"",isList:!1,fields:i});for(const r of o)a.push(n.get(r));return a}function At(t,l){const n=l.trim().toLowerCase();return n?t.map(o=>({...o,fields:o.fields.filter(a=>a.fieldLabel.toLowerCase().includes(n)||a.fieldKey.toLowerCase().includes(n))})).filter(o=>o.fields.length>0):t}const co={class:"field-tree-panel"},uo={class:"tree-container"},mo=["onClick"],po={class:"expand-icon"},fo={class:"node-icon"},vo={class:"group-label"},go=["onDragstart"],ho={class:"node-label"},bo={class:"node-key"},yo={key:0,class:"pd-empty"},ko=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(t,{emit:l}){const n=t,o=l,a=e.ref(""),i=e.ref(new Set),r=e.computed(()=>!!a.value.trim()),s=e.computed(()=>At(It(n.fields),a.value));function d(f){const m=new Set(i.value);m.has(f)?m.delete(f):m.add(f),i.value=m}function u(f,m){f.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:m.fieldKey,fieldLabel:m.fieldLabel})),f.dataTransfer&&(f.dataTransfer.effectAllowed="copy"),o("field-drag",m)}return(f,m)=>(e.openBlock(),e.createElementBlock("div",co,[m[2]||(m[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":m[0]||(m[0]=y=>a.value=y),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,a.value]]),e.createElementVNode("div",uo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,y=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y.key||"_top"},[y.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["field-group-header",{"is-list":y.isList}]),onClick:B=>d(y.key)},[e.createElementVNode("span",po,e.toDisplayString(i.value.has(y.key)&&!r.value?"▶":"▼"),1),e.createElementVNode("span",fo,e.toDisplayString(y.isList?"📋":"📁"),1),e.createElementVNode("span",vo,e.toDisplayString(y.label),1)],10,mo)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.fields,B=>(e.openBlock(),e.createElementBlock("div",{key:B.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(y.key?22:8)+"px"}),onDragstart:z=>u(z,B)},[m[1]||(m[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",ho,e.toDisplayString(B.fieldLabel),1),e.createElementVNode("span",bo,"("+e.toDisplayString(B.fieldKey)+")",1)],44,go))),128))],512),[[e.vShow,!y.key||r.value||!i.value.has(y.key)]])],64))),128))]),s.value.length===0?(e.openBlock(),e.createElementBlock("p",yo,"暂无字段")):e.createCommentVNode("",!0)]))}}),Eo=_(ko,[["__scopeId","data-v-cc814de0"]]),wo={key:0,class:"left-collapsed"},Vo={class:"left-head"},No={class:"pd-tabs left-tabs"},Co={class:"pd-tab-bar",role:"tablist"},So={class:"pd-tab-pane",role:"tabpanel"},$o=["onDragstart"],Mo={class:"material-icon"},Bo={class:"material-label"},xo={class:"pd-tab-pane",role:"tabpanel"},Do={class:"pd-tab-pane",role:"tabpanel"},To=e.defineComponent({__name:"LeftPanel",props:{fields:{},elements:{},selectedIds:{},collapsed:{type:Boolean}},emits:["select","move-layer","toggle-visible","toggle-locked","field-drag","toggle-collapse"],setup(t,{emit:l}){const n=l,o=e.ref("elements"),a=[{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 i(d,u){d.dataTransfer?.setData("elementType",u)}function r(d){n("field-drag",d)}function s(d){o.value=d,n("toggle-collapse")}return(d,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",wo,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:u[0]||(u[0]=f=>s(o.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:o.value==="elements"}]),title:"元素",onClick:u[1]||(u[1]=f=>s("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:o.value==="fields"}]),title:"字段",onClick:u[2]||(u[2]=f=>s("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:o.value==="layers"}]),title:"图层",onClick:u[3]||(u[3]=f=>s("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Vo,[u[12]||(u[12]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:u[4]||(u[4]=f=>d.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",No,[e.createElementVNode("div",Co,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:o.value==="elements"}]),onClick:u[5]||(u[5]=f=>o.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:o.value==="fields"}]),onClick:u[6]||(u[6]=f=>o.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:o.value==="layers"}]),onClick:u[7]||(u[7]=f=>o.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",So,[u[13]||(u[13]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(a,f=>e.createElementVNode("div",{key:f.type,class:"material-card",draggable:"true",onDragstart:m=>i(m,f.type)},[e.createElementVNode("span",Mo,e.toDisplayString(f.icon),1),e.createElementVNode("span",Bo,e.toDisplayString(f.label),1)],40,$o)),64))],512),[[e.vShow,o.value==="elements"]]),e.withDirectives(e.createElementVNode("div",xo,[e.createVNode(Eo,{fields:t.fields,onFieldDrag:r},null,8,["fields"])],512),[[e.vShow,o.value==="fields"]]),e.withDirectives(e.createElementVNode("div",Do,[e.createVNode(so,{elements:t.elements,"selected-ids":t.selectedIds,onSelect:u[8]||(u[8]=(f,m)=>d.$emit("select",f,m)),onMoveLayer:u[9]||(u[9]=f=>d.$emit("move-layer",f)),onToggleVisible:u[10]||(u[10]=f=>d.$emit("toggle-visible",f)),onToggleLocked:u[11]||(u[11]=f=>d.$emit("toggle-locked",f))},null,8,["elements","selected-ids"])],512),[[e.vShow,o.value==="layers"]])])],64))],2))}}),zo=_(To,[["__scopeId","data-v-eb646f19"]]);function Lo(t,l){const n=e.ref(!1),o=e.ref(null);let a=0,i=0,r=0,s=0,d=!1;function u(E){if(l.disabled)return;const V=E.target;if(!(V instanceof HTMLElement)||V.classList.contains("resize-handle"))return;n.value=!0,d=E.altKey,a=E.clientX,i=E.clientY;const A=t.value;A&&(r=parseFloat(A.style.left)||0,s=parseFloat(A.style.top)||0,o.value={left:r,top:s,width:parseFloat(A.style.width)||0,height:parseFloat(A.style.height)||0},l.onStart?.({altKey:d}),document.addEventListener("mousemove",m),document.addEventListener("mouseup",y),E.preventDefault())}function f(E){const V=l.getScale?.()??1;let A=r+(E.clientX-a)/V,H=s+(E.clientY-i)/V;if(l.axis==="x"&&(H=s),l.axis==="y"&&(A=r),l.onAdsorb){const W=t.value;if(W){const L=parseFloat(W.style.width)||0,G=parseFloat(W.style.height)||0,Y=l.onAdsorb({left:A,top:H,width:L,height:G});A=Y.left,H=Y.top}}return{left:A,top:H}}function m(E){const V=f(E);o.value&&(o.value.left=V.left,o.value.top=V.top),l.onDrag(V)}function y(E){n.value=!1;const V=f(E);l.onDragEnd?.(V,{altKey:d}),l.onStop?.(),o.value=null,document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",y)}function B(){const E=t.value;E&&E.removeEventListener("mousedown",u),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",y)}function z(){B();const E=t.value;E&&E.addEventListener("mousedown",u)}return{isDragging:n,dragPreview:o,setup:z,cleanup:B}}const Po=["nw","n","ne","e","se","s","sw","w"];function Io(t,l,n,o,a,i){let{left:r,top:s,width:d,height:u}=l;switch(t){case"e":d=Math.max(a,l.width+n);break;case"w":d=Math.max(a,l.width-n),r=l.left+l.width-d;break;case"s":u=Math.max(i,l.height+o);break;case"n":u=Math.max(i,l.height-o),s=l.top+l.height-u;break;case"se":d=Math.max(a,l.width+n),u=Math.max(i,l.height+o);break;case"sw":d=Math.max(a,l.width-n),r=l.left+l.width-d,u=Math.max(i,l.height+o);break;case"ne":d=Math.max(a,l.width+n),u=Math.max(i,l.height-o),s=l.top+l.height-u;break;case"nw":d=Math.max(a,l.width-n),r=l.left+l.width-d,u=Math.max(i,l.height-o),s=l.top+l.height-u;break}return{left:r,top:s,width:d,height:u}}function Ao(t){let l=0,n=0,o={left:0,top:0,width:0,height:0},a=null;function i(u,f){a=u,l=f.clientX,n=f.clientY,o={...t.getRect()},t.onStart?.(),document.addEventListener("mousemove",r),document.addEventListener("mouseup",s),f.preventDefault()}function r(u){if(!a)return;const f=t.getScale?.()||1,m=(u.clientX-l)/f,y=(u.clientY-n)/f,B=t.minWidth||20,z=t.minHeight||20;t.onResize(Io(a,o,m,y,B,z))}function s(){a=null,t.onStop?.(),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s)}function d(){document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s)}return{startResize:i,cleanup:d}}function Ro(t,l){return l.split(".").reduce((n,o)=>n?.[o],t)}function Uo(){function t(l){const n=l.options.formatter,o=l.options.title;if(!n)return{status:"unbound",badge:o||"文本",badgeColor:"#909399",demoPreview:o||"文本"};const a=xt(),i=n.match(/\{([^}]+)\}/);if(i){const r=i[1],s=Ro(a,r);return{status:"bound",badge:`fx ${n}`,badgeColor:"#409EFF",demoPreview:s!=null?String(s):n}}return{status:"bound",badge:`fx ${n}`,badgeColor:"#409EFF",demoPreview:n}}return{getBindingDisplayState:t}}const Fo=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,n={top:"flex-start",middle:"center",bottom:"flex-end"},o={left:"flex-start",center:"center",right:"flex-end"},a=e.computed(()=>{const r=l.element.options;return{fontSize:(r.fontSize||12)+"pt",fontWeight:r.fontWeight||"normal",fontFamily:r.fontFamily||"inherit",color:r.color||"#333",backgroundColor:r.backgroundColor||"transparent",textAlign:r.textAlign||"left",lineHeight:r.lineHeight?r.lineHeight+"pt":"normal",letterSpacing:r.letterSpacing?r.letterSpacing+"pt":"normal",textDecoration:r.textDecoration||"none",padding:`${r.contentPaddingTop||0}pt ${r.contentPaddingRight||0}pt ${r.contentPaddingBottom||0}pt ${r.contentPaddingLeft||0}pt`,width:"100%",height:"100%",boxSizing:"border-box",overflow:"hidden",...r.verticalAlign?{display:"flex",alignItems:n[r.verticalAlign]??"flex-start",justifyContent:o[r.textAlign||"left"]??"flex-start"}:{}}}),i=e.computed(()=>l.designMode?l.element.options.testData?l.element.options.testData:l.element.options.formatter||"文本":Ue(l.element.options,l.data));return(r,s)=>(e.openBlock(),e.createElementBlock("div",{class:"print-text",style:e.normalizeStyle(a.value)},e.toDisplayString(i.value),5))}}),Ho={class:"print-image"},Oo=["src"],Go={key:1,class:"image-placeholder"},qo=e.defineComponent({__name:"ImageElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,n=e.computed(()=>{const r=l.element.options.src||"";return r?r.includes("{")?l.designMode?Ce(r,fe):Ce(r,l.data?.[0]||{}):r:""}),o=e.ref(!1);function a(){o.value=!0}e.watch(n,()=>{o.value=!1});const i=e.computed(()=>({objectFit:l.element.options.fit||"contain"}));return(r,s)=>(e.openBlock(),e.createElementBlock("div",Ho,[n.value&&!o.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.value,style:e.normalizeStyle(i.value),onError:a},null,44,Oo)):(e.openBlock(),e.createElementBlock("div",Go,"图片"))]))}}),Wo=_(qo,[["__scopeId","data-v-530ee54f"]]),Ko=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,n={top:"flex-start",middle:"center",bottom:"flex-end"},o={left:"flex-start",center:"center",right:"flex-end"},a=e.computed(()=>{const r=l.element.options;return{fontSize:(r.fontSize||12)+"pt",fontWeight:r.fontWeight||"normal",fontFamily:r.fontFamily||"inherit",color:r.color||"#333",backgroundColor:r.backgroundColor||"transparent",textAlign:r.textAlign||"left",lineHeight:r.lineHeight?r.lineHeight+"pt":"1.5",letterSpacing:r.letterSpacing?r.letterSpacing+"pt":"normal",textIndent:r.longTextIndent?r.longTextIndent+"pt":"0",width:"100%",height:"100%",overflow:"hidden",wordBreak:"break-all",boxSizing:"border-box",...r.verticalAlign?{display:"flex",alignItems:n[r.verticalAlign]??"flex-start",justifyContent:o[r.textAlign||"left"]??"flex-start"}:{}}}),i=e.computed(()=>l.designMode?l.element.options.formatter?l.element.options.formatter:"长文本内容":Ue(l.element.options,l.data));return(r,s)=>(e.openBlock(),e.createElementBlock("div",{class:"print-longtext",style:e.normalizeStyle(a.value)},e.toDisplayString(i.value),5))}}),Yo=["title"],Xo=["title","onClick"],jo=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:l}){const n=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],o=l;function a(i,r){o("action",i,r)}return(i,r)=>(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:r[8]||(r[8]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"menu-item",onClick:r[0]||(r[0]=s=>a("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:r[1]||(r[1]=s=>a("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteRow}]),onClick:r[2]||(r[2]=s=>t.canDeleteRow&&a("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]=s=>a("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:r[4]||(r[4]=s=>a("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteCol}]),onClick:r[5]||(r[5]=s=>t.canDeleteCol&&a("delete-col"))}," 删除列 ",2),r[10]||(r[10]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!!t.mergeDisabledReason}]),title:t.mergeDisabledReason||"",onClick:r[6]||(r[6]=s=>!t.mergeDisabledReason&&a("merge"))}," 合并单元格 ",10,Yo),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canSplit}]),onClick:r[7]||(r[7]=s=>t.canSplit&&a("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(n,s=>e.createElementVNode("div",{key:s.value,class:e.normalizeClass(["menu-item",{disabled:!!t.rowTypeDisabledReason(s.value),active:t.currentRowType===s.value}]),title:t.rowTypeDisabledReason(s.value)||"",onClick:d=>!t.rowTypeDisabledReason(s.value)&&a("set-row-type",s.value)},e.toDisplayString(s.label),11,Xo)),64))],36)):e.createCommentVNode("",!0)]))}}),Jo=_(jo,[["__scopeId","data-v-3f0b28d4"]]),Zo={class:"cell-barcode"},Qo=["src"],_o={key:1,class:"cell-barcode-fallback"},el=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{}},setup(t){const l=t,n=e.ref(null),o=e.ref(!1),a=e.ref(""),i=e.computed(()=>({objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"})),r=e.computed(()=>({objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}));function s(){if(o.value=!1,!!n.value)try{tt(n.value,l.value,{format:l.barcodeType||"CODE128",width:1,height:28,displayValue:l.showText!==!1,fontSize:9,margin:0}),o.value=!0}catch{}}async function d(){if(!l.value){a.value="";return}try{a.value=await nt.toDataURL(l.value,{width:96,margin:1,errorCorrectionLevel:l.qrCodeLevel||"M"})}catch{a.value=""}}function u(){l.cellType==="barcode"?s():d()}return e.onMounted(u),e.watch(()=>[l.cellType,l.value,l.barcodeType,l.qrCodeLevel,l.showText],u),(f,m)=>(e.openBlock(),e.createElementBlock("div",Zo,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:n,preserveAspectRatio:"xMidYMid meet",style:e.normalizeStyle(i.value)},null,4)),[[e.vShow,t.cellType==="barcode"&&o.value]]),t.cellType==="qrcode"&&a.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:a.value,alt:"qrcode",style:e.normalizeStyle(r.value)},null,12,Qo)):e.createCommentVNode("",!0),!o.value&&t.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",_o,e.toDisplayString(t.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),tl=_(el,[["__scopeId","data-v-612f4008"]]),nl={class:"cell-image"},ol=["src"],ll={key:1,class:"image-placeholder"},al=e.defineComponent({__name:"CellImage",props:{value:{},fit:{},maxWidth:{},maxHeight:{},designMode:{type:Boolean},data:{}},setup(t){const l=t,n=e.computed(()=>{const r=l.value||"";return r?r.includes("{")?l.designMode?Ce(r,fe):Ce(r,l.data?.[0]||{}):r:""}),o=e.ref(!1);function a(){o.value=!0}e.watch(n,()=>{o.value=!1});const i=e.computed(()=>({objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}));return(r,s)=>(e.openBlock(),e.createElementBlock("div",nl,[n.value&&!o.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.value,style:e.normalizeStyle(i.value),onError:a},null,44,ol)):(e.openBlock(),e.createElementBlock("div",ll,"图片"))]))}}),il=_(al,[["__scopeId","data-v-7f838bbb"]]),rl=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],sl={key:2,class:"data-placeholder"},dl={key:0,class:"col-resize-layer"},cl=["onMousedown"],ul={key:1,class:"row-badges"},Ye=3.7795275591,ml=.1,pl=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:l}){const n={header:"题",data:"数",subtotal:"小",summary:"汇"},o=t,a=l,i=e.inject(xe,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),r=e.computed(()=>o.element.options.tableRows??[]),s=e.computed(()=>o.element.options.tableColWidths??[]),d=e.computed(()=>o.element.options.tableDefaultFontSize??10),u=e.computed(()=>o.element.options.tableDefaultColor??"#333333"),f=e.computed(()=>{const C=i.tableSelection.value;return C&&C.elementId===o.element.id?C:null});function m(C){let $=0;for(let D=0;D<C;D++)$+=r.value[D].height;return $}const y=e.ref(null),B=e.ref([]);function z(){if(!o.designMode)return;const C=y.value;if(!C)return;const $=C.offsetHeight;if($<=0)return;const D=o.element.options,w=$/Ye;Math.abs(w-(D.height??0))>ml&&(D.height=Math.round(w*100)/100);const k=C.offsetTop;B.value=Array.from(C.rows).map(q=>({top:(q.offsetTop-k)/Ye,height:q.offsetHeight/Ye}))}function E(C){return B.value[C]?.top??m(C)}function V(C){return B.value[C]?.height??r.value[C]?.height??0}e.watch(()=>[o.element.options,o.designMode],()=>z(),{deep:!0,flush:"post"}),e.onMounted(()=>{z(),document.fonts?.ready.then(()=>z())});const A=e.computed(()=>{const C=o.element.options.dataSource;if(C&&Array.isArray(fe[C]))return fe[C];for(const $ of Object.values(fe))if(Array.isArray($))return $}),H=e.computed(()=>{if(o.data)return o.data});function W(C){return C.cellType==="barcode"||C.cellType==="qrcode"}function L(C,$){return W($)?vn($.formatter,A.value):$.formatter||""}function G(C,$){const D=o.element.options,w={designMode:o.designMode,showGhostBorder:o.showTableGhostBorder};return{fontFamily:$.fontFamily||"inherit",textAlign:$.align??"left",verticalAlign:$.valign??"middle",fontSize:($.fontSize??d.value)+"pt",fontWeight:$.fontWeight??"normal",color:$.color??u.value,backgroundColor:$.backgroundColor??"transparent",borderTop:Le($.borders?.top,w),borderRight:Le($.borders?.right,w),borderBottom:Le($.borders?.bottom,w),borderLeft:Le($.borders?.left,w),padding:($.padding??D.tableDefaultPadding??1)+"mm",whiteSpace:$.wordWrap??!0?"normal":"nowrap",overflow:$.wordWrap??!0?"visible":"hidden"}}function Y(C,$){const D=f.value;return{"cell-selected":!!D&&C>=D.r1&&C<=D.r2&&$>=D.c1&&$<=D.c2,"row-data-bg":r.value[C].type==="data"}}const J=e.ref(null);function P(C,$){const D=Ct(r.value,C,$);i.setTableSelection({elementId:o.element.id,...D})}function v(C,$,D){!o.designMode||!o.isSelected||(D.stopPropagation(),D.shiftKey&&f.value?P({r:f.value.r1,c:f.value.c1},{r:C,c:$}):(J.value={r:C,c:$},P({r:C,c:$},{r:C,c:$})),window.addEventListener("mouseup",()=>{J.value=null},{once:!0}))}function g(C,$){J.value&&P(J.value,{r:C,c:$})}function M(C,$){o.designMode&&a("dblclick-cell",o.element.id,C,$)}const x=e.reactive({visible:!1,x:0,y:0});function c(C,$,D){if(!o.designMode||!o.isSelected)return;const w=f.value;w&&C>=w.r1&&C<=w.r2&&$>=w.c1&&$<=w.c2||P({r:C,c:$},{r:C,c:$}),x.x=D.clientX,x.y=D.clientY,x.visible=!0,window.addEventListener("mousedown",()=>{x.visible=!1},{once:!0})}const h=e.computed(()=>{const C=f.value;return C?St(r.value,C):"未选择单元格"}),T=e.computed(()=>{const C=f.value;if(!C)return!1;for(let $=C.r1;$<=C.r2;$++)for(let D=C.c1;D<=C.c2;D++){const w=r.value[$].cells[D];if(!w.merged&&((w.rowspan??1)>1||(w.colspan??1)>1))return!0}return!1});function O(C){const $=f.value;if(!$)return"未选择单元格";if($.r1!==$.r2)return"行类型仅支持单行设置";const D=JSON.parse(JSON.stringify(r.value));return Ze(D,$.r1,C)}function X(){Re(o.element.options)}function oe(C,$){const D=i.maxTableWidth.value,w=C.reduce((k,q)=>k+q,0)+C[$];return w>D?`插入后表格总宽 ${Math.round(w*10)/10}mm 超过打印范围宽度 ${D}mm,请先缩小列宽`:null}function ie(C,$){const D=f.value;if(!D)return;x.visible=!1;const w=o.element.options,k=w.tableRows,q=w.tableColWidths;let Z=null;switch(C){case"insert-row-above":mt(k,D.r1,"above");break;case"insert-row-below":mt(k,D.r2,"below");break;case"delete-row":Z=an(k,D.r1);break;case"insert-col-left":Z=oe(q,D.c1),Z||pt(k,q,D.c1,"left");break;case"insert-col-right":Z=oe(q,D.c2),Z||pt(k,q,D.c2,"right");break;case"delete-col":Z=rn(k,q,D.c1);break;case"merge":$t(k,D);break;case"split":Mt(k,D);break;case"set-row-type":Z=Ze(k,D.r1,$);break}if(Z){alert(Z);return}i.setTableSelection(null),X(),i.recordHistory()}const re=e.computed(()=>o.designMode&&!!o.isSelected&&!o.element.options.locked&&s.value.length>1),se=e.computed(()=>s.value.length>1?Array.from({length:s.value.length-1},(C,$)=>$+1):[]);function ae(C){return s.value.slice(0,C).reduce(($,D)=>$+D,0)}const p=e.ref(null);let b=0,N=0;function S(C,$){re.value&&(p.value=C,b=$.clientX,N=s.value[C-1],document.addEventListener("mousemove",U),document.addEventListener("mouseup",K))}function U(C){if(p.value===null)return;const $=o.scale||1,D=(C.clientX-b)/$,w=p.value-1,k=o.element.options.tableColWidths;k[w]=cn(k,w,N+D,i.maxTableWidth.value)}function K(){document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",K),p.value!==null&&(p.value=null,X(),i.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",K)}),(C,$)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["print-table",{"design-mode":t.designMode}]),onContextmenu:$[0]||($[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:y,style:e.normalizeStyle({fontSize:d.value+"pt",color:u.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(D,w)=>(e.openBlock(),e.createElementBlock("col",{key:w,style:e.normalizeStyle({width:D+"mm"})},null,4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(D,w)=>(e.openBlock(),e.createElementBlock("tr",{key:D.id,style:e.normalizeStyle({height:D.height+"mm"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.cells,(k,q)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k.id},[k.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:k.rowspan||1,colspan:k.colspan||1,class:e.normalizeClass(Y(w,q)),style:e.normalizeStyle(G(D,k)),onMousedown:e.withModifiers(Z=>v(w,q,Z),["left"]),onMouseenter:Z=>g(w,q),onDblclick:e.withModifiers(Z=>M(w,q),["stop"]),onContextmenu:e.withModifiers(Z=>c(w,q,Z),["prevent","stop"])},[W(k)?(e.openBlock(),e.createBlock(tl,{key:0,"cell-type":k.cellType,value:L(D,k),"barcode-type":k.barcodeType,"qr-code-level":k.qrCodeLevel,"show-text":k.showBarcodeText,fit:k.fit,"max-width":k.maxWidth,"max-height":k.maxHeight},null,8,["cell-type","value","barcode-type","qr-code-level","show-text","fit","max-width","max-height"])):k.cellType==="image"?(e.openBlock(),e.createBlock(il,{key:1,value:k.formatter||"",fit:k.fit,"max-width":k.maxWidth,"max-height":k.maxHeight,"design-mode":t.designMode,data:H.value},null,8,["value","fit","max-width","max-height","design-mode","data"])):D.type==="data"?(e.openBlock(),e.createElementBlock("span",sl,e.toDisplayString(L(D,k)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(L(D,k)),1)],64))],46,rl))],64))),128))],4))),128))])],4),re.value?(e.openBlock(),e.createElementBlock("div",dl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.value,D=>(e.openBlock(),e.createElementBlock("div",{key:D,class:e.normalizeClass(["col-resize-handle",{dragging:p.value===D}]),style:e.normalizeStyle({left:ae(D)+"mm"}),onMousedown:e.withModifiers(w=>S(D,w),["stop","prevent"])},null,46,cl))),128))])):e.createCommentVNode("",!0),t.designMode&&t.isSelected?(e.openBlock(),e.createElementBlock("div",ul,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(D,w)=>(e.openBlock(),e.createElementBlock("span",{key:D.id,class:"row-badge",style:e.normalizeStyle({top:E(w)+"mm",height:V(w)+"mm"})},e.toDisplayString(n[D.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(Jo,{visible:x.visible,x:x.x,y:x.y,"can-delete-row":r.value.length>1,"can-delete-col":s.value.length>1,"merge-disabled-reason":h.value,"can-split":T.value,"current-row-type":f.value?r.value[f.value.r1]?.type??null:null,"row-type-disabled-reason":O,onAction:ie},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),fl=_(pl,[["__scopeId","data-v-ce38806a"]]),ht=e.defineComponent({__name:"LineElement",props:{element:{}},setup(t){const l=t,n=e.computed(()=>l.element.printElementType.type==="hline"),o=e.computed(()=>{const a=l.element.options,i=(a.borderWidth||.75)+"pt",r=a.borderStyle||"solid",s=a.borderColor||"#333";return n.value?{width:"100%",height:"0",borderTop:`${i} ${r} ${s}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${i} ${r} ${s}`,boxSizing:"border-box"}});return(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(o.value)},null,4))}}),bt=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(t){const l=t,n=e.computed(()=>l.element.printElementType.type==="oval"),o=e.computed(()=>{const a=l.element.options;return{width:"100%",height:"100%",borderWidth:(a.borderWidth||1)+"pt",borderStyle:a.borderStyle||"solid",borderColor:a.borderColor||"#333",backgroundColor:a.backgroundColor||"transparent",borderRadius:n.value?"50%":"0",boxSizing:"border-box"}});return(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(o.value)},null,4))}}),vl={class:"print-barcode",ref:"containerRef"},gl=96/25.4,hl=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,n=e.ref(null);function o(){if(!n.value)return;const a=l.element.options,i=(l.designMode?a.testData||a.formatter:Ue(a,l.data))||"条码",r=!a.hideTitle,s=(a.fontSize||12)*(96/72),d=(a.height||40)*gl,u=r?s+4:0,f=Math.max(8,d-u);try{tt(n.value,i,{format:a.barcodeType||"CODE128",width:a.barWidth?a.barWidth/2:1,height:f,displayValue:r,fontSize:s,margin:2})}catch{}}return e.onMounted(o),e.watch(()=>[l.element.options.formatter,l.element.options.testData,l.element.options.barcodeType,l.element.options.width,l.element.options.height,l.element.options.barWidth,l.element.options.hideTitle,l.element.options.fontSize],o),(a,i)=>(e.openBlock(),e.createElementBlock("div",vl,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:n,preserveAspectRatio:"xMidYMid meet"},null,512))],512))}}),bl=_(hl,[["__scopeId","data-v-a71e7c44"]]),yl={class:"print-qrcode"},kl=["src"],El=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,n=e.ref("");async function o(){const a=l.element.options,i=(l.designMode?a.testData||a.formatter:Ue(a,l.data))||"二维码",r=Math.min(a.width||80,a.height||80);try{n.value=await nt.toDataURL(i,{width:r,margin:1,errorCorrectionLevel:String(a.qrCodeLevel??"M")})}catch{n.value=""}}return e.onMounted(o),e.watch(()=>[l.element.options.formatter,l.element.options.testData],o),(a,i)=>(e.openBlock(),e.createElementBlock("div",yl,[n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.value,alt:"qrcode"},null,8,kl)):e.createCommentVNode("",!0)]))}}),wl=_(El,[["__scopeId","data-v-90b31b7e"]]),Vl=["innerHTML"],Nl=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,n=e.computed(()=>{if(l.element.options.formatter){const o=l.data&&l.data.length>0?l.data[0]:{},a=Ce(l.element.options.formatter,o??{});return a?Qt.sanitize(a):""}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(o,a)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:n.value},null,8,Vl))}}),Cl=_(Nl,[["__scopeId","data-v-f0a224c2"]]),Sl=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,n=e.computed(()=>{const a=l.element.options;return{fontSize:(a.fontSize||12)+"pt",fontWeight:a.fontWeight||"normal",fontFamily:a.fontFamily||"inherit",color:a.color||"#333",textAlign:a.textAlign||"left",lineHeight:a.lineHeight?a.lineHeight+"pt":"normal",letterSpacing:a.letterSpacing?a.letterSpacing+"pt":"normal"}}),o=e.computed(()=>l.designMode?l.element.options.title||"{pageIndex}/{totalPages}":l.element.options.title||"");return(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(n.value)},e.toDisplayString(o.value),5))}}),$l=_(Sl,[["__scopeId","data-v-c3750ca3"]]),Ml={key:0,class:"drag-preview"},Bl={key:1,class:"resize-handles"},xl=["onMousedown"],Dl={key:2,class:"selected-indicator"},Tl={class:"position-label"},zl=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:l}){const n=t,o=l,a=e.ref(null),i=e.inject(zt,null),r=e.computed(()=>i?.value?i.value.has(n.element.id):n.isSelected??!1),s=e.inject(Lt,null),d=e.computed(()=>s?.value.has(n.element.id)??!1),u={text:e.markRaw(Fo),image:e.markRaw(Wo),longText:e.markRaw(Ko),table:e.markRaw(fl),hline:e.markRaw(ht),vline:e.markRaw(ht),rect:e.markRaw(bt),oval:e.markRaw(bt),barcode:e.markRaw(bl),qrcode:e.markRaw(wl),html:e.markRaw(Cl),pageNumber:e.markRaw($l)},{getBindingDisplayState:f}=Uo(),m=e.computed(()=>n.designMode?f(n.element):null),y=e.computed(()=>u[n.element.printElementType.type]),B=e.computed(()=>n.element.printElementType.type==="table"?{showTableGhostBorder:n.showTableGhostBorder,scale:n.scale}:{}),z=e.computed(()=>{const c=n.element.options;return{position:"absolute",left:c.left+"mm",top:c.top+"mm",width:c.width+"mm",height:c.height+"mm",zIndex:c.zIndex||"auto"}}),E=e.computed(()=>{const c=n.element.options;return`x:${Math.round(c.left)} y:${Math.round(c.top)} ${Math.round(c.width)}×${Math.round(c.height)}mm`});let V=0,A=0;const H=e.reactive({disabled:!n.designMode||!!n.element.options.locked,getScale:()=>n.scale||1,onDrag:c=>{const h=c.left-V,T=c.top-A;a.value&&(a.value.style.transform=`translate(${h}mm, ${T}mm)`)},onDragEnd:(c,h)=>{if(h.altKey){const X=JSON.parse(JSON.stringify(n.element));X.id=Ne(),X.options.left=c.left,X.options.top=c.top,o("clone-element",X,{left:c.left,top:c.top}),a.value&&(a.value.style.transform="");return}const T=c.left-V,O=c.top-A;if(n.element.options.left=c.left,n.element.options.top=c.top,a.value&&(a.value.style.transform=""),n.element.options.groupId&&n.allElements)for(const X of n.allElements)X.id!==n.element.id&&X.options.groupId===n.element.options.groupId&&(X.options.left+=T,X.options.top+=O)},onStart:()=>{V=n.element.options.left,A=n.element.options.top,o("select",n.element.id,!1),o("drag-start")},onStop:()=>{n.clearAdsorbGuides?.(),o("drag-stop")},onAdsorb:c=>{let h=c.left,T=c.top;return n.snapToGrid&&(h=Math.round(c.left/5)*5,T=Math.round(c.top/5)*5),n.adsorbHandler?n.adsorbHandler({id:n.element.id,left:h,top:T,width:n.element.options.width,height:n.element.options.height}):{left:h,top:T,lines:[]}}}),{setup:W,cleanup:L,isDragging:G}=Lo(a,H);e.watchEffect(()=>{H.disabled=!n.designMode||!!n.element.options.locked});const Y=e.computed(()=>r.value&&!!n.designMode&&!n.element.options.locked&&n.element.printElementType.type!=="table"),{startResize:J,cleanup:P}=Ao({minWidth:3.5,minHeight:3.5,getScale:()=>n.scale||1,getRect:()=>({left:n.element.options.left,top:n.element.options.top,width:n.element.options.width,height:n.element.options.height}),onResize:c=>{n.element.options.left=c.left,n.element.options.top=c.top,n.element.options.width=c.width,n.element.options.height=c.height},onStart:()=>{o("drag-start")},onStop:()=>{o("drag-stop")}});function v(c){n.designMode&&o("select",n.element.id,c.ctrlKey||c.metaKey)}function g(){n.designMode&&o("dblclick-element",n.element.id)}function M(c,h,T){n.designMode&&o("dblclick-cell",c,h,T)}e.onMounted(()=>{n.designMode&&W()});function x(){L(),P(),n.clearAdsorbGuides?.()}return e.onUnmounted(()=>{x()}),(c,h)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:a,class:e.normalizeClass(["print-element",{selected:r.value,previewed:d.value,"design-mode":t.designMode,locked:t.element.options.locked,hidden:t.element.options.visible===!1,"drag-ghost":e.unref(G),[`type-${t.element.printElementType.type}`]:!0,[`zone-${t.zone||"content"}`]:!0}]),style:e.normalizeStyle(z.value),onMousedown:e.withModifiers(v,["stop"]),onDblclick:e.withModifiers(g,["stop"]),onContextmenu:h[0]||(h[0]=e.withModifiers(T=>c.$emit("contextmenu",t.element.id,T),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y.value),e.mergeProps({element:t.element,data:t.printData,"design-mode":t.designMode,"is-selected":r.value},B.value,{onDblclickCell:M}),null,16,["element","data","design-mode","is-selected"])),e.unref(G)?(e.openBlock(),e.createElementBlock("div",Ml)):e.createCommentVNode("",!0),Y.value?(e.openBlock(),e.createElementBlock("div",Bl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Po),T=>(e.openBlock(),e.createElementBlock("div",{key:T,class:e.normalizeClass(["resize-handle",`handle-${T}`]),onMousedown:e.withModifiers(O=>e.unref(J)(T,O),["stop"])},null,42,xl))),128))])):e.createCommentVNode("",!0),r.value&&t.designMode?(e.openBlock(),e.createElementBlock("div",Dl,[e.createElementVNode("div",Tl,e.toDisplayString(E.value),1)])):e.createCommentVNode("",!0),t.designMode&&m.value?(e.openBlock(),e.createElementBlock("div",{key:3,class:"binding-badge",style:e.normalizeStyle({color:m.value.badgeColor})},e.toDisplayString(m.value.badge),5)):e.createCommentVNode("",!0)],38))}}),Xe=_(zl,[["__scopeId","data-v-8172df50"]]);function Ll(t){const l=[];for(let n=0;n<=t+1e-9;n+=5){const o=Math.round(n*100)/100,a=o%10===0;a?l.push({mm:o,major:a,label:String(o)}):l.push({mm:o,major:a})}return l}const je=96/25.4,Ve=16,Pl=e.defineComponent({__name:"Ruler",props:{orientation:{},lengthMM:{},scale:{}},emits:["add-guide"],setup(t,{emit:l}){const n=t,o=l,a=e.ref(null),i=e.computed(()=>n.orientation==="horizontal"?{width:n.lengthMM+"mm",height:Ve+"px"}:{width:Ve+"px",height:n.lengthMM+"mm"});function r(){const m=a.value;if(!m)return;const y=window.devicePixelRatio||1,B=n.lengthMM*je,z=n.orientation==="horizontal";m.width=(z?B:Ve)*y,m.height=(z?Ve:B)*y;const E=m.getContext("2d");if(!E)return;E.scale(y,y);const V=getComputedStyle(m),A=V.getPropertyValue("--pd-ruler-bg").trim()||"#FFFFFF",H=V.getPropertyValue("--pd-ruler").trim()||"#9CA3AF";E.fillStyle=A,E.fillRect(0,0,z?B:Ve,z?Ve:B),E.strokeStyle=H,E.fillStyle=H,E.lineWidth=1,E.font="8px ui-monospace, Menlo, monospace";for(const W of Ll(n.lengthMM)){const L=Math.round(W.mm*je)+.5,G=W.major?8:4;E.beginPath(),z?(E.moveTo(L,0),E.lineTo(L,G)):(E.moveTo(0,L),E.lineTo(G,L)),E.stroke(),W.major&&W.label&&(z?E.fillText(W.label,L+2,14):(E.save(),E.translate(12,L+2),E.rotate(-Math.PI/2),E.fillText(W.label,-E.measureText(W.label).width,0),E.restore()))}}e.watch(()=>[n.lengthMM,n.orientation],r),e.onMounted(r);let s=!1;function d(m){s=!0,m.preventDefault(),window.addEventListener("mousemove",u),window.addEventListener("mouseup",f)}function u(){}function f(m){if(!s)return;s=!1,window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",f);const y=a.value;if(!y)return;const B=y.getBoundingClientRect(),z=n.scale??1,V=(n.orientation==="horizontal"?(m.clientX-B.left)/z:(m.clientY-B.top)/z)/je;V>0&&V<n.lengthMM&&o("add-guide",n.orientation==="horizontal"?"horizontal":"vertical",V)}return(m,y)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:a,class:"pd-ruler",style:e.normalizeStyle(i.value),onMousedown:d},null,36))}}),yt=_(Pl,[["__scopeId","data-v-fdb82e87"]]);function Il(t={}){const l=t.adsorbMin??1,n=t.adsorbLineMin??2,o=t.showAdsorbLine??!0,a=e.ref([]),i=e.ref({width:0,height:0}),r={left:"#3b82f6",center:"#10b981",right:"#f59e0b",top:"#3b82f6",middle:"#10b981",bottom:"#f59e0b"};function s(m){return m==="vCenter"?r.center:m==="hCenter"?r.middle:r[m]??r.left}function d(m,y,B){let z=m.left,E=m.top;const V=[],A={left:m.left,right:m.left+m.width,vCenter:m.left+m.width/2,top:m.top,bottom:m.top+m.height,hCenter:m.top+m.height/2};let H=1/0;for(const L of y){if(L.id===m.id)continue;const G={left:L.left,right:L.left+L.width,vCenter:L.left+L.width/2,top:L.top,bottom:L.top+L.height,hCenter:L.top+L.height/2},Y=[["left","left"],["left","vCenter"],["left","right"],["vCenter","left"],["vCenter","vCenter"],["vCenter","right"],["right","left"],["right","vCenter"],["right","right"]],J=[["top","top"],["top","hCenter"],["top","bottom"],["hCenter","top"],["hCenter","hCenter"],["hCenter","bottom"],["bottom","top"],["bottom","hCenter"],["bottom","bottom"]];for(const[P,v]of Y){const g=Math.abs(A[P]-G[v]);g<=l&&g<H&&(H=g,z=m.left+(G[v]-A[P]))}for(const[P,v]of J){const g=Math.abs(A[P]-G[v]);g<=l&&g<H&&(H=g,E=m.top+(G[v]-A[P]))}}if(B){const L={left:z,right:z+m.width,vCenter:z+m.width/2,top:E,bottom:E+m.height,hCenter:E+m.height/2},G=["left","vCenter","right"];for(const J of B.vertical)for(const P of G){const v=Math.abs(L[P]-J);v<=l&&v<H&&(H=v,z=m.left+(J-L[P]))}const Y=["top","hCenter","bottom"];for(const J of B.horizontal)for(const P of Y){const v=Math.abs(L[P]-J);v<=l&&v<H&&(H=v,E=m.top+(J-L[P]))}}const W={left:z,right:z+m.width,vCenter:z+m.width/2,top:E,bottom:E+m.height,hCenter:E+m.height/2};if(o){const L=new Set;for(const G of y){if(G.id===m.id)continue;const Y={left:G.left,right:G.left+G.width,vCenter:G.left+G.width/2,top:G.top,bottom:G.top+G.height,hCenter:G.top+G.height/2},J=[["left","left"],["left","vCenter"],["left","right"],["vCenter","left"],["vCenter","vCenter"],["vCenter","right"],["right","left"],["right","vCenter"],["right","right"]],P=[["top","top"],["top","hCenter"],["top","bottom"],["hCenter","top"],["hCenter","hCenter"],["hCenter","bottom"],["bottom","top"],["bottom","hCenter"],["bottom","bottom"]];for(const[v,g]of J)if(Math.abs(W[v]-Y[g])<=n){const x=`v:${Y[g]}`;L.has(x)||(L.add(x),V.push({type:"vertical",position:Y[g],id:G.id,color:s(v)}))}for(const[v,g]of P)if(Math.abs(W[v]-Y[g])<=n){const x=`h:${Y[g]}`;L.has(x)||(L.add(x),V.push({type:"horizontal",position:Y[g],id:G.id,color:s(v)}))}}}if(B){for(const L of B.vertical)V.some(G=>G.type==="vertical"&&G.position===L)||V.push({type:"vertical",position:L});for(const L of B.horizontal)V.some(G=>G.type==="horizontal"&&G.position===L)||V.push({type:"horizontal",position:L})}return{left:z,top:E,lines:V}}function u(m,y,B){a.value=m,i.value={width:y,height:B}}function f(){a.value=[]}return{check:d,renderLines:u,clearLines:f,guideLines:a,paperSize:i}}function Al(t){const{check:l,renderLines:n,clearLines:o,guideLines:a,paperSize:i}=Il(t.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function r(d){const u=t.getElements().filter(y=>y.id!==d.id).map(y=>({id:y.id,left:y.options.left,top:y.options.top,width:y.options.width,height:y.options.height})),f=l(d,u,t.getGuides?.()),m=t.getPaperSize();return n(f.lines,m.width,m.height),f}function s(){o()}return{requestAdsorb:r,clearGuides:s,guideLines:a,paperSize:i}}const Rl={key:0,class:"zone-label"},Ul={key:0,class:"zone-height-tip"},Fl={key:0,class:"zone-label"},Hl={key:0,class:"zone-height-tip"},Ol=["onMousedown","onDblclick"],Gl=e.defineComponent({__name:"CanvasPaper",props:{templateData:{},runtimeElements:{},designMode:{type:Boolean},printData:{},scale:{},showRuler:{type:Boolean},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","add-guide","guide-move","guide-remove","clone-element"],setup(t,{expose:l,emit:n}){const o=t,a=n,i=e.ref(null),r=e.computed(()=>Se(o.templateData).width),s=e.computed(()=>Se(o.templateData).height),d=e.computed(()=>{const p=o.templateData.margins,b=o.templateData.header.height,N=o.templateData.footer.height,S=r.value-p.left-p.right;return{header:{left:p.left,top:p.top,width:S,height:b},content:{left:p.left,top:p.top+b,width:S,height:s.value-p.top-p.bottom-b-N},footer:{left:p.left,top:s.value-p.bottom-N,width:S,height:N}}});function u(p){return{position:"absolute",left:p.left+"mm",top:p.top+"mm",width:p.width+"mm",height:p.height+"mm"}}const f=e.computed(()=>{const p={header:[],footer:[],content:[]};for(const b of o.runtimeElements)b.zone==="header"?p.header.push(b):b.zone==="footer"?p.footer.push(b):p.content.push(b);return p}),m=e.computed(()=>f.value.header),y=e.computed(()=>f.value.footer),B=e.computed(()=>f.value.content);let z="content";const{requestAdsorb:E,clearGuides:V,guideLines:A,paperSize:H}=Al({getElements:()=>f.value[z],getPaperSize:()=>{const p=d.value[z];return{width:p.width,height:p.height}},getGuides:()=>{const p=[],b=[];for(const N of o.guides??[])N.type==="vertical"?p.push(N.position):b.push(N.position);return{vertical:p,horizontal:b}}});function W(p){z=o.runtimeElements.find(S=>S.id===p.id)?.zone||"content";const N=E(p);return(N.left!==p.left||N.top!==p.top)&&x(N.left+p.width/2,N.top+p.height/2),N}function L(p,b){const N=b.position,S=p.clientX,U=p.clientY,K=o.scale??1,C=25.4/96,$=w=>{const k=(b.type==="vertical"?w.clientX-S:w.clientY-U)/K*C;a("guide-move",b.id,N+k)},D=()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",D)};window.addEventListener("mousemove",$),window.addEventListener("mouseup",D)}const G=e.computed(()=>({width:r.value+"mm",minHeight:s.value+"mm",background:o.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))",margin:"0 auto",overflow:"hidden",position:"relative",transform:o.scale?`scale(${o.scale})`:void 0,transformOrigin:"0 0"})),Y=e.computed(()=>{const p=o.templateData.margins;return{padding:`${p.top}mm ${p.right}mm ${p.bottom}mm ${p.left}mm`,position:"relative",boxSizing:"border-box",minHeight:s.value+"mm"}}),J=e.computed(()=>o.showRuler!==!1&&!!o.designMode),P=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 v=0,g=null;const M=e.ref(null);function x(p,b){v+=1,M.value={left:p,top:b,key:v},g&&clearTimeout(g),g=setTimeout(()=>{M.value=null},300)}const c=e.computed(()=>{const p=o.templateData.watermark;return p?!p.mode||p.mode==="fixed"?!!p.content&&p.content.trim().length>0:!!p.binding:!1}),h=e.computed(()=>{const p=o.templateData.watermark||{},b=p.color||"#cccccc",N=p.opacity??.15,S=p.rotate??-30;let U=T(p);if(p.timestamp){const K=new Date,C=`${K.getFullYear()}-${String(K.getMonth()+1).padStart(2,"0")}-${String(K.getDate()).padStart(2,"0")} ${String(K.getHours()).padStart(2,"0")}:${String(K.getMinutes()).padStart(2,"0")}`;U=U?`${U} ${C}`:C}return{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"0",overflow:"hidden",opacity:String(N),backgroundImage:O(U,b,S),backgroundRepeat:"repeat"}});function T(p){if(!p.mode||p.mode==="fixed")return p.content||"";if(p.binding){const b=o.printData?.[0];return b&&b[p.binding]!==void 0&&b[p.binding]!==null?String(b[p.binding]):p.testData||`[${p.binding}]`}return""}function O(p,b,N){const S=p.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),U=`<svg xmlns="http://www.w3.org/2000/svg" width="260" height="180">
|
|
2
|
-
<text x="130" y="90" font-size="16" fill="${
|
|
3
|
-
</svg>`;return`url("data:image/svg+xml,${encodeURIComponent(U)}")`}const X=e.ref(null);function oe(p,b){se(),X.value={zone:p,startY:b.clientY,startH:o.templateData[p].height},window.addEventListener("mousemove",ie),window.addEventListener("mouseup",re)}function ie(p){if(!X.value)return;const{zone:b,startY:N,startH:S}=X.value,K=(p.clientY-N)/(o.scale||1)*25.4/96,C=b==="header"?K:-K,$=Math.min(100,s.value-o.templateData.margins.top-o.templateData.margins.bottom-(b==="header"?o.templateData.footer.height:o.templateData.header.height)-10),D=Math.min($,Math.max(0,Math.round((S+C)*10)/10));a("zone-height-change",b,D)}function re(){if(!X.value)return;const p=X.value.zone;X.value=null,window.removeEventListener("mousemove",ie),window.removeEventListener("mouseup",re),a("zone-height-commit",p)}function se(){window.removeEventListener("mousemove",ie),window.removeEventListener("mouseup",re),X.value=null}e.onUnmounted(()=>{se(),g&&clearTimeout(g)});function ae(p,b){a("select",p,b)}return l({contentRef:i}),(p,b)=>(e.openBlock(),e.createElementBlock("div",{class:"hiprint-printPaper",style:e.normalizeStyle(G.value)},[e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:i,style:e.normalizeStyle(Y.value)},[J.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(yt,{orientation:"horizontal","length-m-m":r.value,scale:t.scale,onAddGuide:b[0]||(b[0]=(N,S)=>a("add-guide",N,S))},null,8,["length-m-m","scale"]),e.createVNode(yt,{orientation:"vertical","length-m-m":s.value,scale:t.scale,onAddGuide:b[1]||(b[1]=(N,S)=>a("add-guide",N,S))},null,8,["length-m-m","scale"])],64)):e.createCommentVNode("",!0),t.showGrid&&t.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"grid-bg",style:e.normalizeStyle(P.value)},null,4)):e.createCommentVNode("",!0),M.value?(e.openBlock(),e.createElementBlock("div",{key:M.value.key,class:"snap-indicator",style:e.normalizeStyle({left:M.value.left+"mm",top:M.value.top+"mm"})},null,4)):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("div",{key:3,class:"watermark-layer",style:e.normalizeStyle(h.value)},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-header",{"design-mode":t.designMode}]),style:e.normalizeStyle(u(d.value.header))},[t.designMode?(e.openBlock(),e.createElementBlock("span",Rl,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,N=>(e.openBlock(),e.createBlock(Xe,{key:N.id,element:N,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":m.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"header","adsorb-handler":W,"clear-adsorb-guides":e.unref(V),onSelect:ae,onDragStart:b[2]||(b[2]=S=>p.$emit("drag-start")),onDragStop:b[3]||(b[3]=S=>p.$emit("drag-stop")),onDblclickElement:b[4]||(b[4]=S=>p.$emit("dblclick-element",S)),onDblclickCell:b[5]||(b[5]=(S,U,K)=>p.$emit("dblclick-cell",S,U,K)),onContextmenu:b[6]||(b[6]=(S,U)=>p.$emit("contextmenu",S,U)),onCloneElement:(S,U)=>p.$emit("clone-element",S,U)},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:b[7]||(b[7]=e.withModifiers(N=>oe("header",N),["prevent","stop"]))},[X.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",Ul,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(u(d.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"})},[...b[19]||(b[19]=[e.createElementVNode("span",{class:"zone-label"},"首页叠加",-1)])],4)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,N=>(e.openBlock(),e.createBlock(Xe,{key:N.id,element:N,"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:"content","adsorb-handler":W,"clear-adsorb-guides":e.unref(V),onSelect:ae,onDragStart:b[8]||(b[8]=S=>p.$emit("drag-start")),onDragStop:b[9]||(b[9]=S=>p.$emit("drag-stop")),onDblclickElement:b[10]||(b[10]=S=>p.$emit("dblclick-element",S)),onDblclickCell:b[11]||(b[11]=(S,U,K)=>p.$emit("dblclick-cell",S,U,K)),onContextmenu:b[12]||(b[12]=(S,U)=>p.$emit("contextmenu",S,U)),onCloneElement:(S,U)=>p.$emit("clone-element",S,U)},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(u(d.value.footer))},[t.designMode?(e.openBlock(),e.createElementBlock("span",Fl,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,N=>(e.openBlock(),e.createBlock(Xe,{key:N.id,element:N,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":y.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"footer","adsorb-handler":W,"clear-adsorb-guides":e.unref(V),onSelect:ae,onDragStart:b[13]||(b[13]=S=>p.$emit("drag-start")),onDragStop:b[14]||(b[14]=S=>p.$emit("drag-stop")),onDblclickElement:b[15]||(b[15]=S=>p.$emit("dblclick-element",S)),onDblclickCell:b[16]||(b[16]=(S,U,K)=>p.$emit("dblclick-cell",S,U,K)),onContextmenu:b[17]||(b[17]=(S,U)=>p.$emit("contextmenu",S,U)),onCloneElement:(S,U)=>p.$emit("clone-element",S,U)},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:b[18]||(b[18]=e.withModifiers(N=>oe("footer",N),["prevent","stop"]))},[X.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",Hl,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(A),(N,S)=>(e.openBlock(),e.createElementBlock("div",{key:S,class:e.normalizeClass(["adsorb-guide",[`guide-${N.type}`]]),style:e.normalizeStyle(N.type==="vertical"?{left:N.position+"mm",top:"0",height:e.unref(H).height+"mm",borderLeftColor:N.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:N.position+"mm",left:"0",width:e.unref(H).width+"mm",borderTopColor:N.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.guides,N=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+N.id,class:e.normalizeClass(["manual-guide",[`guide-${N.type}`]]),style:e.normalizeStyle(N.type==="vertical"?{left:N.position+"mm",top:"0",height:s.value+"mm"}:{top:N.position+"mm",left:"0",width:r.value+"mm"}),onMousedown:e.withModifiers(S=>L(S,N),["prevent","stop"]),onDblclick:e.withModifiers(S=>N.id&&a("guide-remove",N.id),["prevent","stop"])},null,46,Ol))),128))],4)],4))}}),ql=_(Gl,[["__scopeId","data-v-eddd2409"]]),Wl={class:"canvas-scroll"},Kl={key:0,class:"overlay-layer"},Yl=["src"],Ie=96/25.4,Xl=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:{},selectedElementHasGroup:{type:Boolean}},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","group","ungroup","coordinate","add-guide","guide-move","guide-remove","zoom","clone-element"],setup(t,{emit:l}){const n=t,o=l;function a(v,g){o("select",v,g)}const i=e.ref(null);function r(v){const g=i.value?.querySelector(".hiprint-printPaper");if(!g)return;const M=g.getBoundingClientRect(),x=n.scale||1,c=Pe((v.clientX-M.left)/x),h=Pe((v.clientY-M.top)/x);if(!(c<0||h<0))return{x:c,y:h}}function s(v){const g=r(v),M=v.dataTransfer?.getData("fieldData");if(M)try{const c=JSON.parse(M);o("drop-field",c,g);return}catch{}const x=v.dataTransfer?.getData("elementType");x&&o("drop-element",x,g)}const d=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let u={x:0,y:0};function f(v){return!v||!(v instanceof HTMLElement)?!1:!!(v===i.value||v.classList.contains("canvas-scroll")||v.classList.contains("hiprint-printPaper")||v.classList.contains("hiprint-printPaper-content")||v.classList.contains("zone-layer")||v.classList.contains("grid-bg")||v.classList.contains("watermark-layer"))}function m(v){const g=i.value?.querySelector(".hiprint-printPaper");if(!g)return;const M=g.getBoundingClientRect(),x=n.scale||1,c=Pe((v.clientX-M.left)/x),h=Pe((v.clientY-M.top)/x);if(c<0||h<0){o("coordinate",null);return}o("coordinate",{x:c,y:h})}function y(){o("coordinate",null)}function B(v){if(!(v.ctrlKey||v.metaKey))return;v.preventDefault();const g=n.scale,M=Math.max(.25,Math.min(3,g+(v.deltaY>0?-.1:.1)));if(M===g)return;const x=i.value;if(x){const c=x.getBoundingClientRect(),h=v.clientX-c.left,T=v.clientY-c.top,O=M/g;x.scrollLeft=(x.scrollLeft+h)*O-h,x.scrollTop=(x.scrollTop+T)*O-T}o("zoom",(M-g)*100)}function z(v){v.button!==2&&f(v.target)&&(o("clear-selection"),u={x:v.clientX,y:v.clientY},d.visible=!0,d.x=v.clientX,d.y=v.clientY,d.w=0,d.h=0,window.addEventListener("mousemove",V),window.addEventListener("mouseup",A))}function E(){if(d.w<3||d.h<3)return[];const v=i.value?.querySelector(".hiprint-printPaper");if(!v)return[];const g=v.getBoundingClientRect(),M=n.scale||1,x=d.x<u.x,c=[];for(const h of n.elements){if(h.options.visible===!1||h.options.locked)continue;const T=g.left+h.options.left*Ie*M,O=g.top+h.options.top*Ie*M,X=T+h.options.width*Ie*M,oe=O+h.options.height*Ie*M,ie=T<d.x+d.w&&X>d.x&&O<d.y+d.h&&oe>d.y,re=T>=d.x&&X<=d.x+d.w&&O>=d.y&&oe<=d.y+d.h;(x?re:ie)&&c.push(h.id)}return c}function V(v){const g=v.clientX-u.x,M=v.clientY-u.y;d.x=g>=0?u.x:v.clientX,d.y=M>=0?u.y:v.clientY,d.w=Math.abs(g),d.h=Math.abs(M),o("preview",E())}function A(){window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",A);const v=E();o("preview",v),v.length>0?o("commit-preview"):o("clear-selection"),o("preview",[]),d.visible=!1}const H=e.reactive({visible:!1,x:0,y:0,targetId:null});function W(v,g){if(!g&&!f(v.target))return;const M=i.value?.getBoundingClientRect();M&&(H.x=v.clientX-M.left,H.y=v.clientY-M.top,H.targetId=g??null,H.visible=!0,window.removeEventListener("mousedown",L),setTimeout(()=>{window.addEventListener("mousedown",L,{once:!0})},0))}function L(){H.visible=!1,window.removeEventListener("mousedown",L)}function G(){H.visible=!1,n.hasClipboard&&o("paste")}function Y(){H.visible=!1,o("select-all")}function J(){H.visible=!1,o("clear-selection")}function P(v,g){H.visible=!1,v==="copy"?o("copy"):v==="cut"?o("cut"):v==="paste"?o("paste"):v==="delete"?o("delete"):v==="move-layer"?o("move-layer",g):v==="group"?o("group"):v==="ungroup"&&n.selectedElementHasGroup&&o("ungroup")}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",A)}),(v,g)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:i,class:"canvas-area",onDragover:g[21]||(g[21]=e.withModifiers(()=>{},["prevent"])),onDrop:s,onMousedown:z,onMousemove:m,onMouseleave:y,onWheel:B,onContextmenu:e.withModifiers(W,["prevent"])},[e.createElementVNode("div",Wl,[e.createVNode(ql,{"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:a,onAddGuide:g[0]||(g[0]=(M,x)=>v.$emit("add-guide",M,x)),onGuideMove:g[1]||(g[1]=(M,x)=>v.$emit("guide-move",M,x)),onGuideRemove:g[2]||(g[2]=M=>v.$emit("guide-remove",M)),onDragStart:g[3]||(g[3]=M=>v.$emit("drag-start")),onDragStop:g[4]||(g[4]=M=>v.$emit("drag-stop")),onDblclickElement:g[5]||(g[5]=M=>v.$emit("dblclick-element",M)),onDblclickCell:g[6]||(g[6]=(M,x,c)=>v.$emit("dblclick-cell",M,x,c)),onContextmenu:g[7]||(g[7]=(M,x)=>W(x,M)),onZoneHeightChange:g[8]||(g[8]=(M,x)=>v.$emit("zone-height-change",M,x)),onZoneHeightCommit:g[9]||(g[9]=M=>v.$emit("zone-height-commit",M)),onCloneElement:g[10]||(g[10]=(M,x)=>v.$emit("clone-element",M,x))},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",Kl,[e.createElementVNode("img",{src:t.screenshotUrl,class:"overlay-image",style:e.normalizeStyle({opacity:t.overlayOpacity??.5})},null,12,Yl)])):e.createCommentVNode("",!0)]),d.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"marquee-selection",style:e.normalizeStyle({left:d.x+"px",top:d.y+"px",width:d.w+"px",height:d.h+"px"})},null,4)):e.createCommentVNode("",!0),H.visible?(e.openBlock(),e.createElementBlock("div",{key:1,class:"context-menu",style:e.normalizeStyle({left:H.x+"px",top:H.y+"px"})},[H.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:g[11]||(g[11]=M=>P("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:g[12]||(g[12]=M=>P("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:g[13]||(g[13]=M=>P("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:g[14]||(g[14]=M=>P("delete"))},"删除"),g[22]||(g[22]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:g[15]||(g[15]=M=>P("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:g[16]||(g[16]=M=>P("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:g[17]||(g[17]=M=>P("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:g[18]||(g[18]=M=>P("move-layer","bottom"))},"置底"),g[23]||(g[23]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:g[19]||(g[19]=M=>P("group"))},"编组 Ctrl+G"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.selectedElementHasGroup}]),onClick:g[20]||(g[20]=M=>P("ungroup"))},"取消编组 Ctrl+Shift+G",2)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:G},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:Y},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:J},"取消选择")],64))],4)):e.createCommentVNode("",!0)],544))}}),jl=_(Xl,[["__scopeId","data-v-c6288512"]]),Jl=[{group:"position-size",groupLabel:"位置与尺寸",items:[{key:"ps-left",keywords:["X","横坐标","left","位置"]},{key:"ps-top",keywords:["Y","纵坐标","top","位置"]},{key:"ps-width",keywords:["W","宽度","width","尺寸"]},{key:"ps-height",keywords:["H","高度","height","尺寸"]}]},{group:"appearance",groupLabel:"外观",items:[{key:"ap-font-size",keywords:["字体大小","fontsize","字号"]},{key:"ap-font-weight",keywords:["字体粗细","粗体","bold"]},{key:"ap-align",keywords:["对齐","align"]},{key:"ap-vertical-align",keywords:["垂直对齐","verticalalign","顶对齐","底对齐"]},{key:"ap-color",keywords:["颜色","color"]},{key:"ap-bg-color",keywords:["背景色","background"]},{key:"ap-line-height",keywords:["行高","lineheight"]},{key:"ap-letter-spacing",keywords:["字间距","letterspacing"]}]},{group:"content",groupLabel:"内容",items:[{key:"ct-title",keywords:["内容","文本","title"]},{key:"ct-formatter",keywords:["格式化","表达式","formatter"]},{key:"ct-table-mode",keywords:["数据模式","静态布局","动态数据"]},{key:"ct-table-source",keywords:["数据源","列表字段"]},{key:"ct-table-font",keywords:["默认字号","默认颜色","默认内边距"]},{key:"ct-table-cols",keywords:["列宽","表格列"]}]},{group:"border-bg",groupLabel:"边框与背景",items:[{key:"bb-border-width",keywords:["边框宽度","border"]},{key:"bb-border-color",keywords:["边框颜色"]},{key:"bb-bg-color",keywords:["背景色","background"]}]},{group:"binding",groupLabel:"字段绑定",items:[{key:"bd-formatter",keywords:["格式化","表达式","formatter","fx","字段","绑定","field"]},{key:"bd-content",keywords:["内容","表达式","文本","变量"]}]},{group:"pagination",groupLabel:"分页",items:[{key:"pg-enabled",keywords:["分页","pagination","启用分页"]},{key:"pg-pageable",keywords:["参与分页","pageable"]},{key:"pg-keep-with-next",keywords:["同页","keepWithNext"]}]},{group:"advanced",groupLabel:"高级",items:[{key:"ad-locked",keywords:["锁定","lock"]},{key:"ad-fixed",keywords:["每页重复","repeat"]},{key:"ad-z-index",keywords:["层级","zindex"]},{key:"ad-delete",keywords:["删除"]}]}];function Zl(t,l){const n=t.trim().toLowerCase();return n?l.some(o=>o.toLowerCase().includes(n)):!0}function Ql(t){const l=[],n=new Set;for(const o of Jl){const a=o.items.filter(i=>Zl(t,[...i.keywords,o.groupLabel]));if(a.length>0){l.push(o.group);for(const i of a)n.add(i.key)}}return{groups:l,itemKeys:n}}const _l={class:"property-search"},ea=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(t,{emit:l}){const n=e.ref(""),o=l;function a(){o("search",n.value)}return(i,r)=>(e.openBlock(),e.createElementBlock("div",_l,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:a},null,544),[[e.vModelText,n.value]])]))}}),ta=_(ea,[["__scopeId","data-v-10ab6c84"]]),na={class:"group-icon"},oa={class:"group-title"},la={class:"expand-icon"},aa={class:"group-content"},ia=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(t){const l=t,n=e.ref(l.defaultExpanded??!0),a={Document:"≡",Brush:"◧",Setting:"⚙"}[l.icon]||"•";function i(){n.value=!n.value,r()}function r(){const d=`property-group-${l.groupKey}`;try{localStorage.setItem(d,String(n.value))}catch{}}function s(){const d=`property-group-${l.groupKey}`;try{const u=localStorage.getItem(d);u!==null&&(n.value=u==="true")}catch{}}return e.onMounted(()=>{s()}),(d,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":n.value}])},[e.createElementVNode("div",{class:"group-header",onClick:i},[e.createElementVNode("span",na,e.toDisplayString(e.unref(a)),1),e.createElementVNode("span",oa,e.toDisplayString(t.title),1),e.createElementVNode("span",la,e.toDisplayString(n.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",aa,[e.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])],2))}}),he=_(ia,[["__scopeId","data-v-2ba57031"]]),ra={class:"pd-stepper"},sa=["disabled"],da=["value","placeholder","min","max","step"],ca=["disabled"],ua=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{}},emits:["update:modelValue"],setup(t,{emit:l}){const n=t,o=l,a=e.computed(()=>{const E=String(n.step),V=E.indexOf(".");return V===-1?0:E.length-V-1});function i(E){return Number.isFinite(E)?Number(E.toFixed(a.value)):0}const r=e.computed(()=>{const E=n.modelValue;if(!(E==null||!Number.isFinite(E)))return i(E)}),s=e.ref(r.value===void 0?"":String(r.value));e.watch(r,E=>{s.value=E===void 0?"":String(E)});const d=e.computed(()=>r.value!==void 0?r.value:n.min!==void 0?n.min:0),u=e.computed(()=>n.min!==void 0&&d.value<=n.min),f=e.computed(()=>n.max!==void 0&&d.value>=n.max);function m(E){let V=i(E);return n.min!==void 0&&V<n.min&&(V=n.min),n.max!==void 0&&V>n.max&&(V=n.max),V}function y(E){if(E<0&&u.value||E>0&&f.value)return;const V=m(d.value+E*n.step);s.value=String(V),o("update:modelValue",V)}function B(E){s.value=E.target.value}function z(){const E=s.value.trim();if(E===""){r.value!==void 0&&(s.value=String(r.value));return}const V=Number(E);if(!Number.isFinite(V)){s.value=r.value===void 0?"":String(r.value);return}const A=m(V);s.value=String(A),A!==r.value&&o("update:modelValue",A)}return(E,V)=>(e.openBlock(),e.createElementBlock("div",ra,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:u.value,title:"减小","aria-label":"减小",onClick:V[0]||(V[0]=A=>y(-1))},"−",8,sa),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:s.value,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,onInput:B,onChange:z,onBlur:z,onKeydown:V[1]||(V[1]=e.withKeys(e.withModifiers(A=>A.target.blur(),["prevent"]),["enter"]))},null,40,da),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:f.value,title:"增大","aria-label":"增大",onClick:V[2]||(V[2]=A=>y(1))},"+",8,ca)]))}}),te=_(ua,[["__scopeId","data-v-9722a7cf"]]),ma={class:"position-grid"},pa={class:"pd-field"},fa={class:"pd-field"},va={class:"pd-field"},ga={class:"pd-field"},ha=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t;function n(o){return l.searching?l.matchedKeys?.has(o)??!0:!0}return(o,a)=>(e.openBlock(),e.createBlock(he,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[4]||(a[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",ma,[e.withDirectives(e.createElementVNode("div",pa,[a[5]||(a[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(te,{modelValue:t.element.options.left,"onUpdate:modelValue":a[0]||(a[0]=i=>t.element.options.left=i),min:0},null,8,["modelValue"])],512),[[e.vShow,n("ps-left")]]),e.withDirectives(e.createElementVNode("div",fa,[a[6]||(a[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(te,{modelValue:t.element.options.top,"onUpdate:modelValue":a[1]||(a[1]=i=>t.element.options.top=i),min:0},null,8,["modelValue"])],512),[[e.vShow,n("ps-top")]]),e.withDirectives(e.createElementVNode("div",va,[a[7]||(a[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(te,{modelValue:t.element.options.width,"onUpdate:modelValue":a[2]||(a[2]=i=>t.element.options.width=i),min:4},null,8,["modelValue"])],512),[[e.vShow,n("ps-width")]]),e.withDirectives(e.createElementVNode("div",ga,[a[8]||(a[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(te,{modelValue:t.element.options.height,"onUpdate:modelValue":a[3]||(a[3]=i=>t.element.options.height=i),min:4},null,8,["modelValue"])],512),[[e.vShow,n("ps-height")]])])],32)]),_:1}))}}),ba=_(ha,[["__scopeId","data-v-572d7719"]]),ya=["#000000","#333333","#666666","#999999","#cccccc","#ffffff","#e53935","#fb8c00","#1e88e5","#43a047","#8d6e63","#00acc1"],ka=["aria-expanded","title"],Ea={class:"picker-preview"},wa={class:"preset-color-grid"},Va=["title","aria-label","onClick"],Na=e.defineComponent({__name:"PresetColorPicker",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:l}){const n=t,o=l,a=e.ref(!1),i=e.ref(),r=e.ref(),s=e.ref(),d=e.ref({}),u=e.ref(0),f=e.ref(0),m=e.ref(0),y=e.ref("#000000"),B=e.ref(!1),z=e.computed({get:()=>n.modelValue||"#000000",set:p=>o("update:modelValue",p)}),E=e.computed(()=>oe(re(u.value,f.value,m.value))),V=e.computed({get:()=>Math.round(u.value),set:p=>L(se(p),f.value,m.value)});e.watch(z,W,{immediate:!0});function A(p){y.value=p.toUpperCase(),W(p),o("update:modelValue",p)}function H(p){const N=p.target.value.trim();O(N)&&(W(N),o("update:modelValue",X(N)))}function W(p){const b=O(p);if(!b)return;const N=ie(b.r,b.g,b.b);u.value=N.h,f.value=N.s,m.value=N.v,y.value=X(p).toUpperCase()}function L(p,b,N){u.value=se(p),f.value=ae(b),m.value=ae(N),y.value=E.value.toUpperCase(),o("update:modelValue",E.value)}function G(p){p.currentTarget.setPointerCapture(p.pointerId),B.value=!0,P(p)}function Y(p){B.value&&P(p)}function J(p){B.value=!1;const b=p.currentTarget;b.hasPointerCapture(p.pointerId)&&b.releasePointerCapture(p.pointerId)}function P(p){const b=s.value;if(!b)return;const N=b.getBoundingClientRect(),S=ae((p.clientX-N.left)/N.width),U=ae(1-(p.clientY-N.top)/N.height);L(u.value,S,U)}function v(p){const b=p.shiftKey?.1:.02;let N=!0;p.key==="ArrowLeft"?L(u.value,f.value-b,m.value):p.key==="ArrowRight"?L(u.value,f.value+b,m.value):p.key==="ArrowUp"?L(u.value,f.value,m.value+b):p.key==="ArrowDown"?L(u.value,f.value,m.value-b):N=!1,N&&p.preventDefault()}function g(){a.value?x():M()}async function M(){const p=i.value;if(!p)return;W(z.value),a.value=!0,await e.nextTick();const b=p.getBoundingClientRect(),N=190,S=r.value?.offsetHeight??216,U=8,K=Math.min(b.left,window.innerWidth-N-U),C=b.bottom+6,$=C+S>window.innerHeight-U?Math.max(U,b.top-S-6):C;d.value={left:`${Math.max(U,K)}px`,top:`${$}px`}}function x(){a.value=!1}function c(p){const b=p.target;i.value?.contains(b)||r.value?.contains(b)||x()}function h(){a.value&&x()}function T(p){p.key==="Escape"&&a.value&&x()}function O(p){const b=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(p.trim());if(!b)return null;const N=b[1],S=N.length===3?N.split("").map(U=>U+U).join(""):N;return{r:Number.parseInt(S.slice(0,2),16),g:Number.parseInt(S.slice(2,4),16),b:Number.parseInt(S.slice(4,6),16)}}function X(p){const b=O(p);return b?oe(b):"#000000"}function oe({r:p,g:b,b:N}){return`#${[p,b,N].map(S=>Math.round(ae(S/255)*255).toString(16).padStart(2,"0")).join("")}`}function ie(p,b,N){const S=p/255,U=b/255,K=N/255,C=Math.max(S,U,K),$=Math.min(S,U,K),D=C-$;let w=0;return D!==0&&(C===S?w=(U-K)/D%6:C===U?w=(K-S)/D+2:w=(S-U)/D+4,w*=60,w<0&&(w+=360)),{h:w,s:C===0?0:D/C,v:C}}function re(p,b,N){const S=N*b,U=(p%360+360)%360/60,K=S*(1-Math.abs(U%2-1)),[C,$,D]=U<1?[S,K,0]:U<2?[K,S,0]:U<3?[0,S,K]:U<4?[0,K,S]:U<5?[K,0,S]:[S,0,K],w=N-S;return{r:(C+w)*255,g:($+w)*255,b:(D+w)*255}}function se(p){return((Number.isFinite(p)?p:0)%360+360)%360}function ae(p){return Math.min(1,Math.max(0,Number.isFinite(p)?p:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",c,!0),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),document.addEventListener("keydown",T)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",c,!0),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h),document.removeEventListener("keydown",T)}),(p,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{ref_key:"triggerRef",ref:i,type:"button",class:"preset-color-trigger","aria-expanded":a.value,"aria-haspopup":"dialog",title:t.modelValue||"自动",onClick:g},[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle({background:z.value})},null,4)],8,ka),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[a.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:r,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(d.value),onPointerdown:b[2]||(b[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",Ea,[e.createElementVNode("span",{class:"picker-current",style:e.normalizeStyle({background:E.value})},null,4),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":b[0]||(b[0]=N=>y.value=N),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:H},null,544),[[e.vModelText,y.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:s,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(u.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:G,onPointermove:Y,onPointerup:J,onPointercancel:J,onKeydown:v},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${f.value*100}%`,top:`${(1-m.value)*100}%`,background:E.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":b[1]||(b[1]=N=>V.value=N),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,V.value,void 0,{number:!0}]]),b[3]||(b[3]=e.createElementVNode("div",{class:"picker-heading"},"常用颜色",-1)),e.createElementVNode("div",wa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ya),N=>(e.openBlock(),e.createElementBlock("button",{key:N,type:"button",class:e.normalizeClass(["preset-color-item",{active:N.toLowerCase()===E.value.toLowerCase()}]),style:e.normalizeStyle({background:N}),title:N,"aria-label":N,onClick:S=>A(N)},null,14,Va))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),ge=_(Na,[["__scopeId","data-v-db3c3d71"]]),Ca={class:"pd-field"},Sa={class:"pd-field"},$a={class:"pd-field"},Ma={class:"pd-radio-group",role:"radiogroup"},Ba={class:"pd-radio"},xa={class:"pd-radio"},Da={class:"pd-radio"},Ta={class:"pd-field"},za={class:"pd-radio-group",role:"radiogroup"},La={class:"pd-radio"},Pa={class:"pd-radio"},Ia={class:"pd-radio"},Aa={class:"color-row"},Ra={class:"pd-field"},Ua={class:"pd-field"},Fa={class:"pd-field"},Ha={class:"pd-field"},Oa={key:1,class:"pd-empty"},Ga=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t;function n(a){return l.searching?l.matchedKeys?.has(a)??!0:!0}const o=e.computed(()=>l.element.printElementType.type==="table");return(a,i)=>(e.openBlock(),e.createBlock(he,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[12]||(i[12]=e.withModifiers(()=>{},["prevent"]))},[t.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Ca,[i[13]||(i[13]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(te,{modelValue:t.element.options.fontSize,"onUpdate:modelValue":i[0]||(i[0]=r=>t.element.options.fontSize=r),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,n("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",Sa,[i[15]||(i[15]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":i[1]||(i[1]=r=>t.element.options.fontWeight=r),style:{width:"100%"}},[...i[14]||(i[14]=[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,n("ap-font-weight")]]),e.withDirectives(e.createElementVNode("div",$a,[i[19]||(i[19]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",Ma,[e.createElementVNode("label",Ba,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[2]||(i[2]=r=>t.element.options.textAlign=r),value:"left"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),i[16]||(i[16]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",xa,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[3]||(i[3]=r=>t.element.options.textAlign=r),value:"center"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),i[17]||(i[17]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Da,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[4]||(i[4]=r=>t.element.options.textAlign=r),value:"right"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),i[18]||(i[18]=e.createElementVNode("span",null,"右",-1))])])],512),[[e.vShow,n("ap-align")]]),e.withDirectives(e.createElementVNode("div",Ta,[i[23]||(i[23]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",za,[e.createElementVNode("label",La,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[5]||(i[5]=r=>t.element.options.verticalAlign=r),value:"top"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),i[20]||(i[20]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",Pa,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[6]||(i[6]=r=>t.element.options.verticalAlign=r),value:"middle"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),i[21]||(i[21]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Ia,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[7]||(i[7]=r=>t.element.options.verticalAlign=r),value:"bottom"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),i[22]||(i[22]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,n("ap-vertical-align")]]),e.createElementVNode("div",Aa,[e.withDirectives(e.createElementVNode("div",Ra,[i[24]||(i[24]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(ge,{modelValue:t.element.options.color,"onUpdate:modelValue":i[8]||(i[8]=r=>t.element.options.color=r)},null,8,["modelValue"])],512),[[e.vShow,n("ap-color")]]),e.withDirectives(e.createElementVNode("div",Ua,[i[25]||(i[25]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(ge,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":i[9]||(i[9]=r=>t.element.options.backgroundColor=r)},null,8,["modelValue"])],512),[[e.vShow,n("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",Fa,[i[26]||(i[26]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(te,{modelValue:t.element.options.lineHeight,"onUpdate:modelValue":i[10]||(i[10]=r=>t.element.options.lineHeight=r),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,n("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",Ha,[i[27]||(i[27]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(te,{modelValue:t.element.options.letterSpacing,"onUpdate:modelValue":i[11]||(i[11]=r=>t.element.options.letterSpacing=r),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,n("ap-letter-spacing")]])],64)):e.createCommentVNode("",!0),!t.isTextType&&!o.value?(e.openBlock(),e.createElementBlock("p",Oa,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),qa=_(Ga,[["__scopeId","data-v-2b604a48"]]),Wa={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},Ka={class:"pd-dialog-header"},Ya={class:"expression-editor"},Xa={class:"ee-nav"},ja={class:"ee-nav-tabs"},Ja={class:"ee-content"},Za={class:"ee-content-search"},Qa=["placeholder"],_a={class:"ee-content-list"},ei={class:"ee-field-group-icon"},ti=["onDblclick"],ni={class:"ee-field-info"},oi={class:"ee-item-label"},li={class:"ee-item-key"},ai={key:0,class:"pd-empty"},ii=["onDblclick"],ri={class:"ee-field-info"},si={class:"ee-item-label"},di={class:"ee-item-key"},ci={class:"ee-func-group"},ui=["onDblclick"],mi={class:"ee-field-info"},pi={class:"ee-item-label"},fi={class:"ee-item-key"},vi={class:"ee-func-group"},gi=["onDblclick"],hi={class:"ee-field-info"},bi={class:"ee-item-label"},yi={class:"ee-item-key"},ki={class:"ee-editor"},Ei={class:"ee-editor-section"},wi={class:"ee-editor-section"},Vi={class:"pd-dialog-footer"},Ni=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(t,{emit:l}){const n=t,o=l,a=e.computed({get:()=>n.modelValue,set:P=>o("update:modelValue",P)}),i=e.ref("field"),r=e.computed(()=>{switch(i.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),s=e.ref(""),d=e.computed(()=>At(It(n.fields??[]),s.value));e.watch(a,P=>{P&&(V.value=n.expression||"")});function u(P){const{insideParens:v}=y();Y(v?P.fieldKey:`{${P.fieldKey}}`)}function f(P){const{insideParens:v}=y();Y(v?P.template.replace(/^\{|\}$/g,""):P.template)}function m(P){const{insideBlock:v}=y(),g=v?P.template:`{${P.template}}`,M=g.indexOf("(")+1;Y(g,M)}function y(){const v=A.value?.selectionStart??V.value.length,g=V.value.substring(0,v);let M=!1;const x=g.lastIndexOf("{");x!==-1&&!g.slice(x+1).includes("}")&&(M=!0);let c=!1;const h=g.lastIndexOf("(");return h!==-1&&!g.slice(h+1).includes(")")&&(c=!0),{insideBlock:M,insideParens:c}}const B=e.computed(()=>{if(!s.value.trim())return L;const P=s.value.trim().toLowerCase();return L.filter(v=>v.label.toLowerCase().includes(P)||v.name.toLowerCase().includes(P))}),z=e.computed(()=>{if(!s.value.trim())return H;const P=s.value.trim().toLowerCase();return H.filter(v=>v.label.toLowerCase().includes(P)||v.name.toLowerCase().includes(P))}),E=e.computed(()=>{if(!s.value.trim())return W;const P=s.value.trim().toLowerCase();return W.filter(v=>v.label.toLowerCase().includes(P)||v.name.toLowerCase().includes(P))}),V=e.ref(n.expression||""),A=e.ref(null);e.watch(()=>n.expression,P=>{V.value=P||""});const H=[{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()"}],W=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],L=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],G=e.computed(()=>{if(!V.value.trim())return"(输入表达式后预览)";try{const P={...fe,pageIndex:1,totalPages:1,printDate:new Date().toISOString().split("T")[0],printTime:Date.now()},v=Ce(V.value,P);return v==null?"(无法计算)":String(v)}catch{return"(表达式错误)"}});function Y(P,v=P.length){const g=A.value;if(!g){V.value+=P;return}const M=g.selectionStart,x=g.selectionEnd,c=V.value.substring(0,M),h=V.value.substring(x);V.value=c+P+h;const T=M+v;e.nextTick(()=>{g.focus(),g.selectionStart=g.selectionEnd=T})}function J(){o("update:expression",V.value),a.value=!1}return(P,v)=>a.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:v[7]||(v[7]=e.withKeys(g=>a.value=!1,["esc"]))},[e.createElementVNode("section",Wa,[e.createElementVNode("header",Ka,[v[8]||(v[8]=e.createElementVNode("strong",{id:"expression-editor-title"},"编辑表达式",-1)),e.createElementVNode("button",{type:"button",class:"pd-close","aria-label":"关闭",onClick:v[0]||(v[0]=g=>a.value=!1)},"×")]),e.createElementVNode("div",Ya,[e.createElementVNode("div",Xa,[v[9]||(v[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",ja,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:i.value==="field"}]),onClick:v[1]||(v[1]=g=>i.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:i.value==="variable"}]),onClick:v[2]||(v[2]=g=>i.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:i.value==="function"}]),onClick:v[3]||(v[3]=g=>i.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",Ja,[e.createElementVNode("div",Za,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":v[4]||(v[4]=g=>s.value=g),placeholder:r.value},null,8,Qa),[[e.vModelText,s.value]])]),e.createElementVNode("div",_a,[i.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.key||"_top"},[g.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":g.isList}])},[e.createElementVNode("span",ei,e.toDisplayString(g.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(g.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.fields,M=>(e.openBlock(),e.createElementBlock("div",{key:M.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:g.key?"22px":"10px"}),onDblclick:x=>u(M)},[e.createElementVNode("div",ni,[e.createElementVNode("span",oi,e.toDisplayString(M.fieldLabel),1),e.createElementVNode("span",li,e.toDisplayString(M.fieldKey),1)])],44,ti))),128))],64))),128)),d.value.length===0?(e.openBlock(),e.createElementBlock("p",ai,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),i.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(B.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.name,class:"ee-list-item",onDblclick:M=>f(g)},[e.createElementVNode("div",ri,[e.createElementVNode("span",si,e.toDisplayString(g.label),1),e.createElementVNode("span",di,e.toDisplayString(g.template),1)])],40,ii))),128)):e.createCommentVNode("",!0),i.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",ci,[v[10]||(v[10]=e.createElementVNode("div",{class:"ee-func-group-title"},"聚合函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.name,class:"ee-list-item",onDblclick:M=>m(g)},[e.createElementVNode("div",mi,[e.createElementVNode("span",pi,e.toDisplayString(g.label),1),e.createElementVNode("span",fi,e.toDisplayString(g.name)+"()",1)])],40,ui))),128))]),e.createElementVNode("div",vi,[v[11]||(v[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.name,class:"ee-list-item",onDblclick:M=>m(g)},[e.createElementVNode("div",hi,[e.createElementVNode("span",bi,e.toDisplayString(g.label),1),e.createElementVNode("span",yi,e.toDisplayString(g.name)+"()",1)])],40,gi))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ki,[e.createElementVNode("div",Ei,[v[12]||(v[12]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:A,"onUpdate:modelValue":v[5]||(v[5]=g=>V.value=g),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,V.value]])]),e.createElementVNode("div",wi,[v[13]||(v[13]=e.createElementVNode("div",{class:"ee-editor-title"},"预览结果",-1)),e.createElementVNode("div",{class:e.normalizeClass(["ee-preview",{"ee-preview-error":G.value==="(表达式错误)"}])},e.toDisplayString(G.value),3)]),v[14]||(v[14]=e.createStaticVNode('<div class="ee-help-section" data-v-86008c29><div class="ee-help-title" data-v-86008c29>帮助信息</div><div class="ee-help-grid" data-v-86008c29><div class="ee-help-card ee-help-field" data-v-86008c29><div class="ee-help-card-title" data-v-86008c29>输入方式</div><div class="ee-help-card-content" data-v-86008c29> 双击左侧字段、变量、函数即可插入到表达式输入框中<br data-v-86008c29> 静态数据直接输入即可,如:供应商名称<br data-v-86008c29> 动态解析字段、变量、函数必须用 {} 包裹<br data-v-86008c29> 示例:{SUM(supplier.name)}<br data-v-86008c29> 注意:只能嵌套一层 </div></div><div class="ee-help-card ee-help-function" data-v-86008c29><div class="ee-help-card-title" data-v-86008c29>函数使用</div><div class="ee-help-card-content" data-v-86008c29> SUM(字段) - 求和<br data-v-86008c29> AVG(字段) - 平均值<br data-v-86008c29> COUNT(字段) - 计数<br data-v-86008c29> IF(条件, 真值, 假值) - 条件判断 </div></div><div class="ee-help-card ee-help-variable" data-v-86008c29><div class="ee-help-card-title" data-v-86008c29>系统变量</div><div class="ee-help-card-content" data-v-86008c29> {pageIndex} - 当前页码<br data-v-86008c29> {totalPages} - 总页数<br data-v-86008c29> {printDate} - 打印日期 </div></div><div class="ee-help-card ee-help-conditional" data-v-86008c29><div class="ee-help-card-title" data-v-86008c29>示例</div><div class="ee-help-card-content" data-v-86008c29> 静态文本:供应商名称<br data-v-86008c29> 动态字段:{supplier.name}<br data-v-86008c29> 函数调用:{SUM(amount)}<br data-v-86008c29> 条件判断:{IF(amount>1000, "大单", "小单")} </div></div></div></div>',1))])]),e.createElementVNode("footer",Vi,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:v[6]||(v[6]=g=>a.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:J},"确定")])])],32)):e.createCommentVNode("",!0)}}),st=_(Ni,[["__scopeId","data-v-86008c29"]]),Ci={class:"pd-field"},Si={class:"pd-label"},$i=["value","placeholder"],Mi=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(t,{emit:l}){const n=l,o=e.ref(!1);function a(){o.value=!0}return(i,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",Ci,[e.createElementVNode("span",Si,e.toDisplayString(t.descriptor.label),1),e.createElementVNode("input",{value:t.modelValue,class:"pd-input",placeholder:t.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:r[0]||(r[0]=s=>n("update:modelValue",s.target.value)),onDblclick:a},null,40,$i)]),e.createVNode(st,{modelValue:o.value,"onUpdate:modelValue":r[1]||(r[1]=s=>o.value=s),fields:t.fields,expression:t.modelValue,"onUpdate:expression":r[2]||(r[2]=s=>n("update:modelValue",s))},null,8,["modelValue","fields","expression"])],64))}}),Bi=_(Mi,[["__scopeId","data-v-135d160a"]]),xi={class:"pd-field"},Di=["value"],Ti=["value"],zi={class:"pd-field"},Li={class:"pd-field"},Pi={class:"pd-field"},Ii={class:"pd-field"},Ai={style:{width:"60px"}},Ri=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(t){const l=t,n=e.inject(xe,null),o=e.computed(()=>l.fields.filter(r=>r.fieldType==="list").map(r=>({label:r.fieldLabel,value:r.fieldKey})));function a(r){l.element.options.dataSource=r||void 0,n?.recordHistory()}function i(r,s){if(s===void 0)return;const d=l.element.options.tableColWidths,u=n?.maxTableWidth.value??1/0,f=d.reduce((m,y,B)=>B===r?m:m+y,0);if(f+s>u){const m=Math.max(5,Math.round((u-f)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${u}mm,列${r+1} 已调整为 ${m}mm`),d[r]=m}else d[r]=s;Re(l.element.options),n?.recordHistory()}return(r,s)=>(e.openBlock(),e.createBlock(he,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:s[4]||(s[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",xi,[s[5]||(s[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:t.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:s[0]||(s[0]=d=>a(d.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,d=>(e.openBlock(),e.createElementBlock("option",{key:d.value,value:d.value},e.toDisplayString(d.label),9,Ti))),128))],40,Di)]),e.createElementVNode("div",zi,[s[6]||(s[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(te,{modelValue:t.element.options.tableDefaultFontSize,"onUpdate:modelValue":s[1]||(s[1]=d=>t.element.options.tableDefaultFontSize=d),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Li,[s[7]||(s[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(ge,{modelValue:t.element.options.tableDefaultColor,"onUpdate:modelValue":s[2]||(s[2]=d=>t.element.options.tableDefaultColor=d)},null,8,["modelValue"])]),e.createElementVNode("div",Pi,[s[8]||(s[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(te,{modelValue:t.element.options.tableDefaultPadding,"onUpdate:modelValue":s[3]||(s[3]=d=>t.element.options.tableDefaultPadding=d),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Ii,[s[9]||(s[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.element.options.tableColWidths,(d,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:"col-width-row"},[e.createElementVNode("span",Ai,"列"+e.toDisplayString(u+1),1),e.createVNode(te,{"model-value":d,min:5,max:200,"onUpdate:modelValue":f=>i(u,f)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),Ui=_(Ri,[["__scopeId","data-v-2860c993"]]),Fi={class:"border-row"},Hi={class:"pd-field"},Oi={class:"pd-field"},Gi={class:"pd-field"},qi=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t;function n(o){return l.searching?l.matchedKeys?.has(o)??!0:!0}return(o,a)=>(e.openBlock(),e.createBlock(he,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[3]||(a[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Fi,[e.withDirectives(e.createElementVNode("div",Hi,[a[4]||(a[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(te,{modelValue:t.element.options.borderWidth,"onUpdate:modelValue":a[0]||(a[0]=i=>t.element.options.borderWidth=i),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,n("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",Oi,[a[5]||(a[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(ge,{modelValue:t.element.options.borderColor,"onUpdate:modelValue":a[1]||(a[1]=i=>t.element.options.borderColor=i)},null,8,["modelValue"])],512),[[e.vShow,n("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",Gi,[a[6]||(a[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(ge,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":a[2]||(a[2]=i=>t.element.options.backgroundColor=i)},null,8,["modelValue"])],512),[[e.vShow,n("bb-bg-color")]])],32)]),_:1}))}}),Wi=_(qi,[["__scopeId","data-v-84aa55dc"]]),Ki={class:"advanced-row"},Yi={class:"pd-field"},Xi={class:"pd-field"},ji={class:"pd-field"},Ji={class:"pd-field"},Zi=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(t){const l=t;function n(o){return l.searching?l.matchedKeys?.has(o)??!0:!0}return(o,a)=>(e.openBlock(),e.createBlock(he,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[4]||(a[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ki,[e.withDirectives(e.createElementVNode("div",Yi,[a[5]||(a[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":a[0]||(a[0]=i=>t.element.options.locked=i)},null,512),[[e.vModelCheckbox,t.element.options.locked]])],512),[[e.vShow,n("ad-locked")]]),e.withDirectives(e.createElementVNode("div",Xi,[a[6]||(a[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":a[1]||(a[1]=i=>t.element.options.fixed=i)},null,512),[[e.vModelCheckbox,t.element.options.fixed]])],512),[[e.vShow,n("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",ji,[a[7]||(a[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(te,{modelValue:t.element.options.zIndex,"onUpdate:modelValue":a[2]||(a[2]=i=>t.element.options.zIndex=i),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,n("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",Ji,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:a[3]||(a[3]=i=>o.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,n("ad-delete")]])],32)]),_:1}))}}),Qi=_(Zi,[["__scopeId","data-v-84bf7a55"]]),_i={key:0,class:"pd-field"},er=["checked"],tr={class:"pd-field"},nr=["checked"],or={class:"pd-field"},lr=["checked"],kt=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t,n=e.computed(()=>l.element.printElementType.type==="table"),o=e.computed({get:()=>l.element.options.tablePagination?.enabled??!0,set:()=>{}});function a(f){l.element.options.tablePagination={enabled:f}}const i=e.computed({get:()=>l.element.options.pagination?.pageable??!0,set:()=>{}}),r=e.computed({get:()=>l.element.options.pagination?.keepWithNext??!1,set:()=>{}});function s(f){l.element.options.pagination={pageable:f,keepWithNext:r.value}}function d(f){l.element.options.pagination={pageable:i.value,keepWithNext:f}}function u(f){return l.searching?l.matchedKeys?.has(f)??!0:!0}return(f,m)=>(e.openBlock(),e.createBlock(he,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:m[3]||(m[3]=e.withModifiers(()=>{},["prevent"]))},[n.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",_i,[m[4]||(m[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:o.value,onChange:m[0]||(m[0]=y=>a(y.target.checked))},null,40,er)],512)),[[e.vShow,u("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",tr,[m[5]||(m[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:i.value,onChange:m[1]||(m[1]=y=>s(y.target.checked))},null,40,nr)],512),[[e.vShow,u("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",or,[m[6]||(m[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:r.value,onChange:m[2]||(m[2]=y=>d(y.target.checked))},null,40,lr)],512),[[e.vShow,u("pg-keep-with-next")]])],64))],32)]),_:1}))}}),ar={class:"image-content-upload"},ir=["disabled"],rr=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(t,{emit:l}){const n=t,o=l,a=e.ref(!1),i=e.inject(rt,e.computed(()=>{})),r=e.computed(()=>n.disabled||a.value||!i.value);async function s(d){const u=d.target,f=u.files?.[0];if(f){if(!f.type.startsWith("image/")){alert("仅支持上传图片文件"),u.value="";return}if(!i.value){alert("图片上传能力未配置"),u.value="";return}a.value=!0;try{const m=await i.value(f);m?o("success",m):alert("图片上传失败")}catch(m){alert(m instanceof Error?m.message:"图片上传失败")}finally{a.value=!1,u.value=""}}}return(d,u)=>(e.openBlock(),e.createElementBlock("div",ar,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:r.value}])},[u[0]||(u[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(a.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:r.value,onChange:s},null,40,ir)],2),u[1]||(u[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),sr=_(rr,[["__scopeId","data-v-b730e8e6"]]),dr={class:"pd-field"},cr=["value"],ur={class:"pd-field"},mr={key:0,class:"pd-field"},pr=["checked"],fr=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(t){const l=t,n=e.inject(xe),o=e.computed(()=>l.element.options.tableRows[l.selection.r1]);function a(s){const d=Ze(l.element.options.tableRows,l.selection.r1,s);if(d){alert(d);return}n.recordHistory()}function i(s){s!==void 0&&(o.value.height=s,Re(l.element.options),n.recordHistory())}function r(s){o.value.repeatOnPage=s,n.recordHistory()}return(s,d)=>(e.openBlock(),e.createBlock(he,{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",dr,[d[4]||(d[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:o.value.type,class:"pd-select",style:{width:"100%"},onChange:d[0]||(d[0]=u=>a(u.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,cr)]),e.createElementVNode("div",ur,[d[5]||(d[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(te,{"model-value":o.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":i},null,8,["model-value"])]),o.value.type==="header"?(e.openBlock(),e.createElementBlock("div",mr,[d[6]||(d[6]=e.createElementVNode("span",{class:"pd-label"},"每页顶部重复",-1)),e.createElementVNode("input",{checked:o.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:d[1]||(d[1]=u=>r(!!u.target.checked))},null,40,pr)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),vr={class:"pd-field"},gr={class:"pd-radio-group",role:"radiogroup"},hr={class:"pd-radio"},br=["checked"],yr={class:"pd-radio"},kr=["checked"],Er={class:"pd-radio"},wr=["checked"],Vr={class:"pd-radio"},Nr=["checked"],Cr={key:0,class:"pd-field"},Sr=["value"],$r={key:1,class:"pd-field"},Mr=["checked"],Br={key:2,class:"pd-field"},xr=["value"],Dr={key:3,class:"pd-field"},Tr=["value"],zr={key:4,class:"pd-field"},Lr={key:5,class:"pd-field"},Pr={class:"pd-field"},Ir=["value"],Ar={class:"pd-field"},Rr={class:"pd-radio-group",role:"radiogroup"},Ur={class:"pd-radio"},Fr=["checked"],Hr={class:"pd-radio"},Or=["checked"],Gr={class:"pd-radio"},qr=["checked"],Wr={class:"pd-field"},Kr={class:"pd-radio-group",role:"radiogroup"},Yr={class:"pd-radio"},Xr=["checked"],jr={class:"pd-radio"},Jr=["checked"],Zr={class:"pd-radio"},Qr=["checked"],_r={class:"cell-style-grid"},es={class:"pd-field"},ts=["value"],ns={class:"pd-field"},os={class:"pd-field"},ls=["checked"],as={class:"pd-field"},is={class:"pd-field"},rs={class:"border-style-row"},ss={style:{width:"112px","flex-shrink":"0"}},ds={class:"pd-button-group border-presets"},cs={class:"pd-checkbox-group"},us={class:"pd-checkbox"},ms={class:"pd-checkbox"},ps={class:"pd-checkbox"},fs={class:"pd-checkbox"},vs={class:"pd-field"},gs={class:"pd-field"},hs=["checked"],bs={class:"merge-btns"},ys=["disabled","title"],ks=["disabled"],Es=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(t,{expose:l}){const n=t,o=e.inject(xe),a=e.computed(()=>n.element.options.tableRows),i=e.computed(()=>{const x=at(a.value,n.selection.r1,n.selection.c1);return a.value[x.r].cells[x.c]}),r=e.ref(!1),s=e.ref(""),d=e.computed(()=>i.value.cellType==="barcode"),u=e.computed(()=>i.value.cellType==="qrcode"),f=e.computed(()=>i.value.cellType==="image");function m(x){V(c=>{c.align=x})}function y(x){V(c=>{c.valign=x})}function B(x){V(c=>{c.cellType=x==="text"?void 0:x,x!=="barcode"&&(c.barcodeType=void 0,c.showBarcodeText=void 0),x!=="qrcode"&&(c.qrCodeLevel=void 0)})}function z(){s.value=i.value.formatter||"",r.value=!0}function E(x){V(c=>{c.formatter=x||void 0})}function V(x){const c=n.selection;for(let h=c.r1;h<=c.r2;h++)for(let T=c.c1;T<=c.c2;T++){const O=a.value[h].cells[T];O.merged||x(O)}o.recordHistory()}const A=e.ref("solid"),H=e.ref(.75),W=e.ref("#333333"),L=e.ref([]);function G(){return{width:H.value,style:A.value,color:W.value}}function Y(x){sn(a.value,n.selection,x,G()),o.recordHistory()}function J(x){const c=x.target,h=new Set(L.value);c.checked?h.add(c.value):h.delete(c.value),L.value=[...h];const T=G();V(O=>{const X={...O.borders??{}};for(const oe of["top","right","bottom","left"])h.has(oe)?X[oe]={...T}:delete X[oe];O.borders=X})}const P=e.computed(()=>St(a.value,n.selection)),v=e.computed(()=>{const x=n.selection;for(let c=x.r1;c<=x.r2;c++)for(let h=x.c1;h<=x.c2;h++){const T=a.value[c].cells[h];if(!T.merged&&((T.rowspan??1)>1||(T.colspan??1)>1))return!0}return!1});function g(){$t(a.value,n.selection),o.recordHistory()}function M(){Mt(a.value,n.selection),o.recordHistory()}return l({openFormatterEditor:z}),(x,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(he,{title:"单元格",icon:"Menu","default-expanded":"","group-key":"table-cell"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:c[39]||(c[39]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",vr,[c[45]||(c[45]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",gr,[e.createElementVNode("label",hr,[e.createElementVNode("input",{type:"radio",value:"text",checked:(i.value.cellType||"text")==="text",onChange:c[0]||(c[0]=h=>B(h.target.value))},null,40,br),c[41]||(c[41]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",yr,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:i.value.cellType==="barcode",onChange:c[1]||(c[1]=h=>B(h.target.value))},null,40,kr),c[42]||(c[42]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",Er,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:i.value.cellType==="qrcode",onChange:c[2]||(c[2]=h=>B(h.target.value))},null,40,wr),c[43]||(c[43]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",Vr,[e.createElementVNode("input",{type:"radio",value:"image",checked:i.value.cellType==="image",onChange:c[3]||(c[3]=h=>B(h.target.value))},null,40,Nr),c[44]||(c[44]=e.createElementVNode("span",null,"图片",-1))])])]),d.value?(e.openBlock(),e.createElementBlock("div",Cr,[c[47]||(c[47]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:i.value.barcodeType||"CODE128",class:"pd-select",onChange:c[4]||(c[4]=h=>V(T=>{T.barcodeType=h.target.value||void 0}))},[...c[46]||(c[46]=[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,Sr)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",$r,[c[48]||(c[48]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:i.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:c[5]||(c[5]=h=>V(T=>{T.showBarcodeText=!!h.target.checked}))},null,40,Mr)])):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",Br,[c[50]||(c[50]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:i.value.qrCodeLevel||"M",class:"pd-select",onChange:c[6]||(c[6]=h=>V(T=>{T.qrCodeLevel=h.target.value||void 0}))},[...c[49]||(c[49]=[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,xr)])):e.createCommentVNode("",!0),d.value||u.value||f.value?(e.openBlock(),e.createElementBlock("div",Dr,[c[52]||(c[52]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:i.value.fit||"contain",class:"pd-select",onChange:c[7]||(c[7]=h=>V(T=>{T.fit=h.target.value}))},[...c[51]||(c[51]=[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,Tr)])):e.createCommentVNode("",!0),d.value||u.value||f.value?(e.openBlock(),e.createElementBlock("div",zr,[c[53]||(c[53]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(te,{"model-value":i.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":c[8]||(c[8]=h=>V(T=>{T.maxWidth=h??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value||u.value||f.value?(e.openBlock(),e.createElementBlock("div",Lr,[c[54]||(c[54]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(te,{"model-value":i.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":c[9]||(c[9]=h=>V(T=>{T.maxHeight=h??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Pr,[c[55]||(c[55]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:i.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:c[10]||(c[10]=h=>V(T=>{T.formatter=h.target.value||void 0})),onDblclick:z},null,40,Ir)]),e.createElementVNode("div",Ar,[c[59]||(c[59]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",Rr,[e.createElementVNode("label",Ur,[e.createElementVNode("input",{type:"radio",value:"left",checked:i.value.align==="left",onChange:c[11]||(c[11]=h=>m(h.target.value))},null,40,Fr),c[56]||(c[56]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",Hr,[e.createElementVNode("input",{type:"radio",value:"center",checked:i.value.align==="center",onChange:c[12]||(c[12]=h=>m(h.target.value))},null,40,Or),c[57]||(c[57]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Gr,[e.createElementVNode("input",{type:"radio",value:"right",checked:i.value.align==="right",onChange:c[13]||(c[13]=h=>m(h.target.value))},null,40,qr),c[58]||(c[58]=e.createElementVNode("span",null,"右",-1))])])]),e.createElementVNode("div",Wr,[c[63]||(c[63]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",Kr,[e.createElementVNode("label",Yr,[e.createElementVNode("input",{type:"radio",value:"top",checked:i.value.valign==="top",onChange:c[14]||(c[14]=h=>y(h.target.value))},null,40,Xr),c[60]||(c[60]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",jr,[e.createElementVNode("input",{type:"radio",value:"middle",checked:i.value.valign==="middle",onChange:c[15]||(c[15]=h=>y(h.target.value))},null,40,Jr),c[61]||(c[61]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Zr,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:i.value.valign==="bottom",onChange:c[16]||(c[16]=h=>y(h.target.value))},null,40,Qr),c[62]||(c[62]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",_r,[e.createElementVNode("div",es,[c[65]||(c[65]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createElementVNode("select",{value:i.value.fontFamily,class:"pd-select",placeholder:"继承默认",onChange:c[17]||(c[17]=h=>V(T=>{T.fontFamily=h.target.value||void 0}))},[...c[64]||(c[64]=[e.createElementVNode("option",{value:"SimSun"},"宋体",-1),e.createElementVNode("option",{value:"SimHei"},"黑体",-1),e.createElementVNode("option",{value:"Microsoft YaHei"},"微软雅黑",-1),e.createElementVNode("option",{value:"KaiTi"},"楷体",-1),e.createElementVNode("option",{value:"FangSong"},"仿宋",-1),e.createElementVNode("option",{value:"Arial"},"Arial",-1)])],40,ts)]),e.createElementVNode("div",ns,[c[66]||(c[66]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(te,{"model-value":i.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":c[18]||(c[18]=h=>V(T=>{T.fontSize=h??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",os,[c[67]||(c[67]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:i.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:c[19]||(c[19]=h=>V(T=>{T.fontWeight=h.target.checked?"bold":void 0}))},null,40,ls)]),e.createElementVNode("div",as,[c[68]||(c[68]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(ge,{"model-value":i.value.color,"onUpdate:modelValue":c[20]||(c[20]=h=>V(T=>{T.color=h}))},null,8,["model-value"])]),e.createElementVNode("div",is,[c[69]||(c[69]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(ge,{"model-value":i.value.backgroundColor,"onUpdate:modelValue":c[21]||(c[21]=h=>V(T=>{T.backgroundColor=h}))},null,8,["model-value"])])]),c[77]||(c[77]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",rs,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":c[22]||(c[22]=h=>A.value=h),style:{width:"90px"}},[...c[70]||(c[70]=[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,A.value]]),e.createElementVNode("div",ss,[e.createVNode(te,{modelValue:H.value,"onUpdate:modelValue":c[23]||(c[23]=h=>H.value=h),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(ge,{modelValue:W.value,"onUpdate:modelValue":c[24]||(c[24]=h=>W.value=h)},null,8,["modelValue"])]),e.createElementVNode("div",ds,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[25]||(c[25]=h=>Y("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[26]||(c[26]=h=>Y("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[27]||(c[27]=h=>Y("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[28]||(c[28]=h=>Y("none"))},"无")]),e.createElementVNode("div",cs,[e.createElementVNode("label",us,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c[29]||(c[29]=h=>L.value=h),value:"top",onChange:c[30]||(c[30]=h=>J(h))},null,544),[[e.vModelCheckbox,L.value]]),c[71]||(c[71]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",ms,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c[31]||(c[31]=h=>L.value=h),value:"right",onChange:c[32]||(c[32]=h=>J(h))},null,544),[[e.vModelCheckbox,L.value]]),c[72]||(c[72]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",ps,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c[33]||(c[33]=h=>L.value=h),value:"bottom",onChange:c[34]||(c[34]=h=>J(h))},null,544),[[e.vModelCheckbox,L.value]]),c[73]||(c[73]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",fs,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c[35]||(c[35]=h=>L.value=h),value:"left",onChange:c[36]||(c[36]=h=>J(h))},null,544),[[e.vModelCheckbox,L.value]]),c[74]||(c[74]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",vs,[c[75]||(c[75]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(te,{"model-value":i.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":c[37]||(c[37]=h=>V(T=>{T.padding=h??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",gs,[c[76]||(c[76]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:i.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:c[38]||(c[38]=h=>V(T=>{T.wordWrap=!!h.target.checked}))},null,40,hs)]),e.createElementVNode("div",bs,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!P.value,title:P.value||"",onClick:g}," 合并单元格 ",8,ys),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!v.value,onClick:M},"拆分单元格",8,ks)])],32)]),_:1}),e.createVNode(st,{modelValue:r.value,"onUpdate:modelValue":c[40]||(c[40]=h=>r.value=h),fields:t.fields,expression:s.value,"onUpdate:expression":E},null,8,["modelValue","fields","expression"])],64))}}),ws=_(Es,[["__scopeId","data-v-e9669bd2"]]),Vs={text:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],longText:[{targetPath:"options.formatter",label:"内容",dataSource:"main"},{targetPath:"options.styler",label:"样式",dataSource:"main"}],barcode:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],qrcode:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],image:[{targetPath:"options.src",label:"内容",dataSource:"main",placeholder:"输入图片路径,支持 /docfiles/... 相对路径、绝对 URL 或 {字段} 表达式"}],table:[]};function Rt(t,l,n,o){return t==="data"?[{targetPath:`options.tableRows[${l}].cells[${n}].formatter`,label:"内容",dataSource:"list",listField:o,placeholder:"{name}"}]:t==="subtotal"?[{targetPath:`options.tableRows[${l}].cells[${n}].formatter`,label:"内容",dataSource:"subtotal",placeholder:"{MONEY(SUM(amount))}"}]:t==="summary"?[{targetPath:`options.tableRows[${l}].cells[${n}].formatter`,label:"内容",dataSource:"summary",placeholder:"{MONEY(SUM(amount))}"}]:[{targetPath:`options.tableRows[${l}].cells[${n}].formatter`,label:"内容",dataSource:"main",placeholder:"合计: {order.total}"}]}function Ns(t){const l=t.printElementType.type,n=Vs[l]??[],o=[];if(l==="table"){const a=t.options.dataSource;for(const[i,r]of(t.options.tableRows??[]).entries())for(const[s,d]of r.cells.entries())d.merged||o.push(...Rt(r.type,i,s,a))}return[...n,...o]}const Cs={key:0,class:"prop-collapsed"},Ss={class:"prop-head"},$s={class:"pd-tabs prop-tabs"},Ms={class:"pd-tab-bar",role:"tablist"},Bs={class:"pd-tab-pane",role:"tabpanel"},xs={class:"property-content"},Ds={key:1,class:"pd-empty"},Ts={class:"pd-tab-pane",role:"tabpanel"},zs={class:"pd-field"},Ls=["value"],Ps=["value"],Is={key:0,class:"pd-field"},As={class:"custom-size-grid"},Rs={class:"pd-field"},Us={class:"pd-radio-group",role:"radiogroup"},Fs={class:"pd-radio"},Hs=["checked"],Os={class:"pd-radio"},Gs=["checked"],qs={class:"pd-field"},Ws={class:"page-bg-row"},Ks={class:"margin-grid"},Ys={class:"pd-field"},Xs={class:"pd-field"},js={class:"pd-field"},Js={class:"pd-field"},Zs={class:"pd-field"},Qs={class:"pd-field"},_s={class:"pd-field"},ed=e.defineComponent({__name:"PropertyPanel",props:{element:{},templateData:{},fields:{},activeTab:{},tableSelection:{},recordHistory:{type:Function},collapsed:{type:Boolean}},emits:["delete-element","update:templateData","update:activeTab","toggle-collapse"],setup(t,{emit:l}){const n=t,o=l,a=Qe,i=e.ref(""),r=e.computed(()=>n.element?["text","longText"].includes(n.element.printElementType.type):!1),s=e.computed(()=>n.element?n.element.printElementType.type==="image":!1),d=e.computed(()=>!n.element||n.element.printElementType.type!=="table"?!1:!!n.tableSelection&&n.tableSelection.elementId===n.element.id),u=e.computed(()=>n.element?n.element.printElementType.type==="table":!1),f=e.computed(()=>Ql(i.value)),m=e.computed(()=>f.value.groups),y=e.computed(()=>f.value.itemKeys),B=e.computed(()=>!!i.value.trim()),z=e.computed(()=>{if(!n.element)return[];if(n.element.printElementType.type==="table"&&n.tableSelection){const{r1:w,c1:k}=n.tableSelection,q=n.element.options.tableRows;if(q&&q[w]){const Z=q[w],de=n.element.options.fields?.[0]?.dataSource;return Rt(Z.type,w,k,de)}}return Ns(n.element)});function E(w){return w.split(".").flatMap(k=>{const q=k.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!q)return[k];const Z=q[1],de=[...q[2].matchAll(/\[(\d+)\]/g)].map(pe=>Number(pe[1]));return[Z,...de]})}function V(w){return n.element?E(w).reduce((Z,de)=>Z==null?"":Z[de],n.element)??"":""}function A(w,k){if(!n.element)return;const q=E(w),Z=q.pop(),de=q.reduce((pe,be)=>((pe[be]===void 0||pe[be]===null)&&(pe[be]={}),pe[be]),n.element);de[Z]=k||void 0,n.recordHistory?.()}function H(w){i.value=w}function W(w){n.element&&A("options.src",w)}const L=e.computed(()=>n.templateData?.paperSize||"A4"),G=e.computed(()=>n.templateData?.orientation||"portrait"),Y=e.computed({get:()=>n.templateData?.pageBackground||"#ffffff",set:w=>ie(w)}),J=e.computed(()=>n.templateData?.margins.top??10),P=e.computed(()=>n.templateData?.margins.bottom??10),v=e.computed(()=>n.templateData?.margins.left??10),g=e.computed(()=>n.templateData?.margins.right??10),M=e.computed(()=>n.templateData?.header.height??10),x=e.computed(()=>n.templateData?.footer.height??10),c=e.computed(()=>n.templateData?.firstPageOverlay.height??0),h=e.computed(()=>n.templateData?.customWidth??210),T=e.computed(()=>n.templateData?.customHeight??297);function O(w){n.templateData&&o("update:templateData",{...n.templateData,...w})}function X(w){if(w==="CUSTOM"){O({paperSize:"CUSTOM"});return}a[w]&&O({paperSize:w})}function oe(w){O({orientation:String(w)})}function ie(w){const k=w&&w.toLowerCase()!=="#ffffff"&&w.toLowerCase()!=="#fff"?w:void 0;O(k===void 0?{pageBackground:void 0}:{pageBackground:k})}function re(){O({pageBackground:void 0})}function se(w){w!==void 0&&O({customWidth:w})}function ae(w){w!==void 0&&O({customHeight:w})}function p(w){w!==void 0&&O({margins:{...n.templateData.margins,top:w}})}function b(w){w!==void 0&&O({margins:{...n.templateData.margins,bottom:w}})}function N(w){w!==void 0&&O({margins:{...n.templateData.margins,left:w}})}function S(w){w!==void 0&&O({margins:{...n.templateData.margins,right:w}})}function U(w){w!==void 0&&O({header:{...n.templateData.header,height:w}})}function K(w){w!==void 0&&O({footer:{...n.templateData.footer,height:w}})}function C(w){w!==void 0&&O({firstPageOverlay:{...n.templateData.firstPageOverlay,height:w}})}const $=e.computed(()=>n.activeTab||"page");function D(w){o("update:activeTab",w),o("toggle-collapse")}return(w,k)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",Cs,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:k[0]||(k[0]=q=>D($.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:$.value==="element"}]),title:"元素属性",onClick:k[1]||(k[1]=q=>D("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:$.value==="page"}]),title:"页面属性",onClick:k[2]||(k[2]=q=>D("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Ss,[k[12]||(k[12]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:k[3]||(k[3]=q=>w.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",$s,[e.createElementVNode("div",Ms,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="element"}]),onClick:k[4]||(k[4]=q=>w.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="page"}]),onClick:k[5]||(k[5]=q=>w.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",Bs,[t.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(ta,{onSearch:H}),e.createElementVNode("div",xs,[m.value.includes("position-size")&&!d.value?(e.openBlock(),e.createBlock(ba,{key:0,element:t.element,"matched-keys":y.value,searching:B.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),m.value.includes("appearance")?(e.openBlock(),e.createBlock(qa,{key:1,element:t.element,"is-text-type":r.value,"matched-keys":y.value,searching:B.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),m.value.includes("binding")?(e.openBlock(),e.createBlock(he,{key:2,title:"内容",icon:"Document","default-expanded":"","group-key":"binding"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,q=>(e.openBlock(),e.createBlock(Bi,{key:q.targetPath,descriptor:q,fields:t.fields,"model-value":V(q.targetPath),"onUpdate:modelValue":Z=>A(q.targetPath,Z)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),s.value?(e.openBlock(),e.createBlock(sr,{key:0,onSuccess:W})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),u.value&&t.tableSelection&&t.tableSelection.elementId===t.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createVNode(fr,{element:t.element,selection:t.tableSelection},null,8,["element","selection"]),e.createVNode(ws,{element:t.element,selection:t.tableSelection,fields:t.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),u.value&&m.value.includes("content")?(e.openBlock(),e.createBlock(Ui,{key:4,element:t.element,fields:t.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),m.value.includes("border-bg")?(e.openBlock(),e.createBlock(Wi,{key:5,element:t.element,"matched-keys":y.value,searching:B.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),m.value.includes("pagination")&&u.value?(e.openBlock(),e.createBlock(kt,{key:6,element:t.element,"matched-keys":y.value,searching:B.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),m.value.includes("pagination")&&!u.value?(e.openBlock(),e.createBlock(kt,{key:7,element:t.element,"matched-keys":y.value,searching:B.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),m.value.includes("advanced")?(e.openBlock(),e.createBlock(Qi,{key:8,element:t.element,"matched-keys":y.value,searching:B.value,onDeleteElement:k[6]||(k[6]=q=>w.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",Ds,"请在画布中选择一个元素"))],512),[[e.vShow,(t.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",Ts,[e.createElementVNode("form",{class:"pd-form",onSubmit:k[11]||(k[11]=e.withModifiers(()=>{},["prevent"]))},[k[28]||(k[28]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",zs,[k[14]||(k[14]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:L.value,class:"pd-select",onChange:k[7]||(k[7]=q=>X(q.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),(q,Z)=>(e.openBlock(),e.createElementBlock("option",{key:Z,value:Z},e.toDisplayString(Z),9,Ps))),128)),k[13]||(k[13]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,Ls)]),L.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",Is,[k[16]||(k[16]=e.createElementVNode("span",{class:"pd-label"},"自定义宽高 (mm)",-1)),e.createElementVNode("div",As,[e.createVNode(te,{"model-value":h.value,min:25,max:2e3,"onUpdate:modelValue":se},null,8,["model-value"]),k[15]||(k[15]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(te,{"model-value":T.value,min:25,max:2e3,"onUpdate:modelValue":ae},null,8,["model-value"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",Rs,[k[19]||(k[19]=e.createElementVNode("span",{class:"pd-label"},"方向",-1)),e.createElementVNode("div",Us,[e.createElementVNode("label",Fs,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:G.value==="portrait",onChange:k[8]||(k[8]=q=>oe(q.target.value))},null,40,Hs),k[17]||(k[17]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",Os,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:G.value==="landscape",onChange:k[9]||(k[9]=q=>oe(q.target.value))},null,40,Gs),k[18]||(k[18]=e.createElementVNode("span",null,"横向",-1))])])]),e.createElementVNode("div",qs,[k[20]||(k[20]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",Ws,[e.createVNode(ge,{modelValue:Y.value,"onUpdate:modelValue":k[10]||(k[10]=q=>Y.value=q),class:"page-bg-picker"},null,8,["modelValue"]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:re},"默认")])]),k[29]||(k[29]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),e.createElementVNode("div",Ks,[e.createElementVNode("div",Ys,[k[21]||(k[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(te,{"model-value":J.value,min:0,max:50,"onUpdate:modelValue":p},null,8,["model-value"])]),e.createElementVNode("div",Xs,[k[22]||(k[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(te,{"model-value":P.value,min:0,max:50,"onUpdate:modelValue":b},null,8,["model-value"])]),e.createElementVNode("div",js,[k[23]||(k[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(te,{"model-value":v.value,min:0,max:50,"onUpdate:modelValue":N},null,8,["model-value"])]),e.createElementVNode("div",Js,[k[24]||(k[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(te,{"model-value":g.value,min:0,max:50,"onUpdate:modelValue":S},null,8,["model-value"])])]),k[30]||(k[30]=e.createElementVNode("h3",{class:"pd-divider"},"三区高度 (mm)",-1)),e.createElementVNode("div",Zs,[k[25]||(k[25]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(te,{"model-value":M.value,min:0,max:100,step:.1,"onUpdate:modelValue":U},null,8,["model-value"])]),e.createElementVNode("div",Qs,[k[26]||(k[26]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(te,{"model-value":x.value,min:0,max:100,step:.1,"onUpdate:modelValue":K},null,8,["model-value"])]),e.createElementVNode("div",_s,[k[27]||(k[27]=e.createElementVNode("span",{class:"pd-label"},"首页叠加高度",-1)),e.createVNode(te,{"model-value":c.value,min:0,max:200,"onUpdate:modelValue":C},null,8,["model-value"])])],32)],512),[[e.vShow,(t.activeTab||"page")==="page"]])])],64))],2))}}),td=_(ed,[["__scopeId","data-v-93072c2b"]]),nd={class:"status-bar"},od={key:0,class:"status-item coord"},ld={class:"status-item"},ad={class:"status-item"},id={class:"status-item status-paper"},rd=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(t){return(l,n)=>(e.openBlock(),e.createElementBlock("div",nd,[t.coordinate?(e.openBlock(),e.createElementBlock("span",od," x:"+e.toDisplayString(t.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(t.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",ld,"缩放 "+e.toDisplayString(t.scale)+"%",1),e.createElementVNode("span",ad,"元素 "+e.toDisplayString(t.elementCount)+e.toDisplayString(t.selectedCount?` (选中 ${t.selectedCount})`:""),1),e.createElementVNode("span",{class:e.normalizeClass(["status-dirty",{on:t.dirty}])},[n[0]||(n[0]=e.createElementVNode("span",{class:"dirty-dot"},null,-1)),e.createTextVNode(e.toDisplayString(t.dirty?"未保存":"已保存"),1)],2),e.createElementVNode("span",id,e.toDisplayString(t.paper),1)]))}}),sd=_(rd,[["__scopeId","data-v-eb34e9a7"]]),Et="print-studio:left",wt="print-studio:right";function Vt(t,l){try{const n=localStorage.getItem(t);return n===null?l:n==="1"}catch{return l}}function dd(){const t=e.ref(Vt(Et,!1)),l=e.ref(Vt(wt,!1)),n=e.ref(!1);e.watch(t,r=>{try{localStorage.setItem(Et,r?"1":"0")}catch{}},{flush:"sync"}),e.watch(l,r=>{try{localStorage.setItem(wt,r?"1":"0")}catch{}},{flush:"sync"});function o(){t.value=!t.value}function a(){l.value=!l.value}function i(){n.value=!1}return{leftCollapsed:t,rightCollapsed:l,toggleLeft:o,toggleRight:a,dirty:n,markSaved:i}}const cd={class:"designer-container"},ud={class:"designer-body"},md=e.defineComponent({__name:"PrintDesigner",props:{initialTemplate:{},initialElements:{},fields:{},isEdit:{type:Boolean},requestScreenshot:{type:Function},uploadImage:{type:Function},loadDefaultTemplate:{type:Function}},emits:["preview","save"],setup(t,{expose:l,emit:n}){const o=t,a=n,{leftCollapsed:i,rightCollapsed:r,toggleLeft:s,toggleRight:d,dirty:u,markSaved:f}=dd(),{scale:m,showGrid:y,snapToGrid:B,showTableGhostBorder:z,templateData:E,elements:V,fields:A,selectedIds:H,selectedElement:W,select:L,clearSelection:G,selectAll:Y,previewIds:J,setPreview:P,commitPreview:v,hasClipboard:g,copy:M,paste:x,cutSelected:c,canUndo:h,canRedo:T,undo:O,redo:X,alignSelected:oe,groupSelected:ie,ungroupSelected:re,deleteSelected:se,dragStart:ae,dragStop:p,addElement:b,addFieldElement:N,moveLayer:S,updateTemplateData:U,fitToWindow:K,getTemplateJson:C,loadTemplate:$,tableSelection:D,setTableSelection:w,recordHistory:k}=Ln({initialTemplate:o.initialTemplate,initialElements:o.initialElements,initialFields:o.fields});e.watch([V,E],()=>{u.value=!0},{deep:!0});const{guides:q,addGuide:Z,moveGuide:de,removeGuide:pe}=In(E,k),be=e.computed(()=>{const I=E.value,{width:R}=Se(I);return R-I.margins.left-I.margins.right});e.provide(xe,{tableSelection:D,setTableSelection:w,recordHistory:k,maxTableWidth:be}),e.provide(zt,H),e.provide(Lt,J),e.provide(rt,e.computed(()=>o.uploadImage)),e.watch(W,I=>{(!I||I.printElementType.type!=="table")&&w(null)});const $e=e.ref(null),ye=e.ref(!1),Ee=e.ref(""),He=e.ref(.5);async function Oe(){if(ye.value){ye.value=!1;return}const I=C();if(!I){alert("模板数据为空");return}if(!o.requestScreenshot){alert("截图服务未配置");return}try{const R=await o.requestScreenshot({templateJson:I,printData:fe});Ee.value&&URL.revokeObjectURL(Ee.value),Ee.value=URL.createObjectURL(R),ye.value=!0}catch{alert("截图生成失败")}}const De=e.ref(null);function Ge(I){De.value=I}const qe=e.computed(()=>{const I=E.value,R=Se(I),ne=I.orientation==="landscape"?"横向":"纵向";return`${I.paperSize} ${ne} ${Math.round(R.width)}×${Math.round(R.height)}mm`});function F(){const I=$e.value?.$el;I&&K(I.clientWidth,I.clientHeight)}function Q(I){m.value=Math.min(200,Math.max(50,m.value+I))}function j(I){const R=I.target.tagName;R==="INPUT"||R==="TEXTAREA"||R==="SELECT"||(I.ctrlKey||I.metaKey)&&I.key==="0"&&(I.preventDefault(),F())}e.onMounted(()=>document.addEventListener("keydown",j)),e.onUnmounted(()=>document.removeEventListener("keydown",j));function ee(I){const R=E.value.header.height,ne=E.value.footer.height;U(I),I.header.height<R&&ue("header"),I.footer.height<ne&&ue("footer")}function ve(I,R){E.value={...E.value,[I]:{...E.value[I],height:R}}}function le(I){U({...E.value}),ue(I)}function ue(I){const R=Fe(E.value)[I];V.value.some(me=>me.zone===I&&(me.options.top+me.options.height>R.height||me.options.left+me.options.width>R.width))&&alert(`${I==="header"?"页眉":"页脚"}高度已小于区域内元素,请手动调整元素位置`)}function we(){const I=E.value.firstPageOverlay,R={options:{left:0,top:0,width:50,height:10,title:"首页叠加"},printElementType:{type:"text",title:"首页叠加"}};E.value={...E.value,firstPageOverlay:{...I,elements:[...I.elements,R]}}}const dt=L;function Ot(I){const R=V.value.find(ne=>ne.id===I);R&&(R.options.visible=R.options.visible===!1)}function Gt(I){const R=V.value.find(ne=>ne.id===I);R&&(R.options.locked=!R.options.locked)}const Me=e.ref("page");e.watch(W,I=>{Me.value=I?"element":"page"});const qt={text:"formatter",longText:"formatter",barcode:"formatter",qrcode:"formatter",image:"src"},Be=e.ref(!1),Te=e.ref(null),We=e.ref("");function Wt(I){const R=V.value.find(me=>me.id===I);if(!R||(L(I,!1),Me.value="element",R.options.locked))return;const ne=qt[R.printElementType.type];ne&&(Te.value={kind:"element",element:R,field:ne},We.value=R.options[ne]||"",Be.value=!0)}function Kt(I,R,ne){const me=V.value.find(Zt=>Zt.id===I);if(!me||(L(I,!1),Me.value="element",me.options.locked))return;const ct=me.options.tableRows??[],ut=at(ct,R,ne),Ke=ct[ut.r]?.cells[ut.c];Ke&&(Te.value={kind:"cell",cell:Ke},We.value=Ke.formatter||"",Be.value=!0)}function Yt(I){const R=Te.value;R?.kind==="element"?R.element.options[R.field]=I||void 0:R?.kind==="cell"&&(R.cell.formatter=I||void 0),k(),Be.value=!1,Te.value=null}function Xt(I,R){V.value.push(I),L(I.id,!1),k()}e.watch(()=>o.initialTemplate,I=>{I&&$(I,o.initialElements)}),e.watch(()=>o.initialElements,I=>{I&&!o.initialTemplate&&(E.value={...E.value,elements:I.map(R=>({...R,options:{...R.options},printElementType:{...R.printElementType}}))})}),e.watch(()=>o.fields,I=>{A.value=I||[]}),l({getTemplateJson:C});async function jt(){if(o.loadDefaultTemplate&&confirm("将覆盖当前画布内容,是否继续?"))try{const I=await o.loadDefaultTemplate();if(!I){alert("未获取到默认布局");return}$(I),alert("默认布局已加载")}catch{alert("加载默认布局失败")}}function Jt(){a("save",JSON.stringify(C())),f()}return(I,R)=>(e.openBlock(),e.createElementBlock("div",cd,[e.createVNode(_n,{"is-edit":t.isEdit,"can-undo":e.unref(h),"can-redo":e.unref(T),"has-multi-selection":e.unref(H).size>=2,"has-selection":e.unref(H).size>=1,"show-grid":e.unref(y),"snap-to-grid":e.unref(B),"show-table-ghost-border":e.unref(z),"selected-element-has-group":!!e.unref(W)?.options.groupId,"overlay-visible":ye.value,"show-load-default":!!t.loadDefaultTemplate,scale:e.unref(m),"onUpdate:scale":R[0]||(R[0]=ne=>e.isRef(m)?m.value=ne:null),onPreview:R[1]||(R[1]=ne=>I.$emit("preview")),onSave:Jt,onLoadDefault:jt,onUndo:e.unref(O),onRedo:e.unref(X),onAlign:R[2]||(R[2]=ne=>e.unref(oe)(ne)),onMoveLayer:e.unref(S),onToggleGrid:R[3]||(R[3]=ne=>y.value=!e.unref(y)),onToggleSnap:R[4]||(R[4]=ne=>B.value=!e.unref(B)),onToggleTableGhostBorder:R[5]||(R[5]=ne=>z.value=!e.unref(z)),onToggleOverlay:Oe,onGroup:e.unref(ie),onUngroup:e.unref(re),onAddOverlayElement:we,onFitWindow:F,onZoom:Q},null,8,["is-edit","can-undo","can-redo","has-multi-selection","has-selection","show-grid","snap-to-grid","show-table-ghost-border","selected-element-has-group","overlay-visible","show-load-default","scale","onUndo","onRedo","onMoveLayer","onGroup","onUngroup"]),e.createElementVNode("div",ud,[e.createVNode(zo,{fields:e.unref(A),elements:e.unref(V),"selected-ids":e.unref(H),collapsed:e.unref(i),onSelect:e.unref(dt),onMoveLayer:e.unref(S),onToggleVisible:Ot,onToggleLocked:Gt,onToggleCollapse:e.unref(s)},null,8,["fields","elements","selected-ids","collapsed","onSelect","onMoveLayer","onToggleCollapse"]),e.createVNode(jl,{ref_key:"canvasAreaRef",ref:$e,"template-data":e.unref(E),elements:e.unref(V),scale:e.unref(m)/100,"show-grid":e.unref(y),"snap-to-grid":e.unref(B),"show-table-ghost-border":e.unref(z),"has-clipboard":e.unref(g),guides:e.unref(q),"overlay-visible":ye.value,"screenshot-url":Ee.value,"overlay-opacity":He.value,"selected-element-has-group":!!e.unref(W)?.options.groupId,onSelect:e.unref(dt),onDropElement:e.unref(b),onDropField:e.unref(N),onDragStart:e.unref(ae),onDragStop:e.unref(p),onDblclickElement:Wt,onDblclickCell:Kt,onZoneHeightChange:ve,onZoneHeightCommit:le,onSelectAll:e.unref(Y),onClearSelection:e.unref(G),onPreview:e.unref(P),onCommitPreview:e.unref(v),onPaste:e.unref(x),onCopy:e.unref(M),onCut:e.unref(c),onDelete:e.unref(se),onMoveLayer:e.unref(S),onCoordinate:Ge,onGroup:e.unref(ie),onUngroup:e.unref(re),onAddGuide:e.unref(Z),onGuideMove:e.unref(de),onGuideRemove:e.unref(pe),onZoom:Q,onCloneElement:Xt},null,8,["template-data","elements","scale","show-grid","snap-to-grid","show-table-ghost-border","has-clipboard","guides","overlay-visible","screenshot-url","overlay-opacity","selected-element-has-group","onSelect","onDropElement","onDropField","onDragStart","onDragStop","onSelectAll","onClearSelection","onPreview","onCommitPreview","onPaste","onCopy","onCut","onDelete","onMoveLayer","onGroup","onUngroup","onAddGuide","onGuideMove","onGuideRemove"]),e.createVNode(td,{element:e.unref(W),"template-data":e.unref(E),fields:e.unref(A),"table-selection":e.unref(D),"record-history":e.unref(k),collapsed:e.unref(r),"active-tab":Me.value,"onUpdate:activeTab":R[6]||(R[6]=ne=>Me.value=ne),onDeleteElement:e.unref(se),"onUpdate:templateData":ee,onToggleCollapse:e.unref(d)},null,8,["element","template-data","fields","table-selection","record-history","collapsed","active-tab","onDeleteElement","onToggleCollapse"])]),e.createVNode(sd,{coordinate:De.value,scale:e.unref(m),"element-count":e.unref(V).length,"selected-count":e.unref(H).size,paper:qe.value,dirty:e.unref(u)},null,8,["coordinate","scale","element-count","selected-count","paper","dirty"]),e.createVNode(st,{modelValue:Be.value,"onUpdate:modelValue":R[7]||(R[7]=ne=>Be.value=ne),fields:e.unref(A),expression:We.value,"onUpdate:expression":Yt},null,8,["modelValue","fields","expression"])]))}}),pd=_(md,[["__scopeId","data-v-f6f16901"]]),Je=3.7795275591,Ae=3e3;async function Ut(t,l,n,o){const a=ce.bindData(t,l,n),i=await fd(a,o),r=ce.paginate(a,i);return{html:ce.generateHtml(a,r,l,{codeRenderer:o}),pageCount:r.length,pageLayouts:r}}async function fd(t,l){const n=ce.getPaperDimensions(t),o=ce.generateHtml(t,[],void 0,{isMeasurementPass:!0,codeRenderer:l}),a=document.createElement("iframe");a.setAttribute("aria-hidden","true"),a.style.cssText=`position:fixed;left:-10000px;top:0;width:${n.width}mm;height:${n.height}mm;border:0;visibility:hidden;pointer-events:none;`,document.body.appendChild(a);try{const i=a.contentWindow,r=a.contentDocument;if(!i||!r)throw new Error("无法创建测量 iframe");r.open(),r.write(o),r.close(),await vd(i);const s=hd(r),d=new Map,u=new Map(t.elements.map(f=>[f.id,f]));for(const f of s){const y=u.get(f.id)?.options?._repeatHeaderCount??0;d.set(f.id,{id:f.id,measuredHeight:f.height,measuredRowHeights:f.rowHeights,repeatHeaderHeight:f.rowHeights&&y>0?f.rowHeights.slice(0,y).reduce((B,z)=>B+z,0):0})}return d}finally{a.remove()}}function vd(t){return new Promise(l=>{let n=!1;const o=()=>{n||(n=!0,l())},a=setTimeout(o,Ae),i=async()=>{try{const r=t.document.fonts;r?.ready&&await Promise.race([r.ready,Nt(Ae)]),await Promise.race([gd(t.document),Nt(Ae)])}catch{}finally{clearTimeout(a),o()}};t.document.readyState==="complete"?i():(t.addEventListener("load",()=>{i()},{once:!0}),setTimeout(o,Ae))})}function Nt(t){return new Promise((l,n)=>setTimeout(()=>n(new Error("timeout")),t))}function gd(t){const l=Array.from(t.images??[]);return Promise.all(l.map(n=>n.complete?Promise.resolve():new Promise(o=>{n.addEventListener("load",()=>o(),{once:!0}),n.addEventListener("error",()=>o(),{once:!0})}))).then(()=>{})}function hd(t){const l=[],n=t.querySelectorAll("[data-measure-id]");for(const o of n){const a=o,i=a.getAttribute("data-measure-id");if(!i)continue;const r=a.offsetHeight,s=a.querySelector("table.print-table");if(s){const d=[],u=s.querySelectorAll("tbody > tr[data-row-index]");for(const f of u)d.push(f.offsetHeight/Je);l.push({id:i,height:r/Je,rowHeights:d})}else l.push({id:i,height:r/Je})}return l}const Ft="http://www.w3.org/2000/svg";function bd(t,l){const n=document.createElementNS(Ft,"svg");return tt(n,t,{format:l.barcodeType||"CODE128",width:Math.max(1,(l.barWidth??2)/2),height:30,displayValue:l.showText!==!1,fontSize:l.fontSize??10,margin:0,marginBottom:2}),n.outerHTML}function yd(t,l){const n=(l.qrCodeLevel??"M").toUpperCase(),a=nt.create(t,{errorCorrectionLevel:["L","M","Q","H"].includes(n)?n:"M"}).modules,i=a.size,r=4,s=4*r,d=i*r+s*2;let u="";for(let f=0;f<i;f++)for(let m=0;m<i;m++)a.get(m,f)&&(u+=`<rect x="${s+m*r}" y="${s+f*r}" width="${r}" height="${r}" fill="#000"/>`);return`<svg xmlns="${Ft}" viewBox="0 0 ${d} ${d}" width="${d}" height="${d}" shape-rendering="crispEdges">${u}</svg>`}const Ht={render(t,l,n={}){if(!t)throw new Error("empty barcode value");return l==="qrcode"?yd(t,n):bd(t,n)}},kd={class:"print-html-preview"},Ed={key:0,class:"print-html-preview-error"},wd={key:1,class:"print-html-preview-loading"},Vd=e.defineComponent({__name:"PrintHtmlPreview",props:{templateJson:{},printData:{},baseUrl:{}},emits:["rendered","error"],setup(t,{expose:l,emit:n}){const o=t,a=n,i=e.ref(),r=e.ref(!1),s=e.ref("");let d=0;async function u(){if(!o.templateJson){s.value="",r.value=!1;return}const m=++d;r.value=!0,s.value="";try{const{html:y,pageCount:B}=await Ut(o.templateJson,o.printData,o.baseUrl,Ht);if(m!==d)return;const z=i.value?.contentWindow?.document;z&&(z.open(),z.write(y),z.close()),a("rendered",B)}catch(y){if(m!==d)return;s.value=y instanceof Error?y.message:"未知错误",a("error",s.value)}finally{m===d&&(r.value=!1)}}function f(){const m=i.value?.contentWindow;m&&(m.focus(),m.print())}return e.watch(()=>[o.templateJson,o.printData,o.baseUrl],()=>{u()},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{d++}),l({print:f,rerender:u}),(m,y)=>(e.openBlock(),e.createElementBlock("div",kd,[s.value?(e.openBlock(),e.createElementBlock("div",Ed,[e.createElementVNode("span",null,"预览渲染失败:"+e.toDisplayString(s.value),1)])):r.value?(e.openBlock(),e.createElementBlock("div",wd,"预览渲染中…")):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("iframe",{ref_key:"iframeRef",ref:i,class:"print-html-preview-iframe",title:"打印预览"},null,512),[[e.vShow,!r.value&&!s.value]])]))}}),Nd=_(Vd,[["__scopeId","data-v-1841dcea"]]);exports.DEFAULT_DEMO_DATA=fe;exports.PrintDesigner=pd;exports.PrintHtmlPreview=Nd;exports.UPLOAD_IMAGE_KEY=rt;exports.browserCodeRenderer=Ht;exports.createDefaultTemplate=Pt;exports.getDemoData=xt;exports.renderHtmlPages=Ut;exports.toRuntimePool=et;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),de=require("@worm-vue3-print/core"),lt=require("jsbarcode"),at=require("qrcode"),oo=require("dompurify");function no(){let t=0;return function(){return t+=1,`cell-${Date.now().toString(36)}-${t}`}}function lo(){let t=0;return function(){return t+=1,`row-${Date.now().toString(36)}-${t}`}}const ao=no(),io=lo(),Pe={width:.75,style:"solid",color:"#333333"};function it(t){return JSON.parse(JSON.stringify(t))}function rt(t){return{id:ao(),borders:{top:{...Pe},right:{...Pe},bottom:{...Pe},left:{...Pe}},...t}}function ro(){const t=[50,50,50],l=(n,a)=>({id:io(),type:n,height:8,...a!==void 0?{repeatOnPage:a}:{},cells:t.map(()=>rt())}),o=l("header",!0);return o.cells.forEach((n,a)=>{n.formatter=`列${a+1}`,n.align="center",n.fontWeight="bold"}),{rows:[o,l("data"),l("subtotal"),l("summary")],colWidths:t}}function st(t,l,o){if(!t[l].cells[o].merged)return{r:l,c:o};for(let n=l;n>=0;n--)for(let a=o;a>=0;a--){const r=t[n].cells[a];if(r.merged)continue;const i=r.rowspan??1,s=r.colspan??1;if(n+i-1>=l&&a+s-1>=o)return{r:n,c:a}}return{r:l,c:o}}function Ne(t,l,o){const n=st(t,l,o),a=t[n.r].cells[n.c];return{r1:n.r,c1:n.c,r2:n.r+(a.rowspan??1)-1,c2:n.c+(a.colspan??1)-1}}function xt(t,l,o){let n={r1:Math.min(l.r,o.r),c1:Math.min(l.c,o.c),r2:Math.max(l.r,o.r),c2:Math.max(l.c,o.c)};for(;;){let a=!1;for(let r=n.r1;r<=n.r2;r++)for(let i=n.c1;i<=n.c2;i++){const s=Ne(t,r,i),c={r1:Math.min(n.r1,s.r1),c1:Math.min(n.c1,s.c1),r2:Math.max(n.r2,s.r2),c2:Math.max(n.c2,s.c2)};(c.r1!==n.r1||c.c1!==n.c1||c.r2!==n.r2||c.c2!==n.c2)&&(n=c,a=!0)}if(!a)return n}}function Bt(t,l){if((l.r2-l.r1+1)*(l.c2-l.c1+1)<2)return"至少选择 2 个单元格";const n=new Set;for(let r=l.r1;r<=l.r2;r++)n.add(t[r].type);if(n.size>1)return"合并区域不能跨越不同类型的行";const a=xt(t,{r:l.r1,c:l.c1},{r:l.r2,c:l.c2});return a.r1!==l.r1||a.c1!==l.c1||a.r2!==l.r2||a.c2!==l.c2?"选区与已有合并区域部分重叠":null}function Dt(t,l){const o=t[l.r1].cells[l.c1],n=[];for(let a=l.r1;a<=l.r2;a++)for(let r=l.c1;r<=l.c2;r++){const i=t[a].cells[r];i.formatter&&n.push(i.formatter),!(a===l.r1&&r===l.c1)&&(i.merged=!0,i.rowspan=1,i.colspan=1,i.formatter="")}o.rowspan=l.r2-l.r1+1,o.colspan=l.c2-l.c1+1,o.formatter=n.join(" ")}function Tt(t,l){for(let o=l.r1;o<=l.r2;o++)for(let n=l.c1;n<=l.c2;n++){const a=t[o].cells[n];if(!a.merged&&((a.rowspan??1)>1||(a.colspan??1)>1)){const r=Ne(t,o,n),i=a;for(let s=r.r1;s<=r.r2;s++)for(let c=r.c1;c<=r.c2;c++){const u=t[s].cells[c];u.merged=!1,u.rowspan=1,u.colspan=1,so(i,u)}a.rowspan=1,a.colspan=1}}}function so(t,l){t!==l&&(l.align=t.align,l.valign=t.valign,l.fontSize=t.fontSize,l.fontWeight=t.fontWeight,l.color=t.color,l.backgroundColor=t.backgroundColor,l.borders=t.borders?it(t.borders):void 0,l.padding=t.padding,l.wordWrap=t.wordWrap)}function gt(t,l,o){const n=o==="above"?l:l+1,a=t[l],r=a.cells.length,i=a.type==="data"?"header":a.type,s={id:`row-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,type:i,height:a.height,cells:Array.from({length:r},()=>rt())};for(let c=0;c<r;c++)if(n>0&&n<t.length){const u=Ne(t,n-1,c);if(u.r1<n&&u.r2>=n){const f=t[u.r1].cells[u.c1];f.rowspan=(f.rowspan??1)+1,s.cells[c].merged=!0}}t.splice(n,0,s)}function co(t,l){if(t.length<=1)return"不能删除最后一行";const o=t[l],n=o.cells.length;for(let a=0;a<n;a++){const r=o.cells[a];if(!r.merged&&(r.rowspan??1)>1){const i=t[l+1].cells[a];Object.assign(i,it(r),{id:i.id}),i.rowspan=(r.rowspan??1)-1,i.merged=!1}else if(r.merged){const i=Ne(t,l,a);if(i.r1<l&&i.c1===a){const s=t[i.r1].cells[i.c1];s.rowspan=(s.rowspan??1)-1}}}return t.splice(l,1),null}function ht(t,l,o,n){const a=n==="left"?o:o+1;l.splice(a,0,l[o]);for(const r of t){const i=rt();if(a>0&&a<r.cells.length){const s=t.indexOf(r),c=Ne(t,s,a-1);if(c.c1<a&&c.c2>=a){const u=t[c.r1].cells[c.c1];s===c.r1&&(u.colspan=(u.colspan??1)+1),i.merged=!0}}r.cells.splice(a,0,i)}}function uo(t,l,o){if(l.length<=1)return"不能删除最后一列";for(let n=0;n<t.length;n++){const a=t[n].cells[o];if(!a.merged&&(a.colspan??1)>1){const r=t[n].cells[o+1];Object.assign(r,it(a),{id:r.id}),r.colspan=(a.colspan??1)-1,r.merged=!1}else if(a.merged){const r=Ne(t,n,o);if(r.c1<o&&r.r1===n){const i=t[r.r1].cells[r.c1];i.colspan=(i.colspan??1)-1}}}for(const n of t)n.cells.splice(o,1);return l.splice(o,1),null}function et(t,l,o){if(o==="data"){const n=t.findIndex((a,r)=>a.type==="data"&&r!==l);if(n>=0)return`数据行已存在(第 ${n+1} 行),全表最多一行`}if(o==="header"){for(let n=0;n<l;n++)if(t[n].type!=="header")return"标题行必须从表格顶部连续设置"}if(o==="subtotal"||o==="summary"){const n=t.findIndex(a=>a.type==="data");if(n<0)return"请先设置数据行,小计/汇总行必须位于数据行之后";if(l<n)return"小计/汇总行必须位于数据行之后"}if(o==="subtotal"&&t.slice(0,l).some(n=>n.type==="summary"))return"小计行必须位于汇总行之前";if(o==="summary"&&t.slice(l+1).some(n=>n.type==="subtotal"))return"汇总行必须位于小计行之后";if(t[l].type==="header"&&o!=="header"){for(let n=l+1;n<t.length;n++)if(t[n].type==="header")return"取消该标题行会导致标题行不连续,请先调整后续标题行"}return t[l].type=o,o!=="header"&&delete t[l].repeatOnPage,null}function mo(t,l,o,n){for(let a=l.r1;a<=l.r2;a++)for(let r=l.c1;r<=l.c2;r++){const i=t[a].cells[r];if(i.merged)continue;if(o==="none"){delete i.borders;continue}const s=Ne(t,a,r),c=s.r1===l.r1,u=s.r2===l.r2,f=s.c1===l.c1,v=s.c2===l.c2,h={...i.borders??{}};o==="all"?(h.top={...n},h.bottom={...n},h.left={...n},h.right={...n}):o==="outer"?(c&&(h.top={...n}),u&&(h.bottom={...n}),f&&(h.left={...n}),v&&(h.right={...n})):o==="inner"&&(c||(h.top={...n}),u||(h.bottom={...n}),f||(h.left={...n}),v||(h.right={...n})),i.borders=h}}const po="1px dashed rgba(0,0,0,0.18)";function Ae(t,l={}){return t&&t.style!=="none"?`${t.width}pt ${t.style} ${t.color}`:l.designMode&&l.showGhostBorder!==!1?po:"none"}function Fe(t){const l=(t.tableColWidths??[]).reduce((n,a)=>n+a,0),o=(t.tableRows??[]).reduce((n,a)=>n+a.height,0);t.width=Math.round(l*100)/100,t.height=Math.round(o*100)/100}const bt=5;function fo(t,l,o,n){const a=t.reduce((s,c,u)=>u===l?s:s+c,0),r=n===1/0?1/0:Math.max(bt,n-a),i=Math.round(o*10)/10;return Math.min(Math.max(i,bt),r)}function Se(){return`el-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function vo(t){const l={left:7,top:17.6,width:42.3,height:7.1};switch(t){case"text":return{...l,formatter:"文本",fontSize:12,textAlign:"left",height:5.3};case"image":return{...l,width:28.2,height:28.2,fit:"contain"};case"longText":return{...l,width:141.1,height:28.2,fontSize:12,lineHeight:18};case"table":{const{rows:o,colWidths:n}=ro(),a=n.reduce((i,s)=>i+s,0),r=o.reduce((i,s)=>i+s.height,0);return{...l,width:a,height:r,tableMode:"dynamic",tableRows:o,tableColWidths:n,tableDefaultFontSize:10,tableDefaultColor:"#333333",tableDefaultPadding:1,fields:[],tablePagination:{enabled:!0}}}case"hline":return{...l,width:70.6,height:1.8,borderWidth:.75};case"vline":return{...l,width:1.8,height:35.3,borderWidth:.75};case"rect":return{...l,width:28.2,height:28.2,borderWidth:1,borderColor:"#333"};case"oval":return{...l,width:28.2,height:28.2,borderWidth:1,borderColor:"#333"};case"barcode":return{...l,width:56.4,height:14.1,title:"条形码",barcodeType:"code128",testData:"12345678"};case"qrcode":return{...l,width:28.2,height:28.2,title:"二维码",testData:"qrcode"};case"html":return{...l,width:28.2,height:28.2};default:return l}}function zt(t,l){const o={text:{title:"文本"},image:{title:"图片"},longText:{title:"长文"},table:{title:"表格"},hline:{title:"横线"},vline:{title:"竖线"},rect:{title:"矩形"},oval:{title:"椭圆"},barcode:{title:"条形码"},qrcode:{title:"二维码"},html:{title:"HTML"},pageNumber:{title:"页码"}};return{id:Se(),options:{...vo(t),...l},printElementType:{type:t,title:o[t]?.title||t}}}const dt=new de.TemplateEngine;function go(){return fe}const fe={supplier:{name:"鑫达五金有限公司",phone:"0571-88776655",address:"杭州市萧山区经济开发区88号"},receiver:{name:"李四",phone:"13912345678",address:"杭州市余杭区文一西路998号"},order:{no:"PO20260801001",date:"2026-08-01",total:69543.75},goods:[{name:"碳钢螺丝 M8",spec:"M14×10",unit:"个",qty:100,price:.5,amount:50,remark:"A级"},{name:"不锈钢螺母 M10",spec:"M16×11",unit:"套",qty:117,price:.75,amount:87.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×12",unit:"盒",qty:134,price:1,amount:134,remark:""},{name:"六角螺栓 M14",spec:"M5×13",unit:"支",qty:151,price:1.25,amount:188.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×14",unit:"袋",qty:168,price:1.5,amount:252,remark:""},{name:"平垫圈 M6",spec:"M4×15",unit:"件",qty:185,price:1.75,amount:323.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×16",unit:"根",qty:202,price:2,amount:404,remark:""},{name:"双头螺柱 M20",spec:"M8×17",unit:"包",qty:219,price:2.25,amount:492.75,remark:"A级"},{name:"紧定螺钉 M4",spec:"M10×18",unit:"只",qty:236,price:2.5,amount:590,remark:""},{name:"十字盘头钉 M3",spec:"M12×19",unit:"组",qty:253,price:2.75,amount:695.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×20",unit:"个",qty:270,price:3,amount:810,remark:""},{name:"不锈钢螺母 M10",spec:"M16×21",unit:"套",qty:287,price:3.25,amount:932.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×22",unit:"盒",qty:304,price:3.5,amount:1064,remark:""},{name:"六角螺栓 M14",spec:"M5×23",unit:"支",qty:321,price:3.75,amount:1203.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×24",unit:"袋",qty:338,price:4,amount:1352,remark:"A级"},{name:"平垫圈 M6",spec:"M4×25",unit:"件",qty:355,price:4.25,amount:1508.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×26",unit:"根",qty:372,price:4.5,amount:1674,remark:""},{name:"双头螺柱 M20",spec:"M8×27",unit:"包",qty:389,price:4.75,amount:1847.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×28",unit:"只",qty:406,price:5,amount:2030,remark:""},{name:"十字盘头钉 M3",spec:"M12×29",unit:"组",qty:423,price:5.25,amount:2220.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×30",unit:"个",qty:440,price:.5,amount:220,remark:""},{name:"不锈钢螺母 M10",spec:"M16×31",unit:"套",qty:457,price:.75,amount:342.75,remark:"A级"},{name:"弹簧垫圈 M12",spec:"M6×32",unit:"盒",qty:474,price:1,amount:474,remark:""},{name:"六角螺栓 M14",spec:"M5×33",unit:"支",qty:491,price:1.25,amount:613.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×34",unit:"袋",qty:508,price:1.5,amount:762,remark:""},{name:"平垫圈 M6",spec:"M4×35",unit:"件",qty:525,price:1.75,amount:918.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×36",unit:"根",qty:542,price:2,amount:1084,remark:""},{name:"双头螺柱 M20",spec:"M8×37",unit:"包",qty:559,price:2.25,amount:1257.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×38",unit:"只",qty:576,price:2.5,amount:1440,remark:"A级"},{name:"十字盘头钉 M3",spec:"M12×39",unit:"组",qty:593,price:2.75,amount:1630.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×40",unit:"个",qty:610,price:3,amount:1830,remark:""},{name:"不锈钢螺母 M10",spec:"M16×41",unit:"套",qty:627,price:3.25,amount:2037.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×42",unit:"盒",qty:644,price:3.5,amount:2254,remark:""},{name:"六角螺栓 M14",spec:"M5×43",unit:"支",qty:661,price:3.75,amount:2478.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×44",unit:"袋",qty:678,price:4,amount:2712,remark:""},{name:"平垫圈 M6",spec:"M4×45",unit:"件",qty:695,price:4.25,amount:2953.75,remark:"A级"},{name:"自攻螺钉 M5",spec:"M3×46",unit:"根",qty:712,price:4.5,amount:3204,remark:""},{name:"双头螺柱 M20",spec:"M8×47",unit:"包",qty:729,price:4.75,amount:3462.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×48",unit:"只",qty:746,price:5,amount:3730,remark:""},{name:"十字盘头钉 M3",spec:"M12×49",unit:"组",qty:763,price:5.25,amount:4005.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×10",unit:"个",qty:780,price:.5,amount:390,remark:""},{name:"不锈钢螺母 M10",spec:"M16×11",unit:"套",qty:797,price:.75,amount:597.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×12",unit:"盒",qty:814,price:1,amount:814,remark:"A级"},{name:"六角螺栓 M14",spec:"M5×13",unit:"支",qty:831,price:1.25,amount:1038.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×14",unit:"袋",qty:848,price:1.5,amount:1272,remark:""},{name:"平垫圈 M6",spec:"M4×15",unit:"件",qty:865,price:1.75,amount:1513.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×16",unit:"根",qty:882,price:2,amount:1764,remark:""},{name:"双头螺柱 M20",spec:"M8×17",unit:"包",qty:899,price:2.25,amount:2022.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×18",unit:"只",qty:916,price:2.5,amount:2290,remark:""},{name:"十字盘头钉 M3",spec:"M12×19",unit:"组",qty:933,price:2.75,amount:2565.75,remark:"A级"}]},ho={MONEY:de.formatMoney,CONCAT:(...t)=>t.filter(l=>l!=null).join(""),IF:de.ifFn,FORMAT:t=>typeof t!="number"?String(t):t.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2}),SUBSTR:(t,l,o)=>String(t).slice(l,o?l+o:void 0),LEN:t=>String(t).length,ROUND:(t,l)=>Number(Number(t).toFixed(l)),NOW:()=>new Date().toISOString().split("T")[0],IFEMPTY:(t,l)=>t!=null&&t!==""?String(t):l,PAD:(t,l,o)=>String(t).padStart(l,o),REPLACE:(t,l,o)=>String(t).replace(new RegExp(l,"g"),o),JSON:t=>JSON.stringify(t,null,2),DATE:de.formatDate,UPPER:de.toUpperCaseAmount};for(const[t,l]of Object.entries(ho))dt.registerFunction(t,l);function bo(t,l,o){switch(t.toUpperCase()){case"SUM":return de.sum(o,l);case"AVG":return de.avg(o,l);case"COUNT":return de.count(o,l);case"MIN":return de.min(o,l);case"MAX":return de.max(o,l);default:return 0}}function $e(t,l){if(!t)return"";if(!t.includes("{"))return t;const o=Array.isArray(l.rows)?l.rows:[];let n=t.replace(/\{([^}]+)\}/g,(a,r)=>{let i=r.trim();return i=i.replace(/\b(SUM|AVG|COUNT|MIN|MAX)\(([^)]+)\)/g,(s,c,u)=>{const f=u.trim().replace(/^['"]|['"]$/g,"");return String(bo(c,f,o))}),`{${i}}`});try{return dt.render(n,l)}catch{return t}}function yo(t){return zt("text",{formatter:`{${t.fieldKey}}`,title:t.fieldLabel})}function Oe(t,l){if(t.formatter){if(!l||l.length===0)return"";const o=l[0];try{return dt.render(t.formatter,o??{})}catch{return t.formatter}}return""}function yt(t){let l=fe;for(const o of t.split(".")){if(l==null)return;l=Array.isArray(l)?l[0]?.[o]:l[o]}return l}function ko(t,l){const o=l?.[0];return(t??"").replace(/\{([^{}]+)\}/g,(a,r)=>{const i=r.trim(),s=i.includes(".")?yt(i):o?.[i]??yt(i);return s==null?"":String(s)}).trim()||"1234567890128"}function Eo(t){return t/2.83464566929}function Ie(t){return t*(25.4/96)}function ve(t){return t*(96/25.4)}const wo=["left","top","width","height"];function Vo(t){const l={...t.options};for(const o of wo){const n=l[o];typeof n=="number"&&Number.isFinite(n)&&(l[o]=No(Eo(n)))}return{...t,options:l}}function No(t){return Math.round(t*100)/100}function Co(t){if(t.unit==="mm")return t;const l=o=>o?.map(Vo)??[];return{...t,unit:"mm",elements:l(t.elements),header:t.header?{...t.header,elements:l(t.header.elements)}:t.header,footer:t.footer?{...t.footer,elements:l(t.footer.elements)}:t.footer,firstPageOverlay:t.firstPageOverlay?{...t.firstPageOverlay,elements:l(t.firstPageOverlay.elements)}:t.firstPageOverlay}}const tt={A4:{width:210,height:297},A3:{width:297,height:420},A5:{width:148,height:210},Letter:{width:216,height:279},Legal:{width:216,height:356}};function we(t){let l;return t.paperSize==="CUSTOM"?l={width:t.customWidth??210,height:t.customHeight??297}:l=tt[t.paperSize]||tt.A4,t.orientation==="landscape"?{width:l.height,height:l.width}:l}const So=25;function ct(t){return Math.max(So,t)}function $o(t,l,o=1.1){const n=l>0?t*o:t/o;return ct(Math.round(n))}function Mo(t,l,o,n,a=.9){if(o<=0||n<=0)return 100;const r=Math.min(t/o,l/n)*a,i=Math.round(r*100);return ct(i)}const Lt=["text","image","hline","vline","rect","oval","barcode","qrcode"];function xo(t){return we(t)}function Ge(t){const l=xo(t),o=t.margins,n=t.header.height,a=t.footer.height,r=l.width-o.left-o.right,i=l.height-o.top-o.bottom-n-a,s=(c,u,f,v)=>({left:c,top:u,width:f,height:v});return{header:s(o.left,o.top,r,n),content:s(o.left,o.top+n,r,i),footer:s(o.left,l.height-o.bottom-a,r,a)}}function Pt(t,l,o){const n=Ge(t);return n.footer.height>0&&o>=n.footer.top?"footer":n.header.height>0&&o<n.header.top+n.header.height?"header":"content"}function ot(t,l){const o=t.options;o.width=Math.min(o.width,l.width),o.height=Math.min(o.height,l.height),o.left=Math.min(Math.max(0,o.left),l.width-o.width),o.top=Math.min(Math.max(0,o.top),l.height-o.height)}function Bo(t,l){const o=Ge(l),n=t.zone||"content",a=o[n],r=a.left+t.options.left+t.options.width/2,i=a.top+t.options.top+t.options.height/2;let s=Pt(l,r,i),c=!1;if(s!=="content"&&!Lt.includes(t.printElementType.type)&&(s="content",c=!0),s!==n){const u=o[s];t.options.left=a.left+t.options.left-u.left,t.options.top=a.top+t.options.top-u.top,t.zone=s}return s!=="content"?ot(t,o[s]):c&&ot(t,o.content),{rejected:c}}const At=Symbol("selected-ids"),It=Symbol("preview-ids");function Do(t){const l=e.ref(new Set),o=e.ref(new Set),n=e.computed(()=>t.value.filter(h=>l.value.has(h.id))),a=e.computed(()=>l.value.size>0);function r(h,L=!1){if(L){const R=new Set(l.value);R.has(h)?R.delete(h):R.add(h),l.value=R}else l.value=new Set([h])}function i(){l.value=new Set}function s(h){l.value=new Set(h)}function c(h){o.value=new Set(h)}function u(){o.value=new Set}function f(){l.value=new Set(o.value),o.value=new Set}function v(){const h=n.value;if(h.length===0)return null;let L=1/0,R=1/0,B=-1/0,$=-1/0;return h.forEach(A=>{L=Math.min(L,A.options.left),R=Math.min(R,A.options.top),B=Math.max(B,A.options.left+A.options.width),$=Math.max($,A.options.top+A.options.height)}),{left:L,top:R,width:B-L,height:$-R}}return{selectedIds:l,selectedElements:n,hasSelection:a,select:r,clearSelection:i,selectAll:s,getSelectionBounds:v,previewIds:o,setPreview:c,clearPreview:u,commitPreview:f}}function To(){const t=e.ref(null);function l(a){t.value=a.map(r=>({options:{...r.options},printElementType:{...r.printElementType}}))}function o(a=10){return t.value?t.value.map(r=>({id:Se(),options:{...r.options,left:r.options.left+a,top:r.options.top+a},printElementType:{...r.printElementType}})):null}function n(){return t.value!==null&&t.value.length>0}return{clipboard:t,copy:l,paste:o,hasData:n}}function zo(){function t(l,o){if(l.length<2)return;const n={minLeft:Math.min(...l.map(a=>a.options.left)),maxRight:Math.max(...l.map(a=>a.options.left+a.options.width)),minTop:Math.min(...l.map(a=>a.options.top)),maxBottom:Math.max(...l.map(a=>a.options.top+a.options.height))};switch(o){case"left":l.forEach(a=>{a.options.left=n.minLeft});break;case"right":l.forEach(a=>{a.options.left=n.maxRight-a.options.width});break;case"top":l.forEach(a=>{a.options.top=n.minTop});break;case"bottom":l.forEach(a=>{a.options.top=n.maxBottom-a.options.height});break;case"vertical":{const a=n.minLeft+(n.maxRight-n.minLeft)/2;l.forEach(r=>{r.options.left=a-r.options.width/2});break}case"horizontal":{const a=n.minTop+(n.maxBottom-n.minTop)/2;l.forEach(r=>{r.options.top=a-r.options.height/2});break}case"distributeHor":{const a=[...l].sort((c,u)=>c.options.left-u.options.left),r=a.reduce((c,u)=>c+u.options.width,0),i=(n.maxRight-n.minLeft-r)/(a.length-1);let s=n.minLeft;a.forEach(c=>{c.options.left=s,s+=c.options.width+i});break}case"distributeVer":{const a=[...l].sort((c,u)=>c.options.top-u.options.top),r=a.reduce((c,u)=>c+u.options.height,0),i=(n.maxBottom-n.minTop-r)/(a.length-1);let s=n.minTop;a.forEach(c=>{c.options.top=s,s+=c.options.height+i});break}}}return{align:t}}function Lo(){return`grp-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function Po(){function t(n,a){if(n.filter(s=>a.has(s.id)).length<2)return n;const i=Lo();return n.map(s=>a.has(s.id)?{...s,options:{...s.options,groupId:i}}:s)}function l(n,a){const r=n.filter(s=>a.has(s.id)),i=new Set(r.map(s=>s.options.groupId).filter(Boolean));return n.map(s=>s.options.groupId&&i.has(s.options.groupId)?{...s,options:{...s.options,groupId:void 0}}:s)}function o(n,a){const r=n.find(s=>s.id===a);if(!r?.options.groupId)return new Set([a]);const i=new Set;for(const s of n)s.options.groupId===r.options.groupId&&i.add(s.id);return i}return{group:t,ungroup:l,getGroupedIds:o}}function Ao(t){const o=e.ref([]),n=e.ref([]),a=e.ref(!1),r=e.ref(!1);function i(){a.value=o.value.length>0,r.value=n.value.length>0}function s(L){return{elements:JSON.parse(JSON.stringify(L?.elements??[])),templateData:JSON.parse(JSON.stringify(L?.templateData??{}))}}function c(L){return s(L)}function u(L){o.value.push(c(L)),n.value=[],o.value.length>50&&o.value.shift(),i()}function f(L){if(o.value.length===0)return null;const R=o.value.pop();return n.value.push(L?c(L):s(R)),i(),o.value.length>0?s(o.value[o.value.length-1]):null}function v(L){if(n.value.length===0)return null;const R=n.value.pop();return o.value.push(L?c(L):s(R)),i(),s(R)}function h(){o.value=[],n.value=[],i()}return{push:u,undo:f,redo:v,canUndo:a,canRedo:r,clear:h}}const Io=1,Ro=10,Ho=.5;function Uo(t){function l(a){const r=a.target.tagName;if(r==="INPUT"||r==="TEXTAREA"||r==="SELECT")return;const i=a.ctrlKey||a.metaKey;if(a.key.startsWith("Arrow")){a.preventDefault();const s=a.shiftKey?Ro:a.ctrlKey?Ho:Io,c=a.key==="ArrowLeft"?-s:a.key==="ArrowRight"?s:0,u=a.key==="ArrowUp"?-s:a.key==="ArrowDown"?s:0;t.onMove?.(c,u);return}if(a.key==="Delete"||a.key==="Backspace"){a.preventDefault(),t.onDelete?.();return}if(i){const s=a.key.toLowerCase();s==="c"?(a.preventDefault(),t.onCopy?.()):s==="v"?(a.preventDefault(),t.onPaste?.()):s==="a"?(a.preventDefault(),t.onSelectAll?.()):s==="d"?(a.preventDefault(),t.onDuplicate?.()):s==="z"?(a.preventDefault(),a.shiftKey?t.onRedo?.():t.onUndo?.()):s==="y"?(a.preventDefault(),t.onRedo?.()):s==="1"?(a.preventDefault(),t.onResetZoom?.()):s==="l"?(a.preventDefault(),t.onAlignLeft?.()):s==="r"?(a.preventDefault(),t.onAlignRight?.()):s==="e"?(a.preventDefault(),t.onAlignCenterH?.()):s==="t"?(a.preventDefault(),t.onAlignTop?.()):s==="b"?(a.preventDefault(),t.onAlignBottom?.()):s==="g"&&(a.preventDefault(),a.shiftKey?t.onUngroup?.():t.onGroup?.())}}function o(){document.addEventListener("keydown",l)}function n(){document.removeEventListener("keydown",l)}return{setup:o,cleanup:n}}function Rt(){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 nt(t){const l=(o,n)=>(o??[]).map(a=>{const r={...a.options};return(a.printElementType?.type??a.type)==="table"&&Fe(r),{id:a.id||Se(),zone:n,options:r,printElementType:{...a.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:[...l(t.elements??[],"content"),...l(t.header?.elements??[],"header"),...l(t.footer?.elements??[],"footer")]}}function Fo(t={}){const l=e.ref(100),o=e.ref(!0),n=e.ref(!0),a=e.ref(!1),r=e.ref(!0),i=e.ref(nt(t.initialTemplate||Rt())),s=e.computed({get:()=>i.value.elements,set:W=>{i.value.elements=W}}),c=e.ref(t.initialFields||[]),{selectedIds:u,selectedElements:f,select:v,clearSelection:h,selectAll:L,previewIds:R,setPreview:B,clearPreview:$,commitPreview:A}=Do(s),{group:Y,ungroup:j}=Po(),{copy:I,paste:G,hasData:H}=To(),{align:T}=zo(),{push:C,undo:S,redo:x,canUndo:D,canRedo:z}=Ao(),m=e.computed(()=>{if(u.value.size===0)return null;const W=u.value.values().next().value;return s.value.find(ee=>ee.id===W)||null}),y=e.ref(null);function F(W){y.value=W}function K(){return{elements:s.value.map(W=>({id:W.id,zone:W.zone,options:JSON.parse(JSON.stringify(W.options)),printElementType:{...W.printElementType}})),templateData:{paperSize:i.value.paperSize,orientation:i.value.orientation,margins:{...i.value.margins},header:{height:i.value.header.height,elements:[]},footer:{height:i.value.footer.height,elements:[]},firstPageOverlay:{height:i.value.firstPageOverlay.height,elements:[]},elements:[],customWidth:i.value.customWidth,customHeight:i.value.customHeight,watermark:i.value.watermark?{...i.value.watermark}:void 0,guides:[...i.value.guides??[]]}}}function J(){C(K())}function te(){const W=S(K());W?.templateData&&(i.value={...W.templateData,elements:W.elements})}function se(){const W=x(K());W?.templateData&&(i.value={...W.templateData,elements:W.elements})}function re(){I(f.value)}function ae(){I(f.value),q()}function _(){const W=G();W&&W.length>0&&(s.value.push(...W),J())}function g(){I(f.value);const W=G();W&&W.length>0&&(W.forEach(ee=>{ee.options.left+=5,ee.options.top+=5}),s.value.push(...W),v(W[0].id,!1),J())}function d(){l.value=100}const p=e.computed(()=>H());let E=!1,N=null;const P=300;function w(W,ee){const Z=f.value.filter(oe=>!oe.options.locked);Z.length!==0&&(Z.forEach(oe=>{oe.options.left+=W,oe.options.top+=ee}),E||(E=!0,J()),N&&clearTimeout(N),N=setTimeout(()=>{E=!1,N=null},P))}function V(){L(s.value.map(W=>W.id))}function M(W){T(f.value,W),J()}function b(){s.value=Y(s.value,u.value),J()}function k(){s.value=j(s.value,u.value),J()}function q(){u.value.size!==0&&(s.value=s.value.filter(W=>!u.value.has(W.id)),h(),J())}const{setup:X,cleanup:ue}=Uo({onMove:w,onDelete:q,onCopy:re,onPaste:_,onSelectAll:V,onUndo:te,onRedo:se,onDuplicate:g,onResetZoom:d,onAlignLeft:()=>M("left"),onAlignRight:()=>M("right"),onAlignCenterH:()=>M("vertical"),onAlignTop:()=>M("top"),onAlignBottom:()=>M("bottom"),onGroup:b,onUngroup:k});let ce=null;function ke(){ce=K()}function qe(){if(!ce)return;const W=new Map(ce.elements.map(ie=>[ie.id,ie]));let ee=!1;for(const ie of s.value){const he=W.get(ie.id);if(!he)continue;(he.options.left!==ie.options.left||he.options.top!==ie.options.top||he.options.width!==ie.options.width||he.options.height!==ie.options.height)&&Bo(ie,i.value).rejected&&(ee=!0)}ee&&alert("该元素类型不能放入页眉/页脚");const Z=ie=>`${ie.id}:${ie.zone||"content"}:${ie.options.left},${ie.options.top},${ie.options.width},${ie.options.height}`,oe=ce.elements.map(Z).join("|"),ge=K().elements.map(Z).join("|");ce=null,oe!==ge&&J()}function De(W,ee){const Z=Pt(i.value,ee.x,ee.y);if(Z!=="content"&&!Lt.includes(W.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const oe=Ge(i.value)[Z];return W.zone=Z,W.options.left=ee.x-oe.left,W.options.top=ee.y-oe.top,Z!=="content"&&ot(W,oe),!0}function Te(W,ee){const Z=zt(W);ee&&!De(Z,ee)||(s.value.push(Z),v(Z.id,!1),J())}function Ve(W,ee){const Z=yo(W);ee&&!De(Z,ee)||(s.value.push(Z),v(Z.id,!1),J())}function Ce(W){if(u.value.size===0)return;const ee=u.value.values().next().value,Z=s.value.find(Ee=>Ee.id===ee);if(!Z)return;const oe=Z.options.zIndex??0,ge=s.value.map(Ee=>Ee.options.zIndex??0),ie=Math.max(...ge,0),he=Math.min(...ge,0);switch(W){case"top":Z.options.zIndex=ie+1;break;case"bottom":Z.options.zIndex=he-1;break;case"up":Z.options.zIndex=oe+1;break;case"down":Z.options.zIndex=oe-1;break}J()}function We(W,ee){const{width:Z,height:oe}=we(i.value),ge=96/25.4;l.value=Mo(W,ee,Z*ge,oe*ge)}function Ke(W){i.value={...W},J()}function ze(){const W=s.value,ee=Z=>W.filter(oe=>(oe.zone||"content")===Z).map(oe=>({id:oe.id,type:oe.printElementType.type,options:{...oe.options},printElementType:{...oe.printElementType}}));return{unit:"mm",...i.value,header:{...i.value.header,elements:ee("header")},footer:{...i.value.footer,elements:ee("footer")},firstPageOverlay:{...i.value.firstPageOverlay,elements:i.value.firstPageOverlay.elements.map(Z=>({id:Z.id||Se(),type:Z.printElementType?.type||"text",options:{...Z.options},printElementType:{...Z.printElementType}}))},elements:ee("content"),guides:[...i.value.guides??[]]}}function Ye(W,ee){const Z=Co(W);i.value=nt(Z),ee&&(i.value={...i.value,elements:ee.map(oe=>({...oe,id:oe.id||Se(),zone:oe.zone||"content",options:{...oe.options},printElementType:{...oe.printElementType}}))}),C(K())}return C(K()),e.onMounted(()=>X()),e.onUnmounted(()=>{ue(),N&&(clearTimeout(N),N=null)}),{scale:l,showRuler:o,showGrid:n,snapToGrid:a,showTableGhostBorder:r,templateData:i,elements:s,fields:c,selectedIds:u,selectedElements:f,selectedElement:m,select:v,clearSelection:h,selectAll:V,previewIds:R,setPreview:B,clearPreview:$,commitPreview:A,hasClipboard:p,copy:re,paste:_,cutSelected:ae,tableSelection:y,setTableSelection:F,canUndo:D,canRedo:z,undo:te,redo:se,recordHistory:J,alignSelected:M,groupSelected:b,ungroupSelected:k,deleteSelected:q,duplicateSelected:g,resetZoom:d,dragStart:ke,dragStop:qe,addElement:Te,addFieldElement:Ve,moveLayer:Ce,fitToWindow:We,updateTemplateData:Ke,getTemplateJson:ze,loadTemplate:Ye}}let kt=0;function Oo(){return kt+=1,`guide-${kt}`}function Go(t,l){const o=e.computed(()=>t.value.guides??[]);function n(c){t.value={...t.value,guides:c([...t.value.guides??[]])},l()}function a(c,u){n(f=>(f.push({type:c,position:u,id:Oo()}),f))}function r(c,u){n(f=>f.map(v=>v.id===c?{...v,position:u}:v))}function i(c){n(u=>u.filter(f=>f.id!==c))}function s(){const c=[],u=[];for(const f of o.value)f.type==="vertical"?c.push(f.position):u.push(f.position);return{vertical:c,horizontal:u}}return{guides:o,addGuide:a,moveGuide:r,removeGuide:i,getGuidePositions:s}}const Be=Symbol("table-edit"),ut=Symbol("print-upload-image"),qo=e.defineComponent({__name:"HelpButton",emits:["click"],setup(t){return(l,o)=>(e.openBlock(),e.createElementBlock("button",{class:"help-button",title:"帮助文档",onClick:o[0]||(o[0]=n=>l.$emit("click"))},[...o[1]||(o[1]=[e.createElementVNode("span",{class:"help-icon"},"?",-1)])]))}}),Q=(t,l)=>{const o=t.__vccOpts||t;for(const[n,a]of l)o[n]=a;return o},Wo=Q(qo,[["__scopeId","data-v-80ccab03"]]),Ko={class:"designer-toolbar"},Yo={class:"tb-group"},Xo={class:"tb-title"},jo={class:"tb-title-name"},Jo={class:"tb-group"},Zo=["disabled"],Qo=["disabled"],_o={key:0,class:"tb-group"},en={key:1,class:"tb-group"},tn={key:2,class:"tb-group"},on={key:3,class:"tb-group"},nn={class:"tb-group"},ln={class:"tb-zoom"},an={class:"tb-group"},rn={class:"tb-group"},sn={class:"tb-group"},dn=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},showLoadDefault:{type:Boolean}},{scale:{default:100},scaleModifiers:{}}),emits:e.mergeModels(["preview","save","load-default","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(t){const l=e.useModel(t,"scale");return(o,n)=>(e.openBlock(),e.createElementBlock("div",Ko,[e.createElementVNode("div",Yo,[n[30]||(n[30]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-c0858556><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-c0858556><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-c0858556></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-c0858556></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-c0858556></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-c0858556></line></svg></span>',1)),e.createElementVNode("div",Xo,[e.createElementVNode("span",jo,e.toDisplayString(t.isEdit?"编辑模板":"新建模板"),1),n[29]||(n[29]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",Jo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canUndo,onClick:n[0]||(n[0]=a=>o.$emit("undo")),title:"撤销"},"↶",8,Zo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canRedo,onClick:n[1]||(n[1]=a=>o.$emit("redo")),title:"重做"},"↷",8,Qo)]),t.hasMultiSelection?(e.openBlock(),e.createElementBlock("div",_o,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[2]||(n[2]=a=>o.$emit("align","left")),title:"左对齐"},"⇤"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[3]||(n[3]=a=>o.$emit("align","right")),title:"右对齐"},"⇥"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[4]||(n[4]=a=>o.$emit("align","top")),title:"顶对齐"},"⇡"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[5]||(n[5]=a=>o.$emit("align","bottom")),title:"底对齐"},"⇣"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[6]||(n[6]=a=>o.$emit("align","vertical")),title:"水平居中"},"↔"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[7]||(n[7]=a=>o.$emit("align","horizontal")),title:"垂直居中"},"↕"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[8]||(n[8]=a=>o.$emit("align","distributeHor")),title:"水平分布"},"⇔"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[9]||(n[9]=a=>o.$emit("align","distributeVer")),title:"垂直分布"},"⇕")])):e.createCommentVNode("",!0),t.hasMultiSelection?(e.openBlock(),e.createElementBlock("div",en,[e.createElementVNode("button",{class:"tb-btn",onClick:n[10]||(n[10]=a=>o.$emit("group")),title:"组合"},"组合")])):e.createCommentVNode("",!0),!t.hasMultiSelection&&t.selectedElementHasGroup?(e.openBlock(),e.createElementBlock("div",tn,[e.createElementVNode("button",{class:"tb-btn",onClick:n[11]||(n[11]=a=>o.$emit("ungroup")),title:"取消组合"},"取消组合")])):e.createCommentVNode("",!0),t.hasSelection?(e.openBlock(),e.createElementBlock("div",on,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[12]||(n[12]=a=>o.$emit("move-layer","top")),"data-tip":"置顶"},"⤒"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[13]||(n[13]=a=>o.$emit("move-layer","up")),"data-tip":"上移一层"},"↑"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[14]||(n[14]=a=>o.$emit("move-layer","down")),"data-tip":"下移一层"},"↓"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[15]||(n[15]=a=>o.$emit("move-layer","bottom")),"data-tip":"置底"},"⤓")])):e.createCommentVNode("",!0),e.createElementVNode("div",nn,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:t.showRuler}]),title:"显示/隐藏标尺",onClick:n[16]||(n[16]=a=>o.$emit("toggle-ruler"))},[...n[31]||(n[31]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 标尺 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:t.showGrid}]),onClick:n[17]||(n[17]=a=>o.$emit("toggle-grid"))},[...n[32]||(n[32]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:t.showTableGhostBorder}]),title:"显示/隐藏无边框表格的虚拟虚线",onClick:n[18]||(n[18]=a=>o.$emit("toggle-table-ghost-border"))},[...n[33]||(n[33]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:t.snapToGrid}]),onClick:n[19]||(n[19]=a=>o.$emit("toggle-snap"))},[...n[34]||(n[34]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[20]||(n[20]=a=>o.$emit("fit-window")),title:"适应窗口"},"⤢"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[21]||(n[21]=a=>o.$emit("zoom",-10)),title:"缩小"},"−"),e.createElementVNode("span",ln,e.toDisplayString(l.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[22]||(n[22]=a=>o.$emit("zoom",10)),title:"放大"},"+")]),n[35]||(n[35]=e.createElementVNode("div",{class:"tb-spacer"},null,-1)),e.createElementVNode("div",an,[e.createVNode(Wo,{onClick:n[23]||(n[23]=a=>o.$emit("help"))})]),e.createElementVNode("div",rn,[e.createElementVNode("button",{class:"tb-btn",onClick:n[24]||(n[24]=a=>o.$emit("add-overlay-element"))},"首页专属"),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{warn:t.overlayVisible}]),onClick:n[25]||(n[25]=a=>o.$emit("toggle-overlay"))},"叠层对比",2)]),e.createElementVNode("div",sn,[t.showLoadDefault?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn-secondary",onClick:n[26]||(n[26]=a=>o.$emit("load-default"))},"加载默认布局")):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"btn-secondary",onClick:n[27]||(n[27]=a=>o.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary",onClick:n[28]||(n[28]=a=>o.$emit("save"))},"保存")])]))}}),cn=Q(dn,[["__scopeId","data-v-c0858556"]]),un={class:"layer-panel"},mn=["onClick"],pn={class:"layer-icon"},fn={class:"layer-name"},vn={key:0,class:"layer-zone"},gn={class:"layer-zindex"},hn={key:0,class:"layer-actions"},bn=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer"],setup(t){const l=t,o=e.computed(()=>[...l.elements].sort((s,c)=>(c.options.zIndex??0)-(s.options.zIndex??0))),n={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function a(s){return n[s.printElementType.type]||"?"}function r(s){return s.options.title||s.printElementType.title||s.printElementType.type}function i(s){return s.zone==="header"?"页眉":s.zone==="footer"?"页脚":""}return(s,c)=>(e.openBlock(),e.createElementBlock("div",un,[c[4]||(c[4]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:e.normalizeClass(["layer-item",{active:t.selectedIds.has(u.id)}]),onClick:f=>s.$emit("select",u.id,!1)},[e.createElementVNode("span",pn,e.toDisplayString(a(u)),1),e.createElementVNode("span",fn,e.toDisplayString(r(u)),1),i(u)?(e.openBlock(),e.createElementBlock("span",vn,e.toDisplayString(i(u)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",gn,"z:"+e.toDisplayString(u.options.zIndex??0),1)],10,mn))),128)),o.value.length>0?(e.openBlock(),e.createElementBlock("div",hn,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[0]||(c[0]=u=>s.$emit("move-layer","top")),title:"置顶"}," ⤒ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[1]||(c[1]=u=>s.$emit("move-layer","up")),title:"上移"}," ↑ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[2]||(c[2]=u=>s.$emit("move-layer","down")),title:"下移"}," ↓ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[3]||(c[3]=u=>s.$emit("move-layer","bottom")),title:"置底"}," ⤓ ")])):e.createCommentVNode("",!0)]))}}),yn=Q(bn,[["__scopeId","data-v-d091c3fa"]]);function Ht(t){const l=[...t].sort((i,s)=>(i.sortOrder??0)-(s.sortOrder??0)),o=new Map,n=[];for(const i of l){const s=i.fieldKey.indexOf(".");if(s===-1)continue;const c=i.fieldKey.slice(0,s);let u=o.get(c);u||(u={key:c,label:c,isList:!1,fields:[]},o.set(c,u),n.push(c)),u.fields.push(i)}const a=[],r=[];for(const i of l){if(i.fieldKey.includes("."))continue;const s=o.get(i.fieldKey);s?(s.label=i.fieldLabel,s.isList=i.fieldType==="list"):r.push(i)}r.length&&a.push({key:"",label:"",isList:!1,fields:r});for(const i of n)a.push(o.get(i));return a}function Ut(t,l){const o=l.trim().toLowerCase();return o?t.map(n=>({...n,fields:n.fields.filter(a=>a.fieldLabel.toLowerCase().includes(o)||a.fieldKey.toLowerCase().includes(o))})).filter(n=>n.fields.length>0):t}const kn={class:"field-tree-panel"},En={class:"tree-container"},wn=["onClick"],Vn={class:"expand-icon"},Nn={class:"node-icon"},Cn={class:"group-label"},Sn=["onDragstart"],$n={class:"node-label"},Mn={class:"node-key"},xn={key:0,class:"pd-empty"},Bn=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(t,{emit:l}){const o=t,n=l,a=e.ref(""),r=e.ref(new Set),i=e.computed(()=>!!a.value.trim()),s=e.computed(()=>Ut(Ht(o.fields),a.value));function c(f){const v=new Set(r.value);v.has(f)?v.delete(f):v.add(f),r.value=v}function u(f,v){f.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:v.fieldKey,fieldLabel:v.fieldLabel})),f.dataTransfer&&(f.dataTransfer.effectAllowed="copy"),n("field-drag",v)}return(f,v)=>(e.openBlock(),e.createElementBlock("div",kn,[v[2]||(v[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":v[0]||(v[0]=h=>a.value=h),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,a.value]]),e.createElementVNode("div",En,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,h=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:h.key||"_top"},[h.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["field-group-header",{"is-list":h.isList}]),onClick:L=>c(h.key)},[e.createElementVNode("span",Vn,e.toDisplayString(r.value.has(h.key)&&!i.value?"▶":"▼"),1),e.createElementVNode("span",Nn,e.toDisplayString(h.isList?"📋":"📁"),1),e.createElementVNode("span",Cn,e.toDisplayString(h.label),1)],10,wn)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.fields,L=>(e.openBlock(),e.createElementBlock("div",{key:L.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(h.key?22:8)+"px"}),onDragstart:R=>u(R,L)},[v[1]||(v[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",$n,e.toDisplayString(L.fieldLabel),1),e.createElementVNode("span",Mn,"("+e.toDisplayString(L.fieldKey)+")",1)],44,Sn))),128))],512),[[e.vShow,!h.key||i.value||!r.value.has(h.key)]])],64))),128))]),s.value.length===0?(e.openBlock(),e.createElementBlock("p",xn,"暂无字段")):e.createCommentVNode("",!0)]))}}),Dn=Q(Bn,[["__scopeId","data-v-cc814de0"]]),Tn={key:0,class:"left-collapsed"},zn={class:"left-head"},Ln={class:"pd-tabs left-tabs"},Pn={class:"pd-tab-bar",role:"tablist"},An={class:"pd-tab-pane",role:"tabpanel"},In=["onDragstart"],Rn={class:"material-icon"},Hn={class:"material-label"},Un={class:"pd-tab-pane",role:"tabpanel"},Fn={class:"pd-tab-pane",role:"tabpanel"},On=e.defineComponent({__name:"LeftPanel",props:{fields:{},elements:{},selectedIds:{},collapsed:{type:Boolean}},emits:["select","move-layer","toggle-visible","toggle-locked","field-drag","toggle-collapse"],setup(t,{emit:l}){const o=l,n=e.ref("elements"),a=[{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 r(c,u){c.dataTransfer?.setData("elementType",u)}function i(c){o("field-drag",c)}function s(c){n.value=c,o("toggle-collapse")}return(c,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",Tn,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:u[0]||(u[0]=f=>s(n.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="elements"}]),title:"元素",onClick:u[1]||(u[1]=f=>s("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="fields"}]),title:"字段",onClick:u[2]||(u[2]=f=>s("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="layers"}]),title:"图层",onClick:u[3]||(u[3]=f=>s("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",zn,[u[12]||(u[12]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:u[4]||(u[4]=f=>c.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",Ln,[e.createElementVNode("div",Pn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="elements"}]),onClick:u[5]||(u[5]=f=>n.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="fields"}]),onClick:u[6]||(u[6]=f=>n.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="layers"}]),onClick:u[7]||(u[7]=f=>n.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",An,[u[13]||(u[13]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(a,f=>e.createElementVNode("div",{key:f.type,class:"material-card",draggable:"true",onDragstart:v=>r(v,f.type)},[e.createElementVNode("span",Rn,e.toDisplayString(f.icon),1),e.createElementVNode("span",Hn,e.toDisplayString(f.label),1)],40,In)),64))],512),[[e.vShow,n.value==="elements"]]),e.withDirectives(e.createElementVNode("div",Un,[e.createVNode(Dn,{fields:t.fields,onFieldDrag:i},null,8,["fields"])],512),[[e.vShow,n.value==="fields"]]),e.withDirectives(e.createElementVNode("div",Fn,[e.createVNode(yn,{elements:t.elements,"selected-ids":t.selectedIds,onSelect:u[8]||(u[8]=(f,v)=>c.$emit("select",f,v)),onMoveLayer:u[9]||(u[9]=f=>c.$emit("move-layer",f)),onToggleVisible:u[10]||(u[10]=f=>c.$emit("toggle-visible",f)),onToggleLocked:u[11]||(u[11]=f=>c.$emit("toggle-locked",f))},null,8,["elements","selected-ids"])],512),[[e.vShow,n.value==="layers"]])])],64))],2))}}),Gn=Q(On,[["__scopeId","data-v-eb646f19"]]),pe=22,Je=[1,2,5,10,20,50,100,200,500,1e3];function qn(t,l=64){const o=t*3.7795275590551185;for(const n of Je)if(n*o>=l)return n;return Je[Je.length-1]}function Wn(t){const l=Math.floor(Math.log10(t)+1e-9),o=t/10**l;return o===5||o===1&&t>=10?t/5:o===2?t/2:null}function Kn(t){return Math.round(t*1e3)/1e3}function Yn(t,l,o){if(l<t||o<=0)return[];const a=Wn(o)??o,r=Math.ceil(t/a-1e-9)*a,i=Math.floor((l-r)/a+1e-9),s=[];for(let c=0;c<=i;c++){const u=Kn(r+c*a);Math.abs(u/o-Math.round(u/o))<1e-6?s.push({mm:u,major:!0,label:String(u)}):s.push({mm:u,major:!1})}return s}function Xn(t,l){const o=e.ref(!1),n=e.ref(null);let a=0,r=0,i=0,s=0,c=!1;function u(B){if(l.disabled)return;const $=B.target;if(!($ instanceof HTMLElement)||$.classList.contains("resize-handle"))return;o.value=!0,c=B.altKey,a=B.clientX,r=B.clientY;const A=t.value;A&&(i=parseFloat(A.style.left)||0,s=parseFloat(A.style.top)||0,n.value={left:i,top:s,width:parseFloat(A.style.width)||0,height:parseFloat(A.style.height)||0},l.onStart?.({altKey:c}),document.addEventListener("mousemove",v),document.addEventListener("mouseup",h),B.preventDefault())}function f(B){const $=l.getScale?.()??1;let A=i+(B.clientX-a)/$,Y=s+(B.clientY-r)/$;if(l.axis==="x"&&(Y=s),l.axis==="y"&&(A=i),l.onAdsorb){const j=t.value;if(j){const I=parseFloat(j.style.width)||0,G=parseFloat(j.style.height)||0,H=l.onAdsorb({left:A,top:Y,width:I,height:G});A=H.left,Y=H.top}}return{left:A,top:Y}}function v(B){const $=f(B);n.value&&(n.value.left=$.left,n.value.top=$.top),l.onDrag($)}function h(B){o.value=!1;const $=f(B);l.onDragEnd?.($,{altKey:c}),l.onStop?.(),n.value=null,document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",h)}function L(){const B=t.value;B&&B.removeEventListener("mousedown",u),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",h)}function R(){L();const B=t.value;B&&B.addEventListener("mousedown",u)}return{isDragging:o,dragPreview:n,setup:R,cleanup:L}}const jn=["nw","n","ne","e","se","s","sw","w"];function Jn(t,l,o,n,a,r){let{left:i,top:s,width:c,height:u}=l;switch(t){case"e":c=Math.max(a,l.width+o);break;case"w":c=Math.max(a,l.width-o),i=l.left+l.width-c;break;case"s":u=Math.max(r,l.height+n);break;case"n":u=Math.max(r,l.height-n),s=l.top+l.height-u;break;case"se":c=Math.max(a,l.width+o),u=Math.max(r,l.height+n);break;case"sw":c=Math.max(a,l.width-o),i=l.left+l.width-c,u=Math.max(r,l.height+n);break;case"ne":c=Math.max(a,l.width+o),u=Math.max(r,l.height-n),s=l.top+l.height-u;break;case"nw":c=Math.max(a,l.width-o),i=l.left+l.width-c,u=Math.max(r,l.height-n),s=l.top+l.height-u;break}return{left:i,top:s,width:c,height:u}}function Zn(t){let l=0,o=0,n={left:0,top:0,width:0,height:0},a=null;function r(u,f){a=u,l=f.clientX,o=f.clientY,n={...t.getRect()},t.onStart?.(),document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),f.preventDefault()}function i(u){if(!a)return;const f=t.getScale?.()||1,v=(u.clientX-l)/f,h=(u.clientY-o)/f,L=t.minWidth||20,R=t.minHeight||20;t.onResize(Jn(a,n,v,h,L,R))}function s(){a=null,t.onStop?.(),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}function c(){document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}return{startResize:r,cleanup:c}}const Qn=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},a=e.computed(()=>{const i=l.element.options;return{fontSize:(i.fontSize||12)+"pt",fontWeight:i.fontWeight||"normal",fontFamily:i.fontFamily||"inherit",color:i.color||"#333",backgroundColor:i.backgroundColor||"transparent",textAlign:i.textAlign||"left",lineHeight:i.lineHeight?i.lineHeight+"pt":"normal",letterSpacing:i.letterSpacing?i.letterSpacing+"pt":"normal",textDecoration:i.textDecoration||"none",padding:`${i.contentPaddingTop||0}pt ${i.contentPaddingRight||0}pt ${i.contentPaddingBottom||0}pt ${i.contentPaddingLeft||0}pt`,width:"100%",height:"100%",boxSizing:"border-box",overflow:"hidden",...i.verticalAlign?{display:"flex",alignItems:o[i.verticalAlign]??"flex-start",justifyContent:n[i.textAlign||"left"]??"flex-start"}:{}}}),r=e.computed(()=>l.designMode?l.element.options.testData?l.element.options.testData:l.element.options.formatter||"文本":Oe(l.element.options,l.data));return(i,s)=>(e.openBlock(),e.createElementBlock("div",{class:"print-text",style:e.normalizeStyle(a.value)},e.toDisplayString(r.value),5))}}),_n={class:"print-image"},el=["src"],tl={key:1,class:"image-placeholder"},ol=e.defineComponent({__name:"ImageElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.computed(()=>{const i=l.element.options.src||"";return i?i.includes("{")?l.designMode?$e(i,fe):$e(i,l.data?.[0]||{}):i:""}),n=e.ref(!1);function a(){n.value=!0}e.watch(o,()=>{n.value=!1});const r=e.computed(()=>({objectFit:l.element.options.fit||"contain"}));return(i,s)=>(e.openBlock(),e.createElementBlock("div",_n,[o.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,style:e.normalizeStyle(r.value),onError:a},null,44,el)):(e.openBlock(),e.createElementBlock("div",tl,"图片"))]))}}),nl=Q(ol,[["__scopeId","data-v-530ee54f"]]),ll=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},a=e.computed(()=>{const i=l.element.options;return{fontSize:(i.fontSize||12)+"pt",fontWeight:i.fontWeight||"normal",fontFamily:i.fontFamily||"inherit",color:i.color||"#333",backgroundColor:i.backgroundColor||"transparent",textAlign:i.textAlign||"left",lineHeight:i.lineHeight?i.lineHeight+"pt":"1.5",letterSpacing:i.letterSpacing?i.letterSpacing+"pt":"normal",textIndent:i.longTextIndent?i.longTextIndent+"pt":"0",width:"100%",height:"100%",overflow:"hidden",wordBreak:"break-all",boxSizing:"border-box",...i.verticalAlign?{display:"flex",alignItems:o[i.verticalAlign]??"flex-start",justifyContent:n[i.textAlign||"left"]??"flex-start"}:{}}}),r=e.computed(()=>l.designMode?l.element.options.formatter?l.element.options.formatter:"长文本内容":Oe(l.element.options,l.data));return(i,s)=>(e.openBlock(),e.createElementBlock("div",{class:"print-longtext",style:e.normalizeStyle(a.value)},e.toDisplayString(r.value),5))}}),al=["title"],il=["title","onClick"],rl=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:l}){const o=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],n=l;function a(r,i){n("action",r,i)}return(r,i)=>(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:i[8]||(i[8]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"menu-item",onClick:i[0]||(i[0]=s=>a("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:i[1]||(i[1]=s=>a("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteRow}]),onClick:i[2]||(i[2]=s=>t.canDeleteRow&&a("delete-row"))}," 删除行 ",2),i[9]||(i[9]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:"menu-item",onClick:i[3]||(i[3]=s=>a("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:i[4]||(i[4]=s=>a("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteCol}]),onClick:i[5]||(i[5]=s=>t.canDeleteCol&&a("delete-col"))}," 删除列 ",2),i[10]||(i[10]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!!t.mergeDisabledReason}]),title:t.mergeDisabledReason||"",onClick:i[6]||(i[6]=s=>!t.mergeDisabledReason&&a("merge"))}," 合并单元格 ",10,al),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canSplit}]),onClick:i[7]||(i[7]=s=>t.canSplit&&a("split"))}," 拆分单元格 ",2),i[11]||(i[11]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),i[12]||(i[12]=e.createElementVNode("div",{class:"menu-group-title"},"行类型",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(o,s=>e.createElementVNode("div",{key:s.value,class:e.normalizeClass(["menu-item",{disabled:!!t.rowTypeDisabledReason(s.value),active:t.currentRowType===s.value}]),title:t.rowTypeDisabledReason(s.value)||"",onClick:c=>!t.rowTypeDisabledReason(s.value)&&a("set-row-type",s.value)},e.toDisplayString(s.label),11,il)),64))],36)):e.createCommentVNode("",!0)]))}}),sl=Q(rl,[["__scopeId","data-v-3f0b28d4"]]),dl={class:"cell-barcode"},cl=["src"],ul={key:1,class:"cell-barcode-fallback"},ml=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{}},setup(t){const l=t,o=e.ref(null),n=e.ref(!1),a=e.ref(""),r=e.computed(()=>({objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"})),i=e.computed(()=>({objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}));function s(){if(n.value=!1,!!o.value)try{lt(o.value,l.value,{format:l.barcodeType||"CODE128",width:1,height:28,displayValue:l.showText!==!1,fontSize:9,margin:0}),n.value=!0}catch{}}async function c(){if(!l.value){a.value="";return}try{a.value=await at.toDataURL(l.value,{width:96,margin:1,errorCorrectionLevel:l.qrCodeLevel||"M"})}catch{a.value=""}}function u(){l.cellType==="barcode"?s():c()}return e.onMounted(u),e.watch(()=>[l.cellType,l.value,l.barcodeType,l.qrCodeLevel,l.showText],u),(f,v)=>(e.openBlock(),e.createElementBlock("div",dl,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:o,preserveAspectRatio:"xMidYMid meet",style:e.normalizeStyle(r.value)},null,4)),[[e.vShow,t.cellType==="barcode"&&n.value]]),t.cellType==="qrcode"&&a.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:a.value,alt:"qrcode",style:e.normalizeStyle(i.value)},null,12,cl)):e.createCommentVNode("",!0),!n.value&&t.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",ul,e.toDisplayString(t.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),pl=Q(ml,[["__scopeId","data-v-612f4008"]]),fl={class:"cell-image"},vl=["src"],gl={key:1,class:"image-placeholder"},hl=e.defineComponent({__name:"CellImage",props:{value:{},fit:{},maxWidth:{},maxHeight:{},designMode:{type:Boolean},data:{}},setup(t){const l=t,o=e.computed(()=>{const i=l.value||"";return i?i.includes("{")?l.designMode?$e(i,fe):$e(i,l.data?.[0]||{}):i:""}),n=e.ref(!1);function a(){n.value=!0}e.watch(o,()=>{n.value=!1});const r=e.computed(()=>({objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}));return(i,s)=>(e.openBlock(),e.createElementBlock("div",fl,[o.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,style:e.normalizeStyle(r.value),onError:a},null,44,vl)):(e.openBlock(),e.createElementBlock("div",gl,"图片"))]))}}),bl=Q(hl,[["__scopeId","data-v-7f838bbb"]]),yl=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],kl={key:2,class:"data-placeholder"},El={key:0,class:"col-resize-layer"},wl=["aria-label","onMousedown"],Vl={key:1,class:"row-badges"},Re=3.7795275591,Nl=.1,Cl=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:l}){const o={header:"题",data:"数",subtotal:"小",summary:"汇"},n=t,a=l,r=e.inject(Be,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),i=e.computed(()=>n.element.options.tableRows??[]),s=e.computed(()=>n.element.options.tableColWidths??[]),c=e.computed(()=>n.element.options.tableDefaultFontSize??10),u=e.computed(()=>n.element.options.tableDefaultColor??"#333333"),f=e.computed(()=>{const w=r.tableSelection.value;return w&&w.elementId===n.element.id?w:null});function v(w){let V=0;for(let M=0;M<w;M++)V+=i.value[M].height;return V}const h=e.ref(null),L=e.ref([]);function R(){if(!n.designMode)return;const w=h.value;if(!w)return;const V=w.offsetHeight;if(V<=0)return;const M=n.element.options,b=V/Re;Math.abs(b-(M.height??0))>Nl&&(M.height=Math.round(b*100)/100);const k=w.offsetTop;L.value=Array.from(w.rows).map(q=>({top:(q.offsetTop-k)/Re,height:q.offsetHeight/Re}))}function B(w){return L.value[w]?.top??v(w)}function $(w){return L.value[w]?.height??i.value[w]?.height??0}e.watch(()=>[n.element.options,n.designMode],()=>R(),{deep:!0,flush:"post"}),e.onMounted(()=>{R(),document.fonts?.ready.then(()=>R())});const A=e.computed(()=>{const w=n.element.options.dataSource;if(w&&Array.isArray(fe[w]))return fe[w];for(const V of Object.values(fe))if(Array.isArray(V))return V}),Y=e.computed(()=>{if(n.data)return n.data});function j(w){return w.cellType==="barcode"||w.cellType==="qrcode"}function I(w,V){return j(V)?ko(V.formatter,A.value):V.formatter||""}function G(w,V){const M=n.element.options,b={designMode:n.designMode,showGhostBorder:n.showTableGhostBorder};return{fontFamily:V.fontFamily||"inherit",textAlign:V.align??"left",verticalAlign:V.valign??"middle",fontSize:(V.fontSize??c.value)+"pt",fontWeight:V.fontWeight??"normal",color:V.color??u.value,backgroundColor:V.backgroundColor??"transparent",borderTop:Ae(V.borders?.top,b),borderRight:Ae(V.borders?.right,b),borderBottom:Ae(V.borders?.bottom,b),borderLeft:Ae(V.borders?.left,b),padding:(V.padding??M.tableDefaultPadding??1)+"mm",whiteSpace:V.wordWrap??!0?"normal":"nowrap",overflow:V.wordWrap??!0?"visible":"hidden"}}function H(w,V){const M=f.value;return{"cell-selected":!!M&&w>=M.r1&&w<=M.r2&&V>=M.c1&&V<=M.c2,"row-data-bg":i.value[w].type==="data"}}const T=e.ref(null);function C(w,V){const M=xt(i.value,w,V);r.setTableSelection({elementId:n.element.id,...M})}function S(w,V,M){!n.designMode||!n.isSelected||(M.stopPropagation(),M.shiftKey&&f.value?C({r:f.value.r1,c:f.value.c1},{r:w,c:V}):(T.value={r:w,c:V},C({r:w,c:V},{r:w,c:V})),window.addEventListener("mouseup",()=>{T.value=null},{once:!0}))}function x(w,V){T.value&&C(T.value,{r:w,c:V})}function D(w,V){n.designMode&&a("dblclick-cell",n.element.id,w,V)}const z=e.reactive({visible:!1,x:0,y:0});function m(w,V,M){if(!n.designMode||!n.isSelected)return;const b=f.value;b&&w>=b.r1&&w<=b.r2&&V>=b.c1&&V<=b.c2||C({r:w,c:V},{r:w,c:V}),z.x=M.clientX,z.y=M.clientY,z.visible=!0,window.addEventListener("mousedown",()=>{z.visible=!1},{once:!0})}const y=e.computed(()=>{const w=f.value;return w?Bt(i.value,w):"未选择单元格"}),F=e.computed(()=>{const w=f.value;if(!w)return!1;for(let V=w.r1;V<=w.r2;V++)for(let M=w.c1;M<=w.c2;M++){const b=i.value[V].cells[M];if(!b.merged&&((b.rowspan??1)>1||(b.colspan??1)>1))return!0}return!1});function K(w){const V=f.value;if(!V)return"未选择单元格";if(V.r1!==V.r2)return"行类型仅支持单行设置";const M=JSON.parse(JSON.stringify(i.value));return et(M,V.r1,w)}function J(){Fe(n.element.options)}function te(w,V){const M=r.maxTableWidth.value,b=w.reduce((k,q)=>k+q,0)+w[V];return b>M?`插入后表格总宽 ${Math.round(b*10)/10}mm 超过打印范围宽度 ${M}mm,请先缩小列宽`:null}function se(w,V){const M=f.value;if(!M)return;z.visible=!1;const b=n.element.options,k=b.tableRows,q=b.tableColWidths;let X=null;switch(w){case"insert-row-above":gt(k,M.r1,"above");break;case"insert-row-below":gt(k,M.r2,"below");break;case"delete-row":X=co(k,M.r1);break;case"insert-col-left":X=te(q,M.c1),X||ht(k,q,M.c1,"left");break;case"insert-col-right":X=te(q,M.c2),X||ht(k,q,M.c2,"right");break;case"delete-col":X=uo(k,q,M.c1);break;case"merge":Dt(k,M);break;case"split":Tt(k,M);break;case"set-row-type":X=et(k,M.r1,V);break}if(X){alert(X);return}r.setTableSelection(null),J(),r.recordHistory()}const re=e.computed(()=>n.designMode&&!!n.isSelected&&!n.element.options.locked&&s.value.length>=1),ae=e.computed(()=>Array.from({length:s.value.length},(w,V)=>V+1));function _(w){return s.value.slice(0,w).reduce((V,M)=>V+M,0)}const g=e.ref(null);let d=0,p=0;function E(w,V){re.value&&(g.value=w,d=V.clientX,p=s.value[w-1],document.addEventListener("mousemove",N),document.addEventListener("mouseup",P))}function N(w){if(g.value===null)return;const V=n.scale||1,M=(w.clientX-d)/(V*Re),b=g.value-1,k=n.element.options.tableColWidths;k[b]=fo(k,b,p+M,r.maxTableWidth.value),J()}function P(){document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",P),g.value!==null&&(g.value=null,J(),r.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",P)}),(w,V)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["print-table",{"design-mode":t.designMode}]),onContextmenu:V[0]||(V[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:h,style:e.normalizeStyle({fontSize:c.value+"pt",color:u.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(M,b)=>(e.openBlock(),e.createElementBlock("col",{key:b,style:e.normalizeStyle({width:M+"mm"})},null,4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(M,b)=>(e.openBlock(),e.createElementBlock("tr",{key:M.id,style:e.normalizeStyle({height:M.height+"mm"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.cells,(k,q)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k.id},[k.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:k.rowspan||1,colspan:k.colspan||1,class:e.normalizeClass(H(b,q)),style:e.normalizeStyle(G(M,k)),onMousedown:e.withModifiers(X=>S(b,q,X),["left"]),onMouseenter:X=>x(b,q),onDblclick:e.withModifiers(X=>D(b,q),["stop"]),onContextmenu:e.withModifiers(X=>m(b,q,X),["prevent","stop"])},[j(k)?(e.openBlock(),e.createBlock(pl,{key:0,"cell-type":k.cellType,value:I(M,k),"barcode-type":k.barcodeType,"qr-code-level":k.qrCodeLevel,"show-text":k.showBarcodeText,fit:k.fit,"max-width":k.maxWidth,"max-height":k.maxHeight},null,8,["cell-type","value","barcode-type","qr-code-level","show-text","fit","max-width","max-height"])):k.cellType==="image"?(e.openBlock(),e.createBlock(bl,{key:1,value:k.formatter||"",fit:k.fit,"max-width":k.maxWidth,"max-height":k.maxHeight,"design-mode":t.designMode,data:Y.value},null,8,["value","fit","max-width","max-height","design-mode","data"])):M.type==="data"?(e.openBlock(),e.createElementBlock("span",kl,e.toDisplayString(I(M,k)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(I(M,k)),1)],64))],46,yl))],64))),128))],4))),128))])],4),re.value?(e.openBlock(),e.createElementBlock("div",El,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ae.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M,class:e.normalizeClass(["col-resize-handle",{dragging:g.value===M}]),role:"separator","aria-label":"列宽手柄"+M,style:e.normalizeStyle({left:_(M)+"mm"}),onMousedown:e.withModifiers(b=>E(M,b),["stop","prevent"])},null,46,wl))),128))])):e.createCommentVNode("",!0),t.designMode&&t.isSelected?(e.openBlock(),e.createElementBlock("div",Vl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(M,b)=>(e.openBlock(),e.createElementBlock("span",{key:M.id,class:"row-badge",style:e.normalizeStyle({top:B(b)+"mm",height:$(b)+"mm"})},e.toDisplayString(o[M.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(sl,{visible:z.visible,x:z.x,y:z.y,"can-delete-row":i.value.length>1,"can-delete-col":s.value.length>1,"merge-disabled-reason":y.value,"can-split":F.value,"current-row-type":f.value?i.value[f.value.r1]?.type??null:null,"row-type-disabled-reason":K,onAction:se},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),Sl=Q(Cl,[["__scopeId","data-v-980bb07d"]]),Et=e.defineComponent({__name:"LineElement",props:{element:{}},setup(t){const l=t,o=e.computed(()=>l.element.printElementType.type==="hline"),n=e.computed(()=>{const a=l.element.options,r=(a.borderWidth||.75)+"pt",i=a.borderStyle||"solid",s=a.borderColor||"#333";return o.value?{width:"100%",height:"0",borderTop:`${r} ${i} ${s}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${r} ${i} ${s}`,boxSizing:"border-box"}});return(a,r)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(n.value)},null,4))}}),wt=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(t){const l=t,o=e.computed(()=>l.element.printElementType.type==="oval"),n=e.computed(()=>{const a=l.element.options;return{width:"100%",height:"100%",borderWidth:(a.borderWidth||1)+"pt",borderStyle:a.borderStyle||"solid",borderColor:a.borderColor||"#333",backgroundColor:a.backgroundColor||"transparent",borderRadius:o.value?"50%":"0",boxSizing:"border-box"}});return(a,r)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(n.value)},null,4))}}),$l={class:"print-barcode",ref:"containerRef"},Ml=96/25.4,xl=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.ref(null);function n(){if(!o.value)return;const a=l.element.options,r=(l.designMode?a.testData||a.formatter:Oe(a,l.data))||"条码",i=!a.hideTitle,s=(a.fontSize||12)*(96/72),c=(a.height||40)*Ml,u=i?s+4:0,f=Math.max(8,c-u);try{lt(o.value,r,{format:a.barcodeType||"CODE128",width:a.barWidth?a.barWidth/2:1,height:f,displayValue:i,fontSize:s,margin:2})}catch{}}return e.onMounted(n),e.watch(()=>[l.element.options.formatter,l.element.options.testData,l.element.options.barcodeType,l.element.options.width,l.element.options.height,l.element.options.barWidth,l.element.options.hideTitle,l.element.options.fontSize],n),(a,r)=>(e.openBlock(),e.createElementBlock("div",$l,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:o,preserveAspectRatio:"xMidYMid meet"},null,512))],512))}}),Bl=Q(xl,[["__scopeId","data-v-a71e7c44"]]),Dl={class:"print-qrcode"},Tl=["src"],zl=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.ref("");async function n(){const a=l.element.options,r=(l.designMode?a.testData||a.formatter:Oe(a,l.data))||"二维码",i=Math.min(a.width||80,a.height||80);try{o.value=await at.toDataURL(r,{width:i,margin:1,errorCorrectionLevel:String(a.qrCodeLevel??"M")})}catch{o.value=""}}return e.onMounted(n),e.watch(()=>[l.element.options.formatter,l.element.options.testData],n),(a,r)=>(e.openBlock(),e.createElementBlock("div",Dl,[o.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,alt:"qrcode"},null,8,Tl)):e.createCommentVNode("",!0)]))}}),Ll=Q(zl,[["__scopeId","data-v-90b31b7e"]]),Pl=["innerHTML"],Al=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.computed(()=>{if(l.element.options.formatter){const n=l.data&&l.data.length>0?l.data[0]:{},a=$e(l.element.options.formatter,n??{});return a?oo.sanitize(a):""}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,a)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:o.value},null,8,Pl))}}),Il=Q(Al,[["__scopeId","data-v-f0a224c2"]]),Rl=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.computed(()=>{const a=l.element.options;return{fontSize:(a.fontSize||12)+"pt",fontWeight:a.fontWeight||"normal",fontFamily:a.fontFamily||"inherit",color:a.color||"#333",textAlign:a.textAlign||"left",lineHeight:a.lineHeight?a.lineHeight+"pt":"normal",letterSpacing:a.letterSpacing?a.letterSpacing+"pt":"normal"}}),n=e.computed(()=>l.designMode?l.element.options.title||"{pageIndex}/{totalPages}":l.element.options.title||"");return(a,r)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(o.value)},e.toDisplayString(n.value),5))}}),Hl=Q(Rl,[["__scopeId","data-v-c3750ca3"]]),Ul={key:0,class:"drag-preview"},Fl={key:1,class:"resize-handles"},Ol=["onMousedown"],Gl={key:2,class:"selected-indicator"},ql={class:"position-label"},Wl=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:l}){const o=t,n=l,a=e.ref(null),r=e.inject(At,null),i=e.computed(()=>r?.value?r.value.has(o.element.id):o.isSelected??!1),s=e.inject(It,null),c=e.computed(()=>s?.value.has(o.element.id)??!1),u={text:e.markRaw(Qn),image:e.markRaw(nl),longText:e.markRaw(ll),table:e.markRaw(Sl),hline:e.markRaw(Et),vline:e.markRaw(Et),rect:e.markRaw(wt),oval:e.markRaw(wt),barcode:e.markRaw(Bl),qrcode:e.markRaw(Ll),html:e.markRaw(Il),pageNumber:e.markRaw(Hl)},f=e.computed(()=>u[o.element.printElementType.type]),v=e.computed(()=>o.element.printElementType.type==="table"?{showTableGhostBorder:o.showTableGhostBorder,scale:o.scale}:{}),h=e.computed(()=>{const D=o.element.options;return{position:"absolute",left:D.left+"mm",top:D.top+"mm",width:D.width+"mm",height:D.height+"mm",zIndex:D.zIndex||"auto"}}),L=e.computed(()=>{const D=o.element.options;return`x:${Math.round(D.left)} y:${Math.round(D.top)} ${Math.round(D.width)}×${Math.round(D.height)}mm`});let R=0,B=0;const $=e.reactive({disabled:!o.designMode||!!o.element.options.locked,getScale:()=>(o.scale||1)*ve(1),onDrag:D=>{const z=D.left-R,m=D.top-B;a.value&&(a.value.style.transform=`translate(${z}mm, ${m}mm)`)},onDragEnd:(D,z)=>{if(z.altKey){const F=JSON.parse(JSON.stringify(o.element));F.id=Se(),F.options.left=D.left,F.options.top=D.top,n("clone-element",F,{left:D.left,top:D.top}),a.value&&(a.value.style.transform="");return}const m=D.left-R,y=D.top-B;if(o.element.options.left=D.left,o.element.options.top=D.top,a.value&&(a.value.style.transform=""),o.element.options.groupId&&o.allElements)for(const F of o.allElements)F.id!==o.element.id&&F.options.groupId===o.element.options.groupId&&(F.options.left+=m,F.options.top+=y)},onStart:()=>{R=o.element.options.left,B=o.element.options.top,n("select",o.element.id,!1),n("drag-start")},onStop:()=>{o.clearAdsorbGuides?.(),n("drag-stop")},onAdsorb:D=>{let z=D.left,m=D.top;return o.snapToGrid&&(z=Math.round(D.left/5)*5,m=Math.round(D.top/5)*5),o.adsorbHandler?o.adsorbHandler({id:o.element.id,left:z,top:m,width:o.element.options.width,height:o.element.options.height}):{left:z,top:m,lines:[]}}}),{setup:A,cleanup:Y,isDragging:j}=Xn(a,$);e.watchEffect(()=>{$.disabled=!o.designMode||!!o.element.options.locked});const I=e.computed(()=>i.value&&!!o.designMode&&!o.element.options.locked&&o.element.printElementType.type!=="table"),{startResize:G,cleanup:H}=Zn({minWidth:3.5,minHeight:3.5,getScale:()=>(o.scale||1)*ve(1),getRect:()=>({left:o.element.options.left,top:o.element.options.top,width:o.element.options.width,height:o.element.options.height}),onResize:D=>{o.element.options.left=D.left,o.element.options.top=D.top,o.element.options.width=D.width,o.element.options.height=D.height},onStart:()=>{n("drag-start")},onStop:()=>{n("drag-stop")}});function T(D){o.designMode&&n("select",o.element.id,D.ctrlKey||D.metaKey)}function C(){o.designMode&&n("dblclick-element",o.element.id)}function S(D,z,m){o.designMode&&n("dblclick-cell",D,z,m)}e.onMounted(()=>{o.designMode&&A()});function x(){Y(),H(),o.clearAdsorbGuides?.()}return e.onUnmounted(()=>{x()}),(D,z)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:a,class:e.normalizeClass(["print-element",{selected:i.value,previewed:c.value,"design-mode":t.designMode,locked:t.element.options.locked,hidden:t.element.options.visible===!1,"drag-ghost":e.unref(j),[`type-${t.element.printElementType.type}`]:!0,[`zone-${t.zone||"content"}`]:!0}]),style:e.normalizeStyle(h.value),onMousedown:e.withModifiers(T,["stop"]),onDblclick:e.withModifiers(C,["stop"]),onContextmenu:z[0]||(z[0]=e.withModifiers(m=>D.$emit("contextmenu",t.element.id,m),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f.value),e.mergeProps({element:t.element,data:t.printData,"design-mode":t.designMode,"is-selected":i.value},v.value,{onDblclickCell:S}),null,16,["element","data","design-mode","is-selected"])),e.unref(j)?(e.openBlock(),e.createElementBlock("div",Ul)):e.createCommentVNode("",!0),I.value?(e.openBlock(),e.createElementBlock("div",Fl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(jn),m=>(e.openBlock(),e.createElementBlock("div",{key:m,class:e.normalizeClass(["resize-handle",`handle-${m}`]),onMousedown:e.withModifiers(y=>e.unref(G)(m,y),["stop"])},null,42,Ol))),128))])):e.createCommentVNode("",!0),i.value&&t.designMode?(e.openBlock(),e.createElementBlock("div",Gl,[e.createElementVNode("div",ql,e.toDisplayString(L.value),1)])):e.createCommentVNode("",!0)],38))}}),Ze=Q(Wl,[["__scopeId","data-v-64c495e7"]]);function Kl(t={}){const l=t.adsorbMin??1,o=t.adsorbLineMin??2,n=t.showAdsorbLine??!0,a=e.ref([]),r=e.ref({width:0,height:0}),i={left:"#3b82f6",center:"#10b981",right:"#f59e0b",top:"#3b82f6",middle:"#10b981",bottom:"#f59e0b"};function s(v){return v==="vCenter"?i.center:v==="hCenter"?i.middle:i[v]??i.left}function c(v,h,L){let R=v.left,B=v.top;const $=[],A={left:v.left,right:v.left+v.width,vCenter:v.left+v.width/2,top:v.top,bottom:v.top+v.height,hCenter:v.top+v.height/2};let Y=1/0;for(const I of h){if(I.id===v.id)continue;const G={left:I.left,right:I.left+I.width,vCenter:I.left+I.width/2,top:I.top,bottom:I.top+I.height,hCenter:I.top+I.height/2},H=[["left","left"],["left","vCenter"],["left","right"],["vCenter","left"],["vCenter","vCenter"],["vCenter","right"],["right","left"],["right","vCenter"],["right","right"]],T=[["top","top"],["top","hCenter"],["top","bottom"],["hCenter","top"],["hCenter","hCenter"],["hCenter","bottom"],["bottom","top"],["bottom","hCenter"],["bottom","bottom"]];for(const[C,S]of H){const x=Math.abs(A[C]-G[S]);x<=l&&x<Y&&(Y=x,R=v.left+(G[S]-A[C]))}for(const[C,S]of T){const x=Math.abs(A[C]-G[S]);x<=l&&x<Y&&(Y=x,B=v.top+(G[S]-A[C]))}}if(L){const I={left:R,right:R+v.width,vCenter:R+v.width/2,top:B,bottom:B+v.height,hCenter:B+v.height/2},G=["left","vCenter","right"];for(const T of L.vertical)for(const C of G){const S=Math.abs(I[C]-T);S<=l&&S<Y&&(Y=S,R=v.left+(T-I[C]))}const H=["top","hCenter","bottom"];for(const T of L.horizontal)for(const C of H){const S=Math.abs(I[C]-T);S<=l&&S<Y&&(Y=S,B=v.top+(T-I[C]))}}const j={left:R,right:R+v.width,vCenter:R+v.width/2,top:B,bottom:B+v.height,hCenter:B+v.height/2};if(n){const I=new Set;for(const G of h){if(G.id===v.id)continue;const H={left:G.left,right:G.left+G.width,vCenter:G.left+G.width/2,top:G.top,bottom:G.top+G.height,hCenter:G.top+G.height/2},T=[["left","left"],["left","vCenter"],["left","right"],["vCenter","left"],["vCenter","vCenter"],["vCenter","right"],["right","left"],["right","vCenter"],["right","right"]],C=[["top","top"],["top","hCenter"],["top","bottom"],["hCenter","top"],["hCenter","hCenter"],["hCenter","bottom"],["bottom","top"],["bottom","hCenter"],["bottom","bottom"]];for(const[S,x]of T)if(Math.abs(j[S]-H[x])<=o){const z=`v:${H[x]}`;I.has(z)||(I.add(z),$.push({type:"vertical",position:H[x],id:G.id,color:s(S)}))}for(const[S,x]of C)if(Math.abs(j[S]-H[x])<=o){const z=`h:${H[x]}`;I.has(z)||(I.add(z),$.push({type:"horizontal",position:H[x],id:G.id,color:s(S)}))}}}if(L){for(const I of L.vertical)$.some(G=>G.type==="vertical"&&G.position===I)||$.push({type:"vertical",position:I});for(const I of L.horizontal)$.some(G=>G.type==="horizontal"&&G.position===I)||$.push({type:"horizontal",position:I})}return{left:R,top:B,lines:$}}function u(v,h,L){a.value=v,r.value={width:h,height:L}}function f(){a.value=[]}return{check:c,renderLines:u,clearLines:f,guideLines:a,paperSize:r}}function Yl(t){const{check:l,renderLines:o,clearLines:n,guideLines:a,paperSize:r}=Kl(t.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function i(c){const u=t.getElements().filter(h=>h.id!==c.id).map(h=>({id:h.id,left:h.options.left,top:h.options.top,width:h.options.width,height:h.options.height})),f=l(c,u,t.getGuides?.()),v=t.getPaperSize();return o(f.lines,v.width,v.height),f}function s(){n()}return{requestAdsorb:i,clearGuides:s,guideLines:a,paperSize:r}}const Xl={key:0,class:"zone-label"},jl={key:0,class:"zone-height-tip"},Jl={key:0,class:"zone-label"},Zl={key:0,class:"zone-height-tip"},Ql=["onMousedown","onDblclick"],_l=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:l,emit:o}){const n=t,a=o,r=e.ref(null),i=e.computed(()=>we(n.templateData).width),s=e.computed(()=>we(n.templateData).height),c=e.computed(()=>`${8/(n.scale||1)}px`),u=e.computed(()=>{const d=n.scale||1,p=ve(i.value)*d,E=ve(s.value)*d;return{width:p+"px",height:E+"px",position:"relative"}}),f=e.computed(()=>{const d=n.templateData.margins,p=n.templateData.header.height,E=n.templateData.footer.height,N=i.value-d.left-d.right;return{header:{left:d.left,top:d.top,width:N,height:p},content:{left:d.left,top:d.top+p,width:N,height:s.value-d.top-d.bottom-p-E},footer:{left:d.left,top:s.value-d.bottom-E,width:N,height:E}}});function v(d){return{position:"absolute",left:d.left+"mm",top:d.top+"mm",width:d.width+"mm",height:d.height+"mm"}}const h=e.computed(()=>{const d={header:[],footer:[],content:[]};for(const p of n.runtimeElements)p.zone==="header"?d.header.push(p):p.zone==="footer"?d.footer.push(p):d.content.push(p);return d}),L=e.computed(()=>h.value.header),R=e.computed(()=>h.value.footer),B=e.computed(()=>h.value.content);let $="content";const{requestAdsorb:A,clearGuides:Y,guideLines:j,paperSize:I}=Yl({getElements:()=>h.value[$],getPaperSize:()=>{const d=f.value[$];return{width:d.width,height:d.height}},getGuides:()=>{const d=[],p=[];for(const E of n.guides??[])E.type==="vertical"?d.push(E.position):p.push(E.position);return{vertical:d,horizontal:p}}});function G(d){$=n.runtimeElements.find(N=>N.id===d.id)?.zone||"content";const E=A(d);return(E.left!==d.left||E.top!==d.top)&&m(E.left+d.width/2,E.top+d.height/2),E}function H(d,p){const E=p.position,N=d.clientX,P=d.clientY,w=n.scale??1,V=25.4/96,M=k=>{const q=(p.type==="vertical"?k.clientX-N:k.clientY-P)/w*V,X=p.type==="vertical"?i.value:s.value,ue=Math.min(Math.max(E+q,0),X);a("guide-move",p.id,ue)},b=()=>{window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",b)};window.addEventListener("mousemove",M),window.addEventListener("mouseup",b)}const T=e.computed(()=>({width:i.value+"mm",minHeight:s.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"})),C=e.computed(()=>{const d=n.templateData.margins;return{padding:`${d.top}mm ${d.right}mm ${d.bottom}mm ${d.left}mm`,position:"relative",boxSizing:"border-box",minHeight:s.value+"mm"}}),S=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 x=0,D=null;const z=e.ref(null);function m(d,p){x+=1,z.value={left:d,top:p,key:x},D&&clearTimeout(D),D=setTimeout(()=>{z.value=null},300)}const y=e.computed(()=>{const d=n.templateData.watermark;return d?!d.mode||d.mode==="fixed"?!!d.content&&d.content.trim().length>0:!!d.binding:!1}),F=e.computed(()=>{const d=n.templateData.watermark||{},p=d.color||"#cccccc",E=d.opacity??.15,N=d.rotate??-30;let P=K(d);if(d.timestamp){const w=new Date,V=`${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}-${String(w.getDate()).padStart(2,"0")} ${String(w.getHours()).padStart(2,"0")}:${String(w.getMinutes()).padStart(2,"0")}`;P=P?`${P} ${V}`:V}return{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"0",overflow:"hidden",opacity:String(E),backgroundImage:J(P,p,N),backgroundRepeat:"repeat"}});function K(d){if(!d.mode||d.mode==="fixed")return d.content||"";if(d.binding){const p=n.printData?.[0];return p&&p[d.binding]!==void 0&&p[d.binding]!==null?String(p[d.binding]):d.testData||`[${d.binding}]`}return""}function J(d,p,E){const N=d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),P=`<svg xmlns="http://www.w3.org/2000/svg" width="260" height="180">
|
|
2
|
+
<text x="130" y="90" font-size="16" fill="${p}" text-anchor="middle" dominant-baseline="middle" transform="rotate(${E},130,90)">${N}</text>
|
|
3
|
+
</svg>`;return`url("data:image/svg+xml,${encodeURIComponent(P)}")`}const te=e.ref(null);function se(d,p){_(),te.value={zone:d,startY:p.clientY,startH:n.templateData[d].height},window.addEventListener("mousemove",re),window.addEventListener("mouseup",ae)}function re(d){if(!te.value)return;const{zone:p,startY:E,startH:N}=te.value,w=(d.clientY-E)/(n.scale||1)*25.4/96,V=p==="header"?w:-w,M=Math.min(100,s.value-n.templateData.margins.top-n.templateData.margins.bottom-(p==="header"?n.templateData.footer.height:n.templateData.header.height)-10),b=Math.min(M,Math.max(0,Math.round((N+V)*10)/10));a("zone-height-change",p,b)}function ae(){if(!te.value)return;const d=te.value.zone;te.value=null,window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",ae),a("zone-height-commit",d)}function _(){window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",ae),te.value=null}e.onUnmounted(()=>{_(),D&&clearTimeout(D)});function g(d,p){a("select",d,p)}return l({contentRef:r}),(d,p)=>(e.openBlock(),e.createElementBlock("div",{class:"paper-wrapper",style:e.normalizeStyle(u.value)},[e.createElementVNode("div",{class:"hiprint-printPaper",style:e.normalizeStyle(T.value)},[e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:r,style:e.normalizeStyle(C.value)},[t.showGrid&&t.designMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"grid-bg",style:e.normalizeStyle(S.value)},null,4)):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createElementBlock("div",{key:z.value.key,class:"snap-indicator",style:e.normalizeStyle({left:z.value.left+"mm",top:z.value.top+"mm"})},null,4)):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"watermark-layer",style:e.normalizeStyle(F.value)},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-header",{"design-mode":t.designMode}]),style:e.normalizeStyle(v(f.value.header))},[t.designMode?(e.openBlock(),e.createElementBlock("span",Xl,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.value,E=>(e.openBlock(),e.createBlock(Ze,{key:E.id,element:E,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":L.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"header","adsorb-handler":G,"clear-adsorb-guides":e.unref(Y),onSelect:g,onDragStart:p[0]||(p[0]=N=>d.$emit("drag-start")),onDragStop:p[1]||(p[1]=N=>d.$emit("drag-stop")),onDblclickElement:p[2]||(p[2]=N=>d.$emit("dblclick-element",N)),onDblclickCell:p[3]||(p[3]=(N,P,w)=>d.$emit("dblclick-cell",N,P,w)),onContextmenu:p[4]||(p[4]=(N,P)=>d.$emit("contextmenu",N,P)),onCloneElement:(N,P)=>d.$emit("clone-element",N,P)},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:p[5]||(p[5]=e.withModifiers(E=>se("header",E),["prevent","stop"]))},[te.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",jl,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(f.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"})},[...p[17]||(p[17]=[e.createElementVNode("span",{class:"zone-label"},"首页叠加",-1)])],4)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,E=>(e.openBlock(),e.createBlock(Ze,{key:E.id,element:E,"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:"content","adsorb-handler":G,"clear-adsorb-guides":e.unref(Y),onSelect:g,onDragStart:p[6]||(p[6]=N=>d.$emit("drag-start")),onDragStop:p[7]||(p[7]=N=>d.$emit("drag-stop")),onDblclickElement:p[8]||(p[8]=N=>d.$emit("dblclick-element",N)),onDblclickCell:p[9]||(p[9]=(N,P,w)=>d.$emit("dblclick-cell",N,P,w)),onContextmenu:p[10]||(p[10]=(N,P)=>d.$emit("contextmenu",N,P)),onCloneElement:(N,P)=>d.$emit("clone-element",N,P)},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(f.value.footer))},[t.designMode?(e.openBlock(),e.createElementBlock("span",Jl,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,E=>(e.openBlock(),e.createBlock(Ze,{key:E.id,element:E,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":R.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"footer","adsorb-handler":G,"clear-adsorb-guides":e.unref(Y),onSelect:g,onDragStart:p[11]||(p[11]=N=>d.$emit("drag-start")),onDragStop:p[12]||(p[12]=N=>d.$emit("drag-stop")),onDblclickElement:p[13]||(p[13]=N=>d.$emit("dblclick-element",N)),onDblclickCell:p[14]||(p[14]=(N,P,w)=>d.$emit("dblclick-cell",N,P,w)),onContextmenu:p[15]||(p[15]=(N,P)=>d.$emit("contextmenu",N,P)),onCloneElement:(N,P)=>d.$emit("clone-element",N,P)},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:p[16]||(p[16]=e.withModifiers(E=>se("footer",E),["prevent","stop"]))},[te.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",Zl,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(j),(E,N)=>(e.openBlock(),e.createElementBlock("div",{key:N,class:e.normalizeClass(["adsorb-guide",[`guide-${E.type}`]]),style:e.normalizeStyle(E.type==="vertical"?{left:E.position+"mm",top:"0",height:e.unref(I).height+"mm",borderLeftColor:E.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:E.position+"mm",left:"0",width:e.unref(I).width+"mm",borderTopColor:E.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.guides,E=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+E.id,class:e.normalizeClass(["manual-guide",[`guide-${E.type}`]]),style:e.normalizeStyle(E.type==="vertical"?{left:E.position+"mm",top:"0",height:s.value+"mm","--guide-hit":c.value}:{top:E.position+"mm",left:"0",width:i.value+"mm","--guide-hit":c.value}),onMousedown:e.withModifiers(N=>H(N,E),["prevent","stop"]),onDblclick:e.withModifiers(N=>E.id&&a("guide-remove",E.id),["prevent","stop"])},null,46,Ql))),128))],4)],4)],4))}}),ea=Q(_l,[["__scopeId","data-v-a511ac20"]]),ta=e.defineComponent({__name:"Ruler",props:{orientation:{},viewportPx:{},originPx:{},paperLengthMM:{},scale:{},cursorPx:{}},emits:["add-guide","guide-dragging"],setup(t,{emit:l}){const o=t,n=l,a=e.computed(()=>o.orientation==="horizontal"),r=e.computed(()=>a.value?"vertical":"horizontal"),i=e.ref(null),s=e.ref(null),c=e.computed(()=>s.value??o.cursorPx??null),u=e.computed(()=>a.value?{width:o.viewportPx+"px",height:pe+"px"}:{width:pe+"px",height:o.viewportPx+"px"});let f=0;function v(){f||(f=requestAnimationFrame(()=>{f=0,h()}))}function h(){const T=i.value;if(!T)return;const C=T.getContext("2d");if(!C)return;const S=window.devicePixelRatio||1,x=Math.max(0,Math.round(o.viewportPx)),D=pe;T.width=(a.value?x:D)*S,T.height=(a.value?D:x)*S,C.setTransform(S,0,0,S,0,0);const z=getComputedStyle(T),m=z.getPropertyValue("--pd-ruler-bg").trim()||"#F8F9FC",y=z.getPropertyValue("--pd-ruler").trim()||"#9AA1AF",F=z.getPropertyValue("--pd-accent").trim()||"#165DFF";C.fillStyle=m,C.fillRect(0,0,a.value?x:D,a.value?D:x);const K=o.scale>0?o.scale:1,J=ve(1)*K;if(J<=0)return;const te=-o.originPx/J,se=(x-o.originPx)/J,re=qn(K),ae=Yn(te,se,re);L(C,ae,J,y,!0),L(C,ae,J,y,!1),R(C,0,F),R(C,o.paperLengthMM,F);const _=c.value;if(_!==null&&_>=0&&_<=x){if(C.strokeStyle=F,C.lineWidth=1.5,C.beginPath(),a.value){const g=Math.round(_)+.5;C.moveTo(g,0),C.lineTo(g,D)}else{const g=Math.round(_)+.5;C.moveTo(0,g),C.lineTo(D,g)}C.stroke()}}function L(T,C,S,x,D){T.strokeStyle=x,T.fillStyle=x,T.globalAlpha=D?.32:1,T.lineWidth=1,T.font="9px ui-monospace, Menlo, monospace",T.textBaseline="top";for(const z of C){if((z.mm<0||z.mm>o.paperLengthMM)!==D)continue;const y=Math.round(o.originPx+z.mm*S)+.5,F=z.major?8:4;T.beginPath(),a.value?(T.moveTo(y,0),T.lineTo(y,F)):(T.moveTo(0,y),T.lineTo(F,y)),T.stroke(),z.major&&z.label&&(a.value?T.fillText(z.label,y+2,11):(T.save(),T.translate(11,y+2),T.rotate(-Math.PI/2),T.fillText(z.label,0,0),T.restore()))}T.globalAlpha=1}function R(T,C,S){const x=ve(1)*(o.scale>0?o.scale:1),D=Math.round(o.originPx+C*x)+.5;D<=0||D>=o.viewportPx||(T.strokeStyle=S,T.globalAlpha=.55,T.lineWidth=1,T.beginPath(),a.value?(T.moveTo(D,0),T.lineTo(D,pe)):(T.moveTo(0,D),T.lineTo(pe,D)),T.stroke(),T.globalAlpha=1)}e.watch(()=>[o.viewportPx,o.originPx,o.paperLengthMM,o.scale,o.cursorPx,o.orientation],v),e.onMounted(v),e.onBeforeUnmount(()=>{f&&cancelAnimationFrame(f)});let B=!1;function $(T){const C=i.value;if(!C)return null;const S=C.getBoundingClientRect(),x=a.value?T.clientX-S.left:T.clientY-S.top;if(x<0||x>o.viewportPx)return null;const D=ve(1)*(o.scale>0?o.scale:1);return(x-o.originPx)/D}function A(T){B=!0,T.preventDefault(),window.addEventListener("mousemove",G),window.addEventListener("mouseup",H),I(T)}function Y(T){const C=i.value;if(!C)return;const S=C.getBoundingClientRect();s.value=a.value?T.clientX-S.left:T.clientY-S.top,v()}function j(){s.value=null,v()}function I(T){const C=$(T);n("guide-dragging",C)}function G(T){B&&I(T)}function H(T){if(!B)return;B=!1,window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",H);const C=$(T);C!==null&&C>=0&&C<=o.paperLengthMM&&n("add-guide",r.value,C),n("guide-dragging",null)}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",H)}),(T,C)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:i,class:e.normalizeClass(["pd-ruler",`is-${t.orientation}`]),style:e.normalizeStyle(u.value),onMousedown:A,onMousemove:Y,onMouseleave:j},null,38))}}),Vt=Q(ta,[["__scopeId","data-v-eec37db4"]]),oa={class:"canvas-scroll"},na={key:0,class:"overlay-layer"},la=["src"],He=96/25.4,aa=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:{},selectedElementHasGroup:{type:Boolean},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","group","ungroup","coordinate","add-guide","guide-move","guide-remove","zoom","clone-element"],setup(t,{emit:l}){const o=t,n=l;function a(g,d){n("select",g,d)}const r=e.ref(null),i=e.computed(()=>we(o.templateData).width),s=e.computed(()=>we(o.templateData).height),c=e.reactive({originX:0,originY:0,viewW:0,viewH:0,paperScale:1}),u=e.reactive({x:null,y:null}),f=e.reactive({x:0,y:0}),v=e.computed(()=>({transform:`translate(${f.x}px, ${f.y}px)`}));function h(){const g=r.value,d=g?.querySelector(".hiprint-printPaper");if(!g||!d)return;const p=g.getBoundingClientRect(),E=d.getBoundingClientRect(),N=o.scale||1,P=E.width/ve(i.value);c.paperScale=Math.abs(P-N)<.002?N:P,c.originX=E.left-p.left-pe,c.originY=E.top-p.top-pe,c.viewW=g.clientWidth-pe,c.viewH=g.clientHeight-pe}function L(){f.x=r.value?.scrollLeft??0,f.y=r.value?.scrollTop??0,h()}let R=null,B=0;function $(){cancelAnimationFrame(B);const g=performance.now()+220,d=()=>{h(),performance.now()<g&&(B=requestAnimationFrame(d))};B=requestAnimationFrame(d)}const A=e.ref(null);function Y(g,d){A.value=d===null?null:{type:g,mm:d}}const j=e.computed(()=>{const g=A.value,d=r.value?.querySelector(".hiprint-printPaper");if(!g||!d)return{};const p=d.getBoundingClientRect(),E=p.width/ve(i.value),N=ve(g.mm)*(E>0?E:o.scale||1);return g.type==="vertical"?{left:p.left+N+"px",top:p.top+"px",height:p.height+"px"}:{left:p.left+"px",top:p.top+N+"px",width:p.width+"px"}});function I(g){const d=r.value?.querySelector(".hiprint-printPaper");if(!d)return;const p=d.getBoundingClientRect(),E=o.scale||1,N=Ie((g.clientX-p.left)/E),P=Ie((g.clientY-p.top)/E);if(!(N<0||P<0))return{x:N,y:P}}function G(g){const d=I(g),p=g.dataTransfer?.getData("fieldData");if(p)try{const N=JSON.parse(p);n("drop-field",N,d);return}catch{}const E=g.dataTransfer?.getData("elementType");E&&n("drop-element",E,d)}const H=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let T={x:0,y:0};function C(g){return!g||!(g instanceof HTMLElement)?!1:!!(g===r.value||g.classList.contains("canvas-scroll")||g.classList.contains("hiprint-printPaper")||g.classList.contains("hiprint-printPaper-content")||g.classList.contains("zone-layer")||g.classList.contains("grid-bg")||g.classList.contains("watermark-layer"))}function S(g){const d=r.value,p=d?.querySelector(".hiprint-printPaper");if(!d||!p)return;const E=d.getBoundingClientRect();u.x=g.clientX-E.left-pe,u.y=g.clientY-E.top-pe;const N=p.getBoundingClientRect(),P=o.scale||1,w=Ie((g.clientX-N.left)/P),V=Ie((g.clientY-N.top)/P);if(w<0||V<0){n("coordinate",null);return}n("coordinate",{x:w,y:V})}function x(){n("coordinate",null),u.x=null,u.y=null}function D(g){if(!(g.ctrlKey||g.metaKey))return;g.preventDefault();const d=o.scale||1,p=Math.round(d*100),E=$o(p,g.deltaY>0?-1:1);if(E===p)return;const N=E/100,P=r.value;let w=null;if(P){const V=P.getBoundingClientRect(),M=getComputedStyle(P),b=parseFloat(M.paddingLeft)||0,k=parseFloat(M.paddingTop)||0;w={x:P.scrollLeft+(g.clientX-V.left)-b,y:P.scrollTop+(g.clientY-V.top)-k,ratio:N/d,mouseX:g.clientX-V.left,mouseY:g.clientY-V.top}}if(n("zoom",E-p),P&&w){const V=w;e.nextTick(()=>{const M=getComputedStyle(P),b=parseFloat(M.paddingLeft)||0,k=parseFloat(M.paddingTop)||0;P.scrollLeft=V.x*V.ratio-V.mouseX+b,P.scrollTop=V.y*V.ratio-V.mouseY+k})}}function z(g){g.button!==2&&C(g.target)&&(n("clear-selection"),T={x:g.clientX,y:g.clientY},H.visible=!0,H.x=g.clientX,H.y=g.clientY,H.w=0,H.h=0,window.addEventListener("mousemove",y),window.addEventListener("mouseup",F))}function m(){if(H.w<3||H.h<3)return[];const g=r.value?.querySelector(".hiprint-printPaper");if(!g)return[];const d=g.getBoundingClientRect(),p=o.scale||1,E=H.x<T.x,N=[];for(const P of o.elements){if(P.options.visible===!1||P.options.locked)continue;const w=d.left+P.options.left*He*p,V=d.top+P.options.top*He*p,M=w+P.options.width*He*p,b=V+P.options.height*He*p,k=w<H.x+H.w&&M>H.x&&V<H.y+H.h&&b>H.y,q=w>=H.x&&M<=H.x+H.w&&V>=H.y&&b<=H.y+H.h;(E?q:k)&&N.push(P.id)}return N}function y(g){const d=g.clientX-T.x,p=g.clientY-T.y;H.x=d>=0?T.x:g.clientX,H.y=p>=0?T.y:g.clientY,H.w=Math.abs(d),H.h=Math.abs(p),n("preview",m())}function F(){window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",F);const g=m();n("preview",g),g.length>0?n("commit-preview"):n("clear-selection"),n("preview",[]),H.visible=!1}const K=e.reactive({visible:!1,x:0,y:0,targetId:null});function J(g,d){if(!d&&!C(g.target))return;const p=r.value?.getBoundingClientRect();p&&(K.x=g.clientX-p.left,K.y=g.clientY-p.top,K.targetId=d??null,K.visible=!0,window.removeEventListener("mousedown",te),setTimeout(()=>{window.addEventListener("mousedown",te,{once:!0})},0))}function te(){K.visible=!1,window.removeEventListener("mousedown",te)}function se(){K.visible=!1,o.hasClipboard&&n("paste")}function re(){K.visible=!1,n("select-all")}function ae(){K.visible=!1,n("clear-selection")}function _(g,d){K.visible=!1,g==="copy"?n("copy"):g==="cut"?n("cut"):g==="paste"?n("paste"):g==="delete"?n("delete"):g==="move-layer"?n("move-layer",d):g==="group"?n("group"):g==="ungroup"&&o.selectedElementHasGroup&&n("ungroup")}return e.onMounted(()=>{e.nextTick(h),r.value&&typeof ResizeObserver<"u"&&(R=new ResizeObserver(h),R.observe(r.value))}),e.watch(()=>o.scale,$),e.watch([i,s],()=>e.nextTick(h)),e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",F),R?.disconnect(),cancelAnimationFrame(B)}),(g,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"canvas-area",onDragover:d[24]||(d[24]=e.withModifiers(()=>{},["prevent"])),onDrop:G,onMousedown:z,onMousemove:S,onMouseleave:x,onWheel:D,onScroll:L,onContextmenu:e.withModifiers(J,["prevent"])},[e.createElementVNode("div",oa,[e.createVNode(ea,{"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:a,onGuideMove:d[0]||(d[0]=(p,E)=>g.$emit("guide-move",p,E)),onGuideRemove:d[1]||(d[1]=p=>g.$emit("guide-remove",p)),onDragStart:d[2]||(d[2]=p=>g.$emit("drag-start")),onDragStop:d[3]||(d[3]=p=>g.$emit("drag-stop")),onDblclickElement:d[4]||(d[4]=p=>g.$emit("dblclick-element",p)),onDblclickCell:d[5]||(d[5]=(p,E,N)=>g.$emit("dblclick-cell",p,E,N)),onContextmenu:d[6]||(d[6]=(p,E)=>J(E,p)),onZoneHeightChange:d[7]||(d[7]=(p,E)=>g.$emit("zone-height-change",p,E)),onZoneHeightCommit:d[8]||(d[8]=p=>g.$emit("zone-height-commit",p)),onCloneElement:d[9]||(d[9]=(p,E)=>g.$emit("clone-element",p,E))},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",na,[e.createElementVNode("img",{src:t.screenshotUrl,class:"overlay-image",style:e.normalizeStyle({opacity:t.overlayOpacity??.5})},null,12,la)])):e.createCommentVNode("",!0)]),t.showRuler?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ruler-overlay",style:e.normalizeStyle(v.value)},[d[25]||(d[25]=e.createElementVNode("div",{class:"ruler-corner"},null,-1)),e.createVNode(Vt,{orientation:"horizontal","viewport-px":c.viewW,"origin-px":c.originX,"paper-length-m-m":i.value,scale:c.paperScale,"cursor-px":u.x,onAddGuide:d[10]||(d[10]=(p,E)=>n("add-guide",p,E)),onGuideDragging:d[11]||(d[11]=p=>Y("vertical",p))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"]),e.createVNode(Vt,{orientation:"vertical","viewport-px":c.viewH,"origin-px":c.originY,"paper-length-m-m":s.value,scale:c.paperScale,"cursor-px":u.y,onAddGuide:d[12]||(d[12]=(p,E)=>n("add-guide",p,E)),onGuideDragging:d[13]||(d[13]=p=>Y("horizontal",p))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"])],4)):e.createCommentVNode("",!0),A.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ruler-guide-preview",`guide-${A.value.type}`]),style:e.normalizeStyle(j.value)},null,6)):e.createCommentVNode("",!0),H.visible?(e.openBlock(),e.createElementBlock("div",{key:2,class:"marquee-selection",style:e.normalizeStyle({left:H.x+"px",top:H.y+"px",width:H.w+"px",height:H.h+"px"})},null,4)):e.createCommentVNode("",!0),K.visible?(e.openBlock(),e.createElementBlock("div",{key:3,class:"context-menu",style:e.normalizeStyle({left:K.x+"px",top:K.y+"px"})},[K.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:d[14]||(d[14]=p=>_("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:d[15]||(d[15]=p=>_("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:d[16]||(d[16]=p=>_("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:d[17]||(d[17]=p=>_("delete"))},"删除"),d[26]||(d[26]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:d[18]||(d[18]=p=>_("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:d[19]||(d[19]=p=>_("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:d[20]||(d[20]=p=>_("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:d[21]||(d[21]=p=>_("move-layer","bottom"))},"置底"),d[27]||(d[27]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:d[22]||(d[22]=p=>_("group"))},"编组 Ctrl+G"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.selectedElementHasGroup}]),onClick:d[23]||(d[23]=p=>_("ungroup"))},"取消编组 Ctrl+Shift+G",2)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:se},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:re},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:ae},"取消选择")],64))],4)):e.createCommentVNode("",!0)],544))}}),ia=Q(aa,[["__scopeId","data-v-b9af7f23"]]),ra=[{group:"position-size",groupLabel:"位置与尺寸",items:[{key:"ps-left",keywords:["X","横坐标","left","位置"]},{key:"ps-top",keywords:["Y","纵坐标","top","位置"]},{key:"ps-width",keywords:["W","宽度","width","尺寸"]},{key:"ps-height",keywords:["H","高度","height","尺寸"]}]},{group:"appearance",groupLabel:"外观",items:[{key:"ap-font-size",keywords:["字体大小","fontsize","字号"]},{key:"ap-font-weight",keywords:["字体粗细","粗体","bold"]},{key:"ap-align",keywords:["对齐","align"]},{key:"ap-vertical-align",keywords:["垂直对齐","verticalalign","顶对齐","底对齐"]},{key:"ap-color",keywords:["颜色","color"]},{key:"ap-bg-color",keywords:["背景色","background"]},{key:"ap-line-height",keywords:["行高","lineheight"]},{key:"ap-letter-spacing",keywords:["字间距","letterspacing"]}]},{group:"content",groupLabel:"内容",items:[{key:"ct-title",keywords:["内容","文本","title"]},{key:"ct-formatter",keywords:["格式化","表达式","formatter"]},{key:"ct-table-mode",keywords:["数据模式","静态布局","动态数据"]},{key:"ct-table-source",keywords:["数据源","列表字段"]},{key:"ct-table-font",keywords:["默认字号","默认颜色","默认内边距"]},{key:"ct-table-cols",keywords:["列宽","表格列"]}]},{group:"border-bg",groupLabel:"边框与背景",items:[{key:"bb-border-width",keywords:["边框宽度","border"]},{key:"bb-border-color",keywords:["边框颜色"]},{key:"bb-bg-color",keywords:["背景色","background"]}]},{group:"binding",groupLabel:"字段绑定",items:[{key:"bd-formatter",keywords:["格式化","表达式","formatter","fx","字段","绑定","field"]},{key:"bd-content",keywords:["内容","表达式","文本","变量"]}]},{group:"pagination",groupLabel:"分页",items:[{key:"pg-enabled",keywords:["分页","pagination","启用分页"]},{key:"pg-pageable",keywords:["参与分页","pageable"]},{key:"pg-keep-with-next",keywords:["同页","keepWithNext"]}]},{group:"advanced",groupLabel:"高级",items:[{key:"ad-locked",keywords:["锁定","lock"]},{key:"ad-fixed",keywords:["每页重复","repeat"]},{key:"ad-z-index",keywords:["层级","zindex"]},{key:"ad-delete",keywords:["删除"]}]}];function sa(t,l){const o=t.trim().toLowerCase();return o?l.some(n=>n.toLowerCase().includes(o)):!0}function da(t){const l=[],o=new Set;for(const n of ra){const a=n.items.filter(r=>sa(t,[...r.keywords,n.groupLabel]));if(a.length>0){l.push(n.group);for(const r of a)o.add(r.key)}}return{groups:l,itemKeys:o}}const ca={class:"property-search"},ua=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(t,{emit:l}){const o=e.ref(""),n=l;function a(){n("search",o.value)}return(r,i)=>(e.openBlock(),e.createElementBlock("div",ca,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=s=>o.value=s),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:a},null,544),[[e.vModelText,o.value]])]))}}),ma=Q(ua,[["__scopeId","data-v-10ab6c84"]]),pa={class:"group-icon"},fa={class:"group-title"},va={class:"expand-icon"},ga={class:"group-content"},ha=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(t){const l=t,o=e.ref(l.defaultExpanded??!0),a={Document:"≡",Brush:"◧",Setting:"⚙"}[l.icon]||"•";function r(){o.value=!o.value,i()}function i(){const c=`property-group-${l.groupKey}`;try{localStorage.setItem(c,String(o.value))}catch{}}function s(){const c=`property-group-${l.groupKey}`;try{const u=localStorage.getItem(c);u!==null&&(o.value=u==="true")}catch{}}return e.onMounted(()=>{s()}),(c,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":o.value}])},[e.createElementVNode("div",{class:"group-header",onClick:r},[e.createElementVNode("span",pa,e.toDisplayString(e.unref(a)),1),e.createElementVNode("span",fa,e.toDisplayString(t.title),1),e.createElementVNode("span",va,e.toDisplayString(o.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",ga,[e.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[e.vShow,o.value]])],2))}}),ye=Q(ha,[["__scopeId","data-v-2ba57031"]]),ba={class:"pd-stepper"},ya=["disabled"],ka=["value","placeholder","min","max","step"],Ea=["disabled"],wa=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,n=l,a=e.computed(()=>{const B=String(o.step),$=B.indexOf(".");return $===-1?0:B.length-$-1});function r(B){return Number.isFinite(B)?Number(B.toFixed(a.value)):0}const i=e.computed(()=>{const B=o.modelValue;if(!(B==null||!Number.isFinite(B)))return r(B)}),s=e.ref(i.value===void 0?"":String(i.value));e.watch(i,B=>{s.value=B===void 0?"":String(B)});const c=e.computed(()=>i.value!==void 0?i.value:o.min!==void 0?o.min:0),u=e.computed(()=>o.min!==void 0&&c.value<=o.min),f=e.computed(()=>o.max!==void 0&&c.value>=o.max);function v(B){let $=r(B);return o.min!==void 0&&$<o.min&&($=o.min),o.max!==void 0&&$>o.max&&($=o.max),$}function h(B){if(B<0&&u.value||B>0&&f.value)return;const $=v(c.value+B*o.step);s.value=String($),n("update:modelValue",$)}function L(B){s.value=B.target.value}function R(){const B=s.value.trim();if(B===""){i.value!==void 0&&(s.value=String(i.value));return}const $=Number(B);if(!Number.isFinite($)){s.value=i.value===void 0?"":String(i.value);return}const A=v($);s.value=String(A),A!==i.value&&n("update:modelValue",A)}return(B,$)=>(e.openBlock(),e.createElementBlock("div",ba,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:u.value,title:"减小","aria-label":"减小",onClick:$[0]||($[0]=A=>h(-1))},"−",8,ya),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:s.value,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,onInput:L,onChange:R,onBlur:R,onKeydown:$[1]||($[1]=e.withKeys(e.withModifiers(A=>A.target.blur(),["prevent"]),["enter"]))},null,40,ka),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:f.value,title:"增大","aria-label":"增大",onClick:$[2]||($[2]=A=>h(1))},"+",8,Ea)]))}}),le=Q(wa,[["__scopeId","data-v-9722a7cf"]]),Va={class:"position-grid"},Na={class:"pd-field"},Ca={class:"pd-field"},Sa={class:"pd-field"},$a={class:"pd-field"},Ma=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t;function o(n){return l.searching?l.matchedKeys?.has(n)??!0:!0}return(n,a)=>(e.openBlock(),e.createBlock(ye,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[4]||(a[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Va,[e.withDirectives(e.createElementVNode("div",Na,[a[5]||(a[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(le,{modelValue:t.element.options.left,"onUpdate:modelValue":a[0]||(a[0]=r=>t.element.options.left=r),min:0},null,8,["modelValue"])],512),[[e.vShow,o("ps-left")]]),e.withDirectives(e.createElementVNode("div",Ca,[a[6]||(a[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(le,{modelValue:t.element.options.top,"onUpdate:modelValue":a[1]||(a[1]=r=>t.element.options.top=r),min:0},null,8,["modelValue"])],512),[[e.vShow,o("ps-top")]]),e.withDirectives(e.createElementVNode("div",Sa,[a[7]||(a[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(le,{modelValue:t.element.options.width,"onUpdate:modelValue":a[2]||(a[2]=r=>t.element.options.width=r),min:4},null,8,["modelValue"])],512),[[e.vShow,o("ps-width")]]),e.withDirectives(e.createElementVNode("div",$a,[a[8]||(a[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(le,{modelValue:t.element.options.height,"onUpdate:modelValue":a[3]||(a[3]=r=>t.element.options.height=r),min:4},null,8,["modelValue"])],512),[[e.vShow,o("ps-height")]])])],32)]),_:1}))}}),xa=Q(Ma,[["__scopeId","data-v-572d7719"]]),Ba=["#000000","#333333","#666666","#999999","#cccccc","#ffffff","#e53935","#fb8c00","#1e88e5","#43a047","#8d6e63","#00acc1"],Da=["aria-expanded","title"],Ta={class:"picker-preview"},za={class:"preset-color-grid"},La=["title","aria-label","onClick"],Pa=e.defineComponent({__name:"PresetColorPicker",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,n=l,a=e.ref(!1),r=e.ref(),i=e.ref(),s=e.ref(),c=e.ref({}),u=e.ref(0),f=e.ref(0),v=e.ref(0),h=e.ref("#000000"),L=e.ref(!1),R=e.computed({get:()=>o.modelValue||"#000000",set:g=>n("update:modelValue",g)}),B=e.computed(()=>te(re(u.value,f.value,v.value))),$=e.computed({get:()=>Math.round(u.value),set:g=>I(ae(g),f.value,v.value)});e.watch(R,j,{immediate:!0});function A(g){h.value=g.toUpperCase(),j(g),n("update:modelValue",g)}function Y(g){const p=g.target.value.trim();K(p)&&(j(p),n("update:modelValue",J(p)))}function j(g){const d=K(g);if(!d)return;const p=se(d.r,d.g,d.b);u.value=p.h,f.value=p.s,v.value=p.v,h.value=J(g).toUpperCase()}function I(g,d,p){u.value=ae(g),f.value=_(d),v.value=_(p),h.value=B.value.toUpperCase(),n("update:modelValue",B.value)}function G(g){g.currentTarget.setPointerCapture(g.pointerId),L.value=!0,C(g)}function H(g){L.value&&C(g)}function T(g){L.value=!1;const d=g.currentTarget;d.hasPointerCapture(g.pointerId)&&d.releasePointerCapture(g.pointerId)}function C(g){const d=s.value;if(!d)return;const p=d.getBoundingClientRect(),E=_((g.clientX-p.left)/p.width),N=_(1-(g.clientY-p.top)/p.height);I(u.value,E,N)}function S(g){const d=g.shiftKey?.1:.02;let p=!0;g.key==="ArrowLeft"?I(u.value,f.value-d,v.value):g.key==="ArrowRight"?I(u.value,f.value+d,v.value):g.key==="ArrowUp"?I(u.value,f.value,v.value+d):g.key==="ArrowDown"?I(u.value,f.value,v.value-d):p=!1,p&&g.preventDefault()}function x(){a.value?z():D()}async function D(){const g=r.value;if(!g)return;j(R.value),a.value=!0,await e.nextTick();const d=g.getBoundingClientRect(),p=190,E=i.value?.offsetHeight??216,N=8,P=Math.min(d.left,window.innerWidth-p-N),w=d.bottom+6,V=w+E>window.innerHeight-N?Math.max(N,d.top-E-6):w;c.value={left:`${Math.max(N,P)}px`,top:`${V}px`}}function z(){a.value=!1}function m(g){const d=g.target;r.value?.contains(d)||i.value?.contains(d)||z()}function y(){a.value&&z()}function F(g){g.key==="Escape"&&a.value&&z()}function K(g){const d=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(g.trim());if(!d)return null;const p=d[1],E=p.length===3?p.split("").map(N=>N+N).join(""):p;return{r:Number.parseInt(E.slice(0,2),16),g:Number.parseInt(E.slice(2,4),16),b:Number.parseInt(E.slice(4,6),16)}}function J(g){const d=K(g);return d?te(d):"#000000"}function te({r:g,g:d,b:p}){return`#${[g,d,p].map(E=>Math.round(_(E/255)*255).toString(16).padStart(2,"0")).join("")}`}function se(g,d,p){const E=g/255,N=d/255,P=p/255,w=Math.max(E,N,P),V=Math.min(E,N,P),M=w-V;let b=0;return M!==0&&(w===E?b=(N-P)/M%6:w===N?b=(P-E)/M+2:b=(E-N)/M+4,b*=60,b<0&&(b+=360)),{h:b,s:w===0?0:M/w,v:w}}function re(g,d,p){const E=p*d,N=(g%360+360)%360/60,P=E*(1-Math.abs(N%2-1)),[w,V,M]=N<1?[E,P,0]:N<2?[P,E,0]:N<3?[0,E,P]:N<4?[0,P,E]:N<5?[P,0,E]:[E,0,P],b=p-E;return{r:(w+b)*255,g:(V+b)*255,b:(M+b)*255}}function ae(g){return((Number.isFinite(g)?g:0)%360+360)%360}function _(g){return Math.min(1,Math.max(0,Number.isFinite(g)?g:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",m,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),document.addEventListener("keydown",F)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",m,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y),document.removeEventListener("keydown",F)}),(g,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{ref_key:"triggerRef",ref:r,type:"button",class:"preset-color-trigger","aria-expanded":a.value,"aria-haspopup":"dialog",title:t.modelValue||"自动",onClick:x},[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle({background:R.value})},null,4)],8,Da),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[a.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:i,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(c.value),onPointerdown:d[2]||(d[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",Ta,[e.createElementVNode("span",{class:"picker-current",style:e.normalizeStyle({background:B.value})},null,4),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[0]||(d[0]=p=>h.value=p),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:Y},null,544),[[e.vModelText,h.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:s,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(u.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:G,onPointermove:H,onPointerup:T,onPointercancel:T,onKeydown:S},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${f.value*100}%`,top:`${(1-v.value)*100}%`,background:B.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[1]||(d[1]=p=>$.value=p),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,$.value,void 0,{number:!0}]]),d[3]||(d[3]=e.createElementVNode("div",{class:"picker-heading"},"常用颜色",-1)),e.createElementVNode("div",za,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Ba),p=>(e.openBlock(),e.createElementBlock("button",{key:p,type:"button",class:e.normalizeClass(["preset-color-item",{active:p.toLowerCase()===B.value.toLowerCase()}]),style:e.normalizeStyle({background:p}),title:p,"aria-label":p,onClick:E=>A(p)},null,14,La))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),be=Q(Pa,[["__scopeId","data-v-db3c3d71"]]),Aa={class:"pd-field"},Ia={class:"pd-field"},Ra={class:"pd-field"},Ha={class:"pd-radio-group",role:"radiogroup"},Ua={class:"pd-radio"},Fa={class:"pd-radio"},Oa={class:"pd-radio"},Ga={class:"pd-field"},qa={class:"pd-radio-group",role:"radiogroup"},Wa={class:"pd-radio"},Ka={class:"pd-radio"},Ya={class:"pd-radio"},Xa={class:"color-row"},ja={class:"pd-field"},Ja={class:"pd-field"},Za={class:"pd-field"},Qa={class:"pd-field"},_a={key:1,class:"pd-empty"},ei=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t;function o(a){return l.searching?l.matchedKeys?.has(a)??!0:!0}const n=e.computed(()=>l.element.printElementType.type==="table");return(a,r)=>(e.openBlock(),e.createBlock(ye,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:r[12]||(r[12]=e.withModifiers(()=>{},["prevent"]))},[t.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Aa,[r[13]||(r[13]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(le,{modelValue:t.element.options.fontSize,"onUpdate:modelValue":r[0]||(r[0]=i=>t.element.options.fontSize=i),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,o("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",Ia,[r[15]||(r[15]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":r[1]||(r[1]=i=>t.element.options.fontWeight=i),style:{width:"100%"}},[...r[14]||(r[14]=[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",Ra,[r[19]||(r[19]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",Ha,[e.createElementVNode("label",Ua,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":r[2]||(r[2]=i=>t.element.options.textAlign=i),value:"left"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),r[16]||(r[16]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",Fa,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":r[3]||(r[3]=i=>t.element.options.textAlign=i),value:"center"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),r[17]||(r[17]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Oa,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":r[4]||(r[4]=i=>t.element.options.textAlign=i),value:"right"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),r[18]||(r[18]=e.createElementVNode("span",null,"右",-1))])])],512),[[e.vShow,o("ap-align")]]),e.withDirectives(e.createElementVNode("div",Ga,[r[23]||(r[23]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",qa,[e.createElementVNode("label",Wa,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":r[5]||(r[5]=i=>t.element.options.verticalAlign=i),value:"top"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),r[20]||(r[20]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",Ka,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":r[6]||(r[6]=i=>t.element.options.verticalAlign=i),value:"middle"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),r[21]||(r[21]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Ya,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":r[7]||(r[7]=i=>t.element.options.verticalAlign=i),value:"bottom"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),r[22]||(r[22]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,o("ap-vertical-align")]]),e.createElementVNode("div",Xa,[e.withDirectives(e.createElementVNode("div",ja,[r[24]||(r[24]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(be,{modelValue:t.element.options.color,"onUpdate:modelValue":r[8]||(r[8]=i=>t.element.options.color=i)},null,8,["modelValue"])],512),[[e.vShow,o("ap-color")]]),e.withDirectives(e.createElementVNode("div",Ja,[r[25]||(r[25]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(be,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":r[9]||(r[9]=i=>t.element.options.backgroundColor=i)},null,8,["modelValue"])],512),[[e.vShow,o("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",Za,[r[26]||(r[26]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(le,{modelValue:t.element.options.lineHeight,"onUpdate:modelValue":r[10]||(r[10]=i=>t.element.options.lineHeight=i),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,o("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",Qa,[r[27]||(r[27]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(le,{modelValue:t.element.options.letterSpacing,"onUpdate:modelValue":r[11]||(r[11]=i=>t.element.options.letterSpacing=i),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,o("ap-letter-spacing")]])],64)):e.createCommentVNode("",!0),!t.isTextType&&!n.value?(e.openBlock(),e.createElementBlock("p",_a,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),ti=Q(ei,[["__scopeId","data-v-2b604a48"]]),oi={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},ni={class:"pd-dialog-header"},li={class:"expression-editor"},ai={class:"ee-nav"},ii={class:"ee-nav-tabs"},ri={class:"ee-content"},si={class:"ee-content-search"},di=["placeholder"],ci={class:"ee-content-list"},ui={class:"ee-field-group-icon"},mi=["onDblclick"],pi={class:"ee-field-info"},fi={class:"ee-item-label"},vi={class:"ee-item-key"},gi={key:0,class:"pd-empty"},hi=["onDblclick"],bi={class:"ee-field-info"},yi={class:"ee-item-label"},ki={class:"ee-item-key"},Ei={class:"ee-func-group"},wi=["onDblclick"],Vi={class:"ee-field-info"},Ni={class:"ee-item-label"},Ci={class:"ee-item-key"},Si={class:"ee-func-group"},$i=["onDblclick"],Mi={class:"ee-field-info"},xi={class:"ee-item-label"},Bi={class:"ee-item-key"},Di={class:"ee-editor"},Ti={class:"ee-editor-section"},zi={class:"ee-editor-section"},Li={class:"pd-dialog-footer"},Pi=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(t,{emit:l}){const o=t,n=l,a=e.computed({get:()=>o.modelValue,set:C=>n("update:modelValue",C)}),r=e.ref("field"),i=e.computed(()=>{switch(r.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),s=e.ref(""),c=e.computed(()=>Ut(Ht(o.fields??[]),s.value));e.watch(a,C=>{C&&($.value=o.expression||"")});function u(C){const{insideParens:S}=h();H(S?C.fieldKey:`{${C.fieldKey}}`)}function f(C){const{insideParens:S}=h();H(S?C.template.replace(/^\{|\}$/g,""):C.template)}function v(C){const{insideBlock:S}=h(),x=S?C.template:`{${C.template}}`,D=x.indexOf("(")+1;H(x,D)}function h(){const S=A.value?.selectionStart??$.value.length,x=$.value.substring(0,S);let D=!1;const z=x.lastIndexOf("{");z!==-1&&!x.slice(z+1).includes("}")&&(D=!0);let m=!1;const y=x.lastIndexOf("(");return y!==-1&&!x.slice(y+1).includes(")")&&(m=!0),{insideBlock:D,insideParens:m}}const L=e.computed(()=>{if(!s.value.trim())return I;const C=s.value.trim().toLowerCase();return I.filter(S=>S.label.toLowerCase().includes(C)||S.name.toLowerCase().includes(C))}),R=e.computed(()=>{if(!s.value.trim())return Y;const C=s.value.trim().toLowerCase();return Y.filter(S=>S.label.toLowerCase().includes(C)||S.name.toLowerCase().includes(C))}),B=e.computed(()=>{if(!s.value.trim())return j;const C=s.value.trim().toLowerCase();return j.filter(S=>S.label.toLowerCase().includes(C)||S.name.toLowerCase().includes(C))}),$=e.ref(o.expression||""),A=e.ref(null);e.watch(()=>o.expression,C=>{$.value=C||""});const Y=[{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()"}],j=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],I=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],G=e.computed(()=>{if(!$.value.trim())return"(输入表达式后预览)";try{const C={...fe,pageIndex:1,totalPages:1,printDate:new Date().toISOString().split("T")[0],printTime:Date.now()},S=$e($.value,C);return S==null?"(无法计算)":String(S)}catch{return"(表达式错误)"}});function H(C,S=C.length){const x=A.value;if(!x){$.value+=C;return}const D=x.selectionStart,z=x.selectionEnd,m=$.value.substring(0,D),y=$.value.substring(z);$.value=m+C+y;const F=D+S;e.nextTick(()=>{x.focus(),x.selectionStart=x.selectionEnd=F})}function T(){n("update:expression",$.value),a.value=!1}return(C,S)=>a.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:S[7]||(S[7]=e.withKeys(x=>a.value=!1,["esc"]))},[e.createElementVNode("section",oi,[e.createElementVNode("header",ni,[S[8]||(S[8]=e.createElementVNode("strong",{id:"expression-editor-title"},"编辑表达式",-1)),e.createElementVNode("button",{type:"button",class:"pd-close","aria-label":"关闭",onClick:S[0]||(S[0]=x=>a.value=!1)},"×")]),e.createElementVNode("div",li,[e.createElementVNode("div",ai,[S[9]||(S[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",ii,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:r.value==="field"}]),onClick:S[1]||(S[1]=x=>r.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:r.value==="variable"}]),onClick:S[2]||(S[2]=x=>r.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:r.value==="function"}]),onClick:S[3]||(S[3]=x=>r.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",ri,[e.createElementVNode("div",si,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":S[4]||(S[4]=x=>s.value=x),placeholder:i.value},null,8,di),[[e.vModelText,s.value]])]),e.createElementVNode("div",ci,[r.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,x=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:x.key||"_top"},[x.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":x.isList}])},[e.createElementVNode("span",ui,e.toDisplayString(x.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(x.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.fields,D=>(e.openBlock(),e.createElementBlock("div",{key:D.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:x.key?"22px":"10px"}),onDblclick:z=>u(D)},[e.createElementVNode("div",pi,[e.createElementVNode("span",fi,e.toDisplayString(D.fieldLabel),1),e.createElementVNode("span",vi,e.toDisplayString(D.fieldKey),1)])],44,mi))),128))],64))),128)),c.value.length===0?(e.openBlock(),e.createElementBlock("p",gi,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),r.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(L.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x.name,class:"ee-list-item",onDblclick:D=>f(x)},[e.createElementVNode("div",bi,[e.createElementVNode("span",yi,e.toDisplayString(x.label),1),e.createElementVNode("span",ki,e.toDisplayString(x.template),1)])],40,hi))),128)):e.createCommentVNode("",!0),r.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",Ei,[S[10]||(S[10]=e.createElementVNode("div",{class:"ee-func-group-title"},"聚合函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x.name,class:"ee-list-item",onDblclick:D=>v(x)},[e.createElementVNode("div",Vi,[e.createElementVNode("span",Ni,e.toDisplayString(x.label),1),e.createElementVNode("span",Ci,e.toDisplayString(x.name)+"()",1)])],40,wi))),128))]),e.createElementVNode("div",Si,[S[11]||(S[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x.name,class:"ee-list-item",onDblclick:D=>v(x)},[e.createElementVNode("div",Mi,[e.createElementVNode("span",xi,e.toDisplayString(x.label),1),e.createElementVNode("span",Bi,e.toDisplayString(x.name)+"()",1)])],40,$i))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Di,[e.createElementVNode("div",Ti,[S[12]||(S[12]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:A,"onUpdate:modelValue":S[5]||(S[5]=x=>$.value=x),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,$.value]])]),e.createElementVNode("div",zi,[S[13]||(S[13]=e.createElementVNode("div",{class:"ee-editor-title"},"预览结果",-1)),e.createElementVNode("div",{class:e.normalizeClass(["ee-preview",{"ee-preview-error":G.value==="(表达式错误)"}])},e.toDisplayString(G.value),3)]),S[14]||(S[14]=e.createStaticVNode('<div class="ee-help-section" data-v-86008c29><div class="ee-help-title" data-v-86008c29>帮助信息</div><div class="ee-help-grid" data-v-86008c29><div class="ee-help-card ee-help-field" data-v-86008c29><div class="ee-help-card-title" data-v-86008c29>输入方式</div><div class="ee-help-card-content" data-v-86008c29> 双击左侧字段、变量、函数即可插入到表达式输入框中<br data-v-86008c29> 静态数据直接输入即可,如:供应商名称<br data-v-86008c29> 动态解析字段、变量、函数必须用 {} 包裹<br data-v-86008c29> 示例:{SUM(supplier.name)}<br data-v-86008c29> 注意:只能嵌套一层 </div></div><div class="ee-help-card ee-help-function" data-v-86008c29><div class="ee-help-card-title" data-v-86008c29>函数使用</div><div class="ee-help-card-content" data-v-86008c29> SUM(字段) - 求和<br data-v-86008c29> AVG(字段) - 平均值<br data-v-86008c29> COUNT(字段) - 计数<br data-v-86008c29> IF(条件, 真值, 假值) - 条件判断 </div></div><div class="ee-help-card ee-help-variable" data-v-86008c29><div class="ee-help-card-title" data-v-86008c29>系统变量</div><div class="ee-help-card-content" data-v-86008c29> {pageIndex} - 当前页码<br data-v-86008c29> {totalPages} - 总页数<br data-v-86008c29> {printDate} - 打印日期 </div></div><div class="ee-help-card ee-help-conditional" data-v-86008c29><div class="ee-help-card-title" data-v-86008c29>示例</div><div class="ee-help-card-content" data-v-86008c29> 静态文本:供应商名称<br data-v-86008c29> 动态字段:{supplier.name}<br data-v-86008c29> 函数调用:{SUM(amount)}<br data-v-86008c29> 条件判断:{IF(amount>1000, "大单", "小单")} </div></div></div></div>',1))])]),e.createElementVNode("footer",Li,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:S[6]||(S[6]=x=>a.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:T},"确定")])])],32)):e.createCommentVNode("",!0)}}),mt=Q(Pi,[["__scopeId","data-v-86008c29"]]),Ai={class:"pd-field"},Ii={class:"pd-label"},Ri=["value","placeholder"],Hi=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(t,{emit:l}){const o=l,n=e.ref(!1);function a(){n.value=!0}return(r,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",Ai,[e.createElementVNode("span",Ii,e.toDisplayString(t.descriptor.label),1),e.createElementVNode("input",{value:t.modelValue,class:"pd-input",placeholder:t.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:i[0]||(i[0]=s=>o("update:modelValue",s.target.value)),onDblclick:a},null,40,Ri)]),e.createVNode(mt,{modelValue:n.value,"onUpdate:modelValue":i[1]||(i[1]=s=>n.value=s),fields:t.fields,expression:t.modelValue,"onUpdate:expression":i[2]||(i[2]=s=>o("update:modelValue",s))},null,8,["modelValue","fields","expression"])],64))}}),Ui=Q(Hi,[["__scopeId","data-v-135d160a"]]),Fi={class:"pd-field"},Oi=["value"],Gi=["value"],qi={class:"pd-field"},Wi={class:"pd-field"},Ki={class:"pd-field"},Yi={class:"pd-field"},Xi={style:{width:"60px"}},ji=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(t){const l=t,o=e.inject(Be,null),n=e.computed(()=>l.fields.filter(i=>i.fieldType==="list").map(i=>({label:i.fieldLabel,value:i.fieldKey})));function a(i){l.element.options.dataSource=i||void 0,o?.recordHistory()}function r(i,s){if(s===void 0)return;const c=l.element.options.tableColWidths,u=o?.maxTableWidth.value??1/0,f=c.reduce((v,h,L)=>L===i?v:v+h,0);if(f+s>u){const v=Math.max(5,Math.round((u-f)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${u}mm,列${i+1} 已调整为 ${v}mm`),c[i]=v}else c[i]=s;Fe(l.element.options),o?.recordHistory()}return(i,s)=>(e.openBlock(),e.createBlock(ye,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:s[4]||(s[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Fi,[s[5]||(s[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:t.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:s[0]||(s[0]=c=>a(c.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,c=>(e.openBlock(),e.createElementBlock("option",{key:c.value,value:c.value},e.toDisplayString(c.label),9,Gi))),128))],40,Oi)]),e.createElementVNode("div",qi,[s[6]||(s[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(le,{modelValue:t.element.options.tableDefaultFontSize,"onUpdate:modelValue":s[1]||(s[1]=c=>t.element.options.tableDefaultFontSize=c),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Wi,[s[7]||(s[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(be,{modelValue:t.element.options.tableDefaultColor,"onUpdate:modelValue":s[2]||(s[2]=c=>t.element.options.tableDefaultColor=c)},null,8,["modelValue"])]),e.createElementVNode("div",Ki,[s[8]||(s[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(le,{modelValue:t.element.options.tableDefaultPadding,"onUpdate:modelValue":s[3]||(s[3]=c=>t.element.options.tableDefaultPadding=c),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Yi,[s[9]||(s[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.element.options.tableColWidths,(c,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:"col-width-row"},[e.createElementVNode("span",Xi,"列"+e.toDisplayString(u+1),1),e.createVNode(le,{"model-value":c,min:5,max:200,"onUpdate:modelValue":f=>r(u,f)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),Ji=Q(ji,[["__scopeId","data-v-2860c993"]]),Zi={class:"border-row"},Qi={class:"pd-field"},_i={class:"pd-field"},er={class:"pd-field"},tr=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t;function o(n){return l.searching?l.matchedKeys?.has(n)??!0:!0}return(n,a)=>(e.openBlock(),e.createBlock(ye,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[3]||(a[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Zi,[e.withDirectives(e.createElementVNode("div",Qi,[a[4]||(a[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(le,{modelValue:t.element.options.borderWidth,"onUpdate:modelValue":a[0]||(a[0]=r=>t.element.options.borderWidth=r),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,o("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",_i,[a[5]||(a[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(be,{modelValue:t.element.options.borderColor,"onUpdate:modelValue":a[1]||(a[1]=r=>t.element.options.borderColor=r)},null,8,["modelValue"])],512),[[e.vShow,o("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",er,[a[6]||(a[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(be,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":a[2]||(a[2]=r=>t.element.options.backgroundColor=r)},null,8,["modelValue"])],512),[[e.vShow,o("bb-bg-color")]])],32)]),_:1}))}}),or=Q(tr,[["__scopeId","data-v-84aa55dc"]]),nr={class:"advanced-row"},lr={class:"pd-field"},ar={class:"pd-field"},ir={class:"pd-field"},rr={class:"pd-field"},sr=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(t){const l=t;function o(n){return l.searching?l.matchedKeys?.has(n)??!0:!0}return(n,a)=>(e.openBlock(),e.createBlock(ye,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[4]||(a[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",nr,[e.withDirectives(e.createElementVNode("div",lr,[a[5]||(a[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":a[0]||(a[0]=r=>t.element.options.locked=r)},null,512),[[e.vModelCheckbox,t.element.options.locked]])],512),[[e.vShow,o("ad-locked")]]),e.withDirectives(e.createElementVNode("div",ar,[a[6]||(a[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":a[1]||(a[1]=r=>t.element.options.fixed=r)},null,512),[[e.vModelCheckbox,t.element.options.fixed]])],512),[[e.vShow,o("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",ir,[a[7]||(a[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(le,{modelValue:t.element.options.zIndex,"onUpdate:modelValue":a[2]||(a[2]=r=>t.element.options.zIndex=r),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,o("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",rr,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:a[3]||(a[3]=r=>n.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,o("ad-delete")]])],32)]),_:1}))}}),dr=Q(sr,[["__scopeId","data-v-84bf7a55"]]),cr={key:0,class:"pd-field"},ur=["checked"],mr={class:"pd-field"},pr=["checked"],fr={class:"pd-field"},vr=["checked"],Nt=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t,o=e.computed(()=>l.element.printElementType.type==="table"),n=e.computed({get:()=>l.element.options.tablePagination?.enabled??!0,set:()=>{}});function a(f){l.element.options.tablePagination={enabled:f}}const r=e.computed({get:()=>l.element.options.pagination?.pageable??!0,set:()=>{}}),i=e.computed({get:()=>l.element.options.pagination?.keepWithNext??!1,set:()=>{}});function s(f){l.element.options.pagination={pageable:f,keepWithNext:i.value}}function c(f){l.element.options.pagination={pageable:r.value,keepWithNext:f}}function u(f){return l.searching?l.matchedKeys?.has(f)??!0:!0}return(f,v)=>(e.openBlock(),e.createBlock(ye,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:v[3]||(v[3]=e.withModifiers(()=>{},["prevent"]))},[o.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",cr,[v[4]||(v[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:n.value,onChange:v[0]||(v[0]=h=>a(h.target.checked))},null,40,ur)],512)),[[e.vShow,u("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",mr,[v[5]||(v[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:r.value,onChange:v[1]||(v[1]=h=>s(h.target.checked))},null,40,pr)],512),[[e.vShow,u("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",fr,[v[6]||(v[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:i.value,onChange:v[2]||(v[2]=h=>c(h.target.checked))},null,40,vr)],512),[[e.vShow,u("pg-keep-with-next")]])],64))],32)]),_:1}))}}),gr={class:"image-content-upload"},hr=["disabled"],br=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(t,{emit:l}){const o=t,n=l,a=e.ref(!1),r=e.inject(ut,e.computed(()=>{})),i=e.computed(()=>o.disabled||a.value||!r.value);async function s(c){const u=c.target,f=u.files?.[0];if(f){if(!f.type.startsWith("image/")){alert("仅支持上传图片文件"),u.value="";return}if(!r.value){alert("图片上传能力未配置"),u.value="";return}a.value=!0;try{const v=await r.value(f);v?n("success",v):alert("图片上传失败")}catch(v){alert(v instanceof Error?v.message:"图片上传失败")}finally{a.value=!1,u.value=""}}}return(c,u)=>(e.openBlock(),e.createElementBlock("div",gr,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:i.value}])},[u[0]||(u[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(a.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:i.value,onChange:s},null,40,hr)],2),u[1]||(u[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),yr=Q(br,[["__scopeId","data-v-b730e8e6"]]),kr={class:"pd-field"},Er=["value"],wr={class:"pd-field"},Vr={key:0,class:"pd-field"},Nr=["checked"],Cr=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(t){const l=t,o=e.inject(Be),n=e.computed(()=>l.element.options.tableRows[l.selection.r1]);function a(s){const c=et(l.element.options.tableRows,l.selection.r1,s);if(c){alert(c);return}o.recordHistory()}function r(s){s!==void 0&&(n.value.height=s,Fe(l.element.options),o.recordHistory())}function i(s){n.value.repeatOnPage=s,o.recordHistory()}return(s,c)=>(e.openBlock(),e.createBlock(ye,{title:"行属性",icon:"Grid","default-expanded":"","group-key":"table-row"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:c[2]||(c[2]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",kr,[c[4]||(c[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:n.value.type,class:"pd-select",style:{width:"100%"},onChange:c[0]||(c[0]=u=>a(u.target.value))},[...c[3]||(c[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,Er)]),e.createElementVNode("div",wr,[c[5]||(c[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(le,{"model-value":n.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":r},null,8,["model-value"])]),n.value.type==="header"?(e.openBlock(),e.createElementBlock("div",Vr,[c[6]||(c[6]=e.createElementVNode("span",{class:"pd-label"},"每页顶部重复",-1)),e.createElementVNode("input",{checked:n.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:c[1]||(c[1]=u=>i(!!u.target.checked))},null,40,Nr)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),Sr={class:"pd-field"},$r={class:"pd-radio-group",role:"radiogroup"},Mr={class:"pd-radio"},xr=["checked"],Br={class:"pd-radio"},Dr=["checked"],Tr={class:"pd-radio"},zr=["checked"],Lr={class:"pd-radio"},Pr=["checked"],Ar={key:0,class:"pd-field"},Ir=["value"],Rr={key:1,class:"pd-field"},Hr=["checked"],Ur={key:2,class:"pd-field"},Fr=["value"],Or={key:3,class:"pd-field"},Gr=["value"],qr={key:4,class:"pd-field"},Wr={key:5,class:"pd-field"},Kr={class:"pd-field"},Yr=["value"],Xr={class:"pd-field"},jr={class:"pd-radio-group",role:"radiogroup"},Jr={class:"pd-radio"},Zr=["checked"],Qr={class:"pd-radio"},_r=["checked"],es={class:"pd-radio"},ts=["checked"],os={class:"pd-field"},ns={class:"pd-radio-group",role:"radiogroup"},ls={class:"pd-radio"},as=["checked"],is={class:"pd-radio"},rs=["checked"],ss={class:"pd-radio"},ds=["checked"],cs={class:"cell-style-grid"},us={class:"pd-field"},ms=["value"],ps={class:"pd-field"},fs={class:"pd-field"},vs=["checked"],gs={class:"pd-field"},hs={class:"pd-field"},bs={class:"border-style-row"},ys={style:{width:"112px","flex-shrink":"0"}},ks={class:"pd-button-group border-presets"},Es={class:"pd-checkbox-group"},ws={class:"pd-checkbox"},Vs={class:"pd-checkbox"},Ns={class:"pd-checkbox"},Cs={class:"pd-checkbox"},Ss={class:"pd-field"},$s={class:"pd-field"},Ms=["checked"],xs={class:"merge-btns"},Bs=["disabled","title"],Ds=["disabled"],Ts=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(t,{expose:l}){const o=t,n=e.inject(Be),a=e.computed(()=>o.element.options.tableRows),r=e.computed(()=>{const z=st(a.value,o.selection.r1,o.selection.c1);return a.value[z.r].cells[z.c]}),i=e.ref(!1),s=e.ref(""),c=e.computed(()=>r.value.cellType==="barcode"),u=e.computed(()=>r.value.cellType==="qrcode"),f=e.computed(()=>r.value.cellType==="image");function v(z){$(m=>{m.align=z})}function h(z){$(m=>{m.valign=z})}function L(z){$(m=>{m.cellType=z==="text"?void 0:z,z!=="barcode"&&(m.barcodeType=void 0,m.showBarcodeText=void 0),z!=="qrcode"&&(m.qrCodeLevel=void 0)})}function R(){s.value=r.value.formatter||"",i.value=!0}function B(z){$(m=>{m.formatter=z||void 0})}function $(z){const m=o.selection;for(let y=m.r1;y<=m.r2;y++)for(let F=m.c1;F<=m.c2;F++){const K=a.value[y].cells[F];K.merged||z(K)}n.recordHistory()}const A=e.ref("solid"),Y=e.ref(.75),j=e.ref("#333333"),I=e.ref([]);function G(){return{width:Y.value,style:A.value,color:j.value}}function H(z){mo(a.value,o.selection,z,G()),n.recordHistory()}function T(z){const m=z.target,y=new Set(I.value);m.checked?y.add(m.value):y.delete(m.value),I.value=[...y];const F=G();$(K=>{const J={...K.borders??{}};for(const te of["top","right","bottom","left"])y.has(te)?J[te]={...F}:delete J[te];K.borders=J})}const C=e.computed(()=>Bt(a.value,o.selection)),S=e.computed(()=>{const z=o.selection;for(let m=z.r1;m<=z.r2;m++)for(let y=z.c1;y<=z.c2;y++){const F=a.value[m].cells[y];if(!F.merged&&((F.rowspan??1)>1||(F.colspan??1)>1))return!0}return!1});function x(){Dt(a.value,o.selection),n.recordHistory()}function D(){Tt(a.value,o.selection),n.recordHistory()}return l({openFormatterEditor:R}),(z,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ye,{title:"单元格",icon:"Menu","default-expanded":"","group-key":"table-cell"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:m[39]||(m[39]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Sr,[m[45]||(m[45]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",$r,[e.createElementVNode("label",Mr,[e.createElementVNode("input",{type:"radio",value:"text",checked:(r.value.cellType||"text")==="text",onChange:m[0]||(m[0]=y=>L(y.target.value))},null,40,xr),m[41]||(m[41]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",Br,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:r.value.cellType==="barcode",onChange:m[1]||(m[1]=y=>L(y.target.value))},null,40,Dr),m[42]||(m[42]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",Tr,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:r.value.cellType==="qrcode",onChange:m[2]||(m[2]=y=>L(y.target.value))},null,40,zr),m[43]||(m[43]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",Lr,[e.createElementVNode("input",{type:"radio",value:"image",checked:r.value.cellType==="image",onChange:m[3]||(m[3]=y=>L(y.target.value))},null,40,Pr),m[44]||(m[44]=e.createElementVNode("span",null,"图片",-1))])])]),c.value?(e.openBlock(),e.createElementBlock("div",Ar,[m[47]||(m[47]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:r.value.barcodeType||"CODE128",class:"pd-select",onChange:m[4]||(m[4]=y=>$(F=>{F.barcodeType=y.target.value||void 0}))},[...m[46]||(m[46]=[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,Ir)])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("div",Rr,[m[48]||(m[48]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:r.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:m[5]||(m[5]=y=>$(F=>{F.showBarcodeText=!!y.target.checked}))},null,40,Hr)])):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",Ur,[m[50]||(m[50]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:r.value.qrCodeLevel||"M",class:"pd-select",onChange:m[6]||(m[6]=y=>$(F=>{F.qrCodeLevel=y.target.value||void 0}))},[...m[49]||(m[49]=[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,Fr)])):e.createCommentVNode("",!0),c.value||u.value||f.value?(e.openBlock(),e.createElementBlock("div",Or,[m[52]||(m[52]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:r.value.fit||"contain",class:"pd-select",onChange:m[7]||(m[7]=y=>$(F=>{F.fit=y.target.value}))},[...m[51]||(m[51]=[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,Gr)])):e.createCommentVNode("",!0),c.value||u.value||f.value?(e.openBlock(),e.createElementBlock("div",qr,[m[53]||(m[53]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(le,{"model-value":r.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":m[8]||(m[8]=y=>$(F=>{F.maxWidth=y??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),c.value||u.value||f.value?(e.openBlock(),e.createElementBlock("div",Wr,[m[54]||(m[54]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(le,{"model-value":r.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":m[9]||(m[9]=y=>$(F=>{F.maxHeight=y??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Kr,[m[55]||(m[55]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:r.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:m[10]||(m[10]=y=>$(F=>{F.formatter=y.target.value||void 0})),onDblclick:R},null,40,Yr)]),e.createElementVNode("div",Xr,[m[59]||(m[59]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",jr,[e.createElementVNode("label",Jr,[e.createElementVNode("input",{type:"radio",value:"left",checked:r.value.align==="left",onChange:m[11]||(m[11]=y=>v(y.target.value))},null,40,Zr),m[56]||(m[56]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",Qr,[e.createElementVNode("input",{type:"radio",value:"center",checked:r.value.align==="center",onChange:m[12]||(m[12]=y=>v(y.target.value))},null,40,_r),m[57]||(m[57]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",es,[e.createElementVNode("input",{type:"radio",value:"right",checked:r.value.align==="right",onChange:m[13]||(m[13]=y=>v(y.target.value))},null,40,ts),m[58]||(m[58]=e.createElementVNode("span",null,"右",-1))])])]),e.createElementVNode("div",os,[m[63]||(m[63]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",ns,[e.createElementVNode("label",ls,[e.createElementVNode("input",{type:"radio",value:"top",checked:r.value.valign==="top",onChange:m[14]||(m[14]=y=>h(y.target.value))},null,40,as),m[60]||(m[60]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",is,[e.createElementVNode("input",{type:"radio",value:"middle",checked:r.value.valign==="middle",onChange:m[15]||(m[15]=y=>h(y.target.value))},null,40,rs),m[61]||(m[61]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ss,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:r.value.valign==="bottom",onChange:m[16]||(m[16]=y=>h(y.target.value))},null,40,ds),m[62]||(m[62]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",cs,[e.createElementVNode("div",us,[m[65]||(m[65]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createElementVNode("select",{value:r.value.fontFamily,class:"pd-select",placeholder:"继承默认",onChange:m[17]||(m[17]=y=>$(F=>{F.fontFamily=y.target.value||void 0}))},[...m[64]||(m[64]=[e.createElementVNode("option",{value:"SimSun"},"宋体",-1),e.createElementVNode("option",{value:"SimHei"},"黑体",-1),e.createElementVNode("option",{value:"Microsoft YaHei"},"微软雅黑",-1),e.createElementVNode("option",{value:"KaiTi"},"楷体",-1),e.createElementVNode("option",{value:"FangSong"},"仿宋",-1),e.createElementVNode("option",{value:"Arial"},"Arial",-1)])],40,ms)]),e.createElementVNode("div",ps,[m[66]||(m[66]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(le,{"model-value":r.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":m[18]||(m[18]=y=>$(F=>{F.fontSize=y??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",fs,[m[67]||(m[67]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:r.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:m[19]||(m[19]=y=>$(F=>{F.fontWeight=y.target.checked?"bold":void 0}))},null,40,vs)]),e.createElementVNode("div",gs,[m[68]||(m[68]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(be,{"model-value":r.value.color,"onUpdate:modelValue":m[20]||(m[20]=y=>$(F=>{F.color=y}))},null,8,["model-value"])]),e.createElementVNode("div",hs,[m[69]||(m[69]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(be,{"model-value":r.value.backgroundColor,"onUpdate:modelValue":m[21]||(m[21]=y=>$(F=>{F.backgroundColor=y}))},null,8,["model-value"])])]),m[77]||(m[77]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",bs,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":m[22]||(m[22]=y=>A.value=y),style:{width:"90px"}},[...m[70]||(m[70]=[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,A.value]]),e.createElementVNode("div",ys,[e.createVNode(le,{modelValue:Y.value,"onUpdate:modelValue":m[23]||(m[23]=y=>Y.value=y),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(be,{modelValue:j.value,"onUpdate:modelValue":m[24]||(m[24]=y=>j.value=y)},null,8,["modelValue"])]),e.createElementVNode("div",ks,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:m[25]||(m[25]=y=>H("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:m[26]||(m[26]=y=>H("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:m[27]||(m[27]=y=>H("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:m[28]||(m[28]=y=>H("none"))},"无")]),e.createElementVNode("div",Es,[e.createElementVNode("label",ws,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[29]||(m[29]=y=>I.value=y),value:"top",onChange:m[30]||(m[30]=y=>T(y))},null,544),[[e.vModelCheckbox,I.value]]),m[71]||(m[71]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",Vs,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[31]||(m[31]=y=>I.value=y),value:"right",onChange:m[32]||(m[32]=y=>T(y))},null,544),[[e.vModelCheckbox,I.value]]),m[72]||(m[72]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",Ns,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[33]||(m[33]=y=>I.value=y),value:"bottom",onChange:m[34]||(m[34]=y=>T(y))},null,544),[[e.vModelCheckbox,I.value]]),m[73]||(m[73]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",Cs,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[35]||(m[35]=y=>I.value=y),value:"left",onChange:m[36]||(m[36]=y=>T(y))},null,544),[[e.vModelCheckbox,I.value]]),m[74]||(m[74]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",Ss,[m[75]||(m[75]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(le,{"model-value":r.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":m[37]||(m[37]=y=>$(F=>{F.padding=y??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",$s,[m[76]||(m[76]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:r.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:m[38]||(m[38]=y=>$(F=>{F.wordWrap=!!y.target.checked}))},null,40,Ms)]),e.createElementVNode("div",xs,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!C.value,title:C.value||"",onClick:x}," 合并单元格 ",8,Bs),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!S.value,onClick:D},"拆分单元格",8,Ds)])],32)]),_:1}),e.createVNode(mt,{modelValue:i.value,"onUpdate:modelValue":m[40]||(m[40]=y=>i.value=y),fields:t.fields,expression:s.value,"onUpdate:expression":B},null,8,["modelValue","fields","expression"])],64))}}),zs=Q(Ts,[["__scopeId","data-v-e9669bd2"]]),Ls={text:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],longText:[{targetPath:"options.formatter",label:"内容",dataSource:"main"},{targetPath:"options.styler",label:"样式",dataSource:"main"}],barcode:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],qrcode:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],image:[{targetPath:"options.src",label:"内容",dataSource:"main",placeholder:"输入图片路径,支持 /docfiles/... 相对路径、绝对 URL 或 {字段} 表达式"}],table:[]};function Ft(t,l,o,n){return t==="data"?[{targetPath:`options.tableRows[${l}].cells[${o}].formatter`,label:"内容",dataSource:"list",listField:n,placeholder:"{name}"}]:t==="subtotal"?[{targetPath:`options.tableRows[${l}].cells[${o}].formatter`,label:"内容",dataSource:"subtotal",placeholder:"{MONEY(SUM(amount))}"}]:t==="summary"?[{targetPath:`options.tableRows[${l}].cells[${o}].formatter`,label:"内容",dataSource:"summary",placeholder:"{MONEY(SUM(amount))}"}]:[{targetPath:`options.tableRows[${l}].cells[${o}].formatter`,label:"内容",dataSource:"main",placeholder:"合计: {order.total}"}]}function Ps(t){const l=t.printElementType.type,o=Ls[l]??[],n=[];if(l==="table"){const a=t.options.dataSource;for(const[r,i]of(t.options.tableRows??[]).entries())for(const[s,c]of i.cells.entries())c.merged||n.push(...Ft(i.type,r,s,a))}return[...o,...n]}const As={key:0,class:"prop-collapsed"},Is={class:"prop-head"},Rs={class:"pd-tabs prop-tabs"},Hs={class:"pd-tab-bar",role:"tablist"},Us={class:"pd-tab-pane",role:"tabpanel"},Fs={class:"property-content"},Os={key:1,class:"pd-empty"},Gs={class:"pd-tab-pane",role:"tabpanel"},qs={class:"pd-field"},Ws=["value"],Ks=["value"],Ys={key:0,class:"pd-field"},Xs={class:"custom-size-grid"},js={class:"pd-field"},Js={class:"pd-radio-group",role:"radiogroup"},Zs={class:"pd-radio"},Qs=["checked"],_s={class:"pd-radio"},ed=["checked"],td={class:"pd-field"},od={class:"page-bg-row"},nd={class:"margin-grid"},ld={class:"pd-field"},ad={class:"pd-field"},id={class:"pd-field"},rd={class:"pd-field"},sd={class:"pd-field"},dd={class:"pd-field"},cd={class:"pd-field"},ud=e.defineComponent({__name:"PropertyPanel",props:{element:{},templateData:{},fields:{},activeTab:{},tableSelection:{},recordHistory:{type:Function},collapsed:{type:Boolean}},emits:["delete-element","update:templateData","update:activeTab","toggle-collapse"],setup(t,{emit:l}){const o=t,n=l,a=tt,r=e.ref(""),i=e.computed(()=>o.element?["text","longText"].includes(o.element.printElementType.type):!1),s=e.computed(()=>o.element?o.element.printElementType.type==="image":!1),c=e.computed(()=>!o.element||o.element.printElementType.type!=="table"?!1:!!o.tableSelection&&o.tableSelection.elementId===o.element.id),u=e.computed(()=>o.element?o.element.printElementType.type==="table":!1),f=e.computed(()=>da(r.value)),v=e.computed(()=>f.value.groups),h=e.computed(()=>f.value.itemKeys),L=e.computed(()=>!!r.value.trim()),R=e.computed(()=>{if(!o.element)return[];if(o.element.printElementType.type==="table"&&o.tableSelection){const{r1:b,c1:k}=o.tableSelection,q=o.element.options.tableRows;if(q&&q[b]){const X=q[b],ue=o.element.options.fields?.[0]?.dataSource;return Ft(X.type,b,k,ue)}}return Ps(o.element)});function B(b){return b.split(".").flatMap(k=>{const q=k.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!q)return[k];const X=q[1],ue=[...q[2].matchAll(/\[(\d+)\]/g)].map(ce=>Number(ce[1]));return[X,...ue]})}function $(b){return o.element?B(b).reduce((X,ue)=>X==null?"":X[ue],o.element)??"":""}function A(b,k){if(!o.element)return;const q=B(b),X=q.pop(),ue=q.reduce((ce,ke)=>((ce[ke]===void 0||ce[ke]===null)&&(ce[ke]={}),ce[ke]),o.element);ue[X]=k||void 0,o.recordHistory?.()}function Y(b){r.value=b}function j(b){o.element&&A("options.src",b)}const I=e.computed(()=>o.templateData?.paperSize||"A4"),G=e.computed(()=>o.templateData?.orientation||"portrait"),H=e.computed({get:()=>o.templateData?.pageBackground||"#ffffff",set:b=>se(b)}),T=e.computed(()=>o.templateData?.margins.top??10),C=e.computed(()=>o.templateData?.margins.bottom??10),S=e.computed(()=>o.templateData?.margins.left??10),x=e.computed(()=>o.templateData?.margins.right??10),D=e.computed(()=>o.templateData?.header.height??10),z=e.computed(()=>o.templateData?.footer.height??10),m=e.computed(()=>o.templateData?.firstPageOverlay.height??0),y=e.computed(()=>o.templateData?.customWidth??210),F=e.computed(()=>o.templateData?.customHeight??297);function K(b){o.templateData&&n("update:templateData",{...o.templateData,...b})}function J(b){if(b==="CUSTOM"){K({paperSize:"CUSTOM"});return}a[b]&&K({paperSize:b})}function te(b){K({orientation:String(b)})}function se(b){const k=b&&b.toLowerCase()!=="#ffffff"&&b.toLowerCase()!=="#fff"?b:void 0;K(k===void 0?{pageBackground:void 0}:{pageBackground:k})}function re(){K({pageBackground:void 0})}function ae(b){b!==void 0&&K({customWidth:b})}function _(b){b!==void 0&&K({customHeight:b})}function g(b){b!==void 0&&K({margins:{...o.templateData.margins,top:b}})}function d(b){b!==void 0&&K({margins:{...o.templateData.margins,bottom:b}})}function p(b){b!==void 0&&K({margins:{...o.templateData.margins,left:b}})}function E(b){b!==void 0&&K({margins:{...o.templateData.margins,right:b}})}function N(b){b!==void 0&&K({header:{...o.templateData.header,height:b}})}function P(b){b!==void 0&&K({footer:{...o.templateData.footer,height:b}})}function w(b){b!==void 0&&K({firstPageOverlay:{...o.templateData.firstPageOverlay,height:b}})}const V=e.computed(()=>o.activeTab||"page");function M(b){n("update:activeTab",b),n("toggle-collapse")}return(b,k)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",As,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:k[0]||(k[0]=q=>M(V.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:V.value==="element"}]),title:"元素属性",onClick:k[1]||(k[1]=q=>M("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:V.value==="page"}]),title:"页面属性",onClick:k[2]||(k[2]=q=>M("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Is,[k[12]||(k[12]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:k[3]||(k[3]=q=>b.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",Rs,[e.createElementVNode("div",Hs,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="element"}]),onClick:k[4]||(k[4]=q=>b.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="page"}]),onClick:k[5]||(k[5]=q=>b.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",Us,[t.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(ma,{onSearch:Y}),e.createElementVNode("div",Fs,[v.value.includes("position-size")&&!c.value?(e.openBlock(),e.createBlock(xa,{key:0,element:t.element,"matched-keys":h.value,searching:L.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),v.value.includes("appearance")?(e.openBlock(),e.createBlock(ti,{key:1,element:t.element,"is-text-type":i.value,"matched-keys":h.value,searching:L.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),v.value.includes("binding")?(e.openBlock(),e.createBlock(ye,{key:2,title:"内容",icon:"Document","default-expanded":"","group-key":"binding"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,q=>(e.openBlock(),e.createBlock(Ui,{key:q.targetPath,descriptor:q,fields:t.fields,"model-value":$(q.targetPath),"onUpdate:modelValue":X=>A(q.targetPath,X)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),s.value?(e.openBlock(),e.createBlock(yr,{key:0,onSuccess:j})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),u.value&&t.tableSelection&&t.tableSelection.elementId===t.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createVNode(Cr,{element:t.element,selection:t.tableSelection},null,8,["element","selection"]),e.createVNode(zs,{element:t.element,selection:t.tableSelection,fields:t.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),u.value&&v.value.includes("content")?(e.openBlock(),e.createBlock(Ji,{key:4,element:t.element,fields:t.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),v.value.includes("border-bg")?(e.openBlock(),e.createBlock(or,{key:5,element:t.element,"matched-keys":h.value,searching:L.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),v.value.includes("pagination")&&u.value?(e.openBlock(),e.createBlock(Nt,{key:6,element:t.element,"matched-keys":h.value,searching:L.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),v.value.includes("pagination")&&!u.value?(e.openBlock(),e.createBlock(Nt,{key:7,element:t.element,"matched-keys":h.value,searching:L.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),v.value.includes("advanced")?(e.openBlock(),e.createBlock(dr,{key:8,element:t.element,"matched-keys":h.value,searching:L.value,onDeleteElement:k[6]||(k[6]=q=>b.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",Os,"请在画布中选择一个元素"))],512),[[e.vShow,(t.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",Gs,[e.createElementVNode("form",{class:"pd-form",onSubmit:k[11]||(k[11]=e.withModifiers(()=>{},["prevent"]))},[k[28]||(k[28]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",qs,[k[14]||(k[14]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:I.value,class:"pd-select",onChange:k[7]||(k[7]=q=>J(q.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),(q,X)=>(e.openBlock(),e.createElementBlock("option",{key:X,value:X},e.toDisplayString(X),9,Ks))),128)),k[13]||(k[13]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,Ws)]),I.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",Ys,[k[16]||(k[16]=e.createElementVNode("span",{class:"pd-label"},"自定义宽高 (mm)",-1)),e.createElementVNode("div",Xs,[e.createVNode(le,{"model-value":y.value,min:25,max:2e3,"onUpdate:modelValue":ae},null,8,["model-value"]),k[15]||(k[15]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(le,{"model-value":F.value,min:25,max:2e3,"onUpdate:modelValue":_},null,8,["model-value"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",js,[k[19]||(k[19]=e.createElementVNode("span",{class:"pd-label"},"方向",-1)),e.createElementVNode("div",Js,[e.createElementVNode("label",Zs,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:G.value==="portrait",onChange:k[8]||(k[8]=q=>te(q.target.value))},null,40,Qs),k[17]||(k[17]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",_s,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:G.value==="landscape",onChange:k[9]||(k[9]=q=>te(q.target.value))},null,40,ed),k[18]||(k[18]=e.createElementVNode("span",null,"横向",-1))])])]),e.createElementVNode("div",td,[k[20]||(k[20]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",od,[e.createVNode(be,{modelValue:H.value,"onUpdate:modelValue":k[10]||(k[10]=q=>H.value=q),class:"page-bg-picker"},null,8,["modelValue"]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:re},"默认")])]),k[29]||(k[29]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),e.createElementVNode("div",nd,[e.createElementVNode("div",ld,[k[21]||(k[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(le,{"model-value":T.value,min:0,max:50,"onUpdate:modelValue":g},null,8,["model-value"])]),e.createElementVNode("div",ad,[k[22]||(k[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(le,{"model-value":C.value,min:0,max:50,"onUpdate:modelValue":d},null,8,["model-value"])]),e.createElementVNode("div",id,[k[23]||(k[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(le,{"model-value":S.value,min:0,max:50,"onUpdate:modelValue":p},null,8,["model-value"])]),e.createElementVNode("div",rd,[k[24]||(k[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(le,{"model-value":x.value,min:0,max:50,"onUpdate:modelValue":E},null,8,["model-value"])])]),k[30]||(k[30]=e.createElementVNode("h3",{class:"pd-divider"},"三区高度 (mm)",-1)),e.createElementVNode("div",sd,[k[25]||(k[25]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(le,{"model-value":D.value,min:0,max:100,step:.1,"onUpdate:modelValue":N},null,8,["model-value"])]),e.createElementVNode("div",dd,[k[26]||(k[26]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(le,{"model-value":z.value,min:0,max:100,step:.1,"onUpdate:modelValue":P},null,8,["model-value"])]),e.createElementVNode("div",cd,[k[27]||(k[27]=e.createElementVNode("span",{class:"pd-label"},"首页叠加高度",-1)),e.createVNode(le,{"model-value":m.value,min:0,max:200,"onUpdate:modelValue":w},null,8,["model-value"])])],32)],512),[[e.vShow,(t.activeTab||"page")==="page"]])])],64))],2))}}),md=Q(ud,[["__scopeId","data-v-93072c2b"]]),pd={class:"status-bar"},fd={key:0,class:"status-item coord"},vd={class:"status-item"},gd={class:"status-item"},hd={class:"status-item status-paper"},bd=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(t){return(l,o)=>(e.openBlock(),e.createElementBlock("div",pd,[t.coordinate?(e.openBlock(),e.createElementBlock("span",fd," x:"+e.toDisplayString(t.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(t.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",vd,"缩放 "+e.toDisplayString(t.scale)+"%",1),e.createElementVNode("span",gd,"元素 "+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",hd,e.toDisplayString(t.paper),1)]))}}),yd=Q(bd,[["__scopeId","data-v-eb34e9a7"]]),kd={id:"getting-started",title:"快速入门",content:`
|
|
4
|
+
<h2>界面布局</h2>
|
|
5
|
+
<p>打印模板设计器采用三栏布局:</p>
|
|
6
|
+
<ul>
|
|
7
|
+
<li><strong>左侧面板</strong>:字段树和图层管理,用于查看和管理画布上的元素</li>
|
|
8
|
+
<li><strong>中间画布</strong>:设计区域,支持标尺、参考线、网格显示</li>
|
|
9
|
+
<li><strong>右侧面板</strong>:属性设置和模板配置</li>
|
|
10
|
+
<li><strong>顶部工具栏</strong>:常用操作按钮</li>
|
|
11
|
+
<li><strong>底部状态栏</strong>:显示坐标、缩放比例、元素数量</li>
|
|
12
|
+
</ul>
|
|
13
|
+
|
|
14
|
+
<h2>添加第一个元素</h2>
|
|
15
|
+
<ol>
|
|
16
|
+
<li>从左侧面板选择元素类型(文本、图片、条码等)</li>
|
|
17
|
+
<li>拖拽到画布上松开</li>
|
|
18
|
+
<li>选中元素后,通过拖拽调整位置</li>
|
|
19
|
+
<li>拖拽元素边角手柄调整大小</li>
|
|
20
|
+
</ol>
|
|
21
|
+
|
|
22
|
+
<h2>数据绑定基础</h2>
|
|
23
|
+
<p>使用花括号 <code>{field.path}</code> 语法绑定数据字段:</p>
|
|
24
|
+
<pre><code>供应商:{supplier.name}
|
|
25
|
+
日期:{order.date}
|
|
26
|
+
金额:{MONEY(order.total)}</code></pre>
|
|
27
|
+
<p>双击元素可打开表达式编辑器配置绑定。</p>
|
|
28
|
+
|
|
29
|
+
<h2>保存与预览</h2>
|
|
30
|
+
<ul>
|
|
31
|
+
<li>点击工具栏"保存"按钮,模板以 JSON 格式导出</li>
|
|
32
|
+
<li>点击"预览"按钮查看打印效果</li>
|
|
33
|
+
<li>模板数据包含页面设置、元素定义、样式配置</li>
|
|
34
|
+
</ul>
|
|
35
|
+
|
|
36
|
+
<h2>关于项目</h2>
|
|
37
|
+
<p><strong>项目名称:</strong>worm-vue3-print</p>
|
|
38
|
+
<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>
|
|
39
|
+
<p>基于 Vue 3 的可视化打印模板设计器,支持拖拽式模板编辑、表达式数据绑定和浏览器端打印预览。</p>
|
|
40
|
+
`},Ed={id:"features",title:"功能说明",content:`
|
|
41
|
+
<h2>元素类型</h2>
|
|
42
|
+
<table>
|
|
43
|
+
<thead>
|
|
44
|
+
<tr><th>类型</th><th>说明</th></tr>
|
|
45
|
+
</thead>
|
|
46
|
+
<tbody>
|
|
47
|
+
<tr><td>文本</td><td>静态或动态文本,支持表达式绑定</td></tr>
|
|
48
|
+
<tr><td>长文本</td><td>多行文本,支持自动换行</td></tr>
|
|
49
|
+
<tr><td>数据表格</td><td>动态行列,支持分页、表头重复、序号/小计/汇总</td></tr>
|
|
50
|
+
<tr><td>条形码</td><td>支持 code128 等多种码制</td></tr>
|
|
51
|
+
<tr><td>二维码</td><td>支持 L/M/Q/H 纠错级别</td></tr>
|
|
52
|
+
<tr><td>图片</td><td>静态或动态图片</td></tr>
|
|
53
|
+
<tr><td>线条</td><td>水平线或垂直线</td></tr>
|
|
54
|
+
<tr><td>形状</td><td>矩形、椭圆,支持边框和背景色</td></tr>
|
|
55
|
+
<tr><td>HTML</td><td>自定义 HTML 内容</td></tr>
|
|
56
|
+
<tr><td>页码</td><td>自动页码显示</td></tr>
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>
|
|
59
|
+
|
|
60
|
+
<h2>表达式编辑器</h2>
|
|
61
|
+
<h3>基础语法</h3>
|
|
62
|
+
<p>使用花括号 <code>{}</code> 包裹表达式,花括号外为字面文本。</p>
|
|
63
|
+
|
|
64
|
+
<h3>内置函数</h3>
|
|
65
|
+
<table>
|
|
66
|
+
<thead>
|
|
67
|
+
<tr><th>函数</th><th>说明</th><th>示例</th></tr>
|
|
68
|
+
</thead>
|
|
69
|
+
<tbody>
|
|
70
|
+
<tr><td><code>MONEY(value)</code></td><td>金额格式化(千分位+两位小数)</td><td><code>{MONEY(order.total)}</code> -> "69,543.75"</td></tr>
|
|
71
|
+
<tr><td><code>DATE(value, format)</code></td><td>日期格式化</td><td><code>{DATE(order.date, 'YYYY-MM-DD')}</code></td></tr>
|
|
72
|
+
<tr><td><code>UPPER(value)</code></td><td>数字转大写金额</td><td><code>{UPPER(order.total)}</code> -> "陆万玖仟伍佰肆拾叁元柒角伍分"</td></tr>
|
|
73
|
+
<tr><td><code>IF(cond, true, false)</code></td><td>条件判断</td><td><code>{IF(qty > 100, '大量', '少量')}</code></td></tr>
|
|
74
|
+
<tr><td><code>CONCAT(str1, str2, ...)</code></td><td>字符串拼接</td><td><code>{CONCAT(name, '-', spec)}</code></td></tr>
|
|
75
|
+
<tr><td><code>IFEMPTY(value, default)</code></td><td>空值默认</td><td><code>{IFEMPTY(remark, '无')}</code></td></tr>
|
|
76
|
+
<tr><td><code>ROUND(num, decimals)</code></td><td>四舍五入</td><td><code>{ROUND(price, 2)}</code></td></tr>
|
|
77
|
+
<tr><td><code>NOW()</code></td><td>当前日期</td><td><code>{NOW()}</code></td></tr>
|
|
78
|
+
<tr><td><code>SUBSTR(str, start, len)</code></td><td>子字符串</td><td><code>{SUBSTR(name, 0, 3)}</code></td></tr>
|
|
79
|
+
<tr><td><code>LEN(str)</code></td><td>字符串长度</td><td><code>{LEN(name)}</code></td></tr>
|
|
80
|
+
<tr><td><code>PAD(value, len, char)</code></td><td>左侧补位</td><td><code>{PAD(qty, 5, '0')}</code></td></tr>
|
|
81
|
+
</tbody>
|
|
82
|
+
</table>
|
|
83
|
+
|
|
84
|
+
<h3>聚合函数(表格小计/汇总行使用)</h3>
|
|
85
|
+
<table>
|
|
86
|
+
<thead>
|
|
87
|
+
<tr><th>函数</th><th>说明</th></tr>
|
|
88
|
+
</thead>
|
|
89
|
+
<tbody>
|
|
90
|
+
<tr><td><code>SUM(field)</code></td><td>求和</td></tr>
|
|
91
|
+
<tr><td><code>AVG(field)</code></td><td>平均值</td></tr>
|
|
92
|
+
<tr><td><code>COUNT(field)</code></td><td>计数</td></tr>
|
|
93
|
+
<tr><td><code>MIN(field)</code></td><td>最小值</td></tr>
|
|
94
|
+
<tr><td><code>MAX(field)</code></td><td>最大值</td></tr>
|
|
95
|
+
</tbody>
|
|
96
|
+
</table>
|
|
97
|
+
|
|
98
|
+
<h3>系统变量</h3>
|
|
99
|
+
<table>
|
|
100
|
+
<thead>
|
|
101
|
+
<tr><th>变量</th><th>说明</th></tr>
|
|
102
|
+
</thead>
|
|
103
|
+
<tbody>
|
|
104
|
+
<tr><td><code>pageIndex</code></td><td>当前页码</td></tr>
|
|
105
|
+
<tr><td><code>totalPages</code></td><td>总页数</td></tr>
|
|
106
|
+
<tr><td><code>printDate</code></td><td>打印日期 (YYYY-MM-DD)</td></tr>
|
|
107
|
+
<tr><td><code>printTime</code></td><td>打印时间戳</td></tr>
|
|
108
|
+
</tbody>
|
|
109
|
+
</table>
|
|
110
|
+
|
|
111
|
+
<h2>数据表格配置</h2>
|
|
112
|
+
<h3>行类型</h3>
|
|
113
|
+
<ul>
|
|
114
|
+
<li><strong>标题行 (header)</strong>:可设置每页重复显示</li>
|
|
115
|
+
<li><strong>数据行 (data)</strong>:绑定列表数据源迭代显示</li>
|
|
116
|
+
<li><strong>小计行 (subtotal)</strong>:当前页末尾显示汇总</li>
|
|
117
|
+
<li><strong>汇总行 (summary)</strong>:仅最后一页显示</li>
|
|
118
|
+
</ul>
|
|
119
|
+
|
|
120
|
+
<h3>表格操作</h3>
|
|
121
|
+
<ul>
|
|
122
|
+
<li>右键菜单支持插入/删除行和列</li>
|
|
123
|
+
<li>支持单元格合并/拆分</li>
|
|
124
|
+
<li>支持边框预设:全部/外边框/内边框/无</li>
|
|
125
|
+
<li>无边框表格设计态显示虚拟虚线</li>
|
|
126
|
+
<li><strong>调整列宽</strong>:需要先在左侧面板的图层中选中对应的表格元素,然后才能在画布上拖动列宽分隔线</li>
|
|
127
|
+
<li><strong>调整表格属性</strong>:必须确保当前没有任何单元格被选中。如有选中的单元格,先点击画布空白区域取消选中,再在图层中选择表格元素</li>
|
|
128
|
+
<li><strong>单元格图片处理</strong>:若单元格中图片无法缩小,请将图片处理方式设置为"缩小保持比例"</li>
|
|
129
|
+
</ul>
|
|
130
|
+
|
|
131
|
+
<h2>对齐与吸附</h2>
|
|
132
|
+
<h3>自动对齐</h3>
|
|
133
|
+
<p>拖拽元素时自动显示对齐引导线:</p>
|
|
134
|
+
<ul>
|
|
135
|
+
<li>蓝色:左/顶对齐</li>
|
|
136
|
+
<li>绿色:居中对齐</li>
|
|
137
|
+
<li>橙色:右/底对齐</li>
|
|
138
|
+
</ul>
|
|
139
|
+
|
|
140
|
+
<h3>网格吸附</h3>
|
|
141
|
+
<p>开启吸附功能后,元素自动吸附到网格点。</p>
|
|
142
|
+
|
|
143
|
+
<h3>手动参考线</h3>
|
|
144
|
+
<p>通过标尺区域拖拽添加参考线,参考线参与吸附检测。</p>
|
|
145
|
+
|
|
146
|
+
<h2>图层管理</h2>
|
|
147
|
+
<ul>
|
|
148
|
+
<li>调整元素显示顺序(置顶/置底/上移/下移)</li>
|
|
149
|
+
<li>显示/隐藏元素</li>
|
|
150
|
+
<li>锁定/解锁元素(锁定后不可编辑)</li>
|
|
151
|
+
</ul>
|
|
152
|
+
|
|
153
|
+
<h2>三区布局</h2>
|
|
154
|
+
<p>页面分为三个区域:</p>
|
|
155
|
+
<ul>
|
|
156
|
+
<li><strong>页眉 (header)</strong>:顶部区域</li>
|
|
157
|
+
<li><strong>内容区 (content)</strong>:主体区域</li>
|
|
158
|
+
<li><strong>页脚 (footer)</strong>:底部区域</li>
|
|
159
|
+
</ul>
|
|
160
|
+
<p>页眉/页脚支持的元素类型:文本、图片、线条、形状、条形码、二维码</p>
|
|
161
|
+
|
|
162
|
+
<h2>水印配置</h2>
|
|
163
|
+
<ul>
|
|
164
|
+
<li>支持固定文本或绑定字段</li>
|
|
165
|
+
<li>可设置旋转角度和透明度</li>
|
|
166
|
+
<li>支持显示打印时间戳</li>
|
|
167
|
+
</ul>
|
|
168
|
+
`},wd={id:"shortcuts",title:"快捷键",content:`
|
|
169
|
+
<h2>常用操作</h2>
|
|
170
|
+
<table>
|
|
171
|
+
<thead>
|
|
172
|
+
<tr><th>快捷键</th><th>功能</th></tr>
|
|
173
|
+
</thead>
|
|
174
|
+
<tbody>
|
|
175
|
+
<tr><td><code>Ctrl + C</code></td><td>复制选中元素</td></tr>
|
|
176
|
+
<tr><td><code>Ctrl + V</code></td><td>粘贴元素(偏移 10mm)</td></tr>
|
|
177
|
+
<tr><td><code>Ctrl + D</code></td><td>原地复制(偏移 5mm, 5mm)</td></tr>
|
|
178
|
+
<tr><td><code>Ctrl + A</code></td><td>全选元素</td></tr>
|
|
179
|
+
<tr><td><code>Delete / Backspace</code></td><td>删除选中元素</td></tr>
|
|
180
|
+
<tr><td><code>Ctrl + Z</code></td><td>撤销</td></tr>
|
|
181
|
+
<tr><td><code>Ctrl + Shift + Z</code> / <code>Ctrl + Y</code></td><td>重做</td></tr>
|
|
182
|
+
</tbody>
|
|
183
|
+
</table>
|
|
184
|
+
|
|
185
|
+
<h2>元素移动</h2>
|
|
186
|
+
<table>
|
|
187
|
+
<thead>
|
|
188
|
+
<tr><th>快捷键</th><th>功能</th></tr>
|
|
189
|
+
</thead>
|
|
190
|
+
<tbody>
|
|
191
|
+
<tr><td><code>方向键</code></td><td>移动 1mm</td></tr>
|
|
192
|
+
<tr><td><code>Shift + 方向键</code></td><td>移动 10mm</td></tr>
|
|
193
|
+
<tr><td><code>Ctrl + 方向键</code></td><td>移动 0.5mm</td></tr>
|
|
194
|
+
</tbody>
|
|
195
|
+
</table>
|
|
196
|
+
|
|
197
|
+
<h2>缩放控制</h2>
|
|
198
|
+
<table>
|
|
199
|
+
<thead>
|
|
200
|
+
<tr><th>快捷键</th><th>功能</th></tr>
|
|
201
|
+
</thead>
|
|
202
|
+
<tbody>
|
|
203
|
+
<tr><td><code>Ctrl + 1</code></td><td>重置缩放至 100%</td></tr>
|
|
204
|
+
<tr><td><code>Ctrl + 0</code></td><td>适应窗口</td></tr>
|
|
205
|
+
</tbody>
|
|
206
|
+
</table>
|
|
207
|
+
|
|
208
|
+
<h2>对齐操作(多选时)</h2>
|
|
209
|
+
<table>
|
|
210
|
+
<thead>
|
|
211
|
+
<tr><th>快捷键</th><th>功能</th></tr>
|
|
212
|
+
</thead>
|
|
213
|
+
<tbody>
|
|
214
|
+
<tr><td><code>Ctrl + L</code></td><td>左对齐</td></tr>
|
|
215
|
+
<tr><td><code>Ctrl + R</code></td><td>右对齐</td></tr>
|
|
216
|
+
<tr><td><code>Ctrl + E</code></td><td>水平居中</td></tr>
|
|
217
|
+
<tr><td><code>Ctrl + T</code></td><td>顶对齐</td></tr>
|
|
218
|
+
<tr><td><code>Ctrl + B</code></td><td>底对齐</td></tr>
|
|
219
|
+
</tbody>
|
|
220
|
+
</table>
|
|
221
|
+
|
|
222
|
+
<h2>组合操作</h2>
|
|
223
|
+
<table>
|
|
224
|
+
<thead>
|
|
225
|
+
<tr><th>快捷键</th><th>功能</th></tr>
|
|
226
|
+
</thead>
|
|
227
|
+
<tbody>
|
|
228
|
+
<tr><td><code>Ctrl + G</code></td><td>组合选中元素</td></tr>
|
|
229
|
+
<tr><td><code>Ctrl + Shift + G</code></td><td>取消组合</td></tr>
|
|
230
|
+
</tbody>
|
|
231
|
+
</table>
|
|
232
|
+
|
|
233
|
+
<blockquote>
|
|
234
|
+
<p><strong>注意</strong>:当焦点在输入框、文本框、下拉框内时,快捷键不生效。</p>
|
|
235
|
+
</blockquote>
|
|
236
|
+
`},Vd={id:"faq",title:"常见问题",content:`
|
|
237
|
+
<h2>如何调整纸张大小?</h2>
|
|
238
|
+
<ol>
|
|
239
|
+
<li>在右侧面板选择"页面设置"</li>
|
|
240
|
+
<li>选择预设纸张(A4、A3、A5、Letter、Legal)</li>
|
|
241
|
+
<li>或选择"自定义"输入宽度和高度(mm)</li>
|
|
242
|
+
<li>设置方向:纵向(portrait)或横向(landscape)</li>
|
|
243
|
+
</ol>
|
|
244
|
+
|
|
245
|
+
<h2>如何处理分页?</h2>
|
|
246
|
+
<p>数据表格支持自动分页:</p>
|
|
247
|
+
<ol>
|
|
248
|
+
<li>在表格属性中设置"每页显示行数"</li>
|
|
249
|
+
<li>启用"表头重复"确保跨页时显示标题行</li>
|
|
250
|
+
<li>添加小计行显示当前页汇总</li>
|
|
251
|
+
<li>添加汇总行显示整表汇总</li>
|
|
252
|
+
</ol>
|
|
253
|
+
|
|
254
|
+
<h2>如何导入外部数据?</h2>
|
|
255
|
+
<p>通过组件 props 传入数据:</p>
|
|
256
|
+
<ul>
|
|
257
|
+
<li><code>fields</code>:字段定义数组,用于字段树显示</li>
|
|
258
|
+
<li><code>initialTemplate</code>:初始模板数据</li>
|
|
259
|
+
<li><code>loadDefaultTemplate</code>:加载默认模板的回调函数</li>
|
|
260
|
+
</ul>
|
|
261
|
+
|
|
262
|
+
<h2>如何使用表达式绑定字段?</h2>
|
|
263
|
+
<ol>
|
|
264
|
+
<li>双击元素打开表达式编辑器</li>
|
|
265
|
+
<li>使用 <code>{field.path}</code> 语法绑定字段</li>
|
|
266
|
+
<li>使用内置函数格式化数据(如 <code>{MONEY(price)}</code>)</li>
|
|
267
|
+
<li>点击确认保存</li>
|
|
268
|
+
</ol>
|
|
269
|
+
|
|
270
|
+
<h2>如何调整元素层级?</h2>
|
|
271
|
+
<ol>
|
|
272
|
+
<li>选中一个或多个元素</li>
|
|
273
|
+
<li>点击工具栏的层级按钮:
|
|
274
|
+
<ul>
|
|
275
|
+
<li>⤒ 置顶</li>
|
|
276
|
+
<li>↑ 上移一层</li>
|
|
277
|
+
<li>↓ 下移一层</li>
|
|
278
|
+
<li>⤓ 置底</li>
|
|
279
|
+
</ul>
|
|
280
|
+
</li>
|
|
281
|
+
</ol>
|
|
282
|
+
<p>或使用快捷键在图层面板中调整。</p>
|
|
283
|
+
|
|
284
|
+
<h2>如何组合多个元素?</h2>
|
|
285
|
+
<ol>
|
|
286
|
+
<li>按住 Ctrl 逐个点击选中多个元素</li>
|
|
287
|
+
<li>点击工具栏"组合"按钮,或按 <code>Ctrl + G</code></li>
|
|
288
|
+
<li>组合后点击任一元素可选中整个组</li>
|
|
289
|
+
<li>取消组合:选中组合后点击"取消组合",或按 <code>Ctrl + Shift + G</code></li>
|
|
290
|
+
</ol>
|
|
291
|
+
|
|
292
|
+
<h2>如何使用参考线?</h2>
|
|
293
|
+
<ol>
|
|
294
|
+
<li>在标尺区域拖拽添加参考线</li>
|
|
295
|
+
<li>参考线自动参与吸附检测</li>
|
|
296
|
+
<li>拖拽参考线可调整位置</li>
|
|
297
|
+
<li>双击参考线可删除</li>
|
|
298
|
+
</ol>
|
|
299
|
+
|
|
300
|
+
<h2>如何预览打印效果?</h2>
|
|
301
|
+
<ol>
|
|
302
|
+
<li>点击工具栏"预览"按钮</li>
|
|
303
|
+
<li>预览使用同构渲染管线,确保与实际打印一致</li>
|
|
304
|
+
<li>可通过"叠层对比"功能对比设计稿与截图</li>
|
|
305
|
+
</ol>
|
|
306
|
+
|
|
307
|
+
<h2>模板数据格式是什么?</h2>
|
|
308
|
+
<p>模板以 JSON 格式存储,包含:</p>
|
|
309
|
+
<ul>
|
|
310
|
+
<li><code>paperSize</code>:纸张大小</li>
|
|
311
|
+
<li><code>orientation</code>:方向</li>
|
|
312
|
+
<li><code>margins</code>:页边距</li>
|
|
313
|
+
<li><code>header</code>:页眉配置</li>
|
|
314
|
+
<li><code>footer</code>:页脚配置</li>
|
|
315
|
+
<li><code>elements</code>:元素数组</li>
|
|
316
|
+
<li><code>watermark</code>:水印配置</li>
|
|
317
|
+
</ul>
|
|
318
|
+
|
|
319
|
+
<h2>如何调整表格列宽?</h2>
|
|
320
|
+
<ol>
|
|
321
|
+
<li>在左侧面板的图层列表中,点击选中对应的表格元素</li>
|
|
322
|
+
<li>此时画布上的表格会显示列宽分隔线</li>
|
|
323
|
+
<li>拖动列宽分隔线即可调整列宽</li>
|
|
324
|
+
</ol>
|
|
325
|
+
<blockquote>
|
|
326
|
+
<p><strong>注意</strong>:必须先选中表格元素,才能激活列宽拖动功能。</p>
|
|
327
|
+
</blockquote>
|
|
328
|
+
|
|
329
|
+
<h2>如何调整表格属性?</h2>
|
|
330
|
+
<ol>
|
|
331
|
+
<li>确保当前没有任何单元格被选中(如有选中,点击画布空白区域取消选中)</li>
|
|
332
|
+
<li>在左侧面板的图层列表中,点击选中对应的表格元素</li>
|
|
333
|
+
<li>右侧面板会显示表格属性设置</li>
|
|
334
|
+
</ol>
|
|
335
|
+
<blockquote>
|
|
336
|
+
<p><strong>注意</strong>:如果存在选中的单元格,右侧面板将显示单元格属性而非表格属性。</p>
|
|
337
|
+
</blockquote>
|
|
338
|
+
`},Nd={id:"changelog",title:"更新记录",content:`
|
|
339
|
+
<h2>v1.2.0 <small>2026-09-10</small></h2>
|
|
340
|
+
|
|
341
|
+
<h3>新增</h3>
|
|
342
|
+
<ul>
|
|
343
|
+
<li>帮助文档模态框(HelpModal):内置功能介绍、快捷键一览、常见问题与更新记录,按 Esc 或点击遮罩关闭。</li>
|
|
344
|
+
<li>标尺参考线增强:支持从标尺拖拽添加参考线、双击编辑、删除,参考线对齐吸附实时显示。</li>
|
|
345
|
+
<li>表格列宽拖拽新增末列右边界手柄:可直接拖拽末列右边界调整末列宽,受打印范围宽度与最小列宽 5mm 钳制。</li>
|
|
346
|
+
</ul>
|
|
347
|
+
|
|
348
|
+
<h3>变更</h3>
|
|
349
|
+
<ul>
|
|
350
|
+
<li>优化缩放逻辑:取消放大上限,支持滚轮乘性步进缩放,修复缩放锚点漂移问题。</li>
|
|
351
|
+
<li>移除设计态元素左上角的 fx 绑定标签提示,简化元素视觉呈现。</li>
|
|
352
|
+
</ul>
|
|
353
|
+
|
|
354
|
+
<h3>文档</h3>
|
|
355
|
+
<ul>
|
|
356
|
+
<li>仓库根目录新增 <code>AGENTS.md</code>:AI 代理行为规范,明确代理在本仓库工作时的语言、专家态度、协作约定等强制要求。</li>
|
|
357
|
+
<li>新增 <code>worm-vue3-print</code> 集成支持 skill:包含安装指南、集成 API、故障排查等参考文档。</li>
|
|
358
|
+
</ul>
|
|
359
|
+
|
|
360
|
+
<h3>修复</h3>
|
|
361
|
+
<ul>
|
|
362
|
+
<li>表格列宽拖拽存在的多个缺陷:
|
|
363
|
+
<ul>
|
|
364
|
+
<li>内部列边界向左拖时左列宽度不变,导致边界线不跟随光标。</li>
|
|
365
|
+
<li>px → mm 单位换算缺失,拖拽距离存在约 3.78 倍偏差。</li>
|
|
366
|
+
<li><code>table-layout: fixed</code> 下拖拽过程中表格 CSS <code>width(100%)</code> 与列宽和失配,导致浏览器按比例拉伸列,使边界线与右侧内容偏离光标。</li>
|
|
367
|
+
<li>删除 <code>onColResizeStart</code> 中残留的 <code>document.title</code> 调试代码。</li>
|
|
368
|
+
</ul>
|
|
369
|
+
</li>
|
|
370
|
+
</ul>
|
|
371
|
+
|
|
372
|
+
<h2>v1.1.0 <small>2026-09-06</small></h2>
|
|
373
|
+
|
|
374
|
+
<h3>新增</h3>
|
|
375
|
+
<ul>
|
|
376
|
+
<li>表格元素支持列宽拖拽:设计态选中表格后,在列边界悬停并拖动即可调整该列宽(左侧列),实时更新画布与元素尺寸;受打印范围宽度与最小列宽 5mm 钳制,拖拽结束后计入一次撤销历史。属性面板的列宽数值输入保留作为精确输入兜底。</li>
|
|
377
|
+
<li>表格单元格支持图片类型:单元格可切换为图片类型,设计态支持选择图片与设置 fit/maxWidth/maxHeight,预览与打印输出完整渲染。</li>
|
|
378
|
+
<li>条形码与二维码单元格支持 fit/maxWidth/maxHeight 属性。</li>
|
|
379
|
+
<li>属性面板位置尺寸改用 StepperInput 控件:支持按钮微调数值;StepperInput 支持可选值列表和小数步进。</li>
|
|
380
|
+
<li>新增统一颜色选择器并重构属性面板字段分组。</li>
|
|
381
|
+
<li>支持页面(纸张)背景色 <code>pageBackground</code>,预览与打印/PDF 输出一致。</li>
|
|
382
|
+
<li>支持 canvas 库模式构建与 npm 发布。</li>
|
|
383
|
+
</ul>
|
|
384
|
+
|
|
385
|
+
<h3>修复</h3>
|
|
386
|
+
<ul>
|
|
387
|
+
<li>打印/导出 PDF 保留元素背景色(<code>print-color-adjust: exact</code>)。</li>
|
|
388
|
+
<li>打印预览保留元素重叠,表格下方跟随元素按设计坐标绝对定位并透传层级 z-index。</li>
|
|
389
|
+
<li>打印页眉页脚区域贴页面底部,修复页边距失效。</li>
|
|
390
|
+
<li>条形码渲染缺少 <code>object-fit: contain</code>。</li>
|
|
391
|
+
<li>修复 canvas 测试在 vitest v4 + happy-dom 环境下 <code>localStorage</code> 未定义的问题,补充 mock 以兼容测试环境。</li>
|
|
392
|
+
</ul>
|
|
393
|
+
|
|
394
|
+
<h2>v1.0.0 <small>2026-09-02</small></h2>
|
|
395
|
+
|
|
396
|
+
<h3>新增</h3>
|
|
397
|
+
<ul>
|
|
398
|
+
<li>首次开源发布。</li>
|
|
399
|
+
<li><code>@worm-vue3-print/core</code>:模板表达式引擎与同构渲染管线(HTML 生成 / 分页 / 数据绑定)。</li>
|
|
400
|
+
<li><code>@worm-vue3-print/canvas</code>:Vue 3 可视化打印模板设计器画布。</li>
|
|
401
|
+
<li>渲染微服务拆分为独立仓库 <code>worm-vue3-print-render</code>(仅 Docker 部署,不上 npm)。</li>
|
|
402
|
+
</ul>
|
|
403
|
+
|
|
404
|
+
<blockquote>
|
|
405
|
+
<p>完整更新记录请查阅仓库 <code>docs/中文/CHANGELOG.md</code> 与 <code>docs/en/CHANGELOG.en.md</code>。</p>
|
|
406
|
+
</blockquote>
|
|
407
|
+
`},Cd=[kd,Ed,wd,Vd,Nd],Sd={class:"help-modal"},$d={class:"help-modal-header"},Md={class:"help-modal-body"},xd={class:"help-modal-sidebar"},Bd=["onClick"],Dd={class:"help-modal-content"},Td=["innerHTML"],Qe="worm-print-help-tab",zd=e.defineComponent({__name:"HelpModal",props:{visible:{type:Boolean},initialTab:{default:"getting-started"}},emits:["close","update:tab"],setup(t,{emit:l}){const o=t,n=l,a=Cd,r=e.ref(o.initialTab);e.onMounted(()=>{const u=localStorage.getItem(Qe);u&&a.some(f=>f.id===u)&&(r.value=u)}),e.watch(()=>o.visible,u=>{if(u){const f=localStorage.getItem(Qe);f&&a.some(v=>v.id===f)&&(r.value=f)}});function i(u){r.value=u,localStorage.setItem(Qe,u),n("update:tab",u)}const s=e.computed(()=>a.find(f=>f.id===r.value)?.content||"");function c(u){u.key==="Escape"&&o.visible&&n("close")}return e.onMounted(()=>{document.addEventListener("keydown",c)}),e.onUnmounted(()=>{document.removeEventListener("keydown",c)}),(u,f)=>(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:f[1]||(f[1]=e.withModifiers(v=>u.$emit("close"),["self"]))},[e.createElementVNode("div",Sd,[e.createElementVNode("div",$d,[f[2]||(f[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:f[0]||(f[0]=v=>u.$emit("close"))}," × ")]),e.createElementVNode("div",Md,[e.createElementVNode("div",xd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),v=>(e.openBlock(),e.createElementBlock("button",{key:v.id,class:e.normalizeClass(["help-tab",{active:r.value===v.id}]),onClick:h=>i(v.id)},e.toDisplayString(v.title),11,Bd))),128))]),e.createElementVNode("div",Dd,[e.createElementVNode("div",{class:"help-content",innerHTML:s.value},null,8,Td)])])])])):e.createCommentVNode("",!0)]),_:1})]))}}),Ld=Q(zd,[["__scopeId","data-v-31115934"]]),Ct="print-studio:left",St="print-studio:right";function $t(t,l){try{const o=localStorage.getItem(t);return o===null?l:o==="1"}catch{return l}}function Pd(){const t=e.ref($t(Ct,!1)),l=e.ref($t(St,!1)),o=e.ref(!1);e.watch(t,i=>{try{localStorage.setItem(Ct,i?"1":"0")}catch{}},{flush:"sync"}),e.watch(l,i=>{try{localStorage.setItem(St,i?"1":"0")}catch{}},{flush:"sync"});function n(){t.value=!t.value}function a(){l.value=!l.value}function r(){o.value=!1}return{leftCollapsed:t,rightCollapsed:l,toggleLeft:n,toggleRight:a,dirty:o,markSaved:r}}const Ad={class:"designer-container"},Id={class:"designer-body"},Rd=e.defineComponent({__name:"PrintDesigner",props:{initialTemplate:{},initialElements:{},fields:{},isEdit:{type:Boolean},requestScreenshot:{type:Function},uploadImage:{type:Function},loadDefaultTemplate:{type:Function}},emits:["preview","save"],setup(t,{expose:l,emit:o}){const n=t,a=o,r=e.ref(!1),{leftCollapsed:i,rightCollapsed:s,toggleLeft:c,toggleRight:u,dirty:f,markSaved:v}=Pd(),{scale:h,showRuler:L,showGrid:R,snapToGrid:B,showTableGhostBorder:$,templateData:A,elements:Y,fields:j,selectedIds:I,selectedElement:G,select:H,clearSelection:T,selectAll:C,previewIds:S,setPreview:x,commitPreview:D,hasClipboard:z,copy:m,paste:y,cutSelected:F,canUndo:K,canRedo:J,undo:te,redo:se,alignSelected:re,groupSelected:ae,ungroupSelected:_,deleteSelected:g,dragStart:d,dragStop:p,addElement:E,addFieldElement:N,moveLayer:P,updateTemplateData:w,fitToWindow:V,getTemplateJson:M,loadTemplate:b,tableSelection:k,setTableSelection:q,recordHistory:X}=Fo({initialTemplate:n.initialTemplate,initialElements:n.initialElements,initialFields:n.fields});e.watch([Y,A],()=>{f.value=!0},{deep:!0});const{guides:ue,addGuide:ce,moveGuide:ke,removeGuide:qe}=Go(A,X),De=e.computed(()=>{const U=A.value,{width:O}=we(U);return O-U.margins.left-U.margins.right});e.provide(Be,{tableSelection:k,setTableSelection:q,recordHistory:X,maxTableWidth:De}),e.provide(At,I),e.provide(It,S),e.provide(ut,e.computed(()=>n.uploadImage)),e.watch(G,U=>{(!U||U.printElementType.type!=="table")&&q(null)});const Te=e.ref(null),Ve=e.ref(!1),Ce=e.ref(""),We=e.ref(.5);async function Ke(){if(Ve.value){Ve.value=!1;return}const U=M();if(!U){alert("模板数据为空");return}if(!n.requestScreenshot){alert("截图服务未配置");return}try{const O=await n.requestScreenshot({templateJson:U,printData:fe});Ce.value&&URL.revokeObjectURL(Ce.value),Ce.value=URL.createObjectURL(O),Ve.value=!0}catch{alert("截图生成失败")}}const ze=e.ref(null);function Ye(U){ze.value=U}const W=e.computed(()=>{const U=A.value,O=we(U),ne=U.orientation==="landscape"?"横向":"纵向";return`${U.paperSize} ${ne} ${Math.round(O.width)}×${Math.round(O.height)}mm`});function ee(){const U=Te.value?.$el;U&&V(U.clientWidth,U.clientHeight)}function Z(U){h.value=ct(h.value+U)}function oe(U){const O=U.target.tagName;O==="INPUT"||O==="TEXTAREA"||O==="SELECT"||(U.ctrlKey||U.metaKey)&&U.key==="0"&&(U.preventDefault(),ee())}e.onMounted(()=>document.addEventListener("keydown",oe)),e.onUnmounted(()=>document.removeEventListener("keydown",oe));function ge(U){const O=A.value.header.height,ne=A.value.footer.height;w(U),U.header.height<O&&Ee("header"),U.footer.height<ne&&Ee("footer")}function ie(U,O){A.value={...A.value,[U]:{...A.value[U],height:O}}}function he(U){w({...A.value}),Ee(U)}function Ee(U){const O=Ge(A.value)[U];Y.value.some(me=>me.zone===U&&(me.options.top+me.options.height>O.height||me.options.left+me.options.width>O.width))&&alert(`${U==="header"?"页眉":"页脚"}高度已小于区域内元素,请手动调整元素位置`)}function Wt(){const U=A.value.firstPageOverlay,O={options:{left:0,top:0,width:50,height:10,title:"首页叠加"},printElementType:{type:"text",title:"首页叠加"}};A.value={...A.value,firstPageOverlay:{...U,elements:[...U.elements,O]}}}const pt=H;function Kt(U){const O=Y.value.find(ne=>ne.id===U);O&&(O.options.visible=O.options.visible===!1)}function Yt(U){const O=Y.value.find(ne=>ne.id===U);O&&(O.options.locked=!O.options.locked)}const Me=e.ref("page");e.watch(G,U=>{Me.value=U?"element":"page"});const Xt={text:"formatter",longText:"formatter",barcode:"formatter",qrcode:"formatter",image:"src"},xe=e.ref(!1),Le=e.ref(null),Xe=e.ref("");function jt(U){const O=Y.value.find(me=>me.id===U);if(!O||(H(U,!1),Me.value="element",O.options.locked))return;const ne=Xt[O.printElementType.type];ne&&(Le.value={kind:"element",element:O,field:ne},Xe.value=O.options[ne]||"",xe.value=!0)}function Jt(U,O,ne){const me=Y.value.find(to=>to.id===U);if(!me||(H(U,!1),Me.value="element",me.options.locked))return;const ft=me.options.tableRows??[],vt=st(ft,O,ne),je=ft[vt.r]?.cells[vt.c];je&&(Le.value={kind:"cell",cell:je},Xe.value=je.formatter||"",xe.value=!0)}function Zt(U){const O=Le.value;O?.kind==="element"?O.element.options[O.field]=U||void 0:O?.kind==="cell"&&(O.cell.formatter=U||void 0),X(),xe.value=!1,Le.value=null}function Qt(U,O){Y.value.push(U),H(U.id,!1),X()}e.watch(()=>n.initialTemplate,U=>{U&&b(U,n.initialElements)}),e.watch(()=>n.initialElements,U=>{U&&!n.initialTemplate&&(A.value={...A.value,elements:U.map(O=>({...O,options:{...O.options},printElementType:{...O.printElementType}}))})}),e.watch(()=>n.fields,U=>{j.value=U||[]}),l({getTemplateJson:M});async function _t(){if(n.loadDefaultTemplate&&confirm("将覆盖当前画布内容,是否继续?"))try{const U=await n.loadDefaultTemplate();if(!U){alert("未获取到默认布局");return}b(U),alert("默认布局已加载")}catch{alert("加载默认布局失败")}}function eo(){a("save",JSON.stringify(M())),v()}return(U,O)=>(e.openBlock(),e.createElementBlock("div",Ad,[e.createVNode(cn,{"is-edit":t.isEdit,"can-undo":e.unref(K),"can-redo":e.unref(J),"has-multi-selection":e.unref(I).size>=2,"has-selection":e.unref(I).size>=1,"show-ruler":e.unref(L),"show-grid":e.unref(R),"snap-to-grid":e.unref(B),"show-table-ghost-border":e.unref($),"selected-element-has-group":!!e.unref(G)?.options.groupId,"overlay-visible":Ve.value,"show-load-default":!!t.loadDefaultTemplate,scale:e.unref(h),"onUpdate:scale":O[0]||(O[0]=ne=>e.isRef(h)?h.value=ne:null),onPreview:O[1]||(O[1]=ne=>U.$emit("preview")),onSave:eo,onLoadDefault:_t,onUndo:e.unref(te),onRedo:e.unref(se),onAlign:O[2]||(O[2]=ne=>e.unref(re)(ne)),onMoveLayer:e.unref(P),onToggleRuler:O[3]||(O[3]=ne=>L.value=!e.unref(L)),onToggleGrid:O[4]||(O[4]=ne=>R.value=!e.unref(R)),onToggleSnap:O[5]||(O[5]=ne=>B.value=!e.unref(B)),onToggleTableGhostBorder:O[6]||(O[6]=ne=>$.value=!e.unref($)),onToggleOverlay:Ke,onGroup:e.unref(ae),onUngroup:e.unref(_),onAddOverlayElement:Wt,onFitWindow:ee,onZoom:Z,onHelp:O[7]||(O[7]=ne=>r.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-load-default","scale","onUndo","onRedo","onMoveLayer","onGroup","onUngroup"]),e.createElementVNode("div",Id,[e.createVNode(Gn,{fields:e.unref(j),elements:e.unref(Y),"selected-ids":e.unref(I),collapsed:e.unref(i),onSelect:e.unref(pt),onMoveLayer:e.unref(P),onToggleVisible:Kt,onToggleLocked:Yt,onToggleCollapse:e.unref(c)},null,8,["fields","elements","selected-ids","collapsed","onSelect","onMoveLayer","onToggleCollapse"]),e.createVNode(ia,{ref_key:"canvasAreaRef",ref:Te,"template-data":e.unref(A),elements:e.unref(Y),scale:e.unref(h)/100,"show-ruler":e.unref(L),"show-grid":e.unref(R),"snap-to-grid":e.unref(B),"show-table-ghost-border":e.unref($),"has-clipboard":e.unref(z),guides:e.unref(ue),"overlay-visible":Ve.value,"screenshot-url":Ce.value,"overlay-opacity":We.value,"selected-element-has-group":!!e.unref(G)?.options.groupId,onSelect:e.unref(pt),onDropElement:e.unref(E),onDropField:e.unref(N),onDragStart:e.unref(d),onDragStop:e.unref(p),onDblclickElement:jt,onDblclickCell:Jt,onZoneHeightChange:ie,onZoneHeightCommit:he,onSelectAll:e.unref(C),onClearSelection:e.unref(T),onPreview:e.unref(x),onCommitPreview:e.unref(D),onPaste:e.unref(y),onCopy:e.unref(m),onCut:e.unref(F),onDelete:e.unref(g),onMoveLayer:e.unref(P),onCoordinate:Ye,onGroup:e.unref(ae),onUngroup:e.unref(_),onAddGuide:e.unref(ce),onGuideMove:e.unref(ke),onGuideRemove:e.unref(qe),onZoom:Z,onCloneElement:Qt},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","selected-element-has-group","onSelect","onDropElement","onDropField","onDragStart","onDragStop","onSelectAll","onClearSelection","onPreview","onCommitPreview","onPaste","onCopy","onCut","onDelete","onMoveLayer","onGroup","onUngroup","onAddGuide","onGuideMove","onGuideRemove"]),e.createVNode(md,{element:e.unref(G),"template-data":e.unref(A),fields:e.unref(j),"table-selection":e.unref(k),"record-history":e.unref(X),collapsed:e.unref(s),"active-tab":Me.value,"onUpdate:activeTab":O[8]||(O[8]=ne=>Me.value=ne),onDeleteElement:e.unref(g),"onUpdate:templateData":ge,onToggleCollapse:e.unref(u)},null,8,["element","template-data","fields","table-selection","record-history","collapsed","active-tab","onDeleteElement","onToggleCollapse"])]),e.createVNode(yd,{coordinate:ze.value,scale:e.unref(h),"element-count":e.unref(Y).length,"selected-count":e.unref(I).size,paper:W.value,dirty:e.unref(f)},null,8,["coordinate","scale","element-count","selected-count","paper","dirty"]),e.createVNode(mt,{modelValue:xe.value,"onUpdate:modelValue":O[9]||(O[9]=ne=>xe.value=ne),fields:e.unref(j),expression:Xe.value,"onUpdate:expression":Zt},null,8,["modelValue","fields","expression"]),e.createVNode(Ld,{visible:r.value,onClose:O[10]||(O[10]=ne=>r.value=!1)},null,8,["visible"])]))}}),Hd=Q(Rd,[["__scopeId","data-v-34bc20b3"]]),_e=3.7795275591,Ue=3e3;async function Ot(t,l,o,n){const a=de.bindData(t,l,o),r=await Ud(a,n),i=de.paginate(a,r);return{html:de.generateHtml(a,i,l,{codeRenderer:n}),pageCount:i.length,pageLayouts:i}}async function Ud(t,l){const o=de.getPaperDimensions(t),n=de.generateHtml(t,[],void 0,{isMeasurementPass:!0,codeRenderer:l}),a=document.createElement("iframe");a.setAttribute("aria-hidden","true"),a.style.cssText=`position:fixed;left:-10000px;top:0;width:${o.width}mm;height:${o.height}mm;border:0;visibility:hidden;pointer-events:none;`,document.body.appendChild(a);try{const r=a.contentWindow,i=a.contentDocument;if(!r||!i)throw new Error("无法创建测量 iframe");i.open(),i.write(n),i.close(),await Fd(r);const s=Gd(i),c=new Map,u=new Map(t.elements.map(f=>[f.id,f]));for(const f of s){const h=u.get(f.id)?.options?._repeatHeaderCount??0;c.set(f.id,{id:f.id,measuredHeight:f.height,measuredRowHeights:f.rowHeights,repeatHeaderHeight:f.rowHeights&&h>0?f.rowHeights.slice(0,h).reduce((L,R)=>L+R,0):0})}return c}finally{a.remove()}}function Fd(t){return new Promise(l=>{let o=!1;const n=()=>{o||(o=!0,l())},a=setTimeout(n,Ue),r=async()=>{try{const i=t.document.fonts;i?.ready&&await Promise.race([i.ready,Mt(Ue)]),await Promise.race([Od(t.document),Mt(Ue)])}catch{}finally{clearTimeout(a),n()}};t.document.readyState==="complete"?r():(t.addEventListener("load",()=>{r()},{once:!0}),setTimeout(n,Ue))})}function Mt(t){return new Promise((l,o)=>setTimeout(()=>o(new Error("timeout")),t))}function Od(t){const l=Array.from(t.images??[]);return Promise.all(l.map(o=>o.complete?Promise.resolve():new Promise(n=>{o.addEventListener("load",()=>n(),{once:!0}),o.addEventListener("error",()=>n(),{once:!0})}))).then(()=>{})}function Gd(t){const l=[],o=t.querySelectorAll("[data-measure-id]");for(const n of o){const a=n,r=a.getAttribute("data-measure-id");if(!r)continue;const i=a.offsetHeight,s=a.querySelector("table.print-table");if(s){const c=[],u=s.querySelectorAll("tbody > tr[data-row-index]");for(const f of u)c.push(f.offsetHeight/_e);l.push({id:r,height:i/_e,rowHeights:c})}else l.push({id:r,height:i/_e})}return l}const Gt="http://www.w3.org/2000/svg";function qd(t,l){const o=document.createElementNS(Gt,"svg");return lt(o,t,{format:l.barcodeType||"CODE128",width:Math.max(1,(l.barWidth??2)/2),height:30,displayValue:l.showText!==!1,fontSize:l.fontSize??10,margin:0,marginBottom:2}),o.outerHTML}function Wd(t,l){const o=(l.qrCodeLevel??"M").toUpperCase(),a=at.create(t,{errorCorrectionLevel:["L","M","Q","H"].includes(o)?o:"M"}).modules,r=a.size,i=4,s=4*i,c=r*i+s*2;let u="";for(let f=0;f<r;f++)for(let v=0;v<r;v++)a.get(v,f)&&(u+=`<rect x="${s+v*i}" y="${s+f*i}" width="${i}" height="${i}" fill="#000"/>`);return`<svg xmlns="${Gt}" viewBox="0 0 ${c} ${c}" width="${c}" height="${c}" shape-rendering="crispEdges">${u}</svg>`}const qt={render(t,l,o={}){if(!t)throw new Error("empty barcode value");return l==="qrcode"?Wd(t,o):qd(t,o)}},Kd={class:"print-html-preview"},Yd={key:0,class:"print-html-preview-error"},Xd={key:1,class:"print-html-preview-loading"},jd=e.defineComponent({__name:"PrintHtmlPreview",props:{templateJson:{},printData:{},baseUrl:{}},emits:["rendered","error"],setup(t,{expose:l,emit:o}){const n=t,a=o,r=e.ref(),i=e.ref(!1),s=e.ref("");let c=0;async function u(){if(!n.templateJson){s.value="",i.value=!1;return}const v=++c;i.value=!0,s.value="";try{const{html:h,pageCount:L}=await Ot(n.templateJson,n.printData,n.baseUrl,qt);if(v!==c)return;const R=r.value?.contentWindow?.document;R&&(R.open(),R.write(h),R.close()),a("rendered",L)}catch(h){if(v!==c)return;s.value=h instanceof Error?h.message:"未知错误",a("error",s.value)}finally{v===c&&(i.value=!1)}}function f(){const v=r.value?.contentWindow;v&&(v.focus(),v.print())}return e.watch(()=>[n.templateJson,n.printData,n.baseUrl],()=>{u()},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{c++}),l({print:f,rerender:u}),(v,h)=>(e.openBlock(),e.createElementBlock("div",Kd,[s.value?(e.openBlock(),e.createElementBlock("div",Yd,[e.createElementVNode("span",null,"预览渲染失败:"+e.toDisplayString(s.value),1)])):i.value?(e.openBlock(),e.createElementBlock("div",Xd,"预览渲染中…")):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("iframe",{ref_key:"iframeRef",ref:r,class:"print-html-preview-iframe",title:"打印预览"},null,512),[[e.vShow,!i.value&&!s.value]])]))}}),Jd=Q(jd,[["__scopeId","data-v-1841dcea"]]);exports.DEFAULT_DEMO_DATA=fe;exports.PrintDesigner=Hd;exports.PrintHtmlPreview=Jd;exports.UPLOAD_IMAGE_KEY=ut;exports.browserCodeRenderer=qt;exports.createDefaultTemplate=Rt;exports.getDemoData=go;exports.renderHtmlPages=Ot;exports.toRuntimePool=nt;
|
|
4
408
|
//# sourceMappingURL=index.cjs.map
|