@worm-vue3-print/canvas 1.3.5 → 1.3.6
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/LICENSE +1 -1
- package/dist/components/CanvasArea.vue.d.ts +3 -3
- package/dist/components/CanvasPaper.vue.d.ts +3 -3
- package/dist/components/DesignerToolbar.vue.d.ts +3 -3
- package/dist/components/ExpressionEditor.vue.d.ts +3 -3
- package/dist/components/FieldTreePanel.vue.d.ts +3 -3
- package/dist/components/FormatToolbar.vue.d.ts +3 -3
- package/dist/components/HelpButton.vue.d.ts +3 -3
- package/dist/components/HelpModal.vue.d.ts +3 -3
- package/dist/components/LayerPanel.vue.d.ts +3 -3
- package/dist/components/LeftPanel.vue.d.ts +3 -3
- package/dist/components/PageTabs.vue.d.ts +3 -3
- package/dist/components/PresetColorPicker.vue.d.ts +3 -3
- package/dist/components/PrintDesigner.vue.d.ts +3 -3
- package/dist/components/PrintHtmlPreview.vue.d.ts +3 -3
- package/dist/components/PropertyPanel.vue.d.ts +3 -3
- package/dist/components/Ruler.vue.d.ts +3 -3
- package/dist/components/StatusBar.vue.d.ts +3 -3
- package/dist/components/ToolbarDropdown.vue.d.ts +3 -3
- package/dist/components/WatermarkConfig.vue.d.ts +3 -3
- package/dist/components/elements/BarcodeElement.vue.d.ts +3 -3
- package/dist/components/elements/BaseElement.vue.d.ts +3 -3
- package/dist/components/elements/CellBarcode.vue.d.ts +3 -3
- package/dist/components/elements/CellImage.vue.d.ts +3 -3
- package/dist/components/elements/HtmlElement.vue.d.ts +3 -3
- package/dist/components/elements/ImageElement.vue.d.ts +3 -3
- package/dist/components/elements/LineElement.vue.d.ts +3 -3
- package/dist/components/elements/LongTextElement.vue.d.ts +3 -3
- package/dist/components/elements/PageNumberElement.vue.d.ts +3 -3
- package/dist/components/elements/QrcodeElement.vue.d.ts +3 -3
- package/dist/components/elements/ShapeElement.vue.d.ts +3 -3
- package/dist/components/elements/TableContextMenu.vue.d.ts +3 -3
- package/dist/components/elements/TableElement.vue.d.ts +3 -3
- package/dist/components/elements/TextElement.vue.d.ts +3 -3
- package/dist/components/property/AdvancedGroup.vue.d.ts +3 -3
- package/dist/components/property/AppearanceGroup.vue.d.ts +3 -3
- package/dist/components/property/BindingControl.vue.d.ts +3 -3
- package/dist/components/property/BorderBgGroup.vue.d.ts +3 -3
- package/dist/components/property/CodeGroup.vue.d.ts +3 -3
- package/dist/components/property/DesignBackgroundConfig.vue.d.ts +3 -3
- package/dist/components/property/FontSelect.vue.d.ts +3 -3
- package/dist/components/property/ImageContentUpload.vue.d.ts +3 -3
- package/dist/components/property/PaginationGroup.vue.d.ts +3 -3
- package/dist/components/property/PositionSizeGroup.vue.d.ts +3 -3
- package/dist/components/property/PropertyGroup.vue.d.ts +3 -3
- package/dist/components/property/PropertySearch.vue.d.ts +3 -3
- package/dist/components/property/StepperInput.vue.d.ts +3 -3
- package/dist/components/property/TableCellGroup.vue.d.ts +3 -3
- package/dist/components/property/TableRowGroup.vue.d.ts +3 -3
- package/dist/components/property/TableSettingsGroup.vue.d.ts +3 -3
- package/dist/components/property/TilingConfig.vue.d.ts +3 -3
- package/dist/composables/useAdsorb.d.ts +3 -3
- package/dist/composables/useAdsorbManager.d.ts +3 -3
- package/dist/composables/useClipboard.d.ts +3 -3
- package/dist/composables/useDesignerState.d.ts +3 -3
- package/dist/composables/useDocumentFontFace.d.ts +3 -3
- package/dist/composables/useDrag.d.ts +3 -3
- package/dist/composables/useFontCatalog.d.ts +3 -3
- package/dist/composables/useFormatPainter.d.ts +3 -3
- package/dist/composables/useFormatToolbar.d.ts +3 -3
- package/dist/composables/useGuides.d.ts +3 -3
- package/dist/composables/useHistory.d.ts +3 -3
- package/dist/composables/useHostAdapter.d.ts +3 -3
- package/dist/composables/useSelection.d.ts +3 -3
- package/dist/composables/useShrinkFit.d.ts +3 -3
- package/dist/composables/useStudioChrome.d.ts +3 -3
- package/dist/composables/useTableSelection.d.ts +3 -3
- package/dist/help-content/changelog.d.ts +3 -3
- package/dist/help-content/faq.d.ts +3 -3
- package/dist/help-content/features.d.ts +3 -3
- package/dist/help-content/getting-started.d.ts +3 -3
- package/dist/help-content/index.d.ts +3 -3
- package/dist/help-content/shortcuts.d.ts +3 -3
- package/dist/index.cjs +11 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +11 -4
- package/package.json +3 -5
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-vue3-print/canvas v1.3.
|
|
3
|
-
* Copyright (c) 2026
|
|
4
|
-
* SPDX-FileCopyrightText: 2026
|
|
2
|
+
* @worm-vue3-print/canvas v1.3.6
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),he=require("@worm-vue3-print/core"),E=require("@worm-vue3-print/core/designer"),ie=require("lucide-vue-next"),Ie=require("@worm-vue3-print/core/browser"),zt=require("jsbarcode"),At=require("qrcode"),Wt=require("dompurify"),Je=Symbol("selected-ids"),Pt=Symbol("preview-ids");function Gt(o){const r=e.ref(new Set),t=e.ref(new Set),s=e.computed(()=>o.value.filter(g=>r.value.has(g.id))),n=e.computed(()=>r.value.size>0);function l(g,h=!1){if(h){const R=new Set(r.value);R.has(g)?R.delete(g):R.add(g),r.value=R}else r.value=new Set([g])}function a(){r.value=new Set}function i(g){r.value=new Set(g)}function d(g){t.value=new Set(g)}function m(){t.value=new Set}function c(){r.value=new Set(t.value),t.value=new Set}function f(){const g=s.value;if(g.length===0)return null;let h=1/0,R=1/0,C=-1/0,v=-1/0;return g.forEach(p=>{h=Math.min(h,p.options.left),R=Math.min(R,p.options.top),C=Math.max(C,p.options.left+p.options.width),v=Math.max(v,p.options.top+p.options.height)}),{left:h,top:R,width:C-h,height:v-R}}return{selectedIds:r,selectedElements:s,hasSelection:n,select:l,clearSelection:a,selectAll:i,getSelectionBounds:f,previewIds:t,setPreview:d,clearPreview:m,commitPreview:c}}function Kt(){const o=e.ref(null);function r(n){o.value=n.map(l=>({options:{...l.options},printElementType:{...l.printElementType}}))}function t(n=10){if(!o.value)return null;const l=new Map;for(const i of o.value){const d=i.options.groupId;d&&l.set(d,(l.get(d)??0)+1)}const a=new Map;for(const[i,d]of l)a.set(i,d>=2?E.generateGroupId():void 0);return o.value.map(i=>({id:E.generateId(),options:{...i.options,left:i.options.left+n,top:i.options.top+n,groupId:i.options.groupId?a.get(i.options.groupId):void 0},printElementType:{...i.printElementType}}))}function s(){return o.value!==null&&o.value.length>0}return{clipboard:o,copy:r,paste:t,hasData:s}}function qt(o){const t=e.ref([]),s=e.ref([]),n=e.ref(!1),l=e.ref(!1);function a(){n.value=t.value.length>0,l.value=s.value.length>0}function i(h){const R={elements:JSON.parse(JSON.stringify(h?.elements??[])),templateData:JSON.parse(JSON.stringify(h?.templateData??{}))};return h?.pages&&(R.pages=JSON.parse(JSON.stringify(h.pages)),h.activePageIndex!==void 0&&(R.activePageIndex=h.activePageIndex)),R}function d(h){return i(h)}function m(h){t.value.push(d(h)),s.value=[],t.value.length>50&&t.value.shift(),a()}function c(h){if(t.value.length===0)return null;const R=t.value.pop();return s.value.push(h?d(h):i(R)),a(),t.value.length>0?i(t.value[t.value.length-1]):null}function f(h){if(s.value.length===0)return null;const R=s.value.pop();return t.value.push(h?d(h):i(R)),a(),i(R)}function g(){t.value=[],s.value=[],a()}return{push:m,undo:c,redo:f,canUndo:n,canRedo:l,clear:g}}const mt="开启拼版后只能有一个设计页面";function Pe(){return{paperSize:"A4",orientation:"portrait",unit:"mm",margins:{top:10,right:10,bottom:10,left:10},header:{height:10,elements:[]},footer:{height:10,elements:[]},elements:[],watermark:{}}}function Xe(o){const r=(t,s)=>(t??[]).map(n=>{const l={...n.options};return(n.printElementType?.type??n.type)==="table"&&E.syncTableElementSize(l),{id:n.id||E.generateId(),zone:s,options:l,printElementType:{...n.printElementType}}});return{...o,margins:{...o.margins},header:{height:o.header?.height??10,elements:[]},footer:{height:o.footer?.height??10,elements:[]},guides:[...o.guides??[]],elements:[...r(o.elements??[],"content"),...r(o.header?.elements??[],"header"),...r(o.footer?.elements??[],"footer")]}}function yt(o){const r=(s,n)=>{const l=Xe(E.normalizeTemplateUnits(s));return l.name||(l.name=`页面 ${n+1}`),l};if(!o)return[r(Pe(),0)];const t=Array.isArray(o.pages)?o.pages:[o];return t.length?t.map(r):[r(Pe(),0)]}function kt(o){const r=o.elements,t=s=>r.filter(n=>(n.zone||"content")===s).map(n=>({id:n.id,type:n.printElementType.type,options:{...n.options},printElementType:{...n.printElementType}}));return{unit:"mm",...o,header:{...o.header,elements:t("header")},footer:{...o.footer,elements:t("footer")},elements:t("content"),guides:[...o.guides??[]]}}function Yt(o={}){const r=e.ref(100),t=e.ref(!0),s=e.ref(!0),n=e.ref(!1),l=e.ref(!0),a=e.ref(yt(o.initialTemplate)),i=e.ref(0),d=e.ref(a.value[0]??Xe(Pe())),m=e.computed(()=>a.value.some(H=>H.tiling?.enabled===!0));function c(){return m.value?(alert(mt),!0):!1}function f(){a.value[i.value]=d.value}function g(H){H<0||H>=a.value.length||(f(),i.value=H,d.value=a.value[H],fe())}const h=e.computed({get:()=>d.value.elements,set:H=>{d.value.elements=H}}),R=e.ref(o.initialFields||[]),{selectedIds:C,selectedElements:v,select:p,clearSelection:B,selectAll:_,previewIds:ne,setPreview:G,clearPreview:J,commitPreview:b}=Gt(h),{group:W,ungroup:j,getGroupedIds:U}=E.useGroup(),{copy:y,paste:M,hasData:N}=Kt(),{align:O}=E.useAlign(),{push:A,undo:k,redo:z,canUndo:u,canRedo:x}=qt(),Y=e.computed(()=>{if(C.value.size===0)return null;const H=C.value.values().next().value;return h.value.find(le=>le.id===H)||null}),be=e.ref(null);function ge(H){be.value=H}function fe(){B(),ge(null)}function se(){return{elements:h.value.map(H=>({id:H.id,zone:H.zone,options:JSON.parse(JSON.stringify(H.options)),printElementType:{...H.printElementType}})),templateData:{paperSize:d.value.paperSize,orientation:d.value.orientation,outputRotation:d.value.outputRotation,margins:{...d.value.margins},header:{height:d.value.header.height,elements:[]},footer:{height:d.value.footer.height,elements:[]},elements:[],customWidth:d.value.customWidth,customHeight:d.value.customHeight,watermark:d.value.watermark?{...d.value.watermark}:void 0,guides:[...d.value.guides??[]]},pages:JSON.parse(JSON.stringify(a.value)),activePageIndex:i.value}}function q(){A(se())}function S(H){return H.pages?.[H.activePageIndex??0]?.elements??H.elements}function D(){const H=k(se());H?.pages?(a.value=H.pages,i.value=H.activePageIndex??0,d.value=a.value[i.value]??a.value[0],fe()):H?.templateData&&(d.value={...H.templateData,elements:H.elements})}function K(){const H=z(se());H?.pages?(a.value=H.pages,i.value=H.activePageIndex??0,d.value=a.value[i.value]??a.value[0],fe()):H?.templateData&&(d.value={...H.templateData,elements:H.elements})}function Z(){y(v.value)}function te(){y(v.value),me()}function pe(){const H=M();H&&H.length>0&&(h.value.push(...H),q())}function T(){y(v.value);const H=M();H&&H.length>0&&(H.forEach(le=>{le.options.left+=5,le.options.top+=5}),h.value.push(...H),p(H[0].id,!1),q())}function $(){r.value=100}const I=e.computed(()=>N());let ee=!1,oe=null;const ue=300;function L(H,le){const de=v.value.filter(ke=>!ke.options.locked);de.length!==0&&(de.forEach(ke=>{ke.options.left+=H,ke.options.top+=le}),ee||(ee=!0,q()),oe&&clearTimeout(oe),oe=setTimeout(()=>{ee=!1,oe=null},ue))}function F(){_(h.value.map(H=>H.id))}function V(H){O(v.value,H),q()}function w(H,le=!1){if(le){p(H,!0);return}C.value=new Set(U(h.value,H))}function P(){h.value=W(h.value,C.value),q()}function ae(){h.value=j(h.value,C.value),q()}function me(){C.value.size!==0&&(h.value=h.value.filter(H=>!C.value.has(H.id)),B(),q())}const{setup:ye,cleanup:we}=E.useKeyboard({onMove:L,onDelete:me,onCopy:Z,onPaste:pe,onSelectAll:F,onUndo:D,onRedo:K,onDuplicate:T,onResetZoom:$,onAlignLeft:()=>V("left"),onAlignRight:()=>V("right"),onAlignCenterH:()=>V("vertical"),onAlignTop:()=>V("top"),onAlignBottom:()=>V("bottom"),onGroup:P,onUngroup:ae});let xe=null;function Re(){xe=se()}function _e(){if(!xe)return;const H=new Map(xe.elements.map(Ee=>[Ee.id,Ee]));let le=!1;for(const Ee of h.value){const Be=H.get(Ee.id);if(!Be)continue;(Be.options.left!==Ee.options.left||Be.options.top!==Ee.options.top||Be.options.width!==Ee.options.width||Be.options.height!==Ee.options.height)&&E.finalizeElementZone(Ee,d.value).rejected&&(le=!0)}le&&alert("该元素类型不能放入页眉/页脚");const de=Ee=>`${Ee.id}:${Ee.zone||"content"}:${Ee.options.left},${Ee.options.top},${Ee.options.width},${Ee.options.height}`,ke=S(xe).map(de).join("|"),Se=S(se()).map(de).join("|");xe=null,ke!==Se&&q()}function Oe(H,le){const de=E.zoneFromPaperPoint(d.value,le.x,le.y);if(de!=="content"&&!E.ZONE_ALLOWED_TYPES.includes(H.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const ke=E.getZoneRects(d.value)[de];return H.zone=de,H.options.left=le.x-ke.left,H.options.top=le.y-ke.top,de!=="content"&&E.clampToZone(H,ke),!0}function et(H,le){const de=E.createRuntimeElement(H);le&&!Oe(de,le)||(h.value.push(de),p(de.id,!1),q())}function tt(H,le){const de=E.createFieldElement(H);le&&!Oe(de,le)||(h.value.push(de),p(de.id,!1),q())}function ot(H){if(C.value.size===0)return;const le=C.value.values().next().value,de=h.value.find(ze=>ze.id===le);if(!de)return;const ke=de.options.zIndex??0,Se=h.value.map(ze=>ze.options.zIndex??0),Ee=Math.max(...Se,0),Be=Math.min(...Se,0);switch(H){case"top":de.options.zIndex=Ee+1;break;case"bottom":de.options.zIndex=Be-1;break;case"up":de.options.zIndex=ke+1;break;case"down":de.options.zIndex=ke-1;break}q()}function nt(H,le){const{width:de,height:ke}=E.getPaperDimensions(d.value),Se=96/25.4;r.value=E.computeFitScale(H,le,de*Se,ke*Se)}function lt(H){if(d.value={...H},a.value[i.value]=d.value,a.value.length>1){const le={paperSize:H.paperSize,orientation:H.orientation,outputRotation:H.outputRotation,customWidth:H.customWidth,customHeight:H.customHeight};for(const de of a.value)Object.assign(de,le)}q()}function We(){return f(),a.value.length<=1?kt(a.value[0]):{version:1,pages:a.value.map(kt)}}function Me(H,le){a.value=yt(H),i.value=0,d.value=a.value[0],le&&(d.value={...d.value,elements:le.map(de=>({...de,id:de.id||E.generateId(),zone:de.zone||"content",options:{...de.options},printElementType:{...de.printElementType}}))},a.value[i.value]=d.value),A(se())}function Ge(){const H=new Set(a.value.map(de=>de.name));let le=a.value.length+1;for(;H.has(`页面 ${le}`);)le++;return`页面 ${le}`}function at(){if(c())return;f();const H=a.value[i.value]??Pe(),le=Xe({...Pe(),paperSize:H.paperSize,orientation:H.orientation,customWidth:H.customWidth,customHeight:H.customHeight,name:Ge()});a.value.push(le),i.value=a.value.length-1,d.value=le,fe(),q()}function it(){if(c())return;f();const H=a.value[i.value],le=JSON.parse(JSON.stringify(H));le.name=`${H.name??`页面 ${i.value+1}`} 副本`,le.elements=le.elements.map(de=>({...de,id:E.generateId()})),a.value.splice(i.value+1,0,le),g(i.value+1),q()}function Ke(H){a.value.length<=1||(f(),a.value.splice(H,1),H<i.value?i.value--:H===i.value&&i.value>=a.value.length&&(i.value=a.value.length-1),d.value=a.value[i.value],fe(),q())}function rt(H,le){a.value[H]&&(a.value[H].name=le)}function st(H,le){if(H===le)return;f();const[de]=a.value.splice(H,1);a.value.splice(le,0,de),i.value=le,d.value=de,fe(),q()}return A(se()),e.onMounted(()=>ye()),e.onUnmounted(()=>{we(),oe&&(clearTimeout(oe),oe=null)}),{scale:r,showRuler:t,showGrid:s,snapToGrid:n,showTableGhostBorder:l,templateData:d,elements:h,fields:R,tilingEnabled:m,pages:a,activePageIndex:i,switchPage:g,addPage:at,duplicatePage:it,deletePage:Ke,renamePage:rt,movePage:st,selectedIds:C,selectedElements:v,selectedElement:Y,select:p,selectElement:w,clearSelection:B,selectAll:F,previewIds:ne,setPreview:G,clearPreview:J,commitPreview:b,hasClipboard:I,copy:Z,paste:pe,cutSelected:te,tableSelection:be,setTableSelection:ge,canUndo:u,canRedo:x,undo:D,redo:K,recordHistory:q,alignSelected:V,groupSelected:P,ungroupSelected:ae,deleteSelected:me,duplicateSelected:T,resetZoom:$,dragStart:Re,dragStop:_e,addElement:et,addFieldElement:tt,moveLayer:ot,fitToWindow:nt,updateTemplateData:lt,getTemplateJson:We,loadTemplate:Me}}const Ce=Symbol("mixed"),pt=new Set(["text","longText"]);function jt(o){const{elements:r,selectedIds:t,tableSelection:s,recordHistory:n}=o,l=e.computed(()=>r.value.filter(N=>t.value.has(N.id)&&!N.options.locked)),a=e.computed(()=>{const N=s.value;return N?r.value.find(O=>O.id===N.elementId)??null:null}),i=e.computed(()=>s.value&&a.value?"cells":l.value.length>0||t.value.size>0?"elements":"none"),d=e.computed(()=>{const N=s.value,O=a.value?.options.tableRows;if(!N||!O)return[];const A=[];for(let k=N.r1;k<=N.r2;k++)for(let z=N.c1;z<=N.c2;z++){const u=O[k]?.cells[z];u&&!u.merged&&A.push(u)}return A}),m=e.computed(()=>l.value.filter(N=>pt.has(N.printElementType.type))),c=e.computed(()=>i.value==="cells"?d.value.length>0:i.value!=="elements"?!1:l.value.length>0&&m.value.length===l.value.length),f=e.computed(()=>i.value==="cells"?d.value:m.value.map(N=>N.options));function g(N){if(!N.length)return;const O=N[0];return N.every(A=>A===O)?O:Ce}const h=(N,O)=>(N??"").split(/\s+/).includes(O),R=e.computed(()=>{const N=f.value;if(!N.length)return{fontFamily:void 0,fontSize:void 0,color:void 0,backgroundColor:void 0,textAlign:void 0,verticalAlign:void 0,bold:!1,underline:!1,strike:!1};const O=N.map(k=>k.fontWeight==="bold"||k.fontWeight==="bolder"),A=N.map(k=>k.textDecoration);return{fontFamily:g(N.map(k=>k.fontFamily)),fontSize:g(N.map(k=>k.fontSize)),color:g(N.map(k=>k.color)),backgroundColor:g(N.map(k=>k.backgroundColor)),textAlign:g(N.map(k=>i.value==="cells"?k.align:k.textAlign)),verticalAlign:g(N.map(k=>i.value==="cells"?k.valign:k.verticalAlign)),bold:O.every(Boolean)?!0:O.some(Boolean)?Ce:!1,underline:A.map(k=>h(k,"underline")).every(Boolean)?!0:A.some(k=>h(k,"underline"))?Ce:!1,strike:A.map(k=>h(k,"line-through")).every(Boolean)?!0:A.some(k=>h(k,"line-through"))?Ce:!1}});function C(N){const O=d.value;O.length&&(O.forEach(N),n())}function v(N){if(i.value==="cells"){C(x=>{"fontFamily"in N&&(x.fontFamily=N.fontFamily),"fontSize"in N&&(x.fontSize=N.fontSize),"color"in N&&(x.color=N.color),"backgroundColor"in N&&(x.backgroundColor=N.backgroundColor),"textAlign"in N&&(x.align=N.textAlign),"verticalAlign"in N&&(x.valign=N.verticalAlign)});return}const O=m.value,A=l.value,z=["fontFamily","fontSize","color","textAlign","verticalAlign"].some(x=>x in N),u="backgroundColor"in N;!(O.length&&z)&&!(A.length&&u)||(O.forEach(x=>{const Y=x.options;"fontFamily"in N&&(Y.fontFamily=N.fontFamily),"fontSize"in N&&(Y.fontSize=N.fontSize),"color"in N&&(Y.color=N.color),"textAlign"in N&&(Y.textAlign=N.textAlign),"verticalAlign"in N&&(Y.verticalAlign=N.verticalAlign)}),u&&A.forEach(x=>{x.options.backgroundColor=N.backgroundColor}),n())}function p(){if(i.value==="cells"){const A=R.value.bold!==!0;C(k=>{k.fontWeight=A?"bold":void 0});return}const N=R.value.bold!==!0,O=m.value;O.length&&(O.forEach(A=>{A.options.fontWeight=N?"bold":"normal"}),n())}function B(N){if(i.value==="cells")return;const O=m.value;if(!O.length)return;const A=R.value[N==="underline"?"underline":"strike"]!==!0;O.forEach(k=>{const z=(k.options.textDecoration??"").split(/\s+/).filter(Boolean),u=z.indexOf(N);A&&u<0&&z.push(N),!A&&u>=0&&z.splice(u,1),k.options.textDecoration=z.length?z.join(" "):void 0}),n()}const _=()=>B("underline"),ne=()=>B("line-through");function G(N,O){const A=l.value;A.length&&(A.forEach(k=>{k.options.borders=void 0,N==="none"?k.options.borderWidth=0:(k.options.borderWidth=O.width,k.options.borderStyle=O.style,k.options.borderColor=O.color)}),n())}function J(N,O){const A=s.value,k=a.value?.options.tableRows;!A||!k||(E.applyBorderPreset(k,{r1:A.r1,c1:A.c1,r2:A.r2,c2:A.c2},N,O),n())}function b(N,O,A){C(k=>{const z={...k.borders??{}};for(const u of N)A?z[u]={...O}:delete z[u];k.borders=z})}const W=["top","right","bottom","left"],j=e.computed(()=>{if(i.value!=="cells")return null;const N=d.value;if(!N.length)return null;const O={};for(const A of W){const k=N.map(z=>!!z.borders?.[A]);O[A]=k.every(Boolean)?!0:k.some(Boolean)?Ce:!1}return O});function U(N,O){const A=j.value?.[N]!==!0;b([N],O,A)}const y=e.computed(()=>{if(i.value!=="elements")return null;const N=l.value;if(!N.length)return null;const O={};for(const A of W){const k=N.map(z=>!!z.options.borders?.[A]);O[A]=k.every(Boolean)?!0:k.some(Boolean)?Ce:!1}return O});function M(N,O){const A=l.value;if(!A.length)return;const k=y.value?.[N]!==!0;A.forEach(z=>{const u={...z.options.borders??{}};k?u[N]={width:O.width,style:O.style,color:O.color}:delete u[N],z.options.borders=u}),n()}return{context:i,fontEditable:c,values:R,applyStyle:v,toggleBold:p,toggleUnderline:_,toggleStrike:ne,applyElementBorder:G,applyCellBorderPreset:J,applyCellBorderEdges:b,cellEdges:j,toggleCellEdge:U,elementEdges:y,toggleElementEdge:M}}const Xt=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];function Zt(o){const{elements:r,selectedIds:t,recordHistory:s}=o,n=e.ref(!1),l=e.ref(!1),a=e.ref(null);let i=null;const d=e.computed(()=>r.value.filter(C=>t.value.has(C.id)&&!C.options.locked)),m=e.computed(()=>d.value.length===1);function c(C){if(!C)return;const v={};for(const p of E.ELEMENT_BORDER_SIDES){const B=C[p];B&&(v[p]={...B})}return v}function f(C=!1){const v=d.value[0];if(!v)return!1;const p=v.options,B=v.printElementType.type;return i={text:pt.has(B)?Object.fromEntries(Xt.map(_=>[_,p[_]])):null,backgroundColor:p.backgroundColor,border:E.acceptsElementBorder(B)?{borderWidth:p.borderWidth,borderStyle:p.borderStyle,borderColor:p.borderColor,borders:c(p.borders)}:null},a.value=v.id,n.value=!0,l.value=C,!0}function g(){n.value=!1,l.value=!1,a.value=null,i=null}function h(C){const v=i;if(!v||C.options.locked||C.id===a.value)return!1;const p=C.options,B=C.printElementType.type;return v.text&&pt.has(B)&&Object.assign(p,v.text),p.backgroundColor=v.backgroundColor,v.border&&E.acceptsElementBorder(B)&&(p.borderWidth=v.border.borderWidth,p.borderStyle=v.border.borderStyle,p.borderColor=v.border.borderColor,p.borders=c(v.border.borders)),!0}e.watch(t,()=>{if(!n.value||!i)return;const C=d.value;if(!C.length){g();return}let v=!1;C.forEach(p=>{v=h(p)||v}),v&&(s(),l.value||g())});function R(C){if(C.key!=="Escape"||!n.value)return;const v=C.target?.tagName;v==="INPUT"||v==="TEXTAREA"||v==="SELECT"||g()}return document.addEventListener("keydown",R),e.onScopeDispose(()=>document.removeEventListener("keydown",R)),{active:n,locked:l,sourceId:a,capturable:m,capture:f,cancel:g}}let Vt=0;function Jt(){return Vt+=1,`guide-${Vt}`}function Qt(o,r){const t=e.computed(()=>o.value.guides??[]);function s(d){o.value={...o.value,guides:d([...o.value.guides??[]])},r()}function n(d,m){s(c=>(c.push({type:d,position:m,id:Jt()}),c))}function l(d,m){s(c=>c.map(f=>f.id===d?{...f,position:m}:f))}function a(d){s(m=>m.filter(c=>c.id!==d))}function i(){const d=[],m=[];for(const c of t.value)c.type==="vertical"?d.push(c.position):m.push(c.position);return{vertical:d,horizontal:m}}return{guides:t,addGuide:n,moveGuide:l,removeGuide:a,getGuidePositions:i}}const He=Symbol("table-edit"),vt=Symbol("print-upload-image"),ft=Symbol("print-upload-design-background"),gt=Symbol("print-font-catalog"),_t=e.computed(()=>[]);function eo(o){return{catalog:e.computed(()=>{const t=[],s=new Set;for(const n of e.toValue(o)??[]){const l=n?.family?.trim();if(!l)continue;const a=l.toLowerCase();if(s.has(a))continue;s.add(a);const i=n.label?.trim();t.push(i?{family:l,label:i}:{family:l})}return t})}}function to(){return e.inject(gt,_t)}function Nt(o,r){const t=r?.trim().toLowerCase();if(t)return o.find(s=>s.family.trim().toLowerCase()===t)}function wt(o){return o.label?`${o.label}(${o.family})`:o.family}function Fe(o){return o.toLowerCase().replace(/\s+/g,"")}function Ct(o,r){if(o===r)return 0;if(o.startsWith(r))return 1;if(o.includes(r))return 2;let t=0;for(const s of o)if(s===r[t]&&t++,t===r.length)return 3;return-1}function oo(o,r){const t=Fe(r.trim());return t?o.map((s,n)=>({font:s,index:n,rank:no(s,t)})).filter(s=>s.rank>=0).sort((s,n)=>s.rank-n.rank||s.index-n.index).map(s=>s.font):[...o]}function no(o,r){const t=Ct(Fe(o.family),r);if(!o.label)return t;const s=Ct(Fe(o.label),r);return t<0?s:s<0?t:Math.min(t,s)}const lo="print-designer-font-face";function ao(o){const r=`${lo}-${e.useId()}`;let t;e.watchEffect(()=>{const s=e.toValue(o);if(!s){t?.remove(),t=void 0;return}t||(t=document.createElement("style"),t.id=r,document.head.appendChild(t)),t.textContent=s}),e.onUnmounted(()=>{t?.remove(),t=void 0})}const io=e.defineComponent({__name:"HelpButton",emits:["click"],setup(o){return(r,t)=>(e.openBlock(),e.createElementBlock("button",{class:"help-button",title:"帮助文档",onClick:t[0]||(t[0]=s=>r.$emit("click"))},[...t[1]||(t[1]=[e.createElementVNode("span",{class:"help-icon"},"?",-1)])]))}}),ce=(o,r)=>{const t=o.__vccOpts||o;for(const[s,n]of r)t[s]=n;return t},ro=ce(io,[["__scopeId","data-v-80ccab03"]]),so=["disabled","data-test","data-tip"],co=e.defineComponent({__name:"ToolbarDropdown",props:{disabled:{type:Boolean,default:!1},testId:{default:"dd-trigger"},tip:{},panelClass:{}},setup(o){const r=o,t=e.ref(!1),s=e.ref(null);function n(l){t.value&&(s.value?.contains(l.target)||(t.value=!1))}return e.watch(()=>r.disabled,l=>{l&&(t.value=!1)}),e.onMounted(()=>document.addEventListener("pointerdown",n)),e.onUnmounted(()=>document.removeEventListener("pointerdown",n)),(l,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapRef",ref:s,class:"tb-dd"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["tb-dd-trigger",{on:t.value}]),disabled:o.disabled,"data-test":o.testId,"data-tip":o.tip,onClick:a[0]||(a[0]=i=>t.value=!t.value)},[e.renderSlot(l.$slots,"trigger",{},void 0,!0),e.createVNode(e.unref(ie.ChevronDown),{size:12,class:e.normalizeClass(["tb-dd-arrow",{up:t.value}])},null,8,["class"])],10,so),t.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["tb-dd-panel",o.panelClass])},[e.renderSlot(l.$slots,"default",{},void 0,!0)],2)):e.createCommentVNode("",!0)],512))}}),Ze=ce(co,[["__scopeId","data-v-74fd00c6"]]),uo={class:"designer-toolbar"},mo={class:"tb-group"},po={class:"tb-title"},vo={class:"tb-title-name"},fo={class:"tb-group"},go=["disabled"],ho=["disabled"],bo={class:"tb-group"},Eo={class:"tb-menu","data-test":"arrange-panel"},yo={class:"tb-menu-grid"},ko=["disabled"],Vo=["disabled"],No=["disabled"],wo=["disabled"],Co=["disabled"],So=["disabled"],xo=["disabled"],$o=["disabled"],Bo={class:"tb-menu-grid"},Do=["disabled"],To=["disabled"],Mo=["disabled"],zo=["disabled"],Ao={class:"tb-menu-grid"},Po=["disabled"],Ro=["disabled"],Lo={class:"tb-menu tb-menu-rows","data-test":"view-panel"},Uo={class:"tb-group"},Io={class:"tb-zoom"},Fo={class:"tb-group"},Ho=["disabled","data-tip"],Oo=["disabled","data-tip"],Wo=["disabled","data-tip"],Go={key:0,class:"tb-group"},Ko={class:"tb-group"},qo=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},showHelp:{type:Boolean,default:!0},clipboardDisabled:{type:Boolean,default:!0},hasClipboard:{type:Boolean,default:!1}},{scale:{default:100},scaleModifiers:{}}),emits:e.mergeModels(["preview","save","undo","redo","align","move-layer","toggle-ruler","toggle-grid","toggle-snap","toggle-table-ghost-border","group","ungroup","fit-window","zoom","help","copy","paste","delete"],["update:scale"]),setup(o){const r=e.useModel(o,"scale"),t=o,s=e.computed(()=>t.clipboardDisabled?"粘贴 (Ctrl+V),需选中元素":t.hasClipboard?"粘贴 (Ctrl+V)":"粘贴 (Ctrl+V),剪贴板为空");return(n,l)=>(e.openBlock(),e.createElementBlock("div",uo,[e.createElementVNode("div",mo,[l[30]||(l[30]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-019401e4><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-019401e4><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-019401e4></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-019401e4></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-019401e4></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-019401e4></line></svg></span>',1)),e.createElementVNode("div",po,[e.createElementVNode("span",vo,e.toDisplayString(o.isEdit?"编辑模板":"新建模板"),1),l[29]||(l[29]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",fo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canUndo,onClick:l[0]||(l[0]=a=>n.$emit("undo")),"data-tip":"撤销"},[e.createVNode(e.unref(ie.Undo2),{size:15})],8,go),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canRedo,onClick:l[1]||(l[1]=a=>n.$emit("redo")),"data-tip":"重做"},[e.createVNode(e.unref(ie.Redo2),{size:15})],8,ho)]),e.renderSlot(n.$slots,"default",{},void 0,!0),e.createElementVNode("div",bo,[e.createVNode(Ze,{"test-id":"arrange-dd",tip:"排列"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie.Layers),{size:15}),l[31]||(l[31]=e.createElementVNode("span",{class:"tb-btn-text"},"排列",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Eo,[l[32]||(l[32]=e.createElementVNode("div",{class:"tb-menu-label"},"对齐 / 分布",-1)),e.createElementVNode("div",yo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[2]||(l[2]=a=>n.$emit("align","left")),"data-tip":"左对齐"},[e.createVNode(e.unref(ie.AlignStartVertical),{size:15})],8,ko),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[3]||(l[3]=a=>n.$emit("align","right")),"data-tip":"右对齐"},[e.createVNode(e.unref(ie.AlignEndVertical),{size:15})],8,Vo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[4]||(l[4]=a=>n.$emit("align","top")),"data-tip":"顶对齐"},[e.createVNode(e.unref(ie.AlignStartHorizontal),{size:15})],8,No),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[5]||(l[5]=a=>n.$emit("align","bottom")),"data-tip":"底对齐"},[e.createVNode(e.unref(ie.AlignEndHorizontal),{size:15})],8,wo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[6]||(l[6]=a=>n.$emit("align","vertical")),"data-tip":"水平居中"},[e.createVNode(e.unref(ie.AlignCenterVertical),{size:15})],8,Co),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[7]||(l[7]=a=>n.$emit("align","horizontal")),"data-tip":"垂直居中"},[e.createVNode(e.unref(ie.AlignCenterHorizontal),{size:15})],8,So),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[8]||(l[8]=a=>n.$emit("align","distributeHor")),"data-tip":"水平分布"},[e.createVNode(e.unref(ie.AlignHorizontalSpaceBetween),{size:15})],8,xo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[9]||(l[9]=a=>n.$emit("align","distributeVer")),"data-tip":"垂直分布"},[e.createVNode(e.unref(ie.AlignVerticalSpaceBetween),{size:15})],8,$o)]),l[33]||(l[33]=e.createElementVNode("div",{class:"tb-menu-label"},"层级",-1)),e.createElementVNode("div",Bo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasSelection,onClick:l[10]||(l[10]=a=>n.$emit("move-layer","top")),"data-tip":"置顶"},[e.createVNode(e.unref(ie.ArrowUpToLine),{size:15})],8,Do),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasSelection,onClick:l[11]||(l[11]=a=>n.$emit("move-layer","up")),"data-tip":"上移一层"},[e.createVNode(e.unref(ie.ArrowUp),{size:15})],8,To),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasSelection,onClick:l[12]||(l[12]=a=>n.$emit("move-layer","down")),"data-tip":"下移一层"},[e.createVNode(e.unref(ie.ArrowDown),{size:15})],8,Mo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasSelection,onClick:l[13]||(l[13]=a=>n.$emit("move-layer","bottom")),"data-tip":"置底"},[e.createVNode(e.unref(ie.ArrowDownToLine),{size:15})],8,zo)]),l[34]||(l[34]=e.createElementVNode("div",{class:"tb-menu-label"},"组合",-1)),e.createElementVNode("div",Ao,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[14]||(l[14]=a=>n.$emit("group")),"data-tip":"组合 (Ctrl+G)"},[e.createVNode(e.unref(ie.Group),{size:15})],8,Po),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.selectedElementHasGroup,onClick:l[15]||(l[15]=a=>n.$emit("ungroup")),"data-tip":"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(ie.Ungroup),{size:15})],8,Ro)])])]),_:1}),e.createVNode(Ze,{"test-id":"view-dd",tip:"视图"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie.Eye),{size:15}),l[35]||(l[35]=e.createElementVNode("span",{class:"tb-btn-text"},"视图",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Lo,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:o.showRuler}]),"data-tip":"显示/隐藏标尺",onClick:l[16]||(l[16]=a=>n.$emit("toggle-ruler"))},[...l[36]||(l[36]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 标尺 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:o.showGrid}]),"data-tip":"显示/隐藏网格背景",onClick:l[17]||(l[17]=a=>n.$emit("toggle-grid"))},[...l[37]||(l[37]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:o.showTableGhostBorder}]),"data-tip":"显示/隐藏无边框表格的虚拟虚线",onClick:l[18]||(l[18]=a=>n.$emit("toggle-table-ghost-border"))},[...l[38]||(l[38]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:o.snapToGrid}]),"data-tip":"开启/关闭元素吸附到网格",onClick:l[19]||(l[19]=a=>n.$emit("toggle-snap"))},[...l[39]||(l[39]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2)])]),_:1})]),e.createElementVNode("div",Uo,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[20]||(l[20]=a=>n.$emit("fit-window")),"data-tip":"适应窗口"},[e.createVNode(e.unref(ie.Maximize),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[21]||(l[21]=a=>n.$emit("zoom",-10)),"data-tip":"缩小"},[e.createVNode(e.unref(ie.ZoomOut),{size:15})]),e.createElementVNode("span",Io,e.toDisplayString(r.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[22]||(l[22]=a=>n.$emit("zoom",10)),"data-tip":"放大"},[e.createVNode(e.unref(ie.ZoomIn),{size:15})])]),e.createElementVNode("div",Fo,[e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"copy",disabled:o.clipboardDisabled,onClick:l[23]||(l[23]=a=>n.$emit("copy")),"data-tip":o.clipboardDisabled?"复制 (Ctrl+C),需选中元素":"复制 (Ctrl+C)"},[e.createVNode(e.unref(ie.Copy),{size:15})],8,Ho),e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"paste",disabled:o.clipboardDisabled||!o.hasClipboard,onClick:l[24]||(l[24]=a=>n.$emit("paste")),"data-tip":s.value},[e.createVNode(e.unref(ie.ClipboardPaste),{size:15})],8,Oo),e.createElementVNode("button",{class:"tb-btn tb-icon danger","data-test":"delete",disabled:o.clipboardDisabled,onClick:l[25]||(l[25]=a=>n.$emit("delete")),"data-tip":o.clipboardDisabled?"删除 (Delete),需选中元素":"删除 (Delete)"},[e.createVNode(e.unref(ie.Trash2),{size:15})],8,Wo)]),l[40]||(l[40]=e.createElementVNode("div",{class:"tb-spacer"},null,-1)),o.showHelp?(e.openBlock(),e.createElementBlock("div",Go,[e.createVNode(ro,{onClick:l[26]||(l[26]=a=>n.$emit("help"))})])):e.createCommentVNode("",!0),e.createElementVNode("div",Ko,[e.createElementVNode("button",{class:"btn-secondary","data-tip":"预览模板打印效果",onClick:l[27]||(l[27]=a=>n.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary","data-tip":"保存模板",onClick:l[28]||(l[28]=a=>n.$emit("save"))},"保存")])]))}}),Yo=ce(qo,[["__scopeId","data-v-019401e4"]]),jo={class:"font-select"},Xo=["placeholder","disabled","aria-expanded","aria-activedescendant","onKeydown"],Zo=["id","aria-selected","onMousedown"],Jo=e.defineComponent({__name:"FontSelect",props:{modelValue:{},placeholder:{default:"默认"},disabled:{type:Boolean,default:!1}},emits:["update:model-value"],setup(o,{emit:r}){const t=o,s=r,n=to(),l=`font-select-list-${e.useId()}`,a=e.ref(null),i=e.ref(R(t.modelValue)),d=e.ref(""),m=e.ref(!1),c=e.ref(-1),f=e.computed(()=>{const j=t.modelValue?.trim();return j?Nt(n.value,j)?"":j:""}),g=e.computed(()=>{const j=(t.modelValue??"").trim(),U=(N,O,A,k)=>({kind:N,key:O,label:A,value:k,selected:(k??"")===j}),y=d.value.trim();if(!y){const N=[U("clear","__clear__",t.placeholder)];f.value&&N.push(U("unknown","__unknown__",`${f.value}(未知)`,f.value));for(const O of n.value)N.push(U("font",O.family,wt(O),O.family));return N}const M=oo(n.value,y).map(N=>U("font",N.family,wt(N),N.family));if(!M.length){const N=h(y);M.push(U("free","__free__",`使用「${N}」`,N))}return M});function h(j){const U=Fe(j);return n.value.find(M=>M.label&&Fe(M.label)===U)?.family??j}function R(j){const U=j?.trim();return U?Nt(n.value,U)?.label??U:""}const C=e.computed(()=>m.value&&c.value>=0?`${l}-${c.value}`:void 0);function v(){const j=(t.modelValue??"").trim();return g.value.findIndex(U=>(U.value??"")===j)}function p(){m.value||(m.value=!0,d.value="",c.value=v())}function B(){m.value=!0}function _(){m.value=!0,d.value=i.value,c.value=g.value.length?0:-1}function ne(j){if(!m.value){p();return}const U=g.value.length-1;U<0||(c.value=Math.min(Math.max(c.value+j,0),U),G())}function G(){e.nextTick(()=>{a.value?.children[c.value]?.scrollIntoView?.({block:"nearest"})})}function J(){if(!m.value)return;const j=g.value[c.value];if(j){b(j);return}const U=d.value.trim();if(U){const y=h(U);b({value:y})}}function b(j){i.value=R(j.value),d.value="",m.value=!1,c.value=-1,s("update:model-value",j.value)}function W(){m.value=!1,d.value="",c.value=-1,i.value=R(t.modelValue)}return e.watch(()=>t.modelValue,j=>{i.value=R(j)}),(j,U)=>(e.openBlock(),e.createElementBlock("div",jo,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":U[0]||(U[0]=y=>i.value=y),class:"pd-input font-select-input",type:"text",role:"combobox","aria-autocomplete":"list",autocomplete:"off",placeholder:o.placeholder,disabled:o.disabled,"aria-expanded":m.value,"aria-controls":l,"aria-activedescendant":C.value,onFocus:p,onClick:B,onInput:_,onKeydown:[U[1]||(U[1]=e.withKeys(e.withModifiers(y=>ne(1),["prevent"]),["down"])),U[2]||(U[2]=e.withKeys(e.withModifiers(y=>ne(-1),["prevent"]),["up"])),e.withKeys(e.withModifiers(J,["prevent"]),["enter"]),e.withKeys(e.withModifiers(W,["prevent"]),["esc"])],onBlur:W},null,40,Xo),[[e.vModelText,i.value]]),m.value?(e.openBlock(),e.createElementBlock("ul",{key:0,id:l,ref_key:"listRef",ref:a,class:"font-select-list",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(y,M)=>(e.openBlock(),e.createElementBlock("li",{id:`${l}-${M}`,key:y.key,class:e.normalizeClass(["font-select-option",{"is-active":M===c.value,"is-muted":y.kind==="unknown"||y.kind==="free"}]),role:"option","aria-selected":y.selected,onMousedown:e.withModifiers(N=>b(y),["prevent"])},e.toDisplayString(y.label),43,Zo))),128))],512)):e.createCommentVNode("",!0)]))}}),ht=ce(Jo,[["__scopeId","data-v-f1aae453"]]),Qo={class:"pd-stepper"},_o=["disabled"],en=["value","placeholder","min","max","step","disabled"],tn=["disabled"],on=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=e.computed(()=>{const C=String(t.step),v=C.indexOf(".");return v===-1?0:C.length-v-1});function l(C){return Number.isFinite(C)?Number(C.toFixed(n.value)):0}const a=e.computed(()=>{const C=t.modelValue;if(!(C==null||!Number.isFinite(C)))return l(C)}),i=e.ref(a.value===void 0?"":String(a.value));e.watch(a,C=>{i.value=C===void 0?"":String(C)});const d=e.computed(()=>a.value!==void 0?a.value:t.min!==void 0?t.min:0),m=e.computed(()=>t.min!==void 0&&d.value<=t.min),c=e.computed(()=>t.max!==void 0&&d.value>=t.max);function f(C){let v=l(C);return t.min!==void 0&&v<t.min&&(v=t.min),t.max!==void 0&&v>t.max&&(v=t.max),v}function g(C){if(C<0&&m.value||C>0&&c.value)return;const v=f(d.value+C*t.step);i.value=String(v),s("update:modelValue",v)}function h(C){i.value=C.target.value}function R(){const C=i.value.trim();if(C===""){a.value!==void 0&&(i.value=String(a.value));return}const v=Number(C);if(!Number.isFinite(v)){i.value=a.value===void 0?"":String(a.value);return}const p=f(v);i.value=String(p),p!==a.value&&s("update:modelValue",p)}return(C,v)=>(e.openBlock(),e.createElementBlock("div",Qo,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:m.value||o.disabled,title:"减小","aria-label":"减小",onClick:v[0]||(v[0]=p=>g(-1))},"−",8,_o),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:i.value,placeholder:o.placeholder,min:o.min,max:o.max,step:o.step,disabled:o.disabled,onInput:h,onChange:R,onBlur:R,onKeydown:v[1]||(v[1]=e.withKeys(e.withModifiers(p=>p.target.blur(),["prevent"]),["enter"]))},null,40,en),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:c.value||o.disabled,title:"增大","aria-label":"增大",onClick:v[2]||(v[2]=p=>g(1))},"+",8,tn)]))}}),re=ce(on,[["__scopeId","data-v-627f09cb"]]),nn=["aria-expanded","title"],ln={class:"picker-preview"},an={class:"picker-heading"},rn=["disabled"],sn={class:"preset-color-grid"},dn=["title","aria-label","onClick"],cn=e.defineComponent({__name:"PresetColorPicker",props:{modelValue:{},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(!1),l=e.ref(),a=e.ref(),i=e.ref(),d=e.ref({}),m=e.ref(0),c=e.ref(0),f=e.ref(0),g=e.ref("#000000"),h=e.ref(!1),R=e.computed(()=>t.modelValue||"#000000"),C=e.computed(()=>t.modelValue?{background:t.modelValue}:{background:"transparent"}),v=e.computed(()=>Y(ge(m.value,c.value,f.value))),p=e.computed({get:()=>Math.round(m.value),set:q=>J(fe(q),c.value,f.value)});e.watch(()=>t.modelValue,q=>{if(!q){g.value="";return}G(q)},{immediate:!0});function B(q){g.value=q.toUpperCase(),G(q),s("update:modelValue",q)}function _(){t.clearable&&s("update:modelValue","")}function ne(q){const D=q.target.value.trim();if(!D){t.clearable&&s("update:modelValue","");return}u(D)&&(G(D),s("update:modelValue",x(D)))}function G(q){const S=u(q);if(!S)return;const D=be(S.r,S.g,S.b);m.value=D.h,c.value=D.s,f.value=D.v,g.value=x(q).toUpperCase()}function J(q,S,D){m.value=fe(q),c.value=se(S),f.value=se(D),g.value=v.value.toUpperCase(),s("update:modelValue",v.value)}function b(q){q.currentTarget.setPointerCapture(q.pointerId),h.value=!0,U(q)}function W(q){h.value&&U(q)}function j(q){h.value=!1;const S=q.currentTarget;S.hasPointerCapture(q.pointerId)&&S.releasePointerCapture(q.pointerId)}function U(q){const S=i.value;if(!S)return;const D=S.getBoundingClientRect(),K=se((q.clientX-D.left)/D.width),Z=se(1-(q.clientY-D.top)/D.height);J(m.value,K,Z)}function y(q){const S=q.shiftKey?.1:.02;let D=!0;q.key==="ArrowLeft"?J(m.value,c.value-S,f.value):q.key==="ArrowRight"?J(m.value,c.value+S,f.value):q.key==="ArrowUp"?J(m.value,c.value,f.value+S):q.key==="ArrowDown"?J(m.value,c.value,f.value-S):D=!1,D&&q.preventDefault()}function M(){n.value?O():N()}async function N(){const q=l.value;if(!q)return;t.modelValue&&G(R.value),n.value=!0,await e.nextTick();const S=q.getBoundingClientRect(),D=190,K=a.value?.offsetHeight??216,Z=8,te=Math.min(S.left,window.innerWidth-D-Z),pe=S.bottom+6,T=pe+K>window.innerHeight-Z?Math.max(Z,S.top-K-6):pe;d.value={left:`${Math.max(Z,te)}px`,top:`${T}px`}}function O(){n.value=!1}function A(q){const S=q.target;l.value?.contains(S)||a.value?.contains(S)||O()}function k(){n.value&&O()}function z(q){q.key==="Escape"&&n.value&&O()}function u(q){const S=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(q.trim());if(!S)return null;const D=S[1],K=D.length===3?D.split("").map(Z=>Z+Z).join(""):D;return{r:Number.parseInt(K.slice(0,2),16),g:Number.parseInt(K.slice(2,4),16),b:Number.parseInt(K.slice(4,6),16)}}function x(q){const S=u(q);return S?Y(S):"#000000"}function Y({r:q,g:S,b:D}){return`#${[q,S,D].map(K=>Math.round(se(K/255)*255).toString(16).padStart(2,"0")).join("")}`}function be(q,S,D){const K=q/255,Z=S/255,te=D/255,pe=Math.max(K,Z,te),T=Math.min(K,Z,te),$=pe-T;let I=0;return $!==0&&(pe===K?I=(Z-te)/$%6:pe===Z?I=(te-K)/$+2:I=(K-Z)/$+4,I*=60,I<0&&(I+=360)),{h:I,s:pe===0?0:$/pe,v:pe}}function ge(q,S,D){const K=D*S,Z=(q%360+360)%360/60,te=K*(1-Math.abs(Z%2-1)),[pe,T,$]=Z<1?[K,te,0]:Z<2?[te,K,0]:Z<3?[0,K,te]:Z<4?[0,te,K]:Z<5?[te,0,K]:[K,0,te],I=D-K;return{r:(pe+I)*255,g:(T+I)*255,b:($+I)*255}}function fe(q){return((Number.isFinite(q)?q:0)%360+360)%360}function se(q){return Math.min(1,Math.max(0,Number.isFinite(q)?q:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",A,!0),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),document.addEventListener("keydown",z)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",A,!0),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),document.removeEventListener("keydown",z)}),(q,S)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{ref_key:"triggerRef",ref:l,type:"button",class:"preset-color-trigger","aria-expanded":n.value,"aria-haspopup":"dialog",title:o.modelValue||"自动",onClick:M},[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle(C.value)},null,4)],8,nn),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:a,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(d.value),onPointerdown:S[2]||(S[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",ln,[e.createElementVNode("span",{class:e.normalizeClass(["picker-current",{"is-empty":!o.modelValue}]),style:e.normalizeStyle(o.modelValue?{background:v.value}:void 0)},null,6),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[0]||(S[0]=D=>g.value=D),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:ne},null,544),[[e.vModelText,g.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:i,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(m.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:b,onPointermove:W,onPointerup:j,onPointercancel:j,onKeydown:y},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${c.value*100}%`,top:`${(1-f.value)*100}%`,background:v.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[1]||(S[1]=D=>p.value=D),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,p.value,void 0,{number:!0}]]),e.createElementVNode("div",an,[S[4]||(S[4]=e.createElementVNode("span",null,"常用颜色",-1)),o.clearable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"picker-clear",disabled:!o.modelValue,title:"清除选中的颜色",onClick:_},[...S[3]||(S[3]=[e.createElementVNode("svg",{viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":"true"},[e.createElementVNode("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",fill:"none"})],-1),e.createTextVNode(" 清除 ",-1)])],8,rn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",sn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E.PRESET_COLORS),D=>(e.openBlock(),e.createElementBlock("button",{key:D,type:"button",class:e.normalizeClass(["preset-color-item",{active:!!o.modelValue&&D.toLowerCase()===o.modelValue.toLowerCase()}]),style:e.normalizeStyle({background:D}),title:D,"aria-label":D,onClick:K=>B(D)},null,14,dn))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),Ne=ce(cn,[["__scopeId","data-v-12290e7e"]]),un={class:"format-toolbar"},mn={class:"ft-group"},pn=["disabled","data-tip"],vn={class:"ft-group"},fn={class:"ft-font"},gn={class:"ft-size","data-test":"font-size"},hn={class:"ft-group"},bn=["disabled","data-tip"],En=["disabled","data-tip"],yn=["disabled","data-tip"],kn={class:"ft-group"},Vn=["title"],Nn={class:"ft-glyph"},wn={class:"ft-group"},Cn={class:"ft-align-panel","data-test":"align-panel"},Sn={class:"ft-align-row"},xn={class:"ft-align-row"},$n={class:"ft-group"},Bn={class:"ft-border-panel","data-test":"border-panel"},Dn={class:"ft-border-grid"},Tn=["disabled","data-tip"],Mn={class:"ft-style-row"},zn=["data-test","data-tip","onClick"],An={class:"ft-border-style-row"},Pn={class:"ft-line-width"},Rn={class:"ft-border-style-row"},Ln=e.defineComponent({__name:"FormatToolbar",props:{format:{},painter:{}},setup(o){const r=o,t=e.computed(()=>r.format.values.value),s=e.computed(()=>!r.format.fontEditable.value),n=e.computed(()=>s.value||r.format.context.value==="cells"),l=e.computed(()=>r.format.context.value==="none"),a=e.computed(()=>r.painter?.active.value===!0),i=e.computed(()=>!r.painter||!a.value&&(r.format.context.value==="none"||r.format.context.value==="cells"||!r.painter.capturable.value)),d=e.computed(()=>a.value?"退出格式刷(Esc)":r.painter?r.format.context.value==="cells"?"格式刷(表格单元格暂不支持)":r.format.context.value==="none"?"格式刷(需选中元素)":r.painter.capturable.value?"格式刷:单击刷一次,双击连续刷":"格式刷(请仅选中一个源元素)":"格式刷");function m(){const A=r.painter;if(A){if(A.active.value){A.cancel();return}A.capture(!1)}}function c(){r.painter?.capture(!0)}const f=e.computed(()=>t.value.fontFamily===Ce?void 0:t.value.fontFamily),g=e.computed(()=>t.value.fontFamily===Ce?"混合":"默认"),h=e.computed(()=>t.value.fontSize===Ce?void 0:t.value.fontSize),R=e.computed(()=>t.value.fontSize===Ce?"混合":"默认"),C=e.computed(()=>t.value.bold===!0),v=e.computed(()=>t.value.color===Ce?void 0:t.value.color),p=e.computed(()=>t.value.backgroundColor===Ce?void 0:t.value.backgroundColor),B=e.computed(()=>t.value.textAlign==="center"?ie.TextAlignCenter:t.value.textAlign==="right"?ie.TextAlignEnd:ie.TextAlignStart),_=e.computed(()=>s.value?"对齐(需选中文本元素或单元格)":"对齐"),ne=e.computed(()=>l.value?"边框(需选中元素)":"边框");function G(A){return s.value?`${A}(需选中文本元素)`:r.format.context.value==="cells"?`${A}(单元格不支持)`:A}const J=e.ref("solid"),b=e.ref(.75),W=e.ref("#333333"),j=e.computed(()=>r.format.context.value==="cells"),U=[{key:"solid",label:"实线",preview:"2px solid currentColor"},{key:"dashed",label:"虚线",preview:"2px dashed currentColor"},{key:"dotted",label:"点线",preview:"2px dotted currentColor"},{key:"double",label:"双线",preview:"3px double currentColor"}];function y(){return{width:b.value,style:J.value,color:W.value}}function M(A){j.value?r.format.applyCellBorderPreset(A,y()):r.format.applyElementBorder(A==="none"?"none":"all",y())}function N(A){return(j.value?r.format.cellEdges.value:r.format.elementEdges.value)?.[A]===!0}function O(A){j.value?r.format.toggleCellEdge(A,y()):r.format.toggleElementEdge(A,y())}return(A,k)=>(e.openBlock(),e.createElementBlock("div",un,[e.createElementVNode("div",mn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:a.value}]),"data-test":"format-painter",disabled:i.value,"data-tip":d.value,onClick:m,onDblclick:c},[e.createVNode(e.unref(ie.Paintbrush),{size:15})],42,pn)]),e.createElementVNode("div",vn,[e.createElementVNode("div",fn,[e.createVNode(ht,{"model-value":f.value,placeholder:g.value,disabled:s.value,"onUpdate:modelValue":k[0]||(k[0]=z=>o.format.applyStyle({fontFamily:z}))},null,8,["model-value","placeholder","disabled"])]),e.createElementVNode("div",gn,[e.createVNode(re,{"model-value":h.value,min:5,max:72,placeholder:R.value,disabled:s.value,"onUpdate:modelValue":k[1]||(k[1]=z=>o.format.applyStyle({fontSize:z}))},null,8,["model-value","placeholder","disabled"])])]),e.createElementVNode("div",hn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:C.value}]),"data-test":"bold",disabled:s.value,"data-tip":s.value?"加粗(需选中文本元素或单元格)":"加粗",onClick:k[2]||(k[2]=z=>o.format.toggleBold())},[e.createVNode(e.unref(ie.Bold),{size:15})],10,bn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:t.value.underline===!0}]),"data-test":"underline",disabled:n.value,"data-tip":G("下划线"),onClick:k[3]||(k[3]=z=>o.format.toggleUnderline())},[e.createVNode(e.unref(ie.Underline),{size:15})],10,En),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:t.value.strike===!0}]),"data-test":"strike",disabled:n.value,"data-tip":G("删除线"),onClick:k[4]||(k[4]=z=>o.format.toggleStrike())},[e.createVNode(e.unref(ie.Strikethrough),{size:15})],10,yn)]),e.createElementVNode("div",kn,[e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:s.value}]),title:`字体颜色${s.value?"(需选中或混选文本元素)":""}`},[e.createVNode(Ne,{"model-value":v.value,"onUpdate:modelValue":k[5]||(k[5]=z=>o.format.applyStyle({color:z}))},null,8,["model-value"]),k[23]||(k[23]=e.createElementVNode("span",{class:"ft-glyph"},"A",-1))],10,Vn),e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:l.value}]),title:"背景色"},[e.createVNode(Ne,{"model-value":p.value,"onUpdate:modelValue":k[6]||(k[6]=z=>o.format.applyStyle({backgroundColor:z}))},null,8,["model-value"]),e.createElementVNode("span",Nn,[e.createVNode(e.unref(ie.PaintBucket),{size:14})])],2)]),e.createElementVNode("div",wn,[e.createVNode(Ze,{"test-id":"align-dd",tip:_.value,disabled:s.value},{trigger:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(B.value),{size:15})),k[24]||(k[24]=e.createElementVNode("span",{class:"ft-btn-text"},"对齐",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Cn,[e.createElementVNode("div",Sn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.textAlign==="left"}]),"data-test":"align-left","data-tip":"左对齐",onClick:k[7]||(k[7]=z=>o.format.applyStyle({textAlign:"left"}))},[e.createVNode(e.unref(ie.TextAlignStart),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.textAlign==="center"}]),"data-test":"align-center","data-tip":"水平居中",onClick:k[8]||(k[8]=z=>o.format.applyStyle({textAlign:"center"}))},[e.createVNode(e.unref(ie.TextAlignCenter),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.textAlign==="right"}]),"data-test":"align-right","data-tip":"右对齐",onClick:k[9]||(k[9]=z=>o.format.applyStyle({textAlign:"right"}))},[e.createVNode(e.unref(ie.TextAlignEnd),{size:15})],2)]),e.createElementVNode("div",xn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.verticalAlign==="top"}]),"data-test":"valign-top","data-tip":"顶端对齐",onClick:k[10]||(k[10]=z=>o.format.applyStyle({verticalAlign:"top"}))},[e.createVNode(e.unref(ie.ArrowUpToLine),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.verticalAlign==="middle"}]),"data-test":"valign-middle","data-tip":"垂直居中",onClick:k[11]||(k[11]=z=>o.format.applyStyle({verticalAlign:"middle"}))},[e.createVNode(e.unref(ie.ChevronsUpDown),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.verticalAlign==="bottom"}]),"data-test":"valign-bottom","data-tip":"底端对齐",onClick:k[12]||(k[12]=z=>o.format.applyStyle({verticalAlign:"bottom"}))},[e.createVNode(e.unref(ie.ArrowDownToLine),{size:15})],2)])])]),_:1},8,["tip","disabled"])]),e.createElementVNode("div",$n,[e.createVNode(Ze,{"test-id":"border",tip:ne.value,disabled:l.value},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie.Grid3x3),{size:15}),k[25]||(k[25]=e.createElementVNode("span",{class:"ft-btn-text"},"边框",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Bn,[e.createElementVNode("div",Dn,[e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-none","data-tip":"无边框",onClick:k[13]||(k[13]=z=>M("none"))},[...k[26]||(k[26]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"4",y1:"14",x2:"14",y2:"4"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-all","data-tip":"所有边框",onClick:k[14]||(k[14]=z=>M("all"))},[...k[27]||(k[27]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-outer","data-tip":"外侧边框",onClick:k[15]||(k[15]=z=>M("outer"))},[...k[28]||(k[28]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-inner",disabled:!j.value,"data-tip":j.value?"内部边框":"内部边框(仅表格单元格可用)",onClick:k[16]||(k[16]=z=>M("inner"))},[...k[29]||(k[29]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])],8,Tn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("top")}]),"data-test":"edge-top","data-tip":"上边框",onClick:k[17]||(k[17]=z=>O("top"))},[...k[30]||(k[30]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"3",x2:"16",y2:"3"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("bottom")}]),"data-test":"edge-bottom","data-tip":"下边框",onClick:k[18]||(k[18]=z=>O("bottom"))},[...k[31]||(k[31]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"15",x2:"16",y2:"15"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("left")}]),"data-test":"edge-left","data-tip":"左边框",onClick:k[19]||(k[19]=z=>O("left"))},[...k[32]||(k[32]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"2",x2:"3",y2:"16"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("right")}]),"data-test":"edge-right","data-tip":"右边框",onClick:k[20]||(k[20]=z=>O("right"))},[...k[33]||(k[33]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"15",y1:"2",x2:"15",y2:"16"})],-1)])],2)]),e.createElementVNode("div",Mn,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(U,z=>e.createElementVNode("button",{key:z.key,type:"button",class:e.normalizeClass(["ft-style-btn",{on:J.value===z.key}]),"data-test":`style-${z.key}`,"data-tip":z.label,onClick:u=>J.value=z.key},[e.createElementVNode("span",{class:"ft-style-line",style:e.normalizeStyle({borderTop:z.preview})},null,4)],10,zn)),64))]),e.createElementVNode("div",An,[k[34]||(k[34]=e.createElementVNode("span",{class:"ft-edge-label"},"粗细",-1)),e.createElementVNode("div",Pn,[e.createVNode(re,{modelValue:b.value,"onUpdate:modelValue":k[21]||(k[21]=z=>b.value=z),min:.25,max:5,step:.25},null,8,["modelValue"])])]),e.createElementVNode("div",Rn,[k[35]||(k[35]=e.createElementVNode("span",{class:"ft-edge-label"},"颜色",-1)),e.createVNode(Ne,{modelValue:W.value,"onUpdate:modelValue":k[22]||(k[22]=z=>W.value=z),clearable:!1},null,8,["modelValue"])])])]),_:1},8,["tip","disabled"])])]))}}),Un=ce(Ln,[["__scopeId","data-v-83fd8dc4"]]),In={class:"layer-panel"},Fn=["onClick"],Hn={class:"layer-icon"},On={class:"layer-name"},Wn={key:0,class:"layer-zone"},Gn={class:"layer-zindex"},Kn={key:0,class:"layer-actions"},qn={key:1,class:"layer-actions"},Yn=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer","group","ungroup"],setup(o){const r=o,t=e.computed(()=>r.elements.filter(c=>r.selectedIds.has(c.id))),s=e.computed(()=>t.value.length>=2),n=e.computed(()=>t.value.some(c=>!!c.options.groupId)),l=e.computed(()=>[...r.elements].sort((c,f)=>(f.options.zIndex??0)-(c.options.zIndex??0))),a={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function i(c){return a[c.printElementType.type]||"?"}function d(c){return c.options.title||c.printElementType.title||c.printElementType.type}function m(c){return c.zone==="header"?"页眉":c.zone==="footer"?"页脚":""}return(c,f)=>(e.openBlock(),e.createElementBlock("div",In,[f[6]||(f[6]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:e.normalizeClass(["layer-item",{active:o.selectedIds.has(g.id)}]),onClick:h=>c.$emit("select",g.id,h.ctrlKey||h.metaKey)},[e.createElementVNode("span",Hn,e.toDisplayString(i(g)),1),e.createElementVNode("span",On,e.toDisplayString(d(g)),1),m(g)?(e.openBlock(),e.createElementBlock("span",Wn,e.toDisplayString(m(g)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Gn,"z:"+e.toDisplayString(g.options.zIndex??0),1)],10,Fn))),128)),l.value.length>0?(e.openBlock(),e.createElementBlock("div",Kn,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[0]||(f[0]=g=>c.$emit("move-layer","top")),title:"置顶"},[e.createVNode(e.unref(ie.ArrowUpToLine),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[1]||(f[1]=g=>c.$emit("move-layer","up")),title:"上移"},[e.createVNode(e.unref(ie.ArrowUp),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[2]||(f[2]=g=>c.$emit("move-layer","down")),title:"下移"},[e.createVNode(e.unref(ie.ArrowDown),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[3]||(f[3]=g=>c.$emit("move-layer","bottom")),title:"置底"},[e.createVNode(e.unref(ie.ArrowDownToLine),{size:14})])])):e.createCommentVNode("",!0),s.value||n.value?(e.openBlock(),e.createElementBlock("div",qn,[s.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"pd-button small",onClick:f[4]||(f[4]=g=>c.$emit("group")),title:"组合 (Ctrl+G)"},[e.createVNode(e.unref(ie.Group),{size:14})])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"pd-button small",onClick:f[5]||(f[5]=g=>c.$emit("ungroup")),title:"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(ie.Ungroup),{size:14})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),jn=ce(Yn,[["__scopeId","data-v-567d273e"]]),Xn={class:"field-tree-panel"},Zn={class:"tree-container"},Jn=["onClick"],Qn={class:"expand-icon"},_n={class:"node-icon"},el={class:"group-label"},tl=["onDragstart"],ol={class:"node-label"},nl={class:"node-key"},ll={key:0,class:"pd-empty"},al=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(""),l=e.ref(new Set),a=e.computed(()=>!!n.value.trim()),i=e.computed(()=>E.filterGroups(E.groupFields(t.fields),n.value));function d(c){const f=new Set(l.value);f.has(c)?f.delete(c):f.add(c),l.value=f}function m(c,f){c.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:f.fieldKey,fieldLabel:f.fieldLabel})),c.dataTransfer&&(c.dataTransfer.effectAllowed="copy"),s("field-drag",f)}return(c,f)=>(e.openBlock(),e.createElementBlock("div",Xn,[f[2]||(f[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=g=>n.value=g),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,n.value]]),e.createElementVNode("div",Zn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.key||"_top"},[g.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["field-group-header",{"is-list":g.isList}]),onClick:h=>d(g.key)},[e.createElementVNode("span",Qn,e.toDisplayString(l.value.has(g.key)&&!a.value?"▶":"▼"),1),e.createElementVNode("span",_n,e.toDisplayString(g.isList?"📋":"📁"),1),e.createElementVNode("span",el,e.toDisplayString(g.label),1)],10,Jn)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.fields,h=>(e.openBlock(),e.createElementBlock("div",{key:h.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(g.key?22:8)+"px"}),onDragstart:R=>m(R,h)},[f[1]||(f[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",ol,e.toDisplayString(h.fieldLabel),1),e.createElementVNode("span",nl,"("+e.toDisplayString(h.fieldKey)+")",1)],44,tl))),128))],512),[[e.vShow,!g.key||a.value||!l.value.has(g.key)]])],64))),128))]),i.value.length===0?(e.openBlock(),e.createElementBlock("p",ll,"暂无字段")):e.createCommentVNode("",!0)]))}}),il=ce(al,[["__scopeId","data-v-9b326f07"]]),rl={key:0,class:"left-collapsed"},sl={class:"left-head"},dl={class:"pd-tabs left-tabs"},cl={class:"pd-tab-bar",role:"tablist"},ul={class:"pd-tab-pane",role:"tabpanel"},ml=["onDragstart"],pl={class:"material-icon"},vl={class:"material-label"},fl={class:"pd-tab-pane",role:"tabpanel"},gl={class:"pd-tab-pane",role:"tabpanel"},hl=e.defineComponent({__name:"LeftPanel",props:{fields:{},elements:{},selectedIds:{},collapsed:{type:Boolean}},emits:["select","move-layer","group","ungroup","toggle-visible","toggle-locked","field-drag","toggle-collapse"],setup(o,{emit:r}){const t=r,s=e.ref("elements"),n=[{type:"text",label:"文本",icon:"T"},{type:"barcode",label:"条形码",icon:"▍▍"},{type:"qrcode",label:"二维码",icon:"▦"},{type:"image",label:"图片",icon:"▧"},{type:"table",label:"表格",icon:"⊞"},{type:"longText",label:"长文",icon:"¶"},{type:"hline",label:"横线",icon:"―"},{type:"vline",label:"竖线",icon:"│"},{type:"rect",label:"矩形",icon:"▭"},{type:"oval",label:"椭圆",icon:"◯"},{type:"html",label:"HTML",icon:"<>"}];function l(d,m){d.dataTransfer?.setData("elementType",m)}function a(d){t("field-drag",d)}function i(d){s.value=d,t("toggle-collapse")}return(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",rl,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:m[0]||(m[0]=c=>i(s.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="elements"}]),title:"元素",onClick:m[1]||(m[1]=c=>i("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="fields"}]),title:"字段",onClick:m[2]||(m[2]=c=>i("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="layers"}]),title:"图层",onClick:m[3]||(m[3]=c=>i("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",sl,[m[14]||(m[14]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:m[4]||(m[4]=c=>d.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",dl,[e.createElementVNode("div",cl,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="elements"}]),onClick:m[5]||(m[5]=c=>s.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="fields"}]),onClick:m[6]||(m[6]=c=>s.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="layers"}]),onClick:m[7]||(m[7]=c=>s.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",ul,[m[15]||(m[15]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(n,c=>e.createElementVNode("div",{key:c.type,class:"material-card",draggable:"true",onDragstart:f=>l(f,c.type)},[e.createElementVNode("span",pl,e.toDisplayString(c.icon),1),e.createElementVNode("span",vl,e.toDisplayString(c.label),1)],40,ml)),64))],512),[[e.vShow,s.value==="elements"]]),e.withDirectives(e.createElementVNode("div",fl,[e.createVNode(il,{fields:o.fields,onFieldDrag:a},null,8,["fields"])],512),[[e.vShow,s.value==="fields"]]),e.withDirectives(e.createElementVNode("div",gl,[e.createVNode(jn,{elements:o.elements,"selected-ids":o.selectedIds,onSelect:m[8]||(m[8]=(c,f)=>d.$emit("select",c,f)),onMoveLayer:m[9]||(m[9]=c=>d.$emit("move-layer",c)),onGroup:m[10]||(m[10]=c=>d.$emit("group")),onUngroup:m[11]||(m[11]=c=>d.$emit("ungroup")),onToggleVisible:m[12]||(m[12]=c=>d.$emit("toggle-visible",c)),onToggleLocked:m[13]||(m[13]=c=>d.$emit("toggle-locked",c))},null,8,["elements","selected-ids"])],512),[[e.vShow,s.value==="layers"]])])],64))],2))}}),bl=ce(hl,[["__scopeId","data-v-4501eea7"]]);function El(o,r){const t=e.ref(!1),s=e.ref(null);let n=0,l=0,a=0,i=0,d=!1;function m(C){if(r.disabled||C.button!==0)return;const v=C.target;if(!(v instanceof Element)||v.classList.contains("resize-handle"))return;t.value=!0,d=C.altKey,n=C.clientX,l=C.clientY;const p=o.value;p&&(a=parseFloat(p.style.left)||0,i=parseFloat(p.style.top)||0,s.value={left:a,top:i,width:parseFloat(p.style.width)||0,height:parseFloat(p.style.height)||0},r.onStart?.({altKey:d}),document.addEventListener("mousemove",f),document.addEventListener("mouseup",g),C.preventDefault())}function c(C){const v=r.getScale?.()??1;let p=a+(C.clientX-n)/v,B=i+(C.clientY-l)/v;if(r.axis==="x"&&(B=i),r.axis==="y"&&(p=a),r.onAdsorb){const _=o.value;if(_){const ne=parseFloat(_.style.width)||0,G=parseFloat(_.style.height)||0,J=r.onAdsorb({left:p,top:B,width:ne,height:G});p=J.left,B=J.top}}return{left:p,top:B}}function f(C){const v=c(C);s.value&&(s.value.left=v.left,s.value.top=v.top),r.onDrag(v)}function g(C){t.value=!1;const v=c(C);r.onDragEnd?.(v,{altKey:d}),r.onStop?.(),s.value=null,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function h(){const C=o.value;C&&C.removeEventListener("mousedown",m),document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function R(){h();const C=o.value;C&&C.addEventListener("mousedown",m)}return{isDragging:t,dragPreview:s,setup:R,cleanup:h}}function yl(o){const r=[];return o.getAttribute("data-fit")==="shrink"&&r.push(o),o.querySelectorAll('[data-fit="shrink"]').forEach(t=>r.push(t)),r}function kl(o){o.querySelectorAll("[data-fit-size]").forEach(r=>{if(r.getAttribute("data-fit")==="shrink")return;r.removeAttribute("data-fit-size");const t=r.getAttribute("data-fit-base");t?r.style.fontSize=`${t}pt`:r.style.removeProperty("font-size")})}function bt(o,r){const t=()=>{const s=o.value;s&&(yl(s).forEach(Ie.fitTextNode),kl(s))};e.watchEffect(()=>{r(),e.nextTick(t)},{flush:"post"}),e.onMounted(()=>{e.nextTick(t)})}const Vl=["data-fit","data-fit-base","data-fit-min"],Nl=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},s={left:"flex-start",center:"center",right:"flex-end"},n=e.ref(null),l=e.computed(()=>E.resolveElementTextFit("text",r.element.options)),a=e.computed(()=>r.element.options.fontSize||12),i=e.computed(()=>E.resolveShrinkMinFontSize(r.element.options.shrinkMinFontSize)),d=e.computed(()=>{const c=r.element.options,f=l.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:c.fontWeight||"normal",fontFamily:c.fontFamily||"inherit",color:c.color||"#333",backgroundColor:c.backgroundColor||"transparent",textAlign:c.textAlign||"left",lineHeight:c.lineHeight?c.lineHeight+"pt":"normal",letterSpacing:c.letterSpacing?c.letterSpacing+"pt":"normal",textDecoration:c.textDecoration||"none",padding:`${c.contentPaddingTop||0}pt ${c.contentPaddingRight||0}pt ${c.contentPaddingBottom||0}pt ${c.contentPaddingLeft||0}pt`,width:"100%",height:f?"auto":"100%",boxSizing:"border-box",overflow:f?"visible":"hidden",...c.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...c.verticalAlign?{display:"flex",alignItems:t[c.verticalAlign]??"flex-start",justifyContent:s[c.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>r.designMode?r.element.options.testData?r.element.options.testData:r.element.options.formatter||"文本":E.resolveTextBinding(r.element.options,r.data));return bt(n,()=>[l.value,a.value,i.value,r.element.options.width,r.element.options.height,r.element.options.wordWrap,r.element.options.letterSpacing,r.element.options.lineHeight,m.value]),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"print-text",style:e.normalizeStyle(d.value),"data-fit":l.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(i.value)},e.toDisplayString(m.value),13,Vl))}}),wl={class:"print-image"},Cl=["src"],Sl={key:1,class:"image-placeholder"},xl=e.defineComponent({__name:"ImageElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>{const a=r.element.options.src||"";return a?a.includes("{")?r.designMode?E.evaluateTemplate(a,E.DEFAULT_DEMO_DATA):E.evaluateTemplate(a,r.data?.[0]||{}):a:""}),s=e.ref(!1);function n(){s.value=!0}e.watch(t,()=>{s.value=!1});const l=e.computed(()=>({objectFit:r.element.options.fit||"contain"}));return(a,i)=>(e.openBlock(),e.createElementBlock("div",wl,[t.value&&!s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(l.value),onError:n},null,44,Cl)):(e.openBlock(),e.createElementBlock("div",Sl,"图片"))]))}}),$l=ce(xl,[["__scopeId","data-v-007a2979"]]),Bl=["data-fit","data-fit-base","data-fit-min"],Dl=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},s={left:"flex-start",center:"center",right:"flex-end"},n=e.ref(null),l=e.computed(()=>E.resolveElementTextFit("longText",r.element.options)),a=e.computed(()=>r.element.options.fontSize||12),i=e.computed(()=>E.resolveShrinkMinFontSize(r.element.options.shrinkMinFontSize)),d=e.computed(()=>{const c=r.element.options,f=l.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:c.fontWeight||"normal",fontFamily:c.fontFamily||"inherit",color:c.color||"#333",backgroundColor:c.backgroundColor||"transparent",textAlign:c.textAlign||"left",lineHeight:c.lineHeight?c.lineHeight+"pt":"1.5",letterSpacing:c.letterSpacing?c.letterSpacing+"pt":"normal",textIndent:c.longTextIndent?c.longTextIndent+"pt":"0",width:"100%",height:f?"auto":"100%",overflow:f?"visible":"hidden",wordBreak:"break-all",boxSizing:"border-box",...c.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...c.verticalAlign?{display:"flex",alignItems:t[c.verticalAlign]??"flex-start",justifyContent:s[c.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>r.designMode?r.element.options.formatter?r.element.options.formatter:"长文本内容":E.resolveTextBinding(r.element.options,r.data));return bt(n,()=>[l.value,a.value,i.value,r.element.options.width,r.element.options.height,r.element.options.wordWrap,r.element.options.lineHeight,m.value]),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"print-longtext",style:e.normalizeStyle(d.value),"data-fit":l.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(i.value)},e.toDisplayString(m.value),13,Bl))}}),Tl=["title"],Ml=["title","onClick"],zl=e.defineComponent({__name:"TableContextMenu",props:{visible:{type:Boolean},x:{},y:{},canDeleteRow:{type:Boolean},canDeleteCol:{type:Boolean},mergeDisabledReason:{},canSplit:{type:Boolean},currentRowType:{},rowTypeDisabledReason:{type:Function}},emits:["action"],setup(o,{emit:r}){const t=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],s=r;function n(l,a){s("action",l,a)}return(l,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"table-ctx-menu",style:e.normalizeStyle({left:o.x+"px",top:o.y+"px"}),onMousedown:a[8]||(a[8]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"menu-item",onClick:a[0]||(a[0]=i=>n("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:a[1]||(a[1]=i=>n("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteRow}]),onClick:a[2]||(a[2]=i=>o.canDeleteRow&&n("delete-row"))}," 删除行 ",2),a[9]||(a[9]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:"menu-item",onClick:a[3]||(a[3]=i=>n("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:a[4]||(a[4]=i=>n("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteCol}]),onClick:a[5]||(a[5]=i=>o.canDeleteCol&&n("delete-col"))}," 删除列 ",2),a[10]||(a[10]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!!o.mergeDisabledReason}]),title:o.mergeDisabledReason||"",onClick:a[6]||(a[6]=i=>!o.mergeDisabledReason&&n("merge"))}," 合并单元格 ",10,Tl),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canSplit}]),onClick:a[7]||(a[7]=i=>o.canSplit&&n("split"))}," 拆分单元格 ",2),a[11]||(a[11]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),a[12]||(a[12]=e.createElementVNode("div",{class:"menu-group-title"},"行类型",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(t,i=>e.createElementVNode("div",{key:i.value,class:e.normalizeClass(["menu-item",{disabled:!!o.rowTypeDisabledReason(i.value),active:o.currentRowType===i.value}]),title:o.rowTypeDisabledReason(i.value)||"",onClick:d=>!o.rowTypeDisabledReason(i.value)&&n("set-row-type",i.value)},e.toDisplayString(i.label),11,Ml)),64))],36)):e.createCommentVNode("",!0)]))}}),Al=ce(zl,[["__scopeId","data-v-44e319c1"]]),Pl={class:"cell-barcode"},Rl=["preserveAspectRatio"],Ll=["src"],Ul={key:1,class:"cell-barcode-fallback"},Il=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{},printerDpi:{},targetWidthMm:{},targetHeightMm:{},barWidth:{},barFontSize:{}},setup(o){const r=o,t=e.ref(null),s=e.ref(!1),n=e.ref(""),l=e.ref(null),a={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},i=e.computed(()=>a[r.fit||"contain"]??"xMidYMid meet"),d=e.computed(()=>l.value?{width:l.value.width,height:l.value.height}:{maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}),m=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));function c(){if(s.value=!1,l.value=null,!t.value)return;const R=E.barcodeUnitsPerModule(r.barWidth);try{zt(t.value,r.value,{format:r.barcodeType||"CODE128",width:R,height:E.BARCODE_BAR_HEIGHT_MODULES*R,displayValue:r.showText!==!1,fontSize:(r.barFontSize??E.BARCODE_TEXT_FONT_SIZE_MODULES)*R,margin:0,marginLeft:E.BARCODE_QUIET_ZONE_MODULES*R,marginRight:E.BARCODE_QUIET_ZONE_MODULES*R,marginTop:0,marginBottom:E.BARCODE_MARGIN_BOTTOM_MODULES*R})}catch{return}s.value=!0;const C=f(t.value),v=C?E.resolveBarcodeSize({unitWidth:C.width/R,unitHeight:C.height/R,boxWidthMm:E.barcodeAvailableBoxMm(r.targetWidthMm,r.maxWidth),boxHeightMm:E.barcodeAvailableBoxMm(r.targetHeightMm,r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth}):null;l.value=v?{width:`${v.widthMm}mm`,height:`${v.heightMm}mm`}:null,t.value.setAttribute("shape-rendering","crispEdges")}function f(R){const C=(R.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return C.length!==4||C.some(v=>!Number.isFinite(v))?null:{width:C[2],height:C[3]}}async function g(){if(!r.value){n.value="";return}try{n.value=await At.toDataURL(r.value,{width:96,margin:1,errorCorrectionLevel:r.qrCodeLevel||"M"})}catch{n.value=""}}function h(){r.cellType==="barcode"?c():g()}return e.onMounted(h),e.watch(()=>[r.cellType,r.value,r.barcodeType,r.qrCodeLevel,r.showText,r.printerDpi,r.targetWidthMm,r.targetHeightMm,r.barWidth,r.barFontSize,r.maxWidth,r.maxHeight],h),(R,C)=>(e.openBlock(),e.createElementBlock("div",Pl,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:t,preserveAspectRatio:i.value,style:e.normalizeStyle(d.value)},null,12,Rl)),[[e.vShow,o.cellType==="barcode"&&s.value]]),o.cellType==="qrcode"&&n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.value,alt:"qrcode",style:e.normalizeStyle(m.value)},null,12,Ll)):e.createCommentVNode("",!0),!s.value&&o.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",Ul,e.toDisplayString(o.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),Fl=ce(Il,[["__scopeId","data-v-81e37239"]]),Hl={class:"cell-image"},Ol=["src"],Wl={key:1,class:"image-placeholder"},Gl=e.defineComponent({__name:"CellImage",props:{value:{},fit:{},maxWidth:{},maxHeight:{},designMode:{type:Boolean},data:{}},setup(o){const r=o,t=e.computed(()=>{const a=r.value||"";return a?a.includes("{")?r.designMode?E.evaluateTemplate(a,E.DEFAULT_DEMO_DATA):E.evaluateTemplate(a,r.data?.[0]||{}):a:""}),s=e.ref(!1);function n(){s.value=!0}e.watch(t,()=>{s.value=!1});const l=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));return(a,i)=>(e.openBlock(),e.createElementBlock("div",Hl,[t.value&&!s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(l.value),onError:n},null,44,Ol)):(e.openBlock(),e.createElementBlock("div",Wl,"图片"))]))}}),Kl=ce(Gl,[["__scopeId","data-v-d5bc444b"]]),ql=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],Yl=["data-fit","data-fit-base","data-fit-min","data-fit-mm"],jl={key:0,class:"data-placeholder"},Xl={key:3,class:"data-placeholder"},Zl={key:0,class:"col-resize-layer"},Jl=["aria-label","onMousedown"],Ql={key:1,class:"row-badges"},Ye=3.7795275591,_l=.1,ea=e.defineComponent({__name:"TableElement",props:{element:{},designMode:{type:Boolean},isSelected:{type:Boolean},showTableGhostBorder:{type:Boolean},scale:{},data:{}},emits:["dblclick-cell"],setup(o,{emit:r}){const t={header:"题",data:"数",subtotal:"小",summary:"汇"},s=o,n=r,l=e.inject(He,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),a=e.computed(()=>s.element.options.tableRows??[]),i=e.computed(()=>s.element.options.tableColWidths??[]),d=e.computed(()=>s.element.options.tableDefaultFontSize??10),m=e.computed(()=>s.element.options.tableDefaultColor??"#333333"),c=e.computed(()=>{const L=l.tableSelection.value;return L&&L.elementId===s.element.id?L:null});function f(L){let F=0;for(let V=0;V<L;V++)F+=a.value[V].height;return F}const g=e.ref(null),h=e.ref(null),R=e.ref([]);function C(){if(!s.designMode)return;const L=g.value;if(!L)return;const F=L.offsetHeight;if(F<=0)return;const V=s.element.options,w=F/Ye;Math.abs(w-(V.height??0))>_l&&(V.height=Math.round(w*100)/100);const P=L.offsetTop;R.value=Array.from(L.rows).map(ae=>({top:(ae.offsetTop-P)/Ye,height:ae.offsetHeight/Ye}))}function v(L){return R.value[L]?.top??f(L)}function p(L){return R.value[L]?.height??a.value[L]?.height??0}e.watch(()=>[s.element.options,s.designMode],()=>C(),{deep:!0,flush:"post"}),e.onMounted(()=>{C(),document.fonts?.ready.then(()=>C())});const B=e.computed(()=>{const L=s.element.options.dataSource;if(L&&Array.isArray(E.DEFAULT_DEMO_DATA[L]))return E.DEFAULT_DEMO_DATA[L];for(const F of Object.values(E.DEFAULT_DEMO_DATA))if(Array.isArray(F))return F}),_=e.computed(()=>{if(s.data)return s.data});function ne(L){return L.cellType==="barcode"||L.cellType==="qrcode"}function G(L,F){return ne(F)?E.resolveBarcodeDesignValue(F.formatter,B.value):F.formatter||""}function J(L,F){const V=s.element.options,w={designMode:s.designMode,showGhostBorder:s.showTableGhostBorder};return{fontFamily:F.fontFamily||"inherit",textAlign:F.align??"left",verticalAlign:F.valign??"middle",fontSize:(F.fontSize??d.value)+"pt",fontWeight:F.fontWeight??"normal",color:F.color??m.value,backgroundColor:F.backgroundColor??"transparent",borderTop:E.resolveCellBorderCss(F.borders?.top,w),borderRight:E.resolveCellBorderCss(F.borders?.right,w),borderBottom:E.resolveCellBorderCss(F.borders?.bottom,w),borderLeft:E.resolveCellBorderCss(F.borders?.left,w),padding:(F.padding??V.tableDefaultPadding??1)+"mm",whiteSpace:F.wordWrap??!0?"normal":"nowrap",overflow:F.wordWrap??!0?"visible":"hidden"}}function b(L){return E.resolveCellTextFit(L)}function W(L){return b(L)!=="autoHeight"}function j(L){return L.fontSize??d.value}function U(L,F){return E.cellFitCapMm(a.value,L,F,s.element.options.tableDefaultPadding??1)}function y(L,F){return E.cellFitWidthMm(i.value,L,F,s.element.options.tableDefaultPadding??1)}function M(L,F){return{maxHeight:U(F,L)+"mm",overflow:"hidden",...L.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}bt(h,()=>[s.designMode,s.data?.length,i.value.join(","),d.value,s.element.options.tableDefaultPadding,a.value.map(L=>`${L.height}:${L.cells.map(F=>`${F.formatter??""}|${F.fontSize??""}|${F.wordWrap??""}|${F.textFit??""}|${F.colspan??1}`).join("~")}`).join(",")]);function N(L,F){const V=c.value;return{"cell-selected":!!V&&L>=V.r1&&L<=V.r2&&F>=V.c1&&F<=V.c2,"row-data-bg":a.value[L].type==="data"}}const O=e.ref(null);function A(L,F){const V=E.normalizeSelection(a.value,L,F);l.setTableSelection({elementId:s.element.id,...V})}function k(L,F,V){!s.designMode||!s.isSelected||(V.stopPropagation(),V.shiftKey&&c.value?A({r:c.value.r1,c:c.value.c1},{r:L,c:F}):(O.value={r:L,c:F},A({r:L,c:F},{r:L,c:F})),window.addEventListener("mouseup",()=>{O.value=null},{once:!0}))}function z(L,F){O.value&&A(O.value,{r:L,c:F})}function u(L,F){s.designMode&&n("dblclick-cell",s.element.id,L,F)}const x=e.reactive({visible:!1,x:0,y:0}),Y=e.inject(Je,null);function be(L,F,V){if(!s.designMode)return;!s.isSelected&&Y&&(Y.value=new Set([s.element.id]));const w=c.value;w&&L>=w.r1&&L<=w.r2&&F>=w.c1&&F<=w.c2||A({r:L,c:F},{r:L,c:F}),x.x=V.clientX,x.y=V.clientY,x.visible=!0,window.removeEventListener("mouseup",ge),window.addEventListener("mouseup",ge)}function ge(L){L.target?.closest?.(".table-ctx-menu")||(x.visible=!1,window.removeEventListener("mouseup",ge))}const fe=e.computed(()=>{const L=c.value;return L?E.canMergeReason(a.value,L):"未选择单元格"}),se=e.computed(()=>{const L=c.value;if(!L)return!1;for(let F=L.r1;F<=L.r2;F++)for(let V=L.c1;V<=L.c2;V++){const w=a.value[F].cells[V];if(!w.merged&&((w.rowspan??1)>1||(w.colspan??1)>1))return!0}return!1});function q(L){const F=c.value;if(!F)return"未选择单元格";if(F.r1!==F.r2)return"行类型仅支持单行设置";const V=JSON.parse(JSON.stringify(a.value));return E.setRowType(V,F.r1,L)}function S(){E.syncTableElementSize(s.element.options)}function D(L,F){const V=l.maxTableWidth.value,w=L.reduce((P,ae)=>P+ae,0)+L[F];return w>V?`插入后表格总宽 ${Math.round(w*10)/10}mm 超过打印范围宽度 ${V}mm,请先缩小列宽`:null}function K(L,F){const V=c.value;if(!V)return;x.visible=!1;const w=s.element.options,P=w.tableRows,ae=w.tableColWidths;let me=null;switch(L){case"insert-row-above":E.insertRow(P,V.r1,"above");break;case"insert-row-below":E.insertRow(P,V.r2,"below");break;case"delete-row":me=E.deleteRow(P,V.r1);break;case"insert-col-left":me=D(ae,V.c1),me||E.insertCol(P,ae,V.c1,"left");break;case"insert-col-right":me=D(ae,V.c2),me||E.insertCol(P,ae,V.c2,"right");break;case"delete-col":me=E.deleteCol(P,ae,V.c1);break;case"merge":E.mergeCells(P,V);break;case"split":E.splitCells(P,V);break;case"set-row-type":me=E.setRowType(P,V.r1,F);break}if(me){alert(me);return}l.setTableSelection(null),S(),l.recordHistory()}const Z=e.computed(()=>s.designMode&&!!s.isSelected&&!s.element.options.locked&&i.value.length>=1),te=e.computed(()=>Array.from({length:i.value.length},(L,F)=>F+1));function pe(L){return i.value.slice(0,L).reduce((F,V)=>F+V,0)}const T=e.ref(null);let $=0,I=0;function ee(L,F){Z.value&&F.button===0&&(T.value=L,$=F.clientX,I=i.value[L-1],document.addEventListener("mousemove",oe),document.addEventListener("mouseup",ue))}function oe(L){if(T.value===null)return;const F=s.scale||1,V=(L.clientX-$)/(F*Ye),w=T.value-1,P=s.element.options.tableColWidths;P[w]=E.clampResizedColumnWidth(P,w,I+V,l.maxTableWidth.value),S()}function ue(){document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",ue),T.value!==null&&(T.value=null,S(),l.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",ue)}),(L,F)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:h,class:e.normalizeClass(["print-table",{"design-mode":o.designMode}]),onContextmenu:F[0]||(F[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:g,style:e.normalizeStyle({fontSize:d.value+"pt",color:m.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(V,w)=>(e.openBlock(),e.createElementBlock("col",{key:w,style:e.normalizeStyle({width:V+"mm"})},null,4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(V,w)=>(e.openBlock(),e.createElementBlock("tr",{key:V.id,style:e.normalizeStyle({height:V.height+"mm"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.cells,(P,ae)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:P.id},[P.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:P.rowspan||1,colspan:P.colspan||1,class:e.normalizeClass(N(w,ae)),style:e.normalizeStyle(J(V,P)),onMousedown:e.withModifiers(me=>k(w,ae,me),["left"]),onMouseenter:me=>z(w,ae),onDblclick:e.withModifiers(me=>u(w,ae),["stop"]),onContextmenu:e.withModifiers(me=>be(w,ae,me),["prevent","stop"])},[ne(P)?(e.openBlock(),e.createBlock(Fl,{key:0,"cell-type":P.cellType,value:G(V,P),"barcode-type":P.barcodeType,"qr-code-level":P.qrCodeLevel,"show-text":P.showBarcodeText!==!1,fit:P.fit,"max-width":P.maxWidth,"max-height":P.maxHeight,"printer-dpi":P.printerDpi,"target-width-mm":y(ae,P),"target-height-mm":U(w,P),"bar-width":P.barWidth,"bar-font-size":P.barFontSize},null,8,["cell-type","value","barcode-type","qr-code-level","show-text","fit","max-width","max-height","printer-dpi","target-width-mm","target-height-mm","bar-width","bar-font-size"])):P.cellType==="image"?(e.openBlock(),e.createBlock(Kl,{key:1,value:P.formatter||"",fit:P.fit,"max-width":P.maxWidth,"max-height":P.maxHeight,"design-mode":o.designMode,data:_.value},null,8,["value","fit","max-width","max-height","design-mode","data"])):W(P)?(e.openBlock(),e.createElementBlock("div",{key:2,class:"cell-fit",style:e.normalizeStyle(M(P,w)),"data-fit":b(P)==="shrink"?"shrink":void 0,"data-fit-base":String(j(P)),"data-fit-min":String(e.unref(E.resolveShrinkMinFontSize)(P.shrinkMinFontSize)),"data-fit-mm":U(w,P)},[V.type==="data"?(e.openBlock(),e.createElementBlock("span",jl,e.toDisplayString(G(V,P)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(G(V,P)),1)],64))],12,Yl)):V.type==="data"?(e.openBlock(),e.createElementBlock("span",Xl,e.toDisplayString(G(V,P)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createTextVNode(e.toDisplayString(G(V,P)),1)],64))],46,ql))],64))),128))],4))),128))])],4),Z.value?(e.openBlock(),e.createElementBlock("div",Zl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.value,V=>(e.openBlock(),e.createElementBlock("div",{key:V,class:e.normalizeClass(["col-resize-handle",{dragging:T.value===V}]),role:"separator","aria-label":"列宽手柄"+V,style:e.normalizeStyle({left:pe(V)+"mm"}),onMousedown:e.withModifiers(w=>ee(V,w),["stop","prevent"])},null,46,Jl))),128))])):e.createCommentVNode("",!0),o.designMode&&o.isSelected?(e.openBlock(),e.createElementBlock("div",Ql,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(V,w)=>(e.openBlock(),e.createElementBlock("span",{key:V.id,class:"row-badge",style:e.normalizeStyle({top:v(w)+"mm",height:p(w)+"mm"})},e.toDisplayString(t[V.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(Al,{visible:x.visible,x:x.x,y:x.y,"can-delete-row":a.value.length>1,"can-delete-col":i.value.length>1,"merge-disabled-reason":fe.value,"can-split":se.value,"current-row-type":c.value?a.value[c.value.r1]?.type??null:null,"row-type-disabled-reason":q,onAction:K},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),ta=ce(ea,[["__scopeId","data-v-0c170f83"]]),St=e.defineComponent({__name:"LineElement",props:{element:{}},setup(o){const r=o,t=e.computed(()=>r.element.printElementType.type==="hline"),s=e.computed(()=>{const n=r.element.options,l=(n.borderWidth||.75)+"pt",a=n.borderStyle||"solid",i=n.borderColor||"#333";return t.value?{width:"100%",height:"0",borderTop:`${l} ${a} ${i}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${l} ${a} ${i}`,boxSizing:"border-box"}});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(s.value)},null,4))}}),xt=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(o){const r=o,t=e.computed(()=>r.element.printElementType.type==="oval"),s=e.computed(()=>{const n=r.element.options;return{width:"100%",height:"100%",borderWidth:(n.borderWidth||1)+"pt",borderStyle:n.borderStyle||"solid",borderColor:n.borderColor||"#333",backgroundColor:n.backgroundColor||"transparent",borderRadius:t.value?"50%":"0",boxSizing:"border-box"}});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(s.value)},null,4))}}),oa={class:"print-barcode",ref:"containerRef"},na=["preserveAspectRatio"],la=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.ref(null),s=e.ref(null),n={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},l=e.computed(()=>n[r.element.options.fit||"contain"]??"xMidYMid meet"),a=e.computed(()=>s.value?{width:s.value.width,height:s.value.height}:{maxWidth:"100%",maxHeight:"100%"});function i(){if(!t.value)return;const m=r.element.options,c=(r.designMode?m.testData||m.formatter:E.resolveTextBinding(m,r.data))||"条码",f=E.barcodeUnitsPerModule(m.barWidth);try{zt(t.value,c,{format:m.barcodeType||"CODE128",width:f,height:E.BARCODE_BAR_HEIGHT_MODULES*f,displayValue:!m.hideTitle,fontSize:(m.fontSize??E.BARCODE_TEXT_FONT_SIZE_MODULES)*f,margin:0,marginLeft:E.BARCODE_QUIET_ZONE_MODULES*f,marginRight:E.BARCODE_QUIET_ZONE_MODULES*f,marginTop:0,marginBottom:E.BARCODE_MARGIN_BOTTOM_MODULES*f})}catch{s.value=null;return}const g=d(t.value),h=g?E.resolveBarcodeSize({unitWidth:g.width/f,unitHeight:g.height/f,boxWidthMm:E.barcodeAvailableBoxMm(m.width,m.maxWidth),boxHeightMm:E.barcodeAvailableBoxMm(m.height,m.maxHeight),dpi:m.printerDpi,barWidth:m.barWidth}):null;s.value=h?{width:`${h.widthMm}mm`,height:`${h.heightMm}mm`}:null,t.value.setAttribute("shape-rendering","crispEdges")}function d(m){const c=(m.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return c.length!==4||c.some(f=>!Number.isFinite(f))?null:{width:c[2],height:c[3]}}return e.onMounted(i),e.watch(()=>[r.element.options.formatter,r.element.options.testData,r.element.options.barcodeType,r.element.options.width,r.element.options.height,r.element.options.barWidth,r.element.options.printerDpi,r.element.options.hideTitle,r.element.options.fontSize,r.element.options.maxWidth,r.element.options.maxHeight],i),(m,c)=>(e.openBlock(),e.createElementBlock("div",oa,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:t,preserveAspectRatio:l.value,style:e.normalizeStyle(a.value)},null,12,na))],512))}}),aa=ce(la,[["__scopeId","data-v-6eb95a40"]]),ia={class:"print-qrcode"},ra=["src"],sa=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.ref(""),s=e.computed(()=>{const l=r.element.options;return{objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}});async function n(){const l=r.element.options,a=(r.designMode?l.testData||l.formatter:E.resolveTextBinding(l,r.data))||"二维码",i=Math.min(l.width||80,l.height||80);try{t.value=await At.toDataURL(a,{width:i,margin:1,errorCorrectionLevel:String(l.qrCodeLevel??"M")})}catch{t.value=""}}return e.onMounted(n),e.watch(()=>[r.element.options.formatter,r.element.options.testData,r.element.options.qrCodeLevel],n),(l,a)=>(e.openBlock(),e.createElementBlock("div",ia,[t.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,alt:"qrcode",style:e.normalizeStyle(s.value)},null,12,ra)):e.createCommentVNode("",!0)]))}}),da=ce(sa,[["__scopeId","data-v-3454544f"]]),ca=["innerHTML"],ua=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>{if(r.element.options.formatter){const s=r.data&&r.data.length>0?r.data[0]:{},n=E.evaluateTemplate(r.element.options.formatter,s??{});return n?Wt.sanitize(n):""}return'<div style="background:#e0e0e0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10pt;color:#999">HTML</div>'});return(s,n)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:t.value},null,8,ca))}}),ma=ce(ua,[["__scopeId","data-v-880bbde5"]]),pa=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>{const n=r.element.options;return{fontSize:(n.fontSize||12)+"pt",fontWeight:n.fontWeight||"normal",fontFamily:n.fontFamily||"inherit",color:n.color||"#333",textAlign:n.textAlign||"left",lineHeight:n.lineHeight?n.lineHeight+"pt":"normal",letterSpacing:n.letterSpacing?n.letterSpacing+"pt":"normal"}}),s=e.computed(()=>r.designMode?r.element.options.title||"{pageIndex}/{totalPages}":r.element.options.title||"");return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(t.value)},e.toDisplayString(s.value),5))}}),va=ce(pa,[["__scopeId","data-v-38f1d7df"]]),fa={key:0,class:"drag-preview"},ga={key:1,class:"resize-handles"},ha=["onMousedown"],ba={key:2,class:"selected-indicator"},Ea={class:"position-label"},ya=e.defineComponent({__name:"BaseElement",props:{element:{},isSelected:{type:Boolean},designMode:{type:Boolean},printData:{},scale:{},allElements:{},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},zone:{},adsorbHandler:{type:Function},clearAdsorbGuides:{type:Function}},emits:["select","update:element","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","clone-element"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(null),l=e.inject(Je,null),a=e.computed(()=>l?.value?l.value.has(t.element.id):t.isSelected??!1),i=e.inject(Pt,null),d=e.computed(()=>i?.value.has(t.element.id)??!1),m={text:e.markRaw(Nl),image:e.markRaw($l),longText:e.markRaw(Dl),table:e.markRaw(ta),hline:e.markRaw(St),vline:e.markRaw(St),rect:e.markRaw(xt),oval:e.markRaw(xt),barcode:e.markRaw(aa),qrcode:e.markRaw(da),html:e.markRaw(ma),pageNumber:e.markRaw(va)},c=e.computed(()=>m[t.element.printElementType.type]),f=e.computed(()=>t.element.printElementType.type==="table"?{showTableGhostBorder:t.showTableGhostBorder,scale:t.scale}:{}),g=e.computed(()=>{const y=t.element.options,M=E.resolveElementBorder(t.element.printElementType.type,y),N={};if(M?.all&&(N.border=`${M.all.borderWidth} ${M.all.borderStyle} ${M.all.borderColor}`),M)for(const O of E.ELEMENT_BORDER_SIDES){const A=M.edges[O];A&&(N[`border${O.charAt(0).toUpperCase()}${O.slice(1)}`]=`${A.borderWidth} ${A.borderStyle} ${A.borderColor}`)}return{position:"absolute",left:y.left+"mm",top:y.top+"mm",width:y.width+"mm",height:y.height+"mm",zIndex:y.zIndex||"auto",...N}}),h=e.computed(()=>{const y=t.element.options;return`x:${Math.round(y.left)} y:${Math.round(y.top)} ${Math.round(y.width)}×${Math.round(y.height)}mm`});let R=0,C=0;const v=e.reactive({disabled:!t.designMode||!!t.element.options.locked,getScale:()=>(t.scale||1)*E.mmToPx(1),onDrag:y=>{const M=y.left-R,N=y.top-C;n.value&&(n.value.style.transform=`translate(${M}mm, ${N}mm)`)},onDragEnd:(y,M)=>{if(M.altKey){const A=JSON.parse(JSON.stringify(t.element));A.id=E.generateId(),A.options.left=y.left,A.options.top=y.top,A.options.groupId=void 0,s("clone-element",A,{left:y.left,top:y.top}),n.value&&(n.value.style.transform="");return}const N=y.left-R,O=y.top-C;if(t.element.options.left=y.left,t.element.options.top=y.top,n.value&&(n.value.style.transform=""),t.element.options.groupId&&t.allElements)for(const A of t.allElements)A.id!==t.element.id&&A.options.groupId===t.element.options.groupId&&(A.options.left+=N,A.options.top+=O)},onStart:()=>{R=t.element.options.left,C=t.element.options.top,s("drag-start")},onStop:()=>{t.clearAdsorbGuides?.(),s("drag-stop")},onAdsorb:y=>{let M=y.left,N=y.top;return t.snapToGrid&&(M=Math.round(y.left/5)*5,N=Math.round(y.top/5)*5),t.adsorbHandler?t.adsorbHandler({id:t.element.id,left:M,top:N,width:t.element.options.width,height:t.element.options.height}):{left:M,top:N,lines:[]}}}),{setup:p,cleanup:B,isDragging:_}=El(n,v);e.watchEffect(()=>{v.disabled=!t.designMode||!!t.element.options.locked});const ne=e.computed(()=>a.value&&!!t.designMode&&!t.element.options.locked&&t.element.printElementType.type!=="table"),{startResize:G,cleanup:J}=E.useResize({minWidth:3.5,minHeight:3.5,getScale:()=>(t.scale||1)*E.mmToPx(1),getRect:()=>({left:t.element.options.left,top:t.element.options.top,width:t.element.options.width,height:t.element.options.height}),onResize:y=>{t.element.options.left=y.left,t.element.options.top=y.top,t.element.options.width=y.width,t.element.options.height=y.height},onStart:()=>{s("drag-start")},onStop:()=>{s("drag-stop")}});function b(y){t.designMode&&y.button===0&&s("select",t.element.id,y.ctrlKey||y.metaKey)}function W(){t.designMode&&s("dblclick-element",t.element.id)}function j(y,M,N){t.designMode&&s("dblclick-cell",y,M,N)}e.onMounted(()=>{t.designMode&&p()});function U(){B(),J(),t.clearAdsorbGuides?.()}return e.onUnmounted(()=>{U()}),(y,M)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:n,class:e.normalizeClass(["print-element",{selected:a.value,previewed:d.value,"design-mode":o.designMode,locked:o.element.options.locked,hidden:o.element.options.visible===!1,"drag-ghost":e.unref(_),[`type-${o.element.printElementType.type}`]:!0,[`zone-${o.zone||"content"}`]:!0}]),style:e.normalizeStyle(g.value),onMousedown:e.withModifiers(b,["stop"]),onDblclick:e.withModifiers(W,["stop"]),onContextmenu:M[0]||(M[0]=e.withModifiers(N=>y.$emit("contextmenu",o.element.id,N),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value),e.mergeProps({element:o.element,data:o.printData,"design-mode":o.designMode,"is-selected":a.value},f.value,{onDblclickCell:j}),null,16,["element","data","design-mode","is-selected"])),e.unref(_)?(e.openBlock(),e.createElementBlock("div",fa)):e.createCommentVNode("",!0),ne.value?(e.openBlock(),e.createElementBlock("div",ga,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E.RESIZE_POINTS),N=>(e.openBlock(),e.createElementBlock("div",{key:N,class:e.normalizeClass(["resize-handle",`handle-${N}`]),onMousedown:e.withModifiers(O=>e.unref(G)(N,O),["stop"])},null,42,ha))),128))])):e.createCommentVNode("",!0),a.value&&o.designMode?(e.openBlock(),e.createElementBlock("div",ba,[e.createElementVNode("div",Ea,e.toDisplayString(h.value),1)])):e.createCommentVNode("",!0)],38))}}),ct=ce(ya,[["__scopeId","data-v-5a7482f4"]]);function ka(o={}){const r=e.ref([]),t=e.ref({width:0,height:0});function s(a,i,d){return E.computeAdsorb(a,i,d,o)}function n(a,i,d){r.value=a,t.value={width:i,height:d}}function l(){r.value=[]}return{check:s,renderLines:n,clearLines:l,guideLines:r,paperSize:t}}function Va(o){const{check:r,renderLines:t,clearLines:s,guideLines:n,paperSize:l}=ka(o.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function a(d){const m=o.getElements().filter(g=>g.id!==d.id).map(g=>({id:g.id,left:g.options.left,top:g.options.top,width:g.options.width,height:g.options.height})),c=r(d,m,o.getGuides?.()),f=o.getPaperSize();return t(c.lines,f.width,f.height),c}function i(){s()}return{requestAdsorb:a,clearGuides:i,guideLines:n,paperSize:l}}const Na=["src"],wa=["width","height","viewBox"],Ca=["x","y","font-size","fill","transform"],Sa={key:0,class:"zone-label"},xa={key:0,class:"zone-height-tip"},$a={key:0,class:"zone-label"},Ba={key:0,class:"zone-height-tip"},Da=["onMousedown","onDblclick"],Ta=e.defineComponent({__name:"CanvasPaper",props:{templateData:{},runtimeElements:{},designMode:{type:Boolean},printData:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},guides:{}},emits:["select","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","zone-height-change","zone-height-commit","guide-move","guide-remove","clone-element"],setup(o,{expose:r,emit:t}){const s=o,n=t,l=e.ref(null),a=e.computed(()=>E.getPaperDimensions(s.templateData).width),i=e.computed(()=>E.getPaperDimensions(s.templateData).height),d=e.computed(()=>s.templateData.designBackground),m=e.ref(!1);e.watch(()=>d.value?.src,()=>{m.value=!1});const c=e.computed(()=>{const S=d.value?.rotation;return S===90||S===180||S===270?S:0}),f=e.computed(()=>{const S=c.value,D=S===90||S===270,K=D?i.value:a.value,Z=D?a.value:i.value,te={width:K+"mm",height:Z+"mm",left:(a.value-K)/2+"mm",top:(i.value-Z)/2+"mm"};return S!==0&&(te.transform=`rotate(${S}deg)`),te});function g(){m.value=!0,console.warn("[print-designer] 设计背景图加载失败:",d.value?.src)}const h=e.computed(()=>`${8/(s.scale||1)}px`),R=e.computed(()=>{const S=s.scale||1,D=E.mmToPx(a.value)*S,K=E.mmToPx(i.value)*S;return{width:D+"px",height:K+"px",position:"relative"}}),C=e.computed(()=>{const S=s.templateData.margins,D=s.templateData.header.height,K=s.templateData.footer.height,Z=a.value-S.left-S.right;return{header:{left:S.left,top:S.top,width:Z,height:D},content:{left:S.left,top:S.top+D,width:Z,height:i.value-S.top-S.bottom-D-K},footer:{left:S.left,top:i.value-S.bottom-K,width:Z,height:K}}});function v(S){return{position:"absolute",left:S.left+"mm",top:S.top+"mm",width:S.width+"mm",height:S.height+"mm"}}const p=e.computed(()=>{const S={header:[],footer:[],content:[]};for(const D of s.runtimeElements)D.zone==="header"?S.header.push(D):D.zone==="footer"?S.footer.push(D):S.content.push(D);return S}),B=e.computed(()=>p.value.header),_=e.computed(()=>p.value.footer),ne=e.computed(()=>p.value.content);let G="content";const{requestAdsorb:J,clearGuides:b,guideLines:W,paperSize:j}=Va({getElements:()=>p.value[G],getPaperSize:()=>{const S=C.value[G];return{width:S.width,height:S.height}},getGuides:()=>{const S=[],D=[];for(const K of s.guides??[])K.type==="vertical"?S.push(K.position):D.push(K.position);return{vertical:S,horizontal:D}}});function U(S){G=s.runtimeElements.find(Z=>Z.id===S.id)?.zone||"content";const K=J(S);return(K.left!==S.left||K.top!==S.top)&&u(K.left+S.width/2,K.top+S.height/2),K}function y(S,D){if(S.button!==0)return;const K=D.position,Z=S.clientX,te=S.clientY,pe=s.scale??1,T=25.4/96,$=ee=>{const oe=(D.type==="vertical"?ee.clientX-Z:ee.clientY-te)/pe*T,ue=D.type==="vertical"?a.value:i.value,L=Math.min(Math.max(K+oe,0),ue);n("guide-move",D.id,L)},I=()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",I)};window.addEventListener("mousemove",$),window.addEventListener("mouseup",I)}const M=e.computed(()=>({width:a.value+"mm",minHeight:i.value+"mm",background:s.templateData.pageBackground||"var(--pd-paper, #fff)",boxShadow:"var(--pd-shadow-paper, 0 1px 2px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08))",overflow:"hidden",position:"relative",transform:s.scale?`scale(${s.scale})`:void 0,transformOrigin:"0 0"})),N=e.computed(()=>{const S=s.templateData.margins;return{padding:`${S.top}mm ${S.right}mm ${S.bottom}mm ${S.left}mm`,position:"relative",boxSizing:"border-box",minHeight:i.value+"mm"}}),O=e.computed(()=>({backgroundImage:`url("data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M0 .5H20M.5 0V20" fill="none" stroke="rgba(0,0,0,0.08)" stroke-width="1" stroke-dasharray="4 4"/></svg>')}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}));let A=0,k=null;const z=e.ref(null);function u(S,D){A+=1,z.value={left:S,top:D,key:A},k&&clearTimeout(k),k=setTimeout(()=>{z.value=null},300)}const x=e.computed(()=>he.resolveWatermarkLayout(s.templateData.watermark,s.printData,{width:a.value,height:i.value})),Y=e.ref(null);function be(S,D){D.button===0&&(se(),Y.value={zone:S,startY:D.clientY,startH:s.templateData[S].height},window.addEventListener("mousemove",ge),window.addEventListener("mouseup",fe))}function ge(S){if(!Y.value)return;const{zone:D,startY:K,startH:Z}=Y.value,pe=(S.clientY-K)/(s.scale||1)*25.4/96,T=D==="header"?pe:-pe,$=Math.min(100,i.value-s.templateData.margins.top-s.templateData.margins.bottom-(D==="header"?s.templateData.footer.height:s.templateData.header.height)-10),I=Math.min($,Math.max(0,Math.round((Z+T)*10)/10));n("zone-height-change",D,I)}function fe(){if(!Y.value)return;const S=Y.value.zone;Y.value=null,window.removeEventListener("mousemove",ge),window.removeEventListener("mouseup",fe),n("zone-height-commit",S)}function se(){window.removeEventListener("mousemove",ge),window.removeEventListener("mouseup",fe),Y.value=null}e.onUnmounted(()=>{se(),k&&clearTimeout(k)});function q(S,D){n("select",S,D)}return r({contentRef:l}),(S,D)=>(e.openBlock(),e.createElementBlock("div",{class:"paper-wrapper",style:e.normalizeStyle(R.value)},[e.createElementVNode("div",{class:"hiprint-printPaper",style:e.normalizeStyle(M.value)},[o.designMode&&d.value?.src&&!m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"design-background",style:e.normalizeStyle(f.value)},[e.createElementVNode("img",{src:d.value.src,draggable:"false",alt:"",onError:g},null,40,Na)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:l,style:e.normalizeStyle(N.value)},[o.showGrid&&o.designMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"grid-bg",style:e.normalizeStyle(O.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),x.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"watermark-layer",style:e.normalizeStyle({opacity:String(x.value.opacity)})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value.tiles,(K,Z)=>(e.openBlock(),e.createElementBlock("svg",{key:Z,class:"watermark-tile",width:K.widthMm+"mm",height:K.heightMm+"mm",viewBox:`0 0 ${x.value.tileWidthPx} ${x.value.tileHeightPx}`,style:e.normalizeStyle({left:K.leftMm+"mm",top:K.topMm+"mm"}),xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("text",{x:x.value.tileWidthPx/2,y:x.value.tileHeightPx/2,"font-size":x.value.fontSizePx,fill:x.value.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${x.value.rotate},${x.value.tileWidthPx/2},${x.value.tileHeightPx/2})`},e.toDisplayString(x.value.text),9,Ca)],12,wa))),128))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-header",{"design-mode":o.designMode}]),style:e.normalizeStyle(v(C.value.header))},[o.designMode?(e.openBlock(),e.createElementBlock("span",Sa,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,K=>(e.openBlock(),e.createBlock(ct,{key:K.id,element:K,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":B.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"header","adsorb-handler":U,"clear-adsorb-guides":e.unref(b),onSelect:q,onDragStart:D[0]||(D[0]=Z=>S.$emit("drag-start")),onDragStop:D[1]||(D[1]=Z=>S.$emit("drag-stop")),onDblclickElement:D[2]||(D[2]=Z=>S.$emit("dblclick-element",Z)),onDblclickCell:D[3]||(D[3]=(Z,te,pe)=>S.$emit("dblclick-cell",Z,te,pe)),onContextmenu:D[4]||(D[4]=(Z,te)=>S.$emit("contextmenu",Z,te)),onCloneElement:(Z,te)=>S.$emit("clone-element",Z,te)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-bottom",onMousedown:D[5]||(D[5]=e.withModifiers(K=>be("header",K),["prevent","stop"]))},[Y.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",xa,e.toDisplayString(o.templateData.header.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-content",{"design-mode":o.designMode}]),style:e.normalizeStyle(v(C.value.content))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ne.value,K=>(e.openBlock(),e.createBlock(ct,{key:K.id,element:K,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":ne.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"content","adsorb-handler":U,"clear-adsorb-guides":e.unref(b),onSelect:q,onDragStart:D[6]||(D[6]=Z=>S.$emit("drag-start")),onDragStop:D[7]||(D[7]=Z=>S.$emit("drag-stop")),onDblclickElement:D[8]||(D[8]=Z=>S.$emit("dblclick-element",Z)),onDblclickCell:D[9]||(D[9]=(Z,te,pe)=>S.$emit("dblclick-cell",Z,te,pe)),onContextmenu:D[10]||(D[10]=(Z,te)=>S.$emit("contextmenu",Z,te)),onCloneElement:(Z,te)=>S.$emit("clone-element",Z,te)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128))],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-footer",{"design-mode":o.designMode}]),style:e.normalizeStyle(v(C.value.footer))},[o.designMode?(e.openBlock(),e.createElementBlock("span",$a,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,K=>(e.openBlock(),e.createBlock(ct,{key:K.id,element:K,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":_.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"footer","adsorb-handler":U,"clear-adsorb-guides":e.unref(b),onSelect:q,onDragStart:D[11]||(D[11]=Z=>S.$emit("drag-start")),onDragStop:D[12]||(D[12]=Z=>S.$emit("drag-stop")),onDblclickElement:D[13]||(D[13]=Z=>S.$emit("dblclick-element",Z)),onDblclickCell:D[14]||(D[14]=(Z,te,pe)=>S.$emit("dblclick-cell",Z,te,pe)),onContextmenu:D[15]||(D[15]=(Z,te)=>S.$emit("contextmenu",Z,te)),onCloneElement:(Z,te)=>S.$emit("clone-element",Z,te)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-top",onMousedown:D[16]||(D[16]=e.withModifiers(K=>be("footer",K),["prevent","stop"]))},[Y.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",Ba,e.toDisplayString(o.templateData.footer.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(W),(K,Z)=>(e.openBlock(),e.createElementBlock("div",{key:Z,class:e.normalizeClass(["adsorb-guide",[`guide-${K.type}`]]),style:e.normalizeStyle(K.type==="vertical"?{left:K.position+"mm",top:"0",height:e.unref(j).height+"mm",borderLeftColor:K.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:K.position+"mm",left:"0",width:e.unref(j).width+"mm",borderTopColor:K.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.guides,K=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+K.id,class:e.normalizeClass(["manual-guide",[`guide-${K.type}`]]),style:e.normalizeStyle(K.type==="vertical"?{left:K.position+"mm",top:"0",height:i.value+"mm","--guide-hit":h.value}:{top:K.position+"mm",left:"0",width:a.value+"mm","--guide-hit":h.value}),onMousedown:e.withModifiers(Z=>y(Z,K),["prevent","stop"]),onDblclick:e.withModifiers(Z=>K.id&&n("guide-remove",K.id),["prevent","stop"])},null,46,Da))),128))],4)],4)],4))}}),Ma=ce(Ta,[["__scopeId","data-v-4682b43a"]]),za=e.defineComponent({__name:"Ruler",props:{orientation:{},viewportPx:{},originPx:{},paperLengthMM:{},scale:{},cursorPx:{}},emits:["add-guide","guide-dragging"],setup(o,{emit:r}){const t=o,s=r,n=e.computed(()=>t.orientation==="horizontal"),l=e.computed(()=>n.value?"vertical":"horizontal"),a=e.ref(null),i=e.ref(null),d=e.computed(()=>i.value??t.cursorPx??null),m=e.computed(()=>n.value?{width:t.viewportPx+"px",height:E.RULER_THICKNESS+"px"}:{width:E.RULER_THICKNESS+"px",height:t.viewportPx+"px"});let c=0;function f(){c||(c=requestAnimationFrame(()=>{c=0,g()}))}function g(){const b=a.value;if(!b)return;const W=b.getContext("2d");if(!W)return;const j=window.devicePixelRatio||1,U=Math.max(0,Math.round(t.viewportPx)),y=E.RULER_THICKNESS;b.width=(n.value?U:y)*j,b.height=(n.value?y:U)*j,W.setTransform(j,0,0,j,0,0);const M=getComputedStyle(b),N=M.getPropertyValue("--pd-ruler-bg").trim()||"#F8F9FC",O=M.getPropertyValue("--pd-ruler").trim()||"#9AA1AF",A=M.getPropertyValue("--pd-accent").trim()||"#165DFF";W.fillStyle=N,W.fillRect(0,0,n.value?U:y,n.value?y:U);const k=t.scale>0?t.scale:1,z=E.mmToPx(1)*k;if(z<=0)return;const u=-t.originPx/z,x=(U-t.originPx)/z,Y=E.chooseMajorStepMM(k),be=E.buildRulerTicks(u,x,Y);h(W,be,z,O,!0),h(W,be,z,O,!1),R(W,0,A),R(W,t.paperLengthMM,A);const ge=d.value;if(ge!==null&&ge>=0&&ge<=U){if(W.strokeStyle=A,W.lineWidth=1.5,W.beginPath(),n.value){const fe=Math.round(ge)+.5;W.moveTo(fe,0),W.lineTo(fe,y)}else{const fe=Math.round(ge)+.5;W.moveTo(0,fe),W.lineTo(y,fe)}W.stroke()}}function h(b,W,j,U,y){b.strokeStyle=U,b.fillStyle=U,b.globalAlpha=y?.32:1,b.lineWidth=1,b.font="9px ui-monospace, Menlo, monospace",b.textBaseline="top";for(const M of W){if((M.mm<0||M.mm>t.paperLengthMM)!==y)continue;const O=Math.round(t.originPx+M.mm*j)+.5,A=M.major?8:4;b.beginPath(),n.value?(b.moveTo(O,0),b.lineTo(O,A)):(b.moveTo(0,O),b.lineTo(A,O)),b.stroke(),M.major&&M.label&&(n.value?b.fillText(M.label,O+2,11):(b.save(),b.translate(11,O+2),b.rotate(-Math.PI/2),b.fillText(M.label,0,0),b.restore()))}b.globalAlpha=1}function R(b,W,j){const U=E.mmToPx(1)*(t.scale>0?t.scale:1),y=Math.round(t.originPx+W*U)+.5;y<=0||y>=t.viewportPx||(b.strokeStyle=j,b.globalAlpha=.55,b.lineWidth=1,b.beginPath(),n.value?(b.moveTo(y,0),b.lineTo(y,E.RULER_THICKNESS)):(b.moveTo(0,y),b.lineTo(E.RULER_THICKNESS,y)),b.stroke(),b.globalAlpha=1)}e.watch(()=>[t.viewportPx,t.originPx,t.paperLengthMM,t.scale,t.cursorPx,t.orientation],f),e.onMounted(f),e.onBeforeUnmount(()=>{c&&cancelAnimationFrame(c)});let C=!1;function v(b){const W=a.value;if(!W)return null;const j=W.getBoundingClientRect(),U=n.value?b.clientX-j.left:b.clientY-j.top;if(U<0||U>t.viewportPx)return null;const y=E.mmToPx(1)*(t.scale>0?t.scale:1);return(U-t.originPx)/y}function p(b){b.button===0&&(C=!0,b.preventDefault(),window.addEventListener("mousemove",G),window.addEventListener("mouseup",J),ne(b))}function B(b){const W=a.value;if(!W)return;const j=W.getBoundingClientRect();i.value=n.value?b.clientX-j.left:b.clientY-j.top,f()}function _(){i.value=null,f()}function ne(b){const W=v(b);s("guide-dragging",W)}function G(b){C&&ne(b)}function J(b){if(!C)return;C=!1,window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",J);const W=v(b);W!==null&&W>=0&&W<=t.paperLengthMM&&s("add-guide",l.value,W),s("guide-dragging",null)}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",J)}),(b,W)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:a,class:e.normalizeClass(["pd-ruler",`is-${o.orientation}`]),style:e.normalizeStyle(m.value),onMousedown:p,onMousemove:B,onMouseleave:_},null,38))}}),$t=ce(za,[["__scopeId","data-v-1e7d0633"]]),Aa={class:"canvas-scroll"},je=96/25.4,Pa=e.defineComponent({__name:"CanvasArea",props:{templateData:{},elements:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},hasClipboard:{type:Boolean},guides:{},showRuler:{type:Boolean,default:!0}},emits:["select","drop-element","drop-field","drag-start","drag-stop","dblclick-element","dblclick-cell","zone-height-change","zone-height-commit","select-all","clear-selection","preview","commit-preview","paste","copy","cut","delete","move-layer","coordinate","add-guide","guide-move","guide-remove","zoom","clone-element"],setup(o,{expose:r,emit:t}){const s=o,n=t;function l(T,$){n("select",T,$)}const a=e.ref(null),i=e.computed(()=>E.getPaperDimensions(s.templateData).width),d=e.computed(()=>E.getPaperDimensions(s.templateData).height),m=e.reactive({originX:0,originY:0,viewW:0,viewH:0,paperScale:1}),c=e.reactive({x:null,y:null}),f=e.reactive({x:0,y:0}),g=e.computed(()=>({transform:`translate(${f.x}px, ${f.y}px)`}));function h(){const T=a.value,$=T?.querySelector(".hiprint-printPaper");if(!T||!$)return;const I=T.getBoundingClientRect(),ee=$.getBoundingClientRect(),oe=s.scale||1,ue=ee.width/E.mmToPx(i.value);m.paperScale=Math.abs(ue-oe)<.002?oe:ue,m.originX=ee.left-I.left-E.RULER_THICKNESS,m.originY=ee.top-I.top-E.RULER_THICKNESS,m.viewW=T.clientWidth-E.RULER_THICKNESS,m.viewH=T.clientHeight-E.RULER_THICKNESS}function R(){f.x=a.value?.scrollLeft??0,f.y=a.value?.scrollTop??0,h()}let C=null,v=0;function p(){cancelAnimationFrame(v);const T=performance.now()+220,$=()=>{h(),performance.now()<T&&(v=requestAnimationFrame($))};v=requestAnimationFrame($)}const B=e.ref(null);function _(T,$){B.value=$===null?null:{type:T,mm:$}}const ne=e.computed(()=>{const T=B.value,$=a.value?.querySelector(".hiprint-printPaper");if(!T||!$)return{};const I=$.getBoundingClientRect(),ee=I.width/E.mmToPx(i.value),oe=E.mmToPx(T.mm)*(ee>0?ee:s.scale||1);return T.type==="vertical"?{left:I.left+oe+"px",top:I.top+"px",height:I.height+"px"}:{left:I.left+"px",top:I.top+oe+"px",width:I.width+"px"}});function G(T){const $=a.value?.querySelector(".hiprint-printPaper");if(!$)return;const I=$.getBoundingClientRect(),ee=s.scale||1,oe=E.pxToMm((T.clientX-I.left)/ee),ue=E.pxToMm((T.clientY-I.top)/ee);if(!(oe<0||ue<0))return{x:oe,y:ue}}function J(T){const $=G(T),I=T.dataTransfer?.getData("fieldData");if(I)try{const oe=JSON.parse(I);n("drop-field",oe,$);return}catch{}const ee=T.dataTransfer?.getData("elementType");ee&&n("drop-element",ee,$)}const b=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let W={x:0,y:0};function j(T){return!T||!(T instanceof HTMLElement)?!1:!!(T===a.value||T.classList.contains("canvas-scroll")||T.classList.contains("hiprint-printPaper")||T.classList.contains("hiprint-printPaper-content")||T.classList.contains("zone-layer")||T.classList.contains("grid-bg")||T.classList.contains("watermark-layer"))}function U(T){const $=a.value,I=$?.querySelector(".hiprint-printPaper");if(!$||!I)return;const ee=$.getBoundingClientRect();c.x=T.clientX-ee.left-E.RULER_THICKNESS,c.y=T.clientY-ee.top-E.RULER_THICKNESS;const oe=I.getBoundingClientRect(),ue=s.scale||1,L=E.pxToMm((T.clientX-oe.left)/ue),F=E.pxToMm((T.clientY-oe.top)/ue);if(L<0||F<0){n("coordinate",null);return}n("coordinate",{x:L,y:F})}function y(){n("coordinate",null),c.x=null,c.y=null}function M(T,$,I,ee){const oe=a.value;if(!oe)return;const ue=Math.max(ee,Math.round(T)),L=Math.round((s.scale||1)*100);if(ue===L)return;const F=s.scale||1,V=ue/100/F,w=getComputedStyle(oe),P=parseFloat(w.paddingLeft)||0,ae=parseFloat(w.paddingTop)||0,me=oe.scrollLeft+$-P,ye=oe.scrollTop+I-ae;n("zoom",ue-L),e.nextTick(()=>{const we=getComputedStyle(oe),xe=parseFloat(we.paddingLeft)||0,Re=parseFloat(we.paddingTop)||0;oe.scrollLeft=me*V-$+xe,oe.scrollTop=ye*V-I+Re})}function N(T){if(!(T.ctrlKey||T.metaKey))return;T.preventDefault();const $=a.value;if(!$)return;const I=Math.round((s.scale||1)*100),ee=E.nextWheelScale(I,T.deltaY>0?-1:1);if(ee===I)return;const oe=$.getBoundingClientRect();M(ee,T.clientX-oe.left,T.clientY-oe.top,E.MIN_SCALE_PERCENT)}function O(T){const $=a.value;if(!$)return;const I=Math.round((s.scale||1)*100),ee=E.nextWheelScale(I,T);M(ee,$.clientWidth/2,$.clientHeight/2,E.MIN_SCALE_PERCENT)}function A(T){const $=a.value;if(!$)return;const I=$.querySelector(".hiprint-printPaper"),ee=I?.style.transition??"";I&&(I.style.transition="none"),M(T,$.clientWidth/2,$.clientHeight/2,E.FIT_SCALE_MIN_PERCENT),e.nextTick(()=>{I&&(I.style.transition=ee)})}function k(T){T.button!==2&&j(T.target)&&(n("clear-selection"),W={x:T.clientX,y:T.clientY},b.visible=!0,b.x=T.clientX,b.y=T.clientY,b.w=0,b.h=0,window.addEventListener("mousemove",u),window.addEventListener("mouseup",x))}function z(){if(b.w<3||b.h<3)return[];const T=a.value?.querySelector(".hiprint-printPaper");if(!T)return[];const $=T.getBoundingClientRect(),I=s.scale||1,ee=b.x<W.x,oe=[];for(const ue of s.elements){if(ue.options.visible===!1||ue.options.locked)continue;const L=$.left+ue.options.left*je*I,F=$.top+ue.options.top*je*I,V=L+ue.options.width*je*I,w=F+ue.options.height*je*I,P=L<b.x+b.w&&V>b.x&&F<b.y+b.h&&w>b.y,ae=L>=b.x&&V<=b.x+b.w&&F>=b.y&&w<=b.y+b.h;(ee?ae:P)&&oe.push(ue.id)}return oe}function u(T){const $=T.clientX-W.x,I=T.clientY-W.y;b.x=$>=0?W.x:T.clientX,b.y=I>=0?W.y:T.clientY,b.w=Math.abs($),b.h=Math.abs(I),n("preview",z())}function x(){window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",x);const T=z();n("preview",T),T.length>0?n("commit-preview"):n("clear-selection"),n("preview",[]),b.visible=!1}const Y=e.reactive({visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null}),be=e.ref(null),ge=e.inject(Je,null);function fe(T,$){if(!$&&!j(T.target))return;$&&!ge?.value.has($)&&n("select",$,!1),Y.targetId=$??null,Y.visible=!0,Y.x=T.clientX,Y.y=T.clientY,Y.flipX=0,Y.flipY=0,e.nextTick(()=>{const ee=be.value;if(!ee)return;const oe=ee.getBoundingClientRect(),ue=4;T.clientX+oe.width+ue>window.innerWidth&&(Y.flipX=-oe.width),T.clientY+oe.height+ue>window.innerHeight&&(Y.flipY=-oe.height)}),window.removeEventListener("mousedown",q);const I=++se;e.nextTick(()=>{I===se&&window.addEventListener("mousedown",q)})}let se=0;function q(T){const $=be.value;$&&$.contains(T.target)||S()}function S(){Y.visible=!1,window.removeEventListener("mousedown",q)}function D(){S(),s.hasClipboard&&n("paste")}function K(){S(),n("select-all")}function Z(){S(),n("clear-selection")}function te(T,$){S(),T==="copy"?n("copy"):T==="cut"?n("cut"):T==="paste"?D():T==="delete"?n("delete"):T==="move-layer"&&n("move-layer",$)}e.onMounted(()=>{e.nextTick(h),a.value&&typeof ResizeObserver<"u"&&(C=new ResizeObserver(h),C.observe(a.value))}),e.watch(()=>s.scale,p),e.watch([i,d],()=>e.nextTick(h));function pe(){const T=a.value;if(!T)return;let $=0,I=0,ee=0;const oe=performance.now()+800,ue=()=>{const{scrollWidth:L,scrollHeight:F}=T;if(L===I&&F===ee?$++:$=0,I=L,ee=F,$>=2||performance.now()>oe){const V=T.scrollWidth,w=T.scrollHeight,P=T.clientWidth,ae=T.clientHeight;T.scrollLeft=Math.max(0,(V-P)/2),T.scrollTop=Math.max(0,(w-ae)/2);return}requestAnimationFrame(ue)};requestAnimationFrame(ue)}return r({centerScroll:pe,fitToWindow:A,zoomByStep:O}),e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",x),window.removeEventListener("mousedown",q),C?.disconnect(),cancelAnimationFrame(v)}),(T,$)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"canvas-area",onDragover:$[23]||($[23]=e.withModifiers(()=>{},["prevent"])),onDrop:J,onMousedown:k,onMousemove:U,onMouseleave:y,onWheel:N,onScroll:R,onContextmenu:e.withModifiers(fe,["prevent"])},[e.createElementVNode("div",Aa,[e.createVNode(Ma,{"template-data":o.templateData,"runtime-elements":o.elements,"design-mode":!0,"print-data":[],scale:o.scale,"show-grid":o.showGrid,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,guides:o.guides,onSelect:l,onGuideMove:$[0]||($[0]=(I,ee)=>T.$emit("guide-move",I,ee)),onGuideRemove:$[1]||($[1]=I=>T.$emit("guide-remove",I)),onDragStart:$[2]||($[2]=I=>T.$emit("drag-start")),onDragStop:$[3]||($[3]=I=>T.$emit("drag-stop")),onDblclickElement:$[4]||($[4]=I=>T.$emit("dblclick-element",I)),onDblclickCell:$[5]||($[5]=(I,ee,oe)=>T.$emit("dblclick-cell",I,ee,oe)),onContextmenu:$[6]||($[6]=(I,ee)=>fe(ee,I)),onZoneHeightChange:$[7]||($[7]=(I,ee)=>T.$emit("zone-height-change",I,ee)),onZoneHeightCommit:$[8]||($[8]=I=>T.$emit("zone-height-commit",I)),onCloneElement:$[9]||($[9]=(I,ee)=>T.$emit("clone-element",I,ee))},null,8,["template-data","runtime-elements","scale","show-grid","snap-to-grid","show-table-ghost-border","guides"])]),o.showRuler?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ruler-overlay",style:e.normalizeStyle(g.value)},[$[24]||($[24]=e.createElementVNode("div",{class:"ruler-corner"},null,-1)),e.createVNode($t,{orientation:"horizontal","viewport-px":m.viewW,"origin-px":m.originX,"paper-length-m-m":i.value,scale:m.paperScale,"cursor-px":c.x,onAddGuide:$[10]||($[10]=(I,ee)=>n("add-guide",I,ee)),onGuideDragging:$[11]||($[11]=I=>_("vertical",I))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"]),e.createVNode($t,{orientation:"vertical","viewport-px":m.viewH,"origin-px":m.originY,"paper-length-m-m":d.value,scale:m.paperScale,"cursor-px":c.y,onAddGuide:$[12]||($[12]=(I,ee)=>n("add-guide",I,ee)),onGuideDragging:$[13]||($[13]=I=>_("horizontal",I))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"])],4)):e.createCommentVNode("",!0),B.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ruler-guide-preview",`guide-${B.value.type}`]),style:e.normalizeStyle(ne.value)},null,6)):e.createCommentVNode("",!0),b.visible?(e.openBlock(),e.createElementBlock("div",{key:2,class:"marquee-selection",style:e.normalizeStyle({left:b.x+"px",top:b.y+"px",width:b.w+"px",height:b.h+"px"})},null,4)):e.createCommentVNode("",!0),Y.visible?(e.openBlock(),e.createElementBlock("div",{key:3,ref_key:"contextMenuRef",ref:be,class:"context-menu",onMousedown:$[22]||($[22]=e.withModifiers(()=>{},["stop"])),style:e.normalizeStyle({left:Y.x+Y.flipX+"px",top:Y.y+Y.flipY+"px"})},[Y.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:$[14]||($[14]=I=>te("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:$[15]||($[15]=I=>te("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:$[16]||($[16]=I=>te("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:$[17]||($[17]=I=>te("delete"))},"删除"),$[25]||($[25]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:$[18]||($[18]=I=>te("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:$[19]||($[19]=I=>te("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:$[20]||($[20]=I=>te("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:$[21]||($[21]=I=>te("move-layer","bottom"))},"置底")],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:D},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:K},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:Z},"取消选择")],64))],36)):e.createCommentVNode("",!0)],544))}}),Ra=ce(Pa,[["__scopeId","data-v-427d3548"]]),La={class:"property-search"},Ua=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(o,{emit:r}){const t=e.ref(""),s=r;function n(){s("search",t.value)}return(l,a)=>(e.openBlock(),e.createElementBlock("div",La,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=i=>t.value=i),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:n},null,544),[[e.vModelText,t.value]])]))}}),Ia=ce(Ua,[["__scopeId","data-v-10ab6c84"]]),Fa={class:"group-icon"},Ha={class:"group-title"},Oa={class:"expand-icon"},Wa={class:"group-content"},Ga=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(o){const r=o,t=e.ref(r.defaultExpanded??!0),n={Document:"≡",Brush:"◧",Setting:"⚙"}[r.icon]||"•";function l(){t.value=!t.value,a()}function a(){const d=`property-group-${r.groupKey}`;try{localStorage.setItem(d,String(t.value))}catch{}}function i(){const d=`property-group-${r.groupKey}`;try{const m=localStorage.getItem(d);m!==null&&(t.value=m==="true")}catch{}}return e.onMounted(()=>{i()}),(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":t.value}])},[e.createElementVNode("div",{class:"group-header",onClick:l},[e.createElementVNode("span",Fa,e.toDisplayString(e.unref(n)),1),e.createElementVNode("span",Ha,e.toDisplayString(o.title),1),e.createElementVNode("span",Oa,e.toDisplayString(t.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",Wa,[e.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[e.vShow,t.value]])],2))}}),$e=ce(Ga,[["__scopeId","data-v-2ba57031"]]),Ka={class:"position-grid"},qa={class:"pd-field"},Ya={class:"pd-field"},ja={class:"pd-field"},Xa={class:"pd-field"},Za=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o;function t(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[4]||(n[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ka,[e.withDirectives(e.createElementVNode("div",qa,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(re,{modelValue:o.element.options.left,"onUpdate:modelValue":n[0]||(n[0]=l=>o.element.options.left=l),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-left")]]),e.withDirectives(e.createElementVNode("div",Ya,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(re,{modelValue:o.element.options.top,"onUpdate:modelValue":n[1]||(n[1]=l=>o.element.options.top=l),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-top")]]),e.withDirectives(e.createElementVNode("div",ja,[n[7]||(n[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(re,{modelValue:o.element.options.width,"onUpdate:modelValue":n[2]||(n[2]=l=>o.element.options.width=l),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-width")]]),e.withDirectives(e.createElementVNode("div",Xa,[n[8]||(n[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(re,{modelValue:o.element.options.height,"onUpdate:modelValue":n[3]||(n[3]=l=>o.element.options.height=l),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-height")]])])],32)]),_:1}))}}),Ja=ce(Za,[["__scopeId","data-v-bc364679"]]),Qa={class:"pd-field"},_a={class:"pd-field"},ei={class:"pd-field"},ti={class:"pd-field"},oi={class:"pd-radio-group",role:"radiogroup"},ni={class:"pd-radio"},li={class:"pd-radio"},ai={class:"pd-radio"},ii={class:"pd-field"},ri={class:"pd-radio-group",role:"radiogroup"},si={class:"pd-radio"},di={class:"pd-radio"},ci={class:"pd-radio"},ui={class:"color-row"},mi={class:"pd-field"},pi={class:"pd-field"},vi={class:"pd-field"},fi={class:"pd-field"},gi={class:"pd-field"},hi=["value"],bi={key:0,class:"pd-field"},Ei={class:"pd-field"},yi=["checked"],ki={key:1,class:"pd-empty"},Vi=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o;function t(a){return r.searching?r.matchedKeys?.has(a)??!0:!0}const s=e.computed(()=>r.element.printElementType.type==="table"),n=e.computed(()=>E.resolveElementTextFit(r.element.printElementType.type||"text",r.element.options));function l(a){r.element.options.textFit=a.target.value}return(a,i)=>(e.openBlock(),e.createBlock($e,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[15]||(i[15]=e.withModifiers(()=>{},["prevent"]))},[o.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Qa,[i[16]||(i[16]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(ht,{modelValue:o.element.options.fontFamily,"onUpdate:modelValue":i[0]||(i[0]=d=>o.element.options.fontFamily=d)},null,8,["modelValue"])],512),[[e.vShow,t("ap-font-family")]]),e.withDirectives(e.createElementVNode("div",_a,[i[17]||(i[17]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(re,{modelValue:o.element.options.fontSize,"onUpdate:modelValue":i[1]||(i[1]=d=>o.element.options.fontSize=d),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,t("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",ei,[i[19]||(i[19]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":i[2]||(i[2]=d=>o.element.options.fontWeight=d),style:{width:"100%"}},[...i[18]||(i[18]=[e.createElementVNode("option",{value:"normal"},"正常",-1),e.createElementVNode("option",{value:"bold"},"粗体",-1),e.createElementVNode("option",{value:"bolder"},"更粗",-1),e.createElementVNode("option",{value:"lighter"},"细体",-1)])],512),[[e.vModelSelect,o.element.options.fontWeight]])],512),[[e.vShow,t("ap-font-weight")]]),e.withDirectives(e.createElementVNode("div",ti,[i[23]||(i[23]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",oi,[e.createElementVNode("label",ni,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[3]||(i[3]=d=>o.element.options.textAlign=d),value:"left"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),i[20]||(i[20]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",li,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[4]||(i[4]=d=>o.element.options.textAlign=d),value:"center"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),i[21]||(i[21]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ai,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[5]||(i[5]=d=>o.element.options.textAlign=d),value:"right"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),i[22]||(i[22]=e.createElementVNode("span",null,"右",-1))])])],512),[[e.vShow,t("ap-align")]]),e.withDirectives(e.createElementVNode("div",ii,[i[27]||(i[27]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",ri,[e.createElementVNode("label",si,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[6]||(i[6]=d=>o.element.options.verticalAlign=d),value:"top"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),i[24]||(i[24]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",di,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[7]||(i[7]=d=>o.element.options.verticalAlign=d),value:"middle"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),i[25]||(i[25]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ci,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[8]||(i[8]=d=>o.element.options.verticalAlign=d),value:"bottom"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),i[26]||(i[26]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,t("ap-vertical-align")]]),e.createElementVNode("div",ui,[e.withDirectives(e.createElementVNode("div",mi,[i[28]||(i[28]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ne,{modelValue:o.element.options.color,"onUpdate:modelValue":i[9]||(i[9]=d=>o.element.options.color=d)},null,8,["modelValue"])],512),[[e.vShow,t("ap-color")]]),e.withDirectives(e.createElementVNode("div",pi,[i[29]||(i[29]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ne,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":i[10]||(i[10]=d=>o.element.options.backgroundColor=d)},null,8,["modelValue"])],512),[[e.vShow,t("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",vi,[i[30]||(i[30]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(re,{modelValue:o.element.options.lineHeight,"onUpdate:modelValue":i[11]||(i[11]=d=>o.element.options.lineHeight=d),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,t("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",fi,[i[31]||(i[31]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(re,{modelValue:o.element.options.letterSpacing,"onUpdate:modelValue":i[12]||(i[12]=d=>o.element.options.letterSpacing=d),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,t("ap-letter-spacing")]]),e.withDirectives(e.createElementVNode("div",gi,[i[33]||(i[33]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:n.value,style:{width:"100%"},onChange:l},[...i[32]||(i[32]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,hi)],512),[[e.vShow,t("ap-text-fit")]]),n.value==="shrink"?e.withDirectives((e.openBlock(),e.createElementBlock("div",bi,[i[34]||(i[34]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(re,{"model-value":o.element.options.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":i[13]||(i[13]=d=>o.element.options.shrinkMinFontSize=d??void 0)},null,8,["model-value"])],512)),[[e.vShow,t("ap-shrink-min")]]):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",Ei,[i[35]||(i[35]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:o.element.options.wordWrap!==!1,type:"checkbox",class:"pd-switch",onInput:i[14]||(i[14]=d=>o.element.options.wordWrap=d.target.checked?void 0:!1)},null,40,yi)],512),[[e.vShow,t("ap-word-wrap")]])],64)):e.createCommentVNode("",!0),!o.isTextType&&!s.value?(e.openBlock(),e.createElementBlock("p",ki,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),Ni=ce(Vi,[["__scopeId","data-v-ec9e5cb7"]]),wi={class:"pd-field"},Ci=["value"],Si={class:"pd-field"},xi=["value"],$i={class:"pd-hint"},Bi={class:"pd-field"},Di={class:"pd-field"},Ti=["checked"],Mi={class:"pd-field"},zi={key:1,class:"pd-field"},Ai=["value"],Pi={key:2,class:"pd-hint"},Ri={key:3,class:"pd-field"},Li=["value"],Ui={class:"pd-field"},Ii={class:"pd-field"},Fi=e.defineComponent({__name:"CodeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["change"],setup(o,{emit:r}){const t=o,s=r,n=e.computed(()=>t.element.printElementType.type==="barcode"),l=e.computed(()=>t.element.printElementType.type==="qrcode"),a=e.computed(()=>(t.element.options.barcodeType||"CODE128").toUpperCase()),i=e.computed(()=>t.element.options.printerDpi?String(t.element.options.printerDpi):""),d=e.computed(()=>!!t.element.options.printerDpi),m=e.computed(()=>n.value&&d.value);function c(C){const v=Number(C.target.value);t.element.options.printerDpi=v>0?v:void 0,R()}function f(C){const v=C.target.value;t.element.options.barcodeType=v==="CODE128"?void 0:v,R()}function g(C){t.element.options.fit=C.target.value||void 0,R()}function h(C){return t.searching?t.matchedKeys?.has(C)??!0:!0}function R(){s("change")}return(C,v)=>(e.openBlock(),e.createBlock($e,{title:"条码设置",icon:"Postcard","default-expanded":"","group-key":"code"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:v[6]||(v[6]=e.withModifiers(()=>{},["prevent"]))},[n.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",wi,[v[8]||(v[8]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{class:"pd-select",value:a.value,onChange:f},[...v[7]||(v[7]=[e.createElementVNode("option",{value:"CODE128"},"CODE128(通用)",-1),e.createElementVNode("option",{value:"EAN13"},"EAN13(商品码)",-1),e.createElementVNode("option",{value:"EAN8"},"EAN8",-1),e.createElementVNode("option",{value:"UPC"},"UPC",-1),e.createElementVNode("option",{value:"CODE39"},"CODE39",-1),e.createElementVNode("option",{value:"ITF14"},"ITF14",-1)])],40,Ci)],512),[[e.vShow,h("cd-type")]]),e.withDirectives(e.createElementVNode("div",Si,[v[10]||(v[10]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{class:"pd-select",value:i.value,onChange:c},[...v[9]||(v[9]=[e.createElementVNode("option",{value:""},"不指定(按条宽渲染)",-1),e.createElementVNode("option",{value:"203"},"203 dpi(8 点/mm)",-1),e.createElementVNode("option",{value:"300"},"300 dpi(11.8 点/mm)",-1),e.createElementVNode("option",{value:"600"},"600 dpi(23.6 点/mm)",-1)])],40,xi)],512),[[e.vShow,h("cd-dpi")]]),e.withDirectives(e.createElementVNode("p",$i,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小",512),[[e.vShow,h("cd-dpi")]]),e.withDirectives(e.createElementVNode("div",Bi,[v[11]||(v[11]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(re,{"model-value":o.element.options.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":v[0]||(v[0]=p=>{o.element.options.barWidth=p,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-bar-width")]]),e.withDirectives(e.createElementVNode("p",{class:"pd-hint"},e.toDisplayString(m.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),513),[[e.vShow,h("cd-bar-width")]]),e.withDirectives(e.createElementVNode("div",Di,[v[12]||(v[12]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:o.element.options.hideTitle!==!0,type:"checkbox",class:"pd-switch",onInput:v[1]||(v[1]=p=>{o.element.options.hideTitle=p.target.checked?void 0:!0,R()})},null,40,Ti)],512),[[e.vShow,h("cd-show-text")]]),e.withDirectives(e.createElementVNode("div",Mi,[v[13]||(v[13]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(re,{"model-value":o.element.options.fontSize,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":v[2]||(v[2]=p=>{o.element.options.fontSize=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-font-size")]])],64)):l.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",zi,[v[15]||(v[15]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{class:"pd-select",value:String(o.element.options.qrCodeLevel??"M"),onChange:v[3]||(v[3]=p=>{o.element.options.qrCodeLevel=p.target.value,R()})},[...v[14]||(v[14]=[e.createElementVNode("option",{value:"L"},"L(最低,容量大)",-1),e.createElementVNode("option",{value:"M"},"M(推荐)",-1),e.createElementVNode("option",{value:"Q"},"Q",-1),e.createElementVNode("option",{value:"H"},"H(最高)",-1)])],40,Ai)],512)),[[e.vShow,h("cd-ec-level")]]):e.createCommentVNode("",!0),v[20]||(v[20]=e.createElementVNode("h3",{class:"pd-divider"},"自定义设置",-1)),n.value?(e.openBlock(),e.createElementBlock("p",Pi,"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),n.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("div",Ri,[v[17]||(v[17]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{class:"pd-select",value:o.element.options.fit||"contain",onChange:g},[...v[16]||(v[16]=[e.createElementVNode("option",{value:"contain"},"包含(保持比例)",-1),e.createElementVNode("option",{value:"cover"},"覆盖(保持比例)",-1),e.createElementVNode("option",{value:"fill"},"拉伸填满",-1),e.createElementVNode("option",{value:"none"},"原始尺寸",-1),e.createElementVNode("option",{value:"scale-down"},"缩小(保持比例)",-1)])],40,Li)],512)),[[e.vShow,h("cd-fit")]]),e.withDirectives(e.createElementVNode("div",Ui,[v[18]||(v[18]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(re,{"model-value":o.element.options.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[4]||(v[4]=p=>{o.element.options.maxWidth=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-max-width")]]),e.withDirectives(e.createElementVNode("div",Ii,[v[19]||(v[19]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(re,{"model-value":o.element.options.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[5]||(v[5]=p=>{o.element.options.maxHeight=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-max-height")]])],32)]),_:1}))}}),Hi={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},Oi={class:"pd-dialog-header"},Wi={class:"expression-editor"},Gi={class:"ee-nav"},Ki={class:"ee-nav-tabs"},qi={class:"ee-content"},Yi={class:"ee-content-search"},ji=["placeholder"],Xi={class:"ee-content-list"},Zi={class:"ee-field-group-icon"},Ji=["onDblclick"],Qi={class:"ee-field-info"},_i={class:"ee-item-label"},er={class:"ee-item-key"},tr={key:0,class:"pd-empty"},or=["onDblclick"],nr={class:"ee-field-info"},lr={class:"ee-item-label"},ar={class:"ee-item-key"},ir={class:"ee-func-group"},rr=["onDblclick"],sr={class:"ee-field-info"},dr={class:"ee-item-label"},cr={class:"ee-item-key"},ur={class:"ee-func-group"},mr=["onDblclick"],pr={class:"ee-field-info"},vr={class:"ee-item-label"},fr={class:"ee-item-key"},gr={class:"ee-func-group"},hr=["onDblclick"],br={class:"ee-field-info"},Er={class:"ee-item-label"},yr={class:"ee-item-key"},kr={class:"ee-editor"},Vr={class:"ee-editor-section"},Nr={class:"ee-editor-section"},wr={class:"pd-dialog-footer"},Cr=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(o,{emit:r}){const t=o,s=r,n=e.computed({get:()=>t.modelValue,set:U=>s("update:modelValue",U)}),l=e.ref("field"),a=e.computed(()=>{switch(l.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),i=e.ref(""),d=e.computed(()=>E.filterGroups(E.groupFields(t.fields??[]),i.value));e.watch(n,U=>{U&&(p.value=t.expression||"")});function m(U){const{insideParens:y}=g();W(y?U.fieldKey:`{${U.fieldKey}}`)}function c(U){const{insideParens:y}=g();W(y?U.template.replace(/^\{|\}$/g,""):U.template)}function f(U){const{insideBlock:y}=g(),M=y?U.template:`{${U.template}}`,N=M.indexOf("(")+1;W(M,N)}function g(){const y=B.value?.selectionStart??p.value.length,M=p.value.substring(0,y);let N=!1;const O=M.lastIndexOf("{");O!==-1&&!M.slice(O+1).includes("}")&&(N=!0);let A=!1;const k=M.lastIndexOf("(");return k!==-1&&!M.slice(k+1).includes(")")&&(A=!0),{insideBlock:N,insideParens:A}}const h=e.computed(()=>{if(!i.value.trim())return J;const U=i.value.trim().toLowerCase();return J.filter(y=>y.label.toLowerCase().includes(U)||y.name.toLowerCase().includes(U))}),R=e.computed(()=>{if(!i.value.trim())return _;const U=i.value.trim().toLowerCase();return _.filter(y=>y.label.toLowerCase().includes(U)||y.name.toLowerCase().includes(U))}),C=e.computed(()=>{if(!i.value.trim())return ne;const U=i.value.trim().toLowerCase();return ne.filter(y=>y.label.toLowerCase().includes(U)||y.name.toLowerCase().includes(U))}),v=e.computed(()=>{if(!i.value.trim())return G;const U=i.value.trim().toLowerCase();return G.filter(y=>y.label.toLowerCase().includes(U)||y.name.toLowerCase().includes(U))}),p=e.ref(t.expression||""),B=e.ref(null);e.watch(()=>t.expression,U=>{p.value=U||""});const _=[{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()"}],ne=[{name:"ADD",label:"相加",template:"ADD()"},{name:"SUB",label:"相减",template:"SUB()"},{name:"MUL",label:"相乘",template:"MUL()"},{name:"DIV",label:"相除",template:"DIV()"},{name:"ROUND",label:"四舍五入",template:"ROUND()"},{name:"ROUNDUP",label:"进一法",template:"ROUNDUP()"},{name:"ROUNDDOWN",label:"去尾法",template:"ROUNDDOWN()"},{name:"ROUNDBANK",label:"四舍六入五成双",template:"ROUNDBANK()"}],G=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],J=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],b=e.computed(()=>{if(!p.value.trim())return"(输入表达式后预览)";try{const U={...E.DEFAULT_DEMO_DATA,...he.resolveSystemVariables()},y=E.evaluateTemplate(p.value,U);return y==null?"(无法计算)":String(y)}catch{return"(表达式错误)"}});function W(U,y=U.length){const M=B.value;if(!M){p.value+=U;return}const N=M.selectionStart,O=M.selectionEnd,A=p.value.substring(0,N),k=p.value.substring(O);p.value=A+U+k;const z=N+y;e.nextTick(()=>{M.focus(),M.selectionStart=M.selectionEnd=z})}function j(){s("update:expression",p.value),n.value=!1}return(U,y)=>n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:y[7]||(y[7]=e.withKeys(M=>n.value=!1,["esc"]))},[e.createElementVNode("section",Hi,[e.createElementVNode("header",Oi,[y[8]||(y[8]=e.createElementVNode("strong",{id:"expression-editor-title"},"编辑表达式",-1)),e.createElementVNode("button",{type:"button",class:"pd-close","aria-label":"关闭",onClick:y[0]||(y[0]=M=>n.value=!1)},"×")]),e.createElementVNode("div",Wi,[e.createElementVNode("div",Gi,[y[9]||(y[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",Ki,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="field"}]),onClick:y[1]||(y[1]=M=>l.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="variable"}]),onClick:y[2]||(y[2]=M=>l.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="function"}]),onClick:y[3]||(y[3]=M=>l.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",qi,[e.createElementVNode("div",Yi,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":y[4]||(y[4]=M=>i.value=M),placeholder:a.value},null,8,ji),[[e.vModelText,i.value]])]),e.createElementVNode("div",Xi,[l.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,M=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:M.key||"_top"},[M.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":M.isList}])},[e.createElementVNode("span",Zi,e.toDisplayString(M.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(M.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.fields,N=>(e.openBlock(),e.createElementBlock("div",{key:N.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:M.key?"22px":"10px"}),onDblclick:O=>m(N)},[e.createElementVNode("div",Qi,[e.createElementVNode("span",_i,e.toDisplayString(N.fieldLabel),1),e.createElementVNode("span",er,e.toDisplayString(N.fieldKey),1)])],44,Ji))),128))],64))),128)),d.value.length===0?(e.openBlock(),e.createElementBlock("p",tr,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),l.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(h.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:"ee-list-item",onDblclick:N=>c(M)},[e.createElementVNode("div",nr,[e.createElementVNode("span",lr,e.toDisplayString(M.label),1),e.createElementVNode("span",ar,e.toDisplayString(M.template),1)])],40,or))),128)):e.createCommentVNode("",!0),l.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",ir,[y[10]||(y[10]=e.createElementVNode("div",{class:"ee-func-group-title"},"聚合函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:"ee-list-item",onDblclick:N=>f(M)},[e.createElementVNode("div",sr,[e.createElementVNode("span",dr,e.toDisplayString(M.label),1),e.createElementVNode("span",cr,e.toDisplayString(M.name)+"()",1)])],40,rr))),128))]),e.createElementVNode("div",ur,[y[11]||(y[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"数值运算",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:"ee-list-item",onDblclick:N=>f(M)},[e.createElementVNode("div",pr,[e.createElementVNode("span",vr,e.toDisplayString(M.label),1),e.createElementVNode("span",fr,e.toDisplayString(M.name)+"()",1)])],40,mr))),128))]),e.createElementVNode("div",gr,[y[12]||(y[12]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:"ee-list-item",onDblclick:N=>f(M)},[e.createElementVNode("div",br,[e.createElementVNode("span",Er,e.toDisplayString(M.label),1),e.createElementVNode("span",yr,e.toDisplayString(M.name)+"()",1)])],40,hr))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",kr,[e.createElementVNode("div",Vr,[y[13]||(y[13]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:B,"onUpdate:modelValue":y[5]||(y[5]=M=>p.value=M),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,p.value]])]),e.createElementVNode("div",Nr,[y[14]||(y[14]=e.createElementVNode("div",{class:"ee-editor-title"},"预览结果",-1)),e.createElementVNode("div",{class:e.normalizeClass(["ee-preview",{"ee-preview-error":b.value==="(表达式错误)"}])},e.toDisplayString(b.value),3)]),y[15]||(y[15]=e.createStaticVNode('<div class="ee-help-section" data-v-3fb017fe><div class="ee-help-title" data-v-3fb017fe>帮助信息</div><div class="ee-help-grid" data-v-3fb017fe><div class="ee-help-card ee-help-field" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>输入方式</div><div class="ee-help-card-content" data-v-3fb017fe> 双击左侧字段、变量、函数即可插入到表达式输入框中<br data-v-3fb017fe> 静态数据直接输入即可,如:供应商名称<br data-v-3fb017fe> 动态解析字段、变量、函数必须用 {} 包裹<br data-v-3fb017fe> 示例:{SUM(supplier.name)}<br data-v-3fb017fe> 注意:只能嵌套一层 </div></div><div class="ee-help-card ee-help-function" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>函数使用</div><div class="ee-help-card-content" data-v-3fb017fe> SUM(字段) - 求和<br data-v-3fb017fe> AVG(字段) - 平均值<br data-v-3fb017fe> COUNT(字段) - 计数<br data-v-3fb017fe> IF(条件, 真值, 假值) - 条件判断<br data-v-3fb017fe> 四则运算:{qty * price}、{ADD(qty, 1)}<br data-v-3fb017fe> 修约:ROUND 四舍五入 / ROUNDUP 进一 / ROUNDDOWN 去尾 / ROUNDBANK 四舍六入五成双 </div></div><div class="ee-help-card ee-help-variable" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>系统变量</div><div class="ee-help-card-content" data-v-3fb017fe> {pageIndex} - 当前页码<br data-v-3fb017fe> {totalPages} - 总页数<br data-v-3fb017fe> {printDate} - 打印日期 </div></div><div class="ee-help-card ee-help-conditional" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>示例</div><div class="ee-help-card-content" data-v-3fb017fe> 静态文本:供应商名称<br data-v-3fb017fe> 动态字段:{supplier.name}<br data-v-3fb017fe> 函数调用:{SUM(amount)}<br data-v-3fb017fe> 条件判断:{IF(amount>1000, "大单", "小单")}<br data-v-3fb017fe> 运算并修约:{ROUND(qty * price, 2)} </div></div></div></div>',1))])]),e.createElementVNode("footer",wr,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:y[6]||(y[6]=M=>n.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:j},"确定")])])],32)):e.createCommentVNode("",!0)}}),Qe=ce(Cr,[["__scopeId","data-v-3fb017fe"]]),Sr={class:"pd-field"},xr={class:"pd-label"},$r=["value","placeholder"],Br=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=r,s=e.ref(!1);function n(){s.value=!0}return(l,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",Sr,[e.createElementVNode("span",xr,e.toDisplayString(o.descriptor.label),1),e.createElementVNode("input",{value:o.modelValue,class:"pd-input",placeholder:o.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:a[0]||(a[0]=i=>t("update:modelValue",i.target.value)),onDblclick:n},null,40,$r)]),e.createVNode(Qe,{modelValue:s.value,"onUpdate:modelValue":a[1]||(a[1]=i=>s.value=i),fields:o.fields,expression:o.modelValue,"onUpdate:expression":a[2]||(a[2]=i=>t("update:modelValue",i))},null,8,["modelValue","fields","expression"])],64))}}),Dr={class:"pd-field"},Tr=["value"],Mr=["value"],zr={class:"pd-field"},Ar={class:"pd-field"},Pr={class:"pd-field"},Rr={class:"pd-field"},Lr={style:{width:"60px"}},Ur=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(o){const r=o,t=e.inject(He,null),s=e.computed(()=>r.fields.filter(a=>a.fieldType==="list").map(a=>({label:a.fieldLabel,value:a.fieldKey})));function n(a){r.element.options.dataSource=a||void 0,t?.recordHistory()}function l(a,i){if(i===void 0)return;const d=r.element.options.tableColWidths,m=t?.maxTableWidth.value??1/0,c=d.reduce((f,g,h)=>h===a?f:f+g,0);if(c+i>m){const f=Math.max(5,Math.round((m-c)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${m}mm,列${a+1} 已调整为 ${f}mm`),d[a]=f}else d[a]=i;E.syncTableElementSize(r.element.options),t?.recordHistory()}return(a,i)=>(e.openBlock(),e.createBlock($e,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[4]||(i[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Dr,[i[5]||(i[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:o.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:i[0]||(i[0]=d=>n(d.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,d=>(e.openBlock(),e.createElementBlock("option",{key:d.value,value:d.value},e.toDisplayString(d.label),9,Mr))),128))],40,Tr)]),e.createElementVNode("div",zr,[i[6]||(i[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(re,{modelValue:o.element.options.tableDefaultFontSize,"onUpdate:modelValue":i[1]||(i[1]=d=>o.element.options.tableDefaultFontSize=d),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Ar,[i[7]||(i[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(Ne,{modelValue:o.element.options.tableDefaultColor,"onUpdate:modelValue":i[2]||(i[2]=d=>o.element.options.tableDefaultColor=d)},null,8,["modelValue"])]),e.createElementVNode("div",Pr,[i[8]||(i[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(re,{modelValue:o.element.options.tableDefaultPadding,"onUpdate:modelValue":i[3]||(i[3]=d=>o.element.options.tableDefaultPadding=d),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Rr,[i[9]||(i[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.element.options.tableColWidths,(d,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"col-width-row"},[e.createElementVNode("span",Lr,"列"+e.toDisplayString(m+1),1),e.createVNode(re,{"model-value":d,min:5,max:200,"onUpdate:modelValue":c=>l(m,c)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),Ir=ce(Ur,[["__scopeId","data-v-b5fdc7ff"]]),Fr={class:"border-row"},Hr={class:"pd-field"},Or={class:"pd-field"},Wr={class:"pd-field"},Gr=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o;function t(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[3]||(n[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Fr,[e.withDirectives(e.createElementVNode("div",Hr,[n[4]||(n[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(re,{modelValue:o.element.options.borderWidth,"onUpdate:modelValue":n[0]||(n[0]=l=>o.element.options.borderWidth=l),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",Or,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(Ne,{modelValue:o.element.options.borderColor,"onUpdate:modelValue":n[1]||(n[1]=l=>o.element.options.borderColor=l)},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",Wr,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ne,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":n[2]||(n[2]=l=>o.element.options.backgroundColor=l)},null,8,["modelValue"])],512),[[e.vShow,t("bb-bg-color")]])],32)]),_:1}))}}),Kr=ce(Gr,[["__scopeId","data-v-e0e6d714"]]),qr={class:"advanced-row"},Yr={class:"pd-field"},jr={class:"pd-field"},Xr={class:"pd-field"},Zr={class:"pd-field"},Jr=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(o){const r=o;function t(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[4]||(n[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",qr,[e.withDirectives(e.createElementVNode("div",Yr,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":n[0]||(n[0]=l=>o.element.options.locked=l)},null,512),[[e.vModelCheckbox,o.element.options.locked]])],512),[[e.vShow,t("ad-locked")]]),e.withDirectives(e.createElementVNode("div",jr,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":n[1]||(n[1]=l=>o.element.options.fixed=l)},null,512),[[e.vModelCheckbox,o.element.options.fixed]])],512),[[e.vShow,t("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",Xr,[n[7]||(n[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(re,{modelValue:o.element.options.zIndex,"onUpdate:modelValue":n[2]||(n[2]=l=>o.element.options.zIndex=l),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,t("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",Zr,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:n[3]||(n[3]=l=>s.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,t("ad-delete")]])],32)]),_:1}))}}),Qr=ce(Jr,[["__scopeId","data-v-14924be2"]]),_r={key:0,class:"pd-field"},es=["checked"],ts={class:"pd-field"},os=["checked"],ns={class:"pd-field"},ls=["checked"],Bt=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>r.element.printElementType.type==="table"),s=e.computed({get:()=>r.element.options.tablePagination?.enabled??!0,set:()=>{}});function n(c){r.element.options.tablePagination={enabled:c}}const l=e.computed({get:()=>r.element.options.pagination?.pageable??!0,set:()=>{}}),a=e.computed({get:()=>r.element.options.pagination?.keepWithNext??!1,set:()=>{}});function i(c){r.element.options.pagination={pageable:c,keepWithNext:a.value}}function d(c){r.element.options.pagination={pageable:l.value,keepWithNext:c}}function m(c){return r.searching?r.matchedKeys?.has(c)??!0:!0}return(c,f)=>(e.openBlock(),e.createBlock($e,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:f[3]||(f[3]=e.withModifiers(()=>{},["prevent"]))},[t.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",_r,[f[4]||(f[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:s.value,onChange:f[0]||(f[0]=g=>n(g.target.checked))},null,40,es)],512)),[[e.vShow,m("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",ts,[f[5]||(f[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:l.value,onChange:f[1]||(f[1]=g=>i(g.target.checked))},null,40,os)],512),[[e.vShow,m("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",ns,[f[6]||(f[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:a.value,onChange:f[2]||(f[2]=g=>d(g.target.checked))},null,40,ls)],512),[[e.vShow,m("pg-keep-with-next")]])],64))],32)]),_:1}))}}),as={class:"image-content-upload"},is=["disabled"],rs=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(!1),l=e.inject(vt,e.computed(()=>{})),a=e.computed(()=>t.disabled||n.value||!l.value);async function i(d){const m=d.target,c=m.files?.[0];if(c){if(!c.type.startsWith("image/")){alert("仅支持上传图片文件"),m.value="";return}if(!l.value){alert("图片上传能力未配置"),m.value="";return}n.value=!0;try{const f=await l.value(c);f?s("success",f):alert("图片上传失败")}catch(f){alert(f instanceof Error?f.message:"图片上传失败")}finally{n.value=!1,m.value=""}}}return(d,m)=>(e.openBlock(),e.createElementBlock("div",as,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[m[0]||(m[0]=e.createElementVNode("svg",{class:"pd-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[e.createElementVNode("path",{fill:"currentColor",d:"M12 3l4 4h-3v7h-2V7H8zm-7 12h14v5H5Z"})],-1)),e.createTextVNode(" "+e.toDisplayString(n.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:i},null,40,is)],2),m[1]||(m[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),ss=ce(rs,[["__scopeId","data-v-b730e8e6"]]),ds={class:"pd-field"},cs=["value"],us={class:"pd-field"},ms={key:0,class:"pd-field"},ps=["checked"],vs=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(o){const r=o,t=e.inject(He),s=e.computed(()=>r.element.options.tableRows[r.selection.r1]);function n(i){const d=E.setRowType(r.element.options.tableRows,r.selection.r1,i);if(d){alert(d);return}t.recordHistory()}function l(i){i!==void 0&&(s.value.height=i,E.syncTableElementSize(r.element.options),t.recordHistory())}function a(i){E.setHeaderRepeat(r.element.options.tableRows,i),t.recordHistory()}return(i,d)=>(e.openBlock(),e.createBlock($e,{title:"行属性",icon:"Grid","default-expanded":"","group-key":"table-row"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:d[2]||(d[2]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",ds,[d[4]||(d[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:s.value.type,class:"pd-select",style:{width:"100%"},onChange:d[0]||(d[0]=m=>n(m.target.value))},[...d[3]||(d[3]=[e.createElementVNode("option",{value:"header"},"标题行",-1),e.createElementVNode("option",{value:"data"},"数据行",-1),e.createElementVNode("option",{value:"subtotal"},"小计行(每页小计)",-1),e.createElementVNode("option",{value:"summary"},"汇总行",-1)])],40,cs)]),e.createElementVNode("div",us,[d[5]||(d[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(re,{"model-value":s.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":l},null,8,["model-value"])]),s.value.type==="header"?(e.openBlock(),e.createElementBlock("div",ms,[d[6]||(d[6]=e.createElementVNode("span",{class:"pd-label",title:"多级表头作为一个结构整体重复,勾选后表头区所有行都会在每页顶部重复"},"表头每页重复",-1)),e.createElementVNode("input",{checked:s.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:d[1]||(d[1]=m=>a(!!m.target.checked))},null,40,ps)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),fs={class:"pd-field"},gs={class:"pd-radio-group",role:"radiogroup"},hs={class:"pd-radio"},bs=["checked"],Es={class:"pd-radio"},ys=["checked"],ks={class:"pd-radio"},Vs=["checked"],Ns={class:"pd-radio"},ws=["checked"],Cs={key:0,class:"pd-field"},Ss=["value"],xs={key:1,class:"pd-field"},$s=["checked"],Bs={key:2,class:"pd-field"},Ds={key:3,class:"pd-hint"},Ts={key:4,class:"pd-field"},Ms={key:5,class:"pd-field"},zs=["value"],As={key:6,class:"pd-hint"},Ps={key:7,class:"pd-field"},Rs=["value"],Ls={key:8,class:"pd-hint"},Us={key:9,class:"pd-field"},Is=["value"],Fs={key:10,class:"pd-field"},Hs={key:11,class:"pd-field"},Os={class:"pd-field"},Ws=["value"],Gs={class:"pd-field"},Ks={class:"pd-radio-group",role:"radiogroup"},qs={class:"pd-radio"},Ys=["checked"],js={class:"pd-radio"},Xs=["checked"],Zs={class:"pd-radio"},Js=["checked"],Qs={class:"pd-field"},_s={class:"pd-radio-group",role:"radiogroup"},ed={class:"pd-radio"},td=["checked"],od={class:"pd-radio"},nd=["checked"],ld={class:"pd-radio"},ad=["checked"],id={class:"cell-style-grid"},rd={class:"pd-field cell-font-field"},sd={class:"pd-field"},dd={class:"pd-field"},cd=["checked"],ud={class:"pd-field"},md={class:"pd-field"},pd={class:"border-style-row"},vd={style:{width:"112px","flex-shrink":"0"}},fd={class:"pd-button-group border-presets"},gd={class:"pd-checkbox-group"},hd={class:"pd-checkbox"},bd={class:"pd-checkbox"},Ed={class:"pd-checkbox"},yd={class:"pd-checkbox"},kd={class:"pd-field"},Vd={class:"pd-field"},Nd=["checked"],wd={key:12,class:"pd-field"},Cd=["value"],Sd={key:13,class:"pd-field"},xd={class:"merge-btns"},$d=["disabled","title"],Bd=["disabled"],Dd=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(o,{expose:r}){const t=o,s=e.inject(He),n=e.computed(()=>t.element.options.tableRows),l=e.computed(()=>{const z=E.findMainCell(n.value,t.selection.r1,t.selection.c1);return n.value[z.r].cells[z.c]}),a=e.ref(!1),i=e.ref(""),d=e.computed(()=>l.value.cellType==="barcode"),m=e.computed(()=>l.value.cellType==="qrcode"),c=e.computed(()=>l.value.cellType==="image"),f=e.computed(()=>d.value&&!!l.value.printerDpi),g=e.computed(()=>!d.value&&!m.value&&!c.value),h=e.computed(()=>E.resolveCellTextFit(l.value));function R(z){const u=z.target.value;G(x=>{x.textFit=u})}function C(z){G(u=>{u.align=z})}function v(z){G(u=>{u.valign=z})}function p(z){const u=Number(z);G(x=>{x.printerDpi=u>0?u:void 0})}function B(z){G(u=>{u.cellType=z==="text"?void 0:z,z!=="barcode"&&(u.barcodeType=void 0,u.showBarcodeText=void 0,u.printerDpi=void 0),z!=="qrcode"&&(u.qrCodeLevel=void 0)})}function _(){i.value=l.value.formatter||"",a.value=!0}function ne(z){G(u=>{u.formatter=z||void 0})}function G(z){const u=t.selection;for(let x=u.r1;x<=u.r2;x++)for(let Y=u.c1;Y<=u.c2;Y++){const be=n.value[x].cells[Y];be.merged||z(be)}s.recordHistory()}const J=e.ref("solid"),b=e.ref(.75),W=e.ref("#333333"),j=e.ref([]);function U(){return{width:b.value,style:J.value,color:W.value}}function y(z){E.applyBorderPreset(n.value,t.selection,z,U()),s.recordHistory()}function M(z){const u=z.target,x=new Set(j.value);u.checked?x.add(u.value):x.delete(u.value),j.value=[...x];const Y=U();G(be=>{const ge={...be.borders??{}};for(const fe of["top","right","bottom","left"])x.has(fe)?ge[fe]={...Y}:delete ge[fe];be.borders=ge})}const N=e.computed(()=>E.canMergeReason(n.value,t.selection)),O=e.computed(()=>{const z=t.selection;for(let u=z.r1;u<=z.r2;u++)for(let x=z.c1;x<=z.c2;x++){const Y=n.value[u].cells[x];if(!Y.merged&&((Y.rowspan??1)>1||(Y.colspan??1)>1))return!0}return!1});function A(){E.mergeCells(n.value,t.selection),s.recordHistory()}function k(){E.splitCells(n.value,t.selection),s.recordHistory()}return r({openFormatterEditor:_}),(z,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode($e,{title:"单元格",icon:"Menu","default-expanded":"","group-key":"table-cell"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:u[43]||(u[43]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",fs,[u[49]||(u[49]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",gs,[e.createElementVNode("label",hs,[e.createElementVNode("input",{type:"radio",value:"text",checked:(l.value.cellType||"text")==="text",onChange:u[0]||(u[0]=x=>B(x.target.value))},null,40,bs),u[45]||(u[45]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",Es,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:l.value.cellType==="barcode",onChange:u[1]||(u[1]=x=>B(x.target.value))},null,40,ys),u[46]||(u[46]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",ks,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:l.value.cellType==="qrcode",onChange:u[2]||(u[2]=x=>B(x.target.value))},null,40,Vs),u[47]||(u[47]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",Ns,[e.createElementVNode("input",{type:"radio",value:"image",checked:l.value.cellType==="image",onChange:u[3]||(u[3]=x=>B(x.target.value))},null,40,ws),u[48]||(u[48]=e.createElementVNode("span",null,"图片",-1))])])]),d.value?(e.openBlock(),e.createElementBlock("div",Cs,[u[51]||(u[51]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:l.value.barcodeType||"CODE128",class:"pd-select",onChange:u[4]||(u[4]=x=>G(Y=>{Y.barcodeType=x.target.value||void 0}))},[...u[50]||(u[50]=[e.createElementVNode("option",{value:"CODE128"},"CODE128(通用)",-1),e.createElementVNode("option",{value:"EAN13"},"EAN13(商品码)",-1),e.createElementVNode("option",{value:"EAN8"},"EAN8",-1),e.createElementVNode("option",{value:"UPC"},"UPC",-1),e.createElementVNode("option",{value:"CODE39"},"CODE39",-1),e.createElementVNode("option",{value:"ITF14"},"ITF14",-1)])],40,Ss)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",xs,[u[52]||(u[52]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:l.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:u[5]||(u[5]=x=>G(Y=>{Y.showBarcodeText=!!x.target.checked}))},null,40,$s)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Bs,[u[53]||(u[53]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(re,{"model-value":l.value.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":u[6]||(u[6]=x=>G(Y=>{Y.barWidth=x}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Ds,e.toDisplayString(f.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),1)):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Ts,[u[54]||(u[54]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(re,{"model-value":l.value.barFontSize??10,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":u[7]||(u[7]=x=>G(Y=>{Y.barFontSize=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Ms,[u[56]||(u[56]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{value:l.value.printerDpi?String(l.value.printerDpi):"",class:"pd-select",onChange:u[8]||(u[8]=x=>p(x.target.value))},[...u[55]||(u[55]=[e.createElementVNode("option",{value:""},"不指定(按条宽渲染)",-1),e.createElementVNode("option",{value:"203"},"203 dpi(8 点/mm)",-1),e.createElementVNode("option",{value:"300"},"300 dpi(11.8 点/mm)",-1),e.createElementVNode("option",{value:"600"},"600 dpi(23.6 点/mm)",-1)])],40,zs)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",As,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小")):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",Ps,[u[58]||(u[58]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:l.value.qrCodeLevel||"M",class:"pd-select",onChange:u[9]||(u[9]=x=>G(Y=>{Y.qrCodeLevel=x.target.value||void 0}))},[...u[57]||(u[57]=[e.createElementVNode("option",{value:"L"},"L(最低,容量大)",-1),e.createElementVNode("option",{value:"M"},"M(推荐)",-1),e.createElementVNode("option",{value:"Q"},"Q",-1),e.createElementVNode("option",{value:"H"},"H(最高)",-1)])],40,Rs)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Ls,"单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),m.value||c.value?(e.openBlock(),e.createElementBlock("div",Us,[u[60]||(u[60]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:l.value.fit||"contain",class:"pd-select",onChange:u[10]||(u[10]=x=>G(Y=>{Y.fit=x.target.value}))},[...u[59]||(u[59]=[e.createElementVNode("option",{value:"contain"},"包含(保持比例)",-1),e.createElementVNode("option",{value:"cover"},"覆盖(保持比例)",-1),e.createElementVNode("option",{value:"fill"},"拉伸填满",-1),e.createElementVNode("option",{value:"none"},"原始尺寸",-1),e.createElementVNode("option",{value:"scale-down"},"缩小(保持比例)",-1)])],40,Is)])):e.createCommentVNode("",!0),d.value||m.value||c.value?(e.openBlock(),e.createElementBlock("div",Fs,[u[61]||(u[61]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(re,{"model-value":l.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[11]||(u[11]=x=>G(Y=>{Y.maxWidth=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value||m.value||c.value?(e.openBlock(),e.createElementBlock("div",Hs,[u[62]||(u[62]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(re,{"model-value":l.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[12]||(u[12]=x=>G(Y=>{Y.maxHeight=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Os,[u[63]||(u[63]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:l.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:u[13]||(u[13]=x=>G(Y=>{Y.formatter=x.target.value||void 0})),onDblclick:_},null,40,Ws)]),e.createElementVNode("div",Gs,[u[67]||(u[67]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",Ks,[e.createElementVNode("label",qs,[e.createElementVNode("input",{type:"radio",value:"left",checked:l.value.align==="left",onChange:u[14]||(u[14]=x=>C(x.target.value))},null,40,Ys),u[64]||(u[64]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",js,[e.createElementVNode("input",{type:"radio",value:"center",checked:l.value.align==="center",onChange:u[15]||(u[15]=x=>C(x.target.value))},null,40,Xs),u[65]||(u[65]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Zs,[e.createElementVNode("input",{type:"radio",value:"right",checked:l.value.align==="right",onChange:u[16]||(u[16]=x=>C(x.target.value))},null,40,Js),u[66]||(u[66]=e.createElementVNode("span",null,"右",-1))])])]),e.createElementVNode("div",Qs,[u[71]||(u[71]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",_s,[e.createElementVNode("label",ed,[e.createElementVNode("input",{type:"radio",value:"top",checked:l.value.valign==="top",onChange:u[17]||(u[17]=x=>v(x.target.value))},null,40,td),u[68]||(u[68]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",od,[e.createElementVNode("input",{type:"radio",value:"middle",checked:l.value.valign==="middle",onChange:u[18]||(u[18]=x=>v(x.target.value))},null,40,nd),u[69]||(u[69]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ld,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:l.value.valign==="bottom",onChange:u[19]||(u[19]=x=>v(x.target.value))},null,40,ad),u[70]||(u[70]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",id,[e.createElementVNode("div",rd,[u[72]||(u[72]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(ht,{"model-value":l.value.fontFamily,placeholder:"继承默认","onUpdate:modelValue":u[20]||(u[20]=x=>G(Y=>{Y.fontFamily=x}))},null,8,["model-value"])]),e.createElementVNode("div",sd,[u[73]||(u[73]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(re,{"model-value":l.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":u[21]||(u[21]=x=>G(Y=>{Y.fontSize=x??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",dd,[u[74]||(u[74]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:l.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:u[22]||(u[22]=x=>G(Y=>{Y.fontWeight=x.target.checked?"bold":void 0}))},null,40,cd)]),e.createElementVNode("div",ud,[u[75]||(u[75]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(Ne,{"model-value":l.value.color,"onUpdate:modelValue":u[23]||(u[23]=x=>G(Y=>{Y.color=x}))},null,8,["model-value"])]),e.createElementVNode("div",md,[u[76]||(u[76]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ne,{"model-value":l.value.backgroundColor,"onUpdate:modelValue":u[24]||(u[24]=x=>G(Y=>{Y.backgroundColor=x}))},null,8,["model-value"])])]),u[87]||(u[87]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",pd,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":u[25]||(u[25]=x=>J.value=x),style:{width:"90px"}},[...u[77]||(u[77]=[e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1),e.createElementVNode("option",{value:"double"},"双线",-1)])],512),[[e.vModelSelect,J.value]]),e.createElementVNode("div",vd,[e.createVNode(re,{modelValue:b.value,"onUpdate:modelValue":u[26]||(u[26]=x=>b.value=x),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(Ne,{modelValue:W.value,"onUpdate:modelValue":u[27]||(u[27]=x=>W.value=x),clearable:!1},null,8,["modelValue"])]),e.createElementVNode("div",fd,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[28]||(u[28]=x=>y("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[29]||(u[29]=x=>y("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[30]||(u[30]=x=>y("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[31]||(u[31]=x=>y("none"))},"无")]),e.createElementVNode("div",gd,[e.createElementVNode("label",hd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[32]||(u[32]=x=>j.value=x),value:"top",onChange:u[33]||(u[33]=x=>M(x))},null,544),[[e.vModelCheckbox,j.value]]),u[78]||(u[78]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",bd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[34]||(u[34]=x=>j.value=x),value:"right",onChange:u[35]||(u[35]=x=>M(x))},null,544),[[e.vModelCheckbox,j.value]]),u[79]||(u[79]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",Ed,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[36]||(u[36]=x=>j.value=x),value:"bottom",onChange:u[37]||(u[37]=x=>M(x))},null,544),[[e.vModelCheckbox,j.value]]),u[80]||(u[80]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",yd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[38]||(u[38]=x=>j.value=x),value:"left",onChange:u[39]||(u[39]=x=>M(x))},null,544),[[e.vModelCheckbox,j.value]]),u[81]||(u[81]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",kd,[u[82]||(u[82]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(re,{"model-value":l.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":u[40]||(u[40]=x=>G(Y=>{Y.padding=x??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",Vd,[u[83]||(u[83]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:l.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:u[41]||(u[41]=x=>G(Y=>{Y.wordWrap=!!x.target.checked}))},null,40,Nd)]),g.value?(e.openBlock(),e.createElementBlock("div",wd,[u[85]||(u[85]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:h.value,style:{width:"100%"},onChange:R},[...u[84]||(u[84]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,Cd)])):e.createCommentVNode("",!0),g.value&&h.value==="shrink"?(e.openBlock(),e.createElementBlock("div",Sd,[u[86]||(u[86]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(re,{"model-value":l.value.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":u[42]||(u[42]=x=>G(Y=>{Y.shrinkMinFontSize=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",xd,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!N.value,title:N.value||"",onClick:A}," 合并单元格 ",8,$d),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!O.value,onClick:k},"拆分单元格",8,Bd)])],32)]),_:1}),e.createVNode(Qe,{modelValue:a.value,"onUpdate:modelValue":u[44]||(u[44]=x=>a.value=x),fields:o.fields,expression:i.value,"onUpdate:expression":ne},null,8,["modelValue","fields","expression"])],64))}}),Td=ce(Dd,[["__scopeId","data-v-291c10c6"]]),Md={class:"watermark-config"},zd={class:"pd-field"},Ad={key:0,class:"pd-field"},Pd={class:"pd-field"},Rd={class:"pd-hint"},Ld={class:"pd-field"},Ud={class:"pd-field"},Id={class:"pd-hint"},Fd={class:"pd-field"},Hd=["value"],Od={class:"pd-field"},Wd=["min"],Gd={class:"pd-field"},Kd=["min"],qd=e.defineComponent({__name:"WatermarkConfig",props:{modelValue:{},fields:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=he.WATERMARK_DENSITY_PRESETS,l=he.WATERMARK_DEFAULTS.minTileWidth,a=he.WATERMARK_DEFAULTS.minTileHeight;function i(J){const b=J.trim();return b?/[{}]/.test(b)||/^[A-Za-z_$][\w$]*\s*\(/.test(b)?!0:/^[A-Za-z_$][\w$]*(\.[\w$]+)+$/.test(b):!1}function d(J){return J?J.mode==="binding"?J.binding??"":J.content??"":""}const m=e.ref(d(t.modelValue)),c=e.ref(t.modelValue?.testData||""),f=e.ref(!1),g=e.ref(t.modelValue?.mode==="binding"?"binding":"fixed"),h=e.reactive({rotate:t.modelValue?.rotate??he.WATERMARK_DEFAULTS.rotate,color:t.modelValue?.color||he.WATERMARK_DEFAULTS.color,opacity:t.modelValue?.opacity??he.WATERMARK_DEFAULTS.opacity,tileWidth:t.modelValue?.tileWidth??he.WATERMARK_DEFAULTS.tileWidth,tileHeight:t.modelValue?.tileHeight??he.WATERMARK_DEFAULTS.tileHeight}),R=e.computed(()=>g.value==="binding");e.watch(()=>t.modelValue,J=>{J&&(m.value=d(J),g.value=J.mode==="binding"?"binding":"fixed",c.value=J.testData||"",h.rotate=J.rotate??he.WATERMARK_DEFAULTS.rotate,h.color=J.color||he.WATERMARK_DEFAULTS.color,h.opacity=J.opacity??he.WATERMARK_DEFAULTS.opacity,h.tileWidth=J.tileWidth??he.WATERMARK_DEFAULTS.tileWidth,h.tileHeight=J.tileHeight??he.WATERMARK_DEFAULTS.tileHeight)},{deep:!0});const C=e.computed({get(){const{tileWidth:J,tileHeight:b}=h;for(const[W,j]of Object.entries(n))if(J===j.width&&b===j.height)return W;return"custom"},set(J){const b=n[J];b&&(h.tileWidth=b.width,h.tileHeight=b.height)}});function v(){g.value=i(m.value)?"binding":"fixed",G()}function p(){v()}function B(){f.value=!0}function _(J){m.value=J,v()}function ne(J){h.color=J,G()}function G(){const J={testData:c.value,rotate:h.rotate,color:h.color,opacity:h.opacity,tileWidth:h.tileWidth,tileHeight:h.tileHeight};s("update:modelValue",g.value==="binding"?{...J,mode:"binding",binding:m.value,content:""}:{...J,mode:"fixed",content:m.value,binding:""})}return(J,b)=>(e.openBlock(),e.createElementBlock("div",Md,[b[18]||(b[18]=e.createElementVNode("h3",{class:"pd-divider"},"水印",-1)),e.createElementVNode("form",{class:"pd-form",onSubmit:b[8]||(b[8]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",zd,[b[9]||(b[9]=e.createElementVNode("span",{class:"pd-label"},"水印表达式",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":b[0]||(b[0]=W=>m.value=W),placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onInput:p,onDblclick:B},null,544),[[e.vModelText,m.value]]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:B},"编辑表达式")]),R.value?(e.openBlock(),e.createElementBlock("div",Ad,[b[10]||(b[10]=e.createElementVNode("span",{class:"pd-label"},"测试值",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":b[1]||(b[1]=W=>c.value=W),placeholder:"表达式取不到值时预览显示",onInput:G},null,544),[[e.vModelText,c.value]])])):e.createCommentVNode("",!0),e.createVNode(Qe,{modelValue:f.value,"onUpdate:modelValue":b[2]||(b[2]=W=>f.value=W),fields:o.fields,expression:m.value,"onUpdate:expression":_},null,8,["modelValue","fields","expression"]),e.createElementVNode("div",Pd,[b[11]||(b[11]=e.createElementVNode("span",{class:"pd-label"},"旋转角度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":b[3]||(b[3]=W=>h.rotate=W),min:-90,max:90,step:5,onChange:G},null,544),[[e.vModelText,h.rotate,void 0,{number:!0}]]),e.createElementVNode("span",Rd,e.toDisplayString(h.rotate)+"°",1)]),e.createElementVNode("div",Ld,[b[12]||(b[12]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ne,{"model-value":h.color,"onUpdate:modelValue":ne},null,8,["model-value"])]),e.createElementVNode("div",Ud,[b[13]||(b[13]=e.createElementVNode("span",{class:"pd-label"},"透明度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":b[4]||(b[4]=W=>h.opacity=W),min:.05,max:.5,step:.05,onChange:G},null,544),[[e.vModelText,h.opacity,void 0,{number:!0}]]),e.createElementVNode("span",Id,e.toDisplayString(h.opacity.toFixed(2)),1)]),e.createElementVNode("div",Fd,[b[15]||(b[15]=e.createElementVNode("span",{class:"pd-label"},"密度",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":b[5]||(b[5]=W=>C.value=W),style:{width:"100%"},onChange:G},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),(W,j)=>(e.openBlock(),e.createElementBlock("option",{key:j,value:j},e.toDisplayString(W.label)+"("+e.toDisplayString(W.width)+"×"+e.toDisplayString(W.height)+")",9,Hd))),128)),b[14]||(b[14]=e.createElementVNode("option",{value:"custom"},"自定义",-1))],544),[[e.vModelSelect,C.value]])]),C.value==="custom"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Od,[b[16]||(b[16]=e.createElementVNode("span",{class:"pd-label"},"瓦片宽",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":b[6]||(b[6]=W=>h.tileWidth=W),min:e.unref(l),step:10,onChange:G},null,40,Wd),[[e.vModelText,h.tileWidth,void 0,{number:!0}]])]),e.createElementVNode("div",Gd,[b[17]||(b[17]=e.createElementVNode("span",{class:"pd-label"},"瓦片高",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":b[7]||(b[7]=W=>h.tileHeight=W),min:e.unref(a),step:10,onChange:G},null,40,Kd),[[e.vModelText,h.tileHeight,void 0,{number:!0}]])])],64)):e.createCommentVNode("",!0)],32)]))}}),Yd=ce(qd,[["__scopeId","data-v-b55bfc50"]]),jd={class:"design-background-config"},Xd=["title"],Zd={class:"design-background-actions"},Jd=["disabled"],Qd=e.defineComponent({__name:"DesignBackgroundConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(!1),l=e.inject(ft,e.computed(()=>{})),a=e.computed(()=>n.value||!l.value),i=e.computed(()=>t.modelValue?.rotation??0);async function d(f){const g=f.target,h=g.files?.[0];if(h){if(!h.type.startsWith("image/")){alert("仅支持上传图片文件"),g.value="";return}if(!l.value){alert("设计背景上传能力未配置"),g.value="";return}n.value=!0;try{const R=await l.value(h);R?s("update:modelValue",{src:R,rotation:0}):alert("设计背景上传失败")}catch(R){alert(R instanceof Error?R.message:"设计背景上传失败")}finally{n.value=!1,g.value=""}}}function m(){if(!t.modelValue?.src)return;const f=(i.value+90)%360;s("update:modelValue",{src:t.modelValue.src,rotation:f})}function c(){s("update:modelValue",void 0)}return(f,g)=>(e.openBlock(),e.createElementBlock("div",jd,[g[0]||(g[0]=e.createElementVNode("h3",{class:"pd-divider"},"设计背景",-1)),g[1]||(g[1]=e.createElementVNode("p",{class:"design-background-tip"},"仅设计器显示,用于套打定位,不会出现在预览和打印中",-1)),o.modelValue?.src?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"design-background-path",title:o.modelValue.src},e.toDisplayString(o.modelValue.src),9,Xd),e.createElementVNode("div",Zd,[e.createElementVNode("button",{type:"button",class:"pd-button small rotate-btn",onClick:m}," 旋转("+e.toDisplayString(i.value)+"°) ",1),e.createElementVNode("button",{type:"button",class:"pd-button small remove-btn",onClick:c},"移除")])],64)):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[e.createTextVNode(e.toDisplayString(n.value?"上传中...":"上传背景图")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:d},null,40,Jd)],2))]))}}),_d=ce(Qd,[["__scopeId","data-v-3f4d2e32"]]),ec={class:"tiling-config","data-test":"tiling-config"},tc={class:"pd-field"},oc={class:"tiling-switch"},nc=["checked","disabled"],lc={key:0,class:"pd-hint tiling-error"},ac={class:"pd-field"},ic=["value"],rc=["value"],sc={key:0,class:"pd-field"},dc={class:"custom-size-grid"},cc={key:1,class:"pd-field"},uc={class:"pd-radio-group",role:"radiogroup"},mc={class:"pd-radio"},pc=["checked"],vc={class:"pd-radio"},fc=["checked"],gc={class:"margin-grid"},hc={class:"pd-field"},bc={class:"pd-field"},Ec={class:"pd-field"},yc={class:"pd-field"},kc={class:"pd-field"},Vc={class:"pd-field"},Nc={class:"pd-field"},wc={key:2,class:"pd-hint tiling-summary"},Cc=e.defineComponent({__name:"TilingConfig",props:{modelValue:{},templateData:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=Object.keys(E.PAPER_PRESETS).filter(v=>v!=="CUSTOM"&&!E.PAPER_PRESETS[v]?.continuous),l=e.computed(()=>E.isContinuousPaperSize(t.templateData?.paperSize)),a=e.computed(()=>({...he.TILE_DEFAULTS,...t.modelValue??{},enabled:t.modelValue?.enabled??!1,sheetMargin:{...he.TILE_DEFAULTS.sheetMargin,...t.modelValue?.sheetMargin??{}}})),i=e.computed(()=>t.templateData?{...t.templateData,tiling:a.value}:void 0),d=e.computed(()=>i.value?he.validateTiling(i.value):[]),m=e.computed(()=>{const v=i.value;return v?Math.max(he.computeMaxColumns(v),1):1}),c=e.computed(()=>{const v=i.value;if(!(!v||d.value.length))try{return he.computeTileLayout(v)}catch{return}}),f=e.computed(()=>{const v=c.value,p=i.value;if(!v||!p)return"";const B=he.resolveSheetMm(p),_=a.value.sheetPaperSize==="CUSTOM"?"自定义":a.value.sheetPaperSize??"A4",ne=a.value.sheetPaperSize==="CUSTOM"?"":a.value.sheetOrientation==="landscape"?" 横向":" 纵向";return`目标纸 ${_}${ne} ${B.width}×${B.height}mm · ${v.columns} 列 × ${v.rows} 行 = 每张 ${v.perSheet} 格`});function g(v){s("update:modelValue",{...a.value,...v})}function h(v,p){g({sheetMargin:{...a.value.sheetMargin,[v]:p??0}})}function R(v){if(v!=="CUSTOM"){g({sheetPaperSize:v});return}const p=i.value,B=p?he.resolveSheetMm(p):{width:210,height:297};g({sheetPaperSize:"CUSTOM",sheetCustomWidth:a.value.sheetCustomWidth??B.width,sheetCustomHeight:a.value.sheetCustomHeight??B.height})}function C(v){if(!v){g({enabled:!1});return}const p=m.value,B=p>=1?Math.min(he.TILE_DEFAULTS.columns,p):1;g({...he.TILE_DEFAULTS,columns:B})}return(v,p)=>(e.openBlock(),e.createElementBlock("div",ec,[p[30]||(p[30]=e.createElementVNode("h3",{class:"pd-divider"},"拼版打印",-1)),p[31]||(p[31]=e.createElementVNode("p",{class:"pd-hint"},"把标签按「列 × 行」铺到一张大纸上批量打印",-1)),e.createElementVNode("div",tc,[e.createElementVNode("label",oc,[e.createElementVNode("input",{type:"checkbox",checked:a.value.enabled,disabled:l.value,onChange:p[0]||(p[0]=B=>C(B.target.checked))},null,40,nc),p[13]||(p[13]=e.createElementVNode("span",null,"启用拼版",-1))]),l.value?(e.openBlock(),e.createElementBlock("p",lc,"连续纸不支持拼版")):e.createCommentVNode("",!0)]),a.value.enabled&&!l.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",ac,[p[15]||(p[15]=e.createElementVNode("span",{class:"pd-label"},"目标纸张",-1)),e.createElementVNode("select",{class:"pd-select",style:{width:"100%"},value:a.value.sheetPaperSize??"A4",onChange:p[1]||(p[1]=B=>R(B.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),B=>(e.openBlock(),e.createElementBlock("option",{key:B,value:B},e.toDisplayString(e.unref(E.PAPER_PRESETS)[B]?.label??B),9,rc))),128)),p[14]||(p[14]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,ic)]),a.value.sheetPaperSize==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",sc,[p[17]||(p[17]=e.createElementVNode("span",{class:"pd-label"},"目标纸宽高 (mm)",-1)),e.createElementVNode("div",dc,[e.createVNode(re,{"model-value":a.value.sheetCustomWidth,min:25,max:2e3,"onUpdate:modelValue":p[2]||(p[2]=B=>g({sheetCustomWidth:B}))},null,8,["model-value"]),p[16]||(p[16]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(re,{"model-value":a.value.sheetCustomHeight,min:25,max:2e3,"onUpdate:modelValue":p[3]||(p[3]=B=>g({sheetCustomHeight:B}))},null,8,["model-value"])])])):(e.openBlock(),e.createElementBlock("div",cc,[p[20]||(p[20]=e.createElementVNode("span",{class:"pd-label"},"目标纸方向",-1)),e.createElementVNode("div",uc,[e.createElementVNode("label",mc,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:(a.value.sheetOrientation??"portrait")==="portrait",onChange:p[4]||(p[4]=B=>g({sheetOrientation:"portrait"}))},null,40,pc),p[18]||(p[18]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",vc,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:a.value.sheetOrientation==="landscape",onChange:p[5]||(p[5]=B=>g({sheetOrientation:"landscape"}))},null,40,fc),p[19]||(p[19]=e.createElementVNode("span",null,"横向",-1))])])])),p[28]||(p[28]=e.createElementVNode("h3",{class:"pd-divider"},"拼版留白 (mm)",-1)),e.createElementVNode("div",gc,[e.createElementVNode("div",hc,[p[21]||(p[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(re,{"model-value":a.value.sheetMargin.top,min:0,max:100,"onUpdate:modelValue":p[6]||(p[6]=B=>h("top",B))},null,8,["model-value"])]),e.createElementVNode("div",bc,[p[22]||(p[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(re,{"model-value":a.value.sheetMargin.bottom,min:0,max:100,"onUpdate:modelValue":p[7]||(p[7]=B=>h("bottom",B))},null,8,["model-value"])]),e.createElementVNode("div",Ec,[p[23]||(p[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(re,{"model-value":a.value.sheetMargin.left,min:0,max:100,"onUpdate:modelValue":p[8]||(p[8]=B=>h("left",B))},null,8,["model-value"])]),e.createElementVNode("div",yc,[p[24]||(p[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(re,{"model-value":a.value.sheetMargin.right,min:0,max:100,"onUpdate:modelValue":p[9]||(p[9]=B=>h("right",B))},null,8,["model-value"])])]),p[29]||(p[29]=e.createElementVNode("h3",{class:"pd-divider"},"格间距与列数",-1)),e.createElementVNode("div",kc,[p[25]||(p[25]=e.createElementVNode("span",{class:"pd-label"},"横向间距",-1)),e.createVNode(re,{"model-value":a.value.gapX,min:0,max:50,"onUpdate:modelValue":p[10]||(p[10]=B=>g({gapX:B??0}))},null,8,["model-value"])]),e.createElementVNode("div",Vc,[p[26]||(p[26]=e.createElementVNode("span",{class:"pd-label"},"纵向间距",-1)),e.createVNode(re,{"model-value":a.value.gapY,min:0,max:50,"onUpdate:modelValue":p[11]||(p[11]=B=>g({gapY:B??0}))},null,8,["model-value"])]),e.createElementVNode("div",Nc,[p[27]||(p[27]=e.createElementVNode("span",{class:"pd-label"},"列数",-1)),e.createVNode(re,{"model-value":a.value.columns,min:1,max:m.value,"onUpdate:modelValue":p[12]||(p[12]=B=>g({columns:B??1}))},null,8,["model-value","max"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,B=>(e.openBlock(),e.createElementBlock("p",{key:B.code,class:"pd-hint tiling-error"},e.toDisplayString(B.message),1))),128)),!d.value.length&&f.value?(e.openBlock(),e.createElementBlock("p",wc,e.toDisplayString(f.value),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]))}}),Sc=ce(Cc,[["__scopeId","data-v-aa278268"]]),xc={key:0,class:"prop-collapsed"},$c={class:"prop-head"},Bc={class:"pd-tabs prop-tabs"},Dc={class:"pd-tab-bar",role:"tablist"},Tc={class:"pd-tab-pane",role:"tabpanel"},Mc={class:"property-content"},zc={key:1,class:"pd-empty"},Ac={class:"pd-tab-pane",role:"tabpanel"},Pc={class:"pd-field"},Rc=["value"],Lc=["label"],Uc=["value"],Ic={key:0,class:"pd-hint"},Fc={key:1,class:"pd-field"},Hc={class:"pd-label"},Oc={class:"custom-size-grid"},Wc={key:2,class:"pd-field"},Gc={class:"pd-radio-group",role:"radiogroup"},Kc={class:"pd-radio"},qc=["checked"],Yc={class:"pd-radio"},jc=["checked"],Xc={key:3,class:"pd-field"},Zc={class:"pd-radio-group pd-radio-group--2col",role:"radiogroup"},Jc={class:"pd-radio"},Qc=["checked"],_c={class:"pd-radio"},eu=["checked"],tu={class:"pd-radio"},ou=["checked"],nu={class:"pd-radio"},lu=["checked"],au={class:"pd-field"},iu={class:"page-bg-row"},ru={key:5,class:"pd-hint"},su={class:"margin-grid"},du={class:"pd-field"},cu={class:"pd-field"},uu={class:"pd-field"},mu={class:"pd-field"},pu={class:"pd-field"},vu={class:"pd-field"},fu=e.defineComponent({__name:"PropertyPanel",props:{element:{},templateData:{},fields:{},activeTab:{},tableSelection:{},recordHistory:{type:Function},collapsed:{type:Boolean},multiPage:{type:Boolean}},emits:["delete-element","update:templateData","update:activeTab","toggle-collapse"],setup(o,{emit:r}){const t=o,s=r,n=e.computed(()=>{const V=[];for(const[w,P]of Object.entries(E.PAPER_PRESETS)){if(t.multiPage&&E.isContinuousPaperSize(w))continue;const ae=P.group??"其他";let me=V.find(ye=>ye.group===ae);me||(me={group:ae,items:[]},V.push(me)),me.items.push({key:w,label:P.label??w})}return V}),l=e.ref(""),a=e.computed(()=>t.element?["text","longText"].includes(t.element.printElementType.type):!1),i=e.computed(()=>t.element?t.element.printElementType.type==="image":!1),d=e.computed(()=>t.element?["barcode","qrcode"].includes(t.element.printElementType.type):!1),m=e.computed(()=>!t.element||t.element.printElementType.type!=="table"?!1:!!t.tableSelection&&t.tableSelection.elementId===t.element.id),c=e.computed(()=>t.element?t.element.printElementType.type==="table":!1),f=e.computed(()=>E.searchProperties(l.value)),g=e.computed(()=>f.value.groups),h=e.computed(()=>f.value.itemKeys),R=e.computed(()=>!!l.value.trim()),C=e.computed(()=>{if(!t.element)return[];if(t.element.printElementType.type==="table"&&t.tableSelection){const{r1:V,c1:w}=t.tableSelection,P=t.element.options.tableRows;if(P&&P[V]){const ae=P[V],me=t.element.options.fields?.[0]?.dataSource;return E.getTableCellBindings(ae.type,V,w,me)}}return E.getElementBindings(t.element)});function v(V){return V.split(".").flatMap(w=>{const P=w.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!P)return[w];const ae=P[1],me=[...P[2].matchAll(/\[(\d+)\]/g)].map(ye=>Number(ye[1]));return[ae,...me]})}function p(V){return t.element?v(V).reduce((ae,me)=>ae==null?"":ae[me],t.element)??"":""}function B(V,w){if(!t.element)return;const P=v(V),ae=P.pop(),me=P.reduce((ye,we)=>((ye[we]===void 0||ye[we]===null)&&(ye[we]={}),ye[we]),t.element);me[ae]=w||void 0,t.recordHistory?.()}function _(V){l.value=V}function ne(V){t.element&&B("options.src",V)}const G=e.computed(()=>t.templateData?.paperSize||"A4"),J=e.computed(()=>!t.multiPage&&E.isContinuousPaperSize(G.value)),b=e.computed(()=>E.isLabelPaperSize(G.value)),W=e.computed(()=>t.templateData?.orientation||"portrait"),j=e.computed(()=>!!t.templateData?.tiling?.enabled),U=e.computed(()=>t.templateData?.outputRotation??0),y=e.computed({get:()=>t.templateData?.pageBackground||"#ffffff",set:V=>K(V)}),M=e.computed(()=>t.templateData?.margins.top??10),N=e.computed(()=>t.templateData?.margins.bottom??10),O=e.computed(()=>t.templateData?.margins.left??10),A=e.computed(()=>t.templateData?.margins.right??10),k=e.computed(()=>t.templateData?.header.height??10),z=e.computed(()=>t.templateData?.footer.height??10),u=e.computed(()=>t.templateData?.customWidth??E.PAPER_PRESETS[G.value]?.width??210),x=e.computed(()=>t.templateData?.customHeight??297),Y=e.computed(()=>t.templateData?.designBackground);function be(V){if(t.templateData){if(!V){const w={...t.templateData};delete w.designBackground,s("update:templateData",w);return}se({designBackground:V})}}const ge=e.computed(()=>t.templateData?.watermark??{});function fe(V){se({watermark:V})}function se(V){if(!t.templateData)return;const w={...t.templateData,...V};s("update:templateData",w)}function q(V){if(t.templateData){if(E.isContinuousPaperSize(V)){se({paperSize:V,customWidth:V==="CONTINUOUS"?t.templateData?.customWidth??80:void 0,orientation:"portrait",margins:{...t.templateData.margins,bottom:t.templateData?.margins.bottom??0}});return}if(V==="CUSTOM"){se({paperSize:"CUSTOM"});return}if(E.PAPER_PRESETS[V]){if(E.isLabelPaperSize(V)){se({paperSize:V,...E.labelPaperDefaults(t.templateData)});return}se({paperSize:V})}}}function S(V){se({orientation:String(V)})}function D(V){se({outputRotation:Number(V)})}function K(V){const w=V&&V.toLowerCase()!=="#ffffff"&&V.toLowerCase()!=="#fff"?V:void 0;se(w===void 0?{pageBackground:void 0}:{pageBackground:w})}function Z(){se({pageBackground:void 0})}function te(V){V!==void 0&&se({customWidth:V})}function pe(V){V!==void 0&&se({customHeight:V})}function T(V){V!==void 0&&se({margins:{...t.templateData.margins,top:V}})}function $(V){V!==void 0&&se({margins:{...t.templateData.margins,bottom:V}})}function I(V){V!==void 0&&se({margins:{...t.templateData.margins,left:V}})}function ee(V){V!==void 0&&se({margins:{...t.templateData.margins,right:V}})}function oe(V){V!==void 0&&se({header:{...t.templateData.header,height:V}})}function ue(V){V!==void 0&&se({footer:{...t.templateData.footer,height:V}})}const L=e.computed(()=>t.activeTab||"page");function F(V){s("update:activeTab",V),s("toggle-collapse")}return(V,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",xc,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:w[0]||(w[0]=P=>F(L.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:L.value==="element"}]),title:"元素属性",onClick:w[1]||(w[1]=P=>F("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:L.value==="page"}]),title:"页面属性",onClick:w[2]||(w[2]=P=>F("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",$c,[w[18]||(w[18]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:w[3]||(w[3]=P=>V.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",Bc,[e.createElementVNode("div",Dc,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="element"}]),onClick:w[4]||(w[4]=P=>V.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="page"}]),onClick:w[5]||(w[5]=P=>V.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",Tc,[o.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Ia,{onSearch:_}),e.createElementVNode("div",Mc,[g.value.includes("position-size")&&!m.value?(e.openBlock(),e.createBlock(Ja,{key:0,element:o.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("appearance")?(e.openBlock(),e.createBlock(Ni,{key:1,element:o.element,"is-text-type":a.value,"matched-keys":h.value,searching:R.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("code")&&d.value?(e.openBlock(),e.createBlock(Fi,{key:2,element:o.element,"matched-keys":h.value,searching:R.value,onChange:w[6]||(w[6]=P=>o.recordHistory?.())},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("binding")?(e.openBlock(),e.createBlock($e,{key:3,title:"内容",icon:"Document","default-expanded":"","group-key":"binding"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,P=>(e.openBlock(),e.createBlock(Br,{key:P.targetPath,descriptor:P,fields:o.fields,"model-value":p(P.targetPath),"onUpdate:modelValue":ae=>B(P.targetPath,ae)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),i.value?(e.openBlock(),e.createBlock(ss,{key:0,onSuccess:ne})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),c.value&&o.tableSelection&&o.tableSelection.elementId===o.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createVNode(vs,{element:o.element,selection:o.tableSelection},null,8,["element","selection"]),e.createVNode(Td,{element:o.element,selection:o.tableSelection,fields:o.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),c.value&&g.value.includes("content")?(e.openBlock(),e.createBlock(Ir,{key:5,element:o.element,fields:o.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),g.value.includes("border-bg")?(e.openBlock(),e.createBlock(Kr,{key:6,element:o.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&c.value?(e.openBlock(),e.createBlock(Bt,{key:7,element:o.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&!c.value?(e.openBlock(),e.createBlock(Bt,{key:8,element:o.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("advanced")?(e.openBlock(),e.createBlock(Qr,{key:9,element:o.element,"matched-keys":h.value,searching:R.value,onDeleteElement:w[7]||(w[7]=P=>V.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",zc,"请在画布中选择一个元素"))],512),[[e.vShow,(o.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",Ac,[e.createElementVNode("form",{class:"pd-form",onSubmit:w[17]||(w[17]=e.withModifiers(()=>{},["prevent"]))},[w[39]||(w[39]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",Pc,[w[20]||(w[20]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:G.value,class:"pd-select",onChange:w[8]||(w[8]=P=>q(P.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,P=>(e.openBlock(),e.createElementBlock("optgroup",{key:P.group,label:P.group},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.items,ae=>(e.openBlock(),e.createElementBlock("option",{key:ae.key,value:ae.key},e.toDisplayString(ae.label),9,Uc))),128))],8,Lc))),128)),w[19]||(w[19]=e.createElementVNode("option",{value:"CUSTOM"},"自定义宽高",-1))],40,Rc)]),b.value?(e.openBlock(),e.createElementBlock("p",Ic,"标签纸默认整张给内容区:已取消页边距与页眉页脚,可在下方自行改回")):e.createCommentVNode("",!0),J.value||G.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",Fc,[e.createElementVNode("span",Hc,e.toDisplayString(J.value?"纸宽 (mm)":"自定义宽高 (mm)"),1),e.createElementVNode("div",Oc,[e.createVNode(re,{"model-value":u.value,min:25,max:2e3,"onUpdate:modelValue":te},null,8,["model-value"]),G.value==="CUSTOM"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[w[21]||(w[21]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(re,{"model-value":x.value,min:25,max:2e3,"onUpdate:modelValue":pe},null,8,["model-value"])],64)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),J.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Wc,[w[24]||(w[24]=e.createElementVNode("span",{class:"pd-label"},"纸张方向",-1)),e.createElementVNode("div",Gc,[e.createElementVNode("label",Kc,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:W.value==="portrait",onChange:w[9]||(w[9]=P=>S(P.target.value))},null,40,qc),w[22]||(w[22]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",Yc,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:W.value==="landscape",onChange:w[10]||(w[10]=P=>S(P.target.value))},null,40,jc),w[23]||(w[23]=e.createElementVNode("span",null,"横向",-1))])]),w[25]||(w[25]=e.createElementVNode("p",{class:"pd-hint"},"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)",-1))])),!J.value&&!j.value?(e.openBlock(),e.createElementBlock("div",Xc,[w[30]||(w[30]=e.createElementVNode("span",{class:"pd-label"},"内容旋转角度",-1)),e.createElementVNode("div",Zc,[e.createElementVNode("label",Jc,[e.createElementVNode("input",{type:"radio",value:"0",checked:U.value===0,onChange:w[11]||(w[11]=P=>D(P.target.value))},null,40,Qc),w[26]||(w[26]=e.createElementVNode("span",null,"0°",-1))]),e.createElementVNode("label",_c,[e.createElementVNode("input",{type:"radio",value:"90",checked:U.value===90,onChange:w[12]||(w[12]=P=>D(P.target.value))},null,40,eu),w[27]||(w[27]=e.createElementVNode("span",null,"90°",-1))]),e.createElementVNode("label",tu,[e.createElementVNode("input",{type:"radio",value:"180",checked:U.value===180,onChange:w[13]||(w[13]=P=>D(P.target.value))},null,40,ou),w[28]||(w[28]=e.createElementVNode("span",null,"180°",-1))]),e.createElementVNode("label",nu,[e.createElementVNode("input",{type:"radio",value:"270",checked:U.value===270,onChange:w[14]||(w[14]=P=>D(P.target.value))},null,40,lu),w[29]||(w[29]=e.createElementVNode("span",null,"270°",-1))])]),w[31]||(w[31]=e.createElementVNode("p",{class:"pd-hint"},"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)",-1))])):e.createCommentVNode("",!0),e.createElementVNode("div",au,[w[32]||(w[32]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",iu,[e.createVNode(Ne,{modelValue:y.value,"onUpdate:modelValue":w[15]||(w[15]=P=>y.value=P),class:"page-bg-picker"},null,8,["modelValue"]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:Z},"默认")])]),e.createVNode(_d,{"model-value":Y.value,"onUpdate:modelValue":be},null,8,["model-value"]),o.multiPage?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Sc,{key:4,"model-value":o.templateData?.tiling,"template-data":o.templateData,"onUpdate:modelValue":w[16]||(w[16]=P=>se({tiling:P}))},null,8,["model-value","template-data"])),w[40]||(w[40]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),J.value?(e.openBlock(),e.createElementBlock("p",ru,"底部边距即连续纸走纸留白")):e.createCommentVNode("",!0),e.createElementVNode("div",su,[e.createElementVNode("div",du,[w[33]||(w[33]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(re,{"model-value":M.value,min:0,max:50,"onUpdate:modelValue":T},null,8,["model-value"])]),e.createElementVNode("div",cu,[w[34]||(w[34]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(re,{"model-value":N.value,min:0,max:100,"onUpdate:modelValue":$},null,8,["model-value"])]),e.createElementVNode("div",uu,[w[35]||(w[35]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(re,{"model-value":O.value,min:0,max:50,"onUpdate:modelValue":I},null,8,["model-value"])]),e.createElementVNode("div",mu,[w[36]||(w[36]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(re,{"model-value":A.value,min:0,max:50,"onUpdate:modelValue":ee},null,8,["model-value"])])]),w[41]||(w[41]=e.createElementVNode("h3",{class:"pd-divider"},"页眉/页脚高度 (mm)",-1)),e.createElementVNode("div",pu,[w[37]||(w[37]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(re,{"model-value":k.value,min:0,max:100,step:.1,"onUpdate:modelValue":oe},null,8,["model-value"])]),e.createElementVNode("div",vu,[w[38]||(w[38]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(re,{"model-value":z.value,min:0,max:100,step:.1,"onUpdate:modelValue":ue},null,8,["model-value"])])],32),e.createVNode(Yd,{"model-value":ge.value,fields:o.fields,"onUpdate:modelValue":fe},null,8,["model-value","fields"])],512),[[e.vShow,(o.activeTab||"page")==="page"]])])],64))],2))}}),gu=ce(fu,[["__scopeId","data-v-d2bf0fe4"]]),hu={class:"status-bar"},bu={key:0,class:"status-item coord"},Eu={class:"status-item"},yu={class:"status-item"},ku={class:"status-item status-paper"},Vu=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(o){return(r,t)=>(e.openBlock(),e.createElementBlock("div",hu,[o.coordinate?(e.openBlock(),e.createElementBlock("span",bu," x:"+e.toDisplayString(o.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(o.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",Eu,"缩放 "+e.toDisplayString(o.scale)+"%",1),e.createElementVNode("span",yu,"元素 "+e.toDisplayString(o.elementCount)+e.toDisplayString(o.selectedCount?` (选中 ${o.selectedCount})`:""),1),e.createElementVNode("span",{class:e.normalizeClass(["status-dirty",{on:o.dirty}])},[t[0]||(t[0]=e.createElementVNode("span",{class:"dirty-dot"},null,-1)),e.createTextVNode(e.toDisplayString(o.dirty?"未保存":"已保存"),1)],2),e.createElementVNode("span",ku,e.toDisplayString(o.paper),1)]))}}),Nu=ce(Vu,[["__scopeId","data-v-a91952ff"]]),wu={id:"getting-started",title:"快速入门",content:`
|
|
7
7
|
<h2>界面布局</h2>
|
|
@@ -411,7 +411,14 @@
|
|
|
411
411
|
<p><strong>提示</strong>:水印配置保存在模板 JSON 的 <code>watermark</code> 字段中,仅对当前模板生效。</p>
|
|
412
412
|
</blockquote>
|
|
413
413
|
`},$u={id:"changelog",title:"更新记录",content:`
|
|
414
|
-
<h2>V1.3.
|
|
414
|
+
<h2>V1.3.6<small>(2026-10-16)</small></h2>
|
|
415
|
+
|
|
416
|
+
<h3>修复</h3>
|
|
417
|
+
<ul>
|
|
418
|
+
<li><strong>桌面客户端打印标签不再被转 90°</strong>:宽大于高的标签(如 100×75 mm)经桌面客户端静默打印时,纸上内容会被整体旋转 90°(导出的 PDF 本身是正的)。Windows 上出纸交给 SumatraPDF,它默认会给「宽 > 高」的页面加 90°,现已按页面自身长宽比显式声明方向;macOS / Linux 上此前的纸张声明因出纸参数漏传从未真正下发,现已一并修复,横向单据(横向 A4、宽幅自定义纸)在 macOS 与 Linux 上也都不再被打印系统转 90°。</li>
|
|
419
|
+
</ul>
|
|
420
|
+
|
|
421
|
+
<h2>V1.3.5<small>(2026-10-05)</small></h2>
|
|
415
422
|
|
|
416
423
|
<h3>移除</h3>
|
|
417
424
|
<ul>
|