hflveditor3 0.2.10 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hflveditor3.es.js
CHANGED
|
@@ -1341,7 +1341,7 @@ const Fl = {
|
|
|
1341
1341
|
var kl = Fl;
|
|
1342
1342
|
(function() {
|
|
1343
1343
|
const t = () => {
|
|
1344
|
-
console.log("%c 可视化编辑器 hflveditor3", "color: #3498db; font-size: 16px; font-weight: bold;"), console.log("%c版本号: 0.2.
|
|
1344
|
+
console.log("%c 可视化编辑器 hflveditor3", "color: #3498db; font-size: 16px; font-weight: bold;"), console.log("%c版本号: 0.2.11", "color: #2ecc71;"), console.log("%c编译日期: 2025/11/27 12:32:38", "color: #3498db;"), console.log("%c版权声明:", "color: #e74c3c; font-weight: bold;"), console.log('%c 1. 版权完全归"hflsoft"享有。', "color: #34495e;"), console.log("%c 2. 程序包完整引用,不得以任何形式破解、裁剪,不得隐藏或删除版权信息。", "color: #34495e;"), console.log("%c 3. 保留此版权信息在控制台输出。", "color: #34495e;"), console.log("%c 版权所有 ©2024-2025 hflsoft 保留对此版权信息的最终解释权.", "color: #f39c12;"), console.log("%c Copyright ©2024-2025 hflsoft All rights reserved.", "color: #f39c12;");
|
|
1345
1345
|
};
|
|
1346
1346
|
if (typeof window < "u") {
|
|
1347
1347
|
window._copyright_hflveditor3 = t;
|
|
@@ -1582,6 +1582,14 @@ const Ve = {
|
|
|
1582
1582
|
label: "鼠标点击",
|
|
1583
1583
|
value: "onMouseClick"
|
|
1584
1584
|
},
|
|
1585
|
+
{
|
|
1586
|
+
label: "鼠标双击",
|
|
1587
|
+
value: "onMouseDblClick"
|
|
1588
|
+
},
|
|
1589
|
+
// {
|
|
1590
|
+
// label: '右键菜单',
|
|
1591
|
+
// value: 'onContextMenu'
|
|
1592
|
+
// },
|
|
1585
1593
|
{
|
|
1586
1594
|
label: "键盘回车",
|
|
1587
1595
|
value: "keyEnter"
|
package/dist/hflveditor3.umd.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
`+_+"}"}}return s.pop(),c=_,C}function N(b){if(b.length===0)return h(b);const _=String.fromCodePoint(b.codePointAt(0));if(!se.isIdStartChar(_))return h(b);for(let r=_.length;r<b.length;r++)if(!se.isIdContinueChar(String.fromCodePoint(b.codePointAt(r))))return h(b);return b}function g(b){if(s.indexOf(b)>=0)throw TypeError("Converting circular structure to JSON5");s.push(b);let _=c;c=c+i;let r=[];for(let C=0;C<b.length;C++){const w=p(String(C),b);r.push(w!==void 0?w:"null")}let m;if(r.length===0)m="[]";else if(i==="")m="["+r.join(",")+"]";else{let C=`,
|
|
19
19
|
`+c,w=r.join(C);m=`[
|
|
20
20
|
`+c+w+`,
|
|
21
|
-
`+_+"]"}return s.pop(),c=_,m}},Xo={parse:Io,stringify:qo};(function(){const n=()=>{console.log("%c 可视化编辑器 hflveditor3","color: #3498db; font-size: 16px; font-weight: bold;"),console.log("%c版本号: 0.2.10","color: #2ecc71;"),console.log("%c编译日期: 2025/11/27 09:52:07","color: #3498db;"),console.log("%c版权声明:","color: #e74c3c; font-weight: bold;"),console.log('%c 1. 版权完全归"hflsoft"享有。',"color: #34495e;"),console.log("%c 2. 程序包完整引用,不得以任何形式破解、裁剪,不得隐藏或删除版权信息。","color: #34495e;"),console.log("%c 3. 保留此版权信息在控制台输出。","color: #34495e;"),console.log("%c 版权所有 ©2024-2025 hflsoft 保留对此版权信息的最终解释权.","color: #f39c12;"),console.log("%c Copyright ©2024-2025 hflsoft All rights reserved.","color: #f39c12;")};if(typeof window<"u"){window._copyright_hflveditor3=n;try{Object.defineProperty(window,_copyright_hflveditor3,{value:n,writable:!1,configurable:!1,enumerable:!1})}catch{window._copyright_hflveditor3=n}}n()})();function et(n){return!isNaN(parseFloat(n))&&isFinite(n)}function Re(n){return!!(n&&n!="")}function Le(n){return!!(n&&typeof n=="function")}function pn(n){return n instanceof Object&&n!==null}function Me(n){return Object.keys(n).length===0}function _n(n){return typeof n=="string"||n instanceof String}function be(n){if(typeof n=="object"){const a=Array.isArray(n)?[]:{};for(const o in n)typeof n[o]=="object"?a[o]=be(n[o]):a[o]=n[o];return a}return n}function xe(n,a={}){if(_n(n)&&Re(n))try{return Xo.parse(n)}catch(o){return console.warn("JSON 解析错误:",o),a}else return pn(n)?n:a}function Ve(n){return _n(n)?n:pn(n)?JSON.stringify(n,null,2):""}function oe(n,a){Be.ElMessage({message:a||"message",type:n||"info"})}function ze(n,a="确认",o="info",t,s){Be.ElMessageBox.confirm(n,a,{confirmButtonText:"确认",cancelButtonText:"取消",type:o}).then(()=>{Le(t)&&t()}).catch(()=>{Le(s)&&s()})}function fn(n,a="提示",o={},t,s){Be.ElMessageBox.prompt(n,a,{confirmButtonText:"确认",cancelButtonText:"取消",inputPattern:o.pattern||"",inputErrorMessage:o.errMsg||""}).then(({value:c})=>{Le(t)&&t(c)}).catch(()=>{Le(s)&&s()})}const fe={Component:"Comp_",Page:"P_",CompEvent:"CompEvent_",Dialog:"Dialog_"},Go=[{label:"PC端",value:"0",isDisabled:!0},{label:"1920*1080",value:"1"},{label:"1680*1050",value:"9"},{label:"1600*900",value:"2"},{label:"1400*1050",value:"10"},{label:"1366*768",value:"3"},{label:"1280*720",value:"4"},{label:"移动端",value:"5",isDisabled:!0,isDivided:!0},{label:"1024*1366",value:"6"},{label:"768*1024",value:"7"},{label:"480*800",value:"8"}],Et=["rgba(245, 10, 10, 1)","rgba(255, 255, 0, 1)","rgba(0, 255, 0, 1)","rgba(239, 236, 236, 1)","rgba(114,114,114,1)","rgba(0,255,255,1)","rgba(138,43,226,1)","rgba(16, 55, 81, 1)"],Jo=[{label:"不重复",value:"no-repeat"},{label:"水平重复",value:"repeat-x"},{label:"垂直重复",value:"repeat-y"},{label:"双向重复",value:"repeat"}],Yo=[{label:"覆盖",value:"cover"},{label:"适应",value:"contain"},{label:"自动",value:"auto"}],Qo=[{label:"顶部",value:"top"},{label:"底部",value:"bottom"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"居中",value:"center"}],Zo=[{label:"不适配",value:"no-adapter"},{label:"全屏铺满",value:"all-screen"},{label:"原始比例",value:"original-ratio"},{label:"横向适配-保持纵横比",value:"h-adapter-wh"},{label:"纵向适配-保持纵横比",value:"v-adapter-wh"},{label:"横向适配",value:"h-adapter"},{label:"纵向适配",value:"v-adapter"}],tt=[{label:"选项改变",value:"selectItem"},{label:"值改变",value:"changeValue"},{label:"鼠标点击",value:"onMouseClick"},{label:"键盘回车",value:"keyEnter"},{label:"组件挂载前",value:"onBeforeMount"},{label:"组件挂载后",value:"onMounted"},{label:"组件卸载前",value:"onBeforeUnmount"},{label:"组件卸载后",value:"onUnmounted"}],hn=[{label:"数据请求",value:"dataRequest"},{label:"路由跳转",value:"router"},{label:"缓存设置",value:"cacheSet"},{label:"Web缓存",value:"webStorage"},{label:"组件局域参数设置",value:"paramSet"},{label:"组件局域参数映射",value:"paramMap"},{label:"自定义函数",value:"customFunction"},{label:"组件设置",value:"componentSet"},{label:"操作终止",value:"actionEnd"},{label:"消息弹出框",value:"messageBox"},{label:"打开对话框",value:"openDialog"}],vo=[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"DELETE",value:"DELETE"}],mn=[{label:"==",value:"=="},{label:"!=",value:"!="},{label:">",value:">"},{label:">=",value:">="},{label:"<",value:"<"},{label:"<=",value:"<="},{label:"包含",value:"contain"},{label:"不包含",value:"unContain"},{label:"字符串相等",value:"equals"},{label:"字符串不相等",value:"unEquals"},{label:"字符串忽略大小写相等",value:"equalsIgnoreCase"}],Ae=[{value:"inputV",label:"直接输入值"},{value:"inputP",label:"组件局域参数"},{value:"cacheP",label:"缓存参数"},{value:"containerP",label:"容器参数"},{value:"sessionP",label:"会话缓存参数"},{value:"localP",label:"本地缓存参数"},{value:"jsCookieP",label:"JSCookie缓存参数"},{value:"compProp",label:"组件值"},{value:"compStyle",label:"组件样式"}],$o=[{value:"inputP",label:"组件局域参数"},{value:"cacheP",label:"缓存参数"},{value:"sessionP",label:"会话缓存参数"},{value:"localP",label:"本地缓存参数"},{value:"jsCookieP",label:"JSCookie缓存参数"}],kt=[{value:"primary",label:"primary"},{value:"success",label:"success"},{value:"warning",label:"warning"},{value:"info",label:"info"},{value:"error",label:"error"}],gn=[{value:"msg",label:"Message"},{value:"notify",label:"Notification"}];function Ie(n){return n*Math.PI/180}function ae(n,a,o){return{x:(n.x-a.x)*Math.cos(Ie(o))-(n.y-a.y)*Math.sin(Ie(o))+a.x,y:(n.x-a.x)*Math.sin(Ie(o))+(n.y-a.y)*Math.cos(Ie(o))+a.y}}function Te(n,a){return{x:n.x+(a.x-n.x)/2,y:n.y+(a.y-n.y)/2}}function Cn(n){return Math.abs(Math.sin(Ie(n)))}function xn(n){return Math.abs(Math.cos(Ie(n)))}function He(n){return(n+360)%360}function nt(n){return`${n*100}%`}function ea(n){const a={};return["width","height","top","left","rotate"].forEach(o=>{o!="rotate"?a[o]=`${n[o]}px`:a.transform=`rotate(${n[o]}deg)`}),a}const Vn=["fontSize","width","height","top","left","borderWidth","letterSpacing","borderRadius"];function At(n,a=[]){const o={};return["opacity","width","height","top","left","rotate","fontSize","fontWeight","lineHeight","letterSpacing","textAlign","color"].forEach(t=>{a.includes(t)||(t!="rotate"?n[t]!==""&&(o[t]=n[t],Vn.includes(t)&&(o[t]+="px")):o.transform=`${t}(${n[t]}deg)`)}),o}function Tt(n,a=[]){const o={};return Object.keys(n).forEach(t=>{a.includes(t)||(t!="rotate"?n[t]!==""&&(o[t]=n[t],Vn.includes(t)&&(o[t]+="px")):o.transform=`${t}(${n[t]}deg)`)}),o}function Y(n){if(n={...n},n.rotate!=0){const a=n.width*xn(n.rotate)+n.height*Cn(n.rotate),o=(n.width-a)/2;n.left+=o,n.right=n.left+a;const t=n.height*xn(n.rotate)+n.width*Cn(n.rotate),s=(t-n.height)/2;n.top-=s,n.bottom=n.top+t,n.width=a,n.height=t}else n.bottom=n.top+n.height,n.right=n.left+n.width;return n}const ta=["width","height","scale"];function wn(n){const a={};return Object.keys(n).filter(o=>!ta.includes(o)).forEach(o=>{o==="fontSize"?a[o]+="px":o==="backgroundImage"?a["background-image"]="url("+n[o]+")":o==="backgroundRepeat"?a["background-repeat"]=n[o]:o==="backgroundSize"?a["background-size"]=n[o]:o==="backgroundPosition"?a["background-position"]=n[o]:a[o]=n[o]}),a}function na(n){const a=n.style;(n.propValue.components||[]).forEach(t=>{if(!Object.keys(t.groupStyle).length){const s={...t.style};t.component.startsWith("SVG")?t.groupStyle=At(s):t.groupStyle=Tt(s),t.groupStyle.left=nt((s.left-a.left)/a.width),t.groupStyle.top=nt((s.top-a.top)/a.height),t.groupStyle.width=nt(s.width/a.width),t.groupStyle.height=nt(s.height/a.height)}})}function Dn(n,a,o,t){isNaN(t.rotate)&&(t.rotate=0),n.style&&isNaN(n.style.rotate)&&(n.style.rotate=0),n.style.rotate=He(n.style.rotate+t.rotate),n.style.width=parseFloat(n.groupStyle.width)/100*t.width,n.style.height=parseFloat(n.groupStyle.height)/100*t.height,n.style.left=o.left-a.left+parseFloat(n.groupStyle.left)/100*t.width,n.style.top=o.top-a.top+parseFloat(n.groupStyle.top)/100*t.height,n.groupStyle={},n.style.width=Qe(n.style.width),n.style.height=Qe(n.style.height),n.style.left=Qe(n.style.left),n.style.top=Qe(n.style.top)}function oa(n){return{all:n=n||new Map,on:function(a,o){var t=n.get(a);t?t.push(o):n.set(a,[o])},off:function(a,o){var t=n.get(a);t&&(o?t.splice(t.indexOf(o)>>>0,1):n.set(a,[]))},emit:function(a,o){var t=n.get(a);t&&t.slice().map(function(s){s(o)}),(t=n.get("*"))&&t.slice().map(function(s){s(a,o)})}}}const v=oa(),$={openCanvasSetting:"openCanvasDrawer",openRuleSetting:"openRuleSetting",openNewPage:"openNewPage",runAnimation:"runAnimation",stopAnimation:"stopAnimation",componentClick:"componentClick",move:"move",unmove:"unmove",hideArea:"hideArea",save:"save",preview:"preview",clearCanvas:"clearCanvas",importJson:"importJson",exportJson:"exportJson",openPage:"openPage",savePage:"savePage"},ot=new Map,ee=(n="default")=>{if(ot.has(n))return ot.get(n);const a=xt.defineStore(`editor-${n}`,{state:()=>({rule:{scale:1,minScale:.3,maxScale:3},areaData:{style:{top:0,left:0,width:0,height:0},components:[]},editor:null,editorInstance:null,isDarkMode:!1,lastScale:100,canvasStyleData:{width:1200,height:800,scale:100,color:"#000",opacity:1,background:"#fff",fontSize:14,screenAdapter:"no-adapter"},isInEditor:!1,componentData:[],dashBorderColor:"rgba(114, 114, 114, 1)",curComponent:null,curComponentIndex:null,isClickComponent:!1,snapshotData:[],snapshotIndex:-1,menuTop:0,menuLeft:0,menuShow:!1,copyData:null,isCut:!1,ruleReferenceLine:"#00FFFF",rulePresetLine:[]}),actions:{setRuleScale(o){let t=Number(o);t>0&&(t=t>this.rule.maxScale?this.rule.maxScale:t,t=t<this.rule.minScale?this.rule.minScale:t,this.rule.scale=t)},addRuleScale(o){let t=Number(o)||"0.1",s=this.rule.scale+t;this.setRuleScale(s)},subtractRuleScale(o){let t=Number(o)||"0.1",s=this.rule.scale-t;this.setRuleScale(s)},setEditor(o){this.editor=o},setEditorInstance(o){this.editorInstance=o},setAreaData(o){this.areaData=o},compose(){const o=[];this.areaData.components.forEach(s=>{if(s.component!="Group")o.push(s);else{const c={...s.style},d=s.propValue.components||[],l=this.getEditorBoundingClientRect(),i=this.getComponentRect(s.id);d.forEach(f=>{Dn(f,l,i,c)}),o.push(...s.propValue.components)}});const t={id:ce(fe.Component),component:"Group",label:"组合",icon:"svgcombination",...nn,style:{...tn,...this.areaData.style},propValue:{components:o}};na(t),this.addComponent(t),v.emit($.hideArea),this.batchDeleteComponent(o),this.setCurComponent(this.componentData[this.componentData.length-1],this.componentData.length-1),this.areaData.components=[]},batchDeleteComponent(o){for(let t=0;t<o.length;t++)for(let s=0,c=this.componentData.length;s<c;s++)if(o[t].id==this.componentData[s].id){this.componentData.splice(s,1);break}Se("debug","batchDeleteComponent 需要删除:",o.length,"删除后:",this.componentData.length)},decompose(){const o={...this.curComponent.style},t=this.curComponent.propValue?.components||[],s=this.getEditorBoundingClientRect(),c=this.getComponentRect(this.curComponent.id);this.deleteComponent(),Se("debug","decompose editorRect:",s),Se("debug","decompose parentRect:",c),Se("debug","decompose parentStyle:",o),t.forEach(d=>{Dn(d,s,c,o),Se("info","decompose component:",d.id,d.style),this.addComponent(d)})},getEditorBoundingClientRect(){return this.editor?.getBoundingClientRect()},setComponentData(o=[]){this.componentData=o},addComponent(o,t){t!==void 0?this.componentData.splice(t,0,o):this.componentData.push(o)},deleteComponent(o){o===void 0&&(o=this.curComponentIndex),o==this.curComponentIndex&&(this.curComponentIndex=null,this.curComponent=null),/\d/.test(o)&&this.componentData.splice(o,1)},setClickComponentStatus(o){this.isClickComponent=o},setCanvasStyle(o){this.canvasStyleData=o},setInEditorStatus(o){this.isInEditor=o},setCurComponent(o,t){this.curComponent=o,this.curComponentIndex=t},setShapeStyle({top:o,left:t,width:s,height:c,rotate:d,padding:l}){o!==void 0&&(this.curComponent.style.top=Math.round(o)),t!==void 0&&(this.curComponent.style.left=Math.round(t)),s&&(this.curComponent.style.width=Math.round(s)),l&&(this.curComponent.style.padding=Math.round(l)),c&&(this.curComponent.style.height=Math.round(c)),d&&(this.curComponent.style.rotate=Math.round(d))},setShapeSingleStyle({key:o,value:t}){this.curComponent.style[o]=t},recordSnapshot(){let o=Ce(this.componentData);o.forEach(t=>t.lastScale=this.lastScale),this.snapshotData[++this.snapshotIndex]=o,this.snapshotIndex<this.snapshotData.length-1&&(this.snapshotData=this.snapshotData.slice(0,this.snapshotIndex+1))},undo(){if(this.snapshotIndex>=0){this.snapshotIndex--;let o=Ce(this.snapshotData[this.snapshotIndex])||[];this.curComponent&&!o.find(s=>this.curComponent.id===s.id)&&this.setCurComponent({component:null,index:null}),o=sn(this,this.lastScale,o),this.setComponentData(o)}},redo(){if(this.snapshotIndex<this.snapshotData.length-1){this.snapshotIndex++;let o=sn(this,this.lastScale,Ce(this.snapshotData[this.snapshotIndex]));this.setComponentData(o)}},addAnimation(o){this.curComponent.animations.push(o)},removeAnimation(o){this.curComponent.animations.splice(o,1)},alterAnimation({index:o,data:t={}}){if(typeof o=="number"){const s=this.curComponent.animations[o];this.curComponent.animations[o]={...s,...t}}},addComponentEvent(o){this.curComponent.events[o.type]?this.curComponent.events[o.type].push(o):this.curComponent.events[o.type]=[o]},removeComponentEvent(o,t){this.curComponent.events[o]&&t>=0&&(this.curComponent.events[o].splice(t,1),this.curComponent.events[o].length==0&&delete this.curComponent.events[o])},alterComponentEvent(o,t,s={}){if(this.curComponent.events[o]&&t>=0){const c=this.curComponent.events[o][t];this.curComponent.events[o][t]={...c,...s}}},showContextMenu({top:o,left:t}){this.menuShow=!0,this.menuTop=o,this.menuLeft=t},hideContextMenu(){this.menuShow=!1},lock(){this.curComponent.isLock=!0},unlock(){this.curComponent.isLock=!1},copy(){if(!this.curComponent){oe("error","请选择组件");return}this._restorePreCutData(),this.copyData=this._copyCurrentData(),this.isCut=!1},paste(o){if(!this.copyData){oe("error","请选择组件");return}const t=this.copyData.data;o?(t.style.top=this.menuTop,t.style.left=this.menuLeft):(t.style.top+=30,t.style.left+=20),this.addComponent(this._deepCopyHelper(t),null),this.isCut&&(this.copyData=null)},cut(){if(!this.curComponent){oe("error","请选择组件");return}this._restorePreCutData(),this.copyData=this._copyCurrentData(),this.deleteComponent(),this.isCut=!0},upComponent(){this.curComponentIndex<this.componentData.length-1?(an(this.componentData,this.curComponentIndex,this.curComponentIndex+1),this.curComponentIndex=this.curComponentIndex+1):oe("error","已经到顶了")},downComponent(){this.curComponentIndex>0?(an(this.componentData,this.curComponentIndex,this.curComponentIndex-1),this.curComponentIndex=this.curComponentIndex-1):oe("error","已经到底了")},topComponent(){this.curComponentIndex<this.componentData.length-1?(this.componentData.splice(this.curComponentIndex,1),this.componentData.push(this.curComponent),this.curComponentIndex=this.componentData.length-1):oe("error","已经到顶了")},bottomComponent(){this.curComponentIndex>0?(this.componentData.splice(this.curComponentIndex,1),this.componentData.unshift(this.curComponent),this.curComponentIndex=0):oe("error","已经到底了")},leftAlign(){if(this.areaData.components.length>1){let o=Math.min(...this.areaData.components.map(t=>Y(t.style).left));this.areaData.components.forEach(t=>{let c=Y(t.style).left-o;this._changeAlign(t,{left:t.style.left-c})})}else{let o=Y(this.curComponent.style),t=this.curComponent.style.left-o.left;this._changeAlign(this.curComponent,{left:t})}},rightAlign(){if(this.areaData.components.length>1){let o=Math.max(...this.areaData.components.map(t=>Y(t.style).right));this.areaData.components.forEach(t=>{let s=Y(t.style),c=o-s.right;this._changeAlign(t,{left:t.style.left+c})})}else{let o=Y(this.curComponent.style),t=this.curComponent.style.left-o.left,s=this.canvasStyleData.width+t-o.width;this._changeAlign(this.curComponent,{left:s})}},centerAlign(){if(this.areaData.components.length>1){let o=Math.min(...this.areaData.components.map(c=>Y(c.style).left)),t=Math.max(...this.areaData.components.map(c=>Y(c.style).right)),s=(o+t)/2;this.areaData.components.forEach(c=>{let d=Y(c.style),l=(d.left+d.right)/2,i=s-l;this._changeAlign(c,{left:c.style.left+i})})}else{let o=Y(this.curComponent.style),t=this.canvasStyleData.width/2,s=(o.left+o.right)/2,c=this.curComponent.style.left+(t-s);this._changeAlign(this.curComponent,{left:c})}},topAlign(){if(this.areaData.components.length>1){let o=Math.min(...this.areaData.components.map(t=>Y(t.style).top));this.areaData.components.forEach(t=>{let c=Y(t.style).top-o;this._changeAlign(t,{top:t.style.top-c})})}else{let o=Y(this.curComponent.style),t=this.curComponent.style.top-o.top;this._changeAlign(this.curComponent,{top:t})}},bottomAlign(){if(this.areaData.components.length>1){let o=Math.max(...this.areaData.components.map(t=>Y(t.style).bottom));this.areaData.components.forEach(t=>{let s=Y(t.style),c=o-s.bottom;this._changeAlign(t,{top:t.style.top+c})})}else{let o=Y(this.curComponent.style),t=this.curComponent.style.top-o.top,s=this.canvasStyleData.height+t-o.height;this._changeAlign(this.curComponent,{top:s})}},middleAlign(){if(this.areaData.components.length>1){let o=Math.min(...this.areaData.components.map(c=>Y(c.style).top)),t=Math.max(...this.areaData.components.map(c=>Y(c.style).bottom)),s=(o+t)/2;this.areaData.components.forEach(c=>{let d=Y(c.style),l=(d.top+d.bottom)/2,i=s-l;this._changeAlign(c,{top:c.style.top+i})})}else{let o=Y(this.curComponent.style),t=this.canvasStyleData.height/2,s=(o.top+o.bottom)/2,c=this.curComponent.style.top+(t-s);this._changeAlign(this.curComponent,{top:c})}},verticalSpacing(){const{components:o}=this.areaData;if(o.length>2){let t=0;o.forEach(i=>{let f=Y(i.style);t+=f.height});const c=this.areaData.style.height-t,d=Math.floor(c/(o.length-1));o.sort((i,f)=>Y(i.style).top-Y(f.style).top);let l=0;o.forEach(i=>{this._changeAlign(i,{top:this.areaData.style.top+l}),l+=d+Y(i.style).height})}},horizontalSpacing(){const{components:o}=this.areaData;if(o.length>2){let t=0;o.forEach(i=>{let f=Y(i.style);t+=f.width});const c=this.areaData.style.width-t,d=Math.floor(c/(o.length-1));o.sort((i,f)=>Y(i.style).left-Y(f.style).left);let l=0;o.forEach(i=>{i.style.left=this.areaData.style.left+l,l+=d+Y(i.style).width})}},getComponentRect(o){let t=this.editorInstance.getComponentRef(o),s=this._getComponentDom(t);return s?s.getBoundingClientRect():null},_getComponentDom(o){return o?o.$.vnode?.el?o.$.vnode.el:o.$.subTree?.el?o.$.subTree.el:o.$el?o.$el:null:null},_changeAlign(o,t){if(Array.isArray(o)){o.forEach(s=>{this._changeAlign(s,t)});return}for(let s in t)t.hasOwnProperty(s)&&(o.style[s]=t[s])},_copyCurrentData(){return{data:Ce(this.curComponent),index:this.curComponentIndex}},_deepCopyHelper(o){const t=Ce(o);return t.id=ce(fe.Component),t.component==="Group"&&(t.propValue.components||[]).forEach((c,d)=>{t.propValue.components[d]=this._deepCopyHelper(c)}),t},_restorePreCutData(){if(this.isCut&&this.copyData){const o=Ce(this.copyData.data),t=this.copyData.index;this.addComponent(o,t),this.curComponentIndex>=t&&this.curComponentIndex++}}}})();return ot.set(n,a),a},bn=n=>{ot.delete(n)},aa={__name:"ComponentList",props:{pageId:{type:String,default:""},editorStore:{type:Object,default:()=>ee()}},setup(n,{expose:a}){a();const o=n,t=e.computed(()=>o.editorStore?.curComponent||{}),s=e.computed(()=>o.editorStore?.curComponentIndex||0),c=e.computed(()=>o.editorStore?.componentData||[]),d=C=>{let w=C.compName;return w&&w.length>0&&w.trim()!==""||(w=C.label),w},l=C=>i(C).icon||"",i=C=>c.value[c.value.length-1-C],f=C=>c.value.length-1-C,p=C=>{g(C)},h=()=>{setTimeout(()=>{o.editorStore.deleteComponent(),o.editorStore.recordSnapshot()})},V=()=>{setTimeout(()=>{o.editorStore.upComponent(),o.editorStore.recordSnapshot()})},N=()=>{setTimeout(()=>{o.editorStore.downComponent(),o.editorStore.recordSnapshot()})},g=C=>{o.editorStore.setCurComponent(c.value[C],C)},m={props:o,curComponent:t,curComponentIndex:s,componentData:c,getCompName:d,getComponentIcon:l,getComponent:i,transformIndex:f,onClick:p,deleteComponent:h,upComponent:V,downComponent:N,setCurComponent:g,isShowIcon:C=>i(C).style.isHide?"bukejian":"kejian",isSvgIcon:function(C){return ge(C)&&C.startsWith("svg")},spanIconClass:function(C){return ge(C)&&C.startsWith("el")?C:"iconfont icon-"+C},get useEditorStore(){return ee},computed:e.computed,watch:e.watch,get isNotEmpty(){return ge}};return Object.defineProperty(m,"__isScriptSetup",{enumerable:!1,value:!0}),m}};function la(n,a,o,t,s,c){const d=e.resolveComponent("ve-svg-icon");return e.openBlock(),e.createElementBlock("div",{class:"real-time-component-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.componentData,(l,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,class:e.normalizeClass(["list",{actived:t.transformIndex(i)===t.curComponentIndex}]),onClick:f=>t.onClick(t.transformIndex(i))},[e.createElementVNode("div",{class:"comp-icon"},[t.isSvgIcon(t.getComponentIcon(i))?(e.openBlock(),e.createBlock(d,{key:0,"icon-class":t.getComponentIcon(i).substring(3)},null,8,["icon-class"])):(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(t.spanIconClass(t.getComponentIcon(i)))},null,2))]),e.createTextVNode(),e.createElementVNode("span",{class:e.normalizeClass(["iconfont","icon-"+t.isShowIcon(i)])},null,2),e.createTextVNode(),e.createElementVNode("span",null,e.toDisplayString(t.getCompName(t.getComponent(i))),1),e.createTextVNode(),e.createElementVNode("div",{class:"icon-container"},[e.createElementVNode("span",{class:"iconfont icon-shangyi",onClick:f=>t.upComponent(t.transformIndex(i))},null,8,["onClick"]),e.createTextVNode(),e.createElementVNode("span",{class:"iconfont icon-xiayi",onClick:f=>t.downComponent(t.transformIndex(i))},null,8,["onClick"]),e.createTextVNode(),e.createElementVNode("span",{class:"iconfont icon-shanchu",onClick:f=>t.deleteComponent(t.transformIndex(i))},null,8,["onClick"])])],10,["onClick"]))),128))])}const ia=J(aa,[["render",la],["__scopeId","data-v-abecf561"],["__file","ComponentList.vue"]]),ra={__name:"index",props:{editorStore:{type:Object,default:()=>ee()},pageId:{type:String,default:""}},setup(n,{expose:a}){a();const o=n,t=e.ref("componentTab"),c={props:o,activeName:t,handleClick:()=>{},ref:e.ref,ComponentTab:Lo,get useEditorStore(){return ee},ComponentList:ia};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}};function sa(n,a,o,t,s,c){const d=e.resolveComponent("el-tab-pane"),l=e.resolveComponent("el-tabs");return e.openBlock(),e.createBlock(l,{modelValue:t.activeName,"onUpdate:modelValue":a[0]||(a[0]=i=>t.activeName=i),type:"border-card",class:"tabs",onTabClick:t.handleClick},{default:e.withCtx(()=>[e.createVNode(d,{label:"组件",name:"componentTab"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[e.createVNode(t.ComponentTab)],1024))]),_:1}),e.createTextVNode(),e.createVNode(d,{label:"组件列表",name:"componentTreeTab"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[e.createVNode(t.ComponentList,{"editor-store":t.props.editorStore,"page-id":t.props.pageId},null,8,["editor-store","page-id"])],1024))]),_:1})]),_:1},8,["modelValue"])}const ca=J(ra,[["render",sa],["__scopeId","data-v-f00af19f"],["__file","index.vue"]]),da=Object.assign({name:"CommonDialog"},{__name:"index",props:{width:{type:Number,default:500},title:{type:String,default:"对话框"},modal:{type:Boolean,default:!0}},emits:["confirm"],setup(n,{expose:a,emit:o}){const t=e.ref("弹框"),s=e.ref(!1),c=n,d=o;let l=null;const i=e.computed(()=>t.value&&Re(t.value)?t.value:c.title),f=()=>{d("confirm",{callBack:l})},p=()=>{s.value=!1},h=(N={})=>{s.value=!0,l=N.callBack,t.value=N.title||""};a({show:h,cancel:p});const V={showTitle:t,openDialog:s,props:c,emit:d,get callBack(){return l},set callBack(N){l=N},title:i,confirmInner:f,cancel:p,show:h,ref:e.ref,computed:e.computed,get isNotEmpty(){return Re}};return Object.defineProperty(V,"__isScriptSetup",{enumerable:!1,value:!0}),V}});function ua(n,a,o,t,s,c){const d=e.resolveComponent("el-button"),l=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(l,{title:t.title,modelValue:t.openDialog,"onUpdate:modelValue":a[0]||(a[0]=i=>t.openDialog=i),width:t.props.width,"before-close":t.cancel,"destroy-on-close":!0,modal:t.props.modal,"show-close":!1,"align-center":!0,draggable:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"dialog-content")]),footer:e.withCtx(()=>[e.createElementVNode("div",{class:"dialog-footer"},[e.createVNode(d,{type:"primary",onClick:t.confirmInner},{default:e.withCtx(()=>[e.createTextVNode("确定")]),_:1}),e.createTextVNode(),e.createVNode(d,{onClick:t.cancel},{default:e.withCtx(()=>[e.createTextVNode("关 闭")]),_:1})])]),_:3},8,["title","modelValue","width","modal"])}const yn=J(da,[["render",ua],["__file","index.vue"]]);function pa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Bt={exports:{}},qe={},at={exports:{}},St={},Ft={},Nn;function Ot(){if(Nn)return Ft;Nn=1;function n(t){this.__parent=t,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}n.prototype.clone_empty=function(){var t=new n(this.__parent);return t.set_indent(this.__indent_count,this.__alignment_count),t},n.prototype.item=function(t){return t<0?this.__items[this.__items.length+t]:this.__items[t]},n.prototype.has_match=function(t){for(var s=this.__items.length-1;s>=0;s--)if(this.__items[s].match(t))return!0;return!1},n.prototype.set_indent=function(t,s){this.is_empty()&&(this.__indent_count=t||0,this.__alignment_count=s||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},n.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},n.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},n.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var t=this.__parent.current_line;return t.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),t.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),t.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,t.__items[0]===" "&&(t.__items.splice(0,1),t.__character_count-=1),!0}return!1},n.prototype.is_empty=function(){return this.__items.length===0},n.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},n.prototype.push=function(t){this.__items.push(t);var s=t.lastIndexOf(`
|
|
21
|
+
`+_+"]"}return s.pop(),c=_,m}},Xo={parse:Io,stringify:qo};(function(){const n=()=>{console.log("%c 可视化编辑器 hflveditor3","color: #3498db; font-size: 16px; font-weight: bold;"),console.log("%c版本号: 0.2.11","color: #2ecc71;"),console.log("%c编译日期: 2025/11/27 12:32:38","color: #3498db;"),console.log("%c版权声明:","color: #e74c3c; font-weight: bold;"),console.log('%c 1. 版权完全归"hflsoft"享有。',"color: #34495e;"),console.log("%c 2. 程序包完整引用,不得以任何形式破解、裁剪,不得隐藏或删除版权信息。","color: #34495e;"),console.log("%c 3. 保留此版权信息在控制台输出。","color: #34495e;"),console.log("%c 版权所有 ©2024-2025 hflsoft 保留对此版权信息的最终解释权.","color: #f39c12;"),console.log("%c Copyright ©2024-2025 hflsoft All rights reserved.","color: #f39c12;")};if(typeof window<"u"){window._copyright_hflveditor3=n;try{Object.defineProperty(window,_copyright_hflveditor3,{value:n,writable:!1,configurable:!1,enumerable:!1})}catch{window._copyright_hflveditor3=n}}n()})();function et(n){return!isNaN(parseFloat(n))&&isFinite(n)}function Re(n){return!!(n&&n!="")}function Le(n){return!!(n&&typeof n=="function")}function pn(n){return n instanceof Object&&n!==null}function Me(n){return Object.keys(n).length===0}function _n(n){return typeof n=="string"||n instanceof String}function be(n){if(typeof n=="object"){const a=Array.isArray(n)?[]:{};for(const o in n)typeof n[o]=="object"?a[o]=be(n[o]):a[o]=n[o];return a}return n}function xe(n,a={}){if(_n(n)&&Re(n))try{return Xo.parse(n)}catch(o){return console.warn("JSON 解析错误:",o),a}else return pn(n)?n:a}function Ve(n){return _n(n)?n:pn(n)?JSON.stringify(n,null,2):""}function oe(n,a){Be.ElMessage({message:a||"message",type:n||"info"})}function ze(n,a="确认",o="info",t,s){Be.ElMessageBox.confirm(n,a,{confirmButtonText:"确认",cancelButtonText:"取消",type:o}).then(()=>{Le(t)&&t()}).catch(()=>{Le(s)&&s()})}function fn(n,a="提示",o={},t,s){Be.ElMessageBox.prompt(n,a,{confirmButtonText:"确认",cancelButtonText:"取消",inputPattern:o.pattern||"",inputErrorMessage:o.errMsg||""}).then(({value:c})=>{Le(t)&&t(c)}).catch(()=>{Le(s)&&s()})}const fe={Component:"Comp_",Page:"P_",CompEvent:"CompEvent_",Dialog:"Dialog_"},Go=[{label:"PC端",value:"0",isDisabled:!0},{label:"1920*1080",value:"1"},{label:"1680*1050",value:"9"},{label:"1600*900",value:"2"},{label:"1400*1050",value:"10"},{label:"1366*768",value:"3"},{label:"1280*720",value:"4"},{label:"移动端",value:"5",isDisabled:!0,isDivided:!0},{label:"1024*1366",value:"6"},{label:"768*1024",value:"7"},{label:"480*800",value:"8"}],Et=["rgba(245, 10, 10, 1)","rgba(255, 255, 0, 1)","rgba(0, 255, 0, 1)","rgba(239, 236, 236, 1)","rgba(114,114,114,1)","rgba(0,255,255,1)","rgba(138,43,226,1)","rgba(16, 55, 81, 1)"],Jo=[{label:"不重复",value:"no-repeat"},{label:"水平重复",value:"repeat-x"},{label:"垂直重复",value:"repeat-y"},{label:"双向重复",value:"repeat"}],Yo=[{label:"覆盖",value:"cover"},{label:"适应",value:"contain"},{label:"自动",value:"auto"}],Qo=[{label:"顶部",value:"top"},{label:"底部",value:"bottom"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"居中",value:"center"}],Zo=[{label:"不适配",value:"no-adapter"},{label:"全屏铺满",value:"all-screen"},{label:"原始比例",value:"original-ratio"},{label:"横向适配-保持纵横比",value:"h-adapter-wh"},{label:"纵向适配-保持纵横比",value:"v-adapter-wh"},{label:"横向适配",value:"h-adapter"},{label:"纵向适配",value:"v-adapter"}],tt=[{label:"选项改变",value:"selectItem"},{label:"值改变",value:"changeValue"},{label:"鼠标点击",value:"onMouseClick"},{label:"鼠标双击",value:"onMouseDblClick"},{label:"键盘回车",value:"keyEnter"},{label:"组件挂载前",value:"onBeforeMount"},{label:"组件挂载后",value:"onMounted"},{label:"组件卸载前",value:"onBeforeUnmount"},{label:"组件卸载后",value:"onUnmounted"}],hn=[{label:"数据请求",value:"dataRequest"},{label:"路由跳转",value:"router"},{label:"缓存设置",value:"cacheSet"},{label:"Web缓存",value:"webStorage"},{label:"组件局域参数设置",value:"paramSet"},{label:"组件局域参数映射",value:"paramMap"},{label:"自定义函数",value:"customFunction"},{label:"组件设置",value:"componentSet"},{label:"操作终止",value:"actionEnd"},{label:"消息弹出框",value:"messageBox"},{label:"打开对话框",value:"openDialog"}],vo=[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"DELETE",value:"DELETE"}],mn=[{label:"==",value:"=="},{label:"!=",value:"!="},{label:">",value:">"},{label:">=",value:">="},{label:"<",value:"<"},{label:"<=",value:"<="},{label:"包含",value:"contain"},{label:"不包含",value:"unContain"},{label:"字符串相等",value:"equals"},{label:"字符串不相等",value:"unEquals"},{label:"字符串忽略大小写相等",value:"equalsIgnoreCase"}],Ae=[{value:"inputV",label:"直接输入值"},{value:"inputP",label:"组件局域参数"},{value:"cacheP",label:"缓存参数"},{value:"containerP",label:"容器参数"},{value:"sessionP",label:"会话缓存参数"},{value:"localP",label:"本地缓存参数"},{value:"jsCookieP",label:"JSCookie缓存参数"},{value:"compProp",label:"组件值"},{value:"compStyle",label:"组件样式"}],$o=[{value:"inputP",label:"组件局域参数"},{value:"cacheP",label:"缓存参数"},{value:"sessionP",label:"会话缓存参数"},{value:"localP",label:"本地缓存参数"},{value:"jsCookieP",label:"JSCookie缓存参数"}],kt=[{value:"primary",label:"primary"},{value:"success",label:"success"},{value:"warning",label:"warning"},{value:"info",label:"info"},{value:"error",label:"error"}],gn=[{value:"msg",label:"Message"},{value:"notify",label:"Notification"}];function Ie(n){return n*Math.PI/180}function ae(n,a,o){return{x:(n.x-a.x)*Math.cos(Ie(o))-(n.y-a.y)*Math.sin(Ie(o))+a.x,y:(n.x-a.x)*Math.sin(Ie(o))+(n.y-a.y)*Math.cos(Ie(o))+a.y}}function Te(n,a){return{x:n.x+(a.x-n.x)/2,y:n.y+(a.y-n.y)/2}}function Cn(n){return Math.abs(Math.sin(Ie(n)))}function xn(n){return Math.abs(Math.cos(Ie(n)))}function He(n){return(n+360)%360}function nt(n){return`${n*100}%`}function ea(n){const a={};return["width","height","top","left","rotate"].forEach(o=>{o!="rotate"?a[o]=`${n[o]}px`:a.transform=`rotate(${n[o]}deg)`}),a}const Vn=["fontSize","width","height","top","left","borderWidth","letterSpacing","borderRadius"];function At(n,a=[]){const o={};return["opacity","width","height","top","left","rotate","fontSize","fontWeight","lineHeight","letterSpacing","textAlign","color"].forEach(t=>{a.includes(t)||(t!="rotate"?n[t]!==""&&(o[t]=n[t],Vn.includes(t)&&(o[t]+="px")):o.transform=`${t}(${n[t]}deg)`)}),o}function Tt(n,a=[]){const o={};return Object.keys(n).forEach(t=>{a.includes(t)||(t!="rotate"?n[t]!==""&&(o[t]=n[t],Vn.includes(t)&&(o[t]+="px")):o.transform=`${t}(${n[t]}deg)`)}),o}function Y(n){if(n={...n},n.rotate!=0){const a=n.width*xn(n.rotate)+n.height*Cn(n.rotate),o=(n.width-a)/2;n.left+=o,n.right=n.left+a;const t=n.height*xn(n.rotate)+n.width*Cn(n.rotate),s=(t-n.height)/2;n.top-=s,n.bottom=n.top+t,n.width=a,n.height=t}else n.bottom=n.top+n.height,n.right=n.left+n.width;return n}const ta=["width","height","scale"];function wn(n){const a={};return Object.keys(n).filter(o=>!ta.includes(o)).forEach(o=>{o==="fontSize"?a[o]+="px":o==="backgroundImage"?a["background-image"]="url("+n[o]+")":o==="backgroundRepeat"?a["background-repeat"]=n[o]:o==="backgroundSize"?a["background-size"]=n[o]:o==="backgroundPosition"?a["background-position"]=n[o]:a[o]=n[o]}),a}function na(n){const a=n.style;(n.propValue.components||[]).forEach(t=>{if(!Object.keys(t.groupStyle).length){const s={...t.style};t.component.startsWith("SVG")?t.groupStyle=At(s):t.groupStyle=Tt(s),t.groupStyle.left=nt((s.left-a.left)/a.width),t.groupStyle.top=nt((s.top-a.top)/a.height),t.groupStyle.width=nt(s.width/a.width),t.groupStyle.height=nt(s.height/a.height)}})}function Dn(n,a,o,t){isNaN(t.rotate)&&(t.rotate=0),n.style&&isNaN(n.style.rotate)&&(n.style.rotate=0),n.style.rotate=He(n.style.rotate+t.rotate),n.style.width=parseFloat(n.groupStyle.width)/100*t.width,n.style.height=parseFloat(n.groupStyle.height)/100*t.height,n.style.left=o.left-a.left+parseFloat(n.groupStyle.left)/100*t.width,n.style.top=o.top-a.top+parseFloat(n.groupStyle.top)/100*t.height,n.groupStyle={},n.style.width=Qe(n.style.width),n.style.height=Qe(n.style.height),n.style.left=Qe(n.style.left),n.style.top=Qe(n.style.top)}function oa(n){return{all:n=n||new Map,on:function(a,o){var t=n.get(a);t?t.push(o):n.set(a,[o])},off:function(a,o){var t=n.get(a);t&&(o?t.splice(t.indexOf(o)>>>0,1):n.set(a,[]))},emit:function(a,o){var t=n.get(a);t&&t.slice().map(function(s){s(o)}),(t=n.get("*"))&&t.slice().map(function(s){s(a,o)})}}}const v=oa(),$={openCanvasSetting:"openCanvasDrawer",openRuleSetting:"openRuleSetting",openNewPage:"openNewPage",runAnimation:"runAnimation",stopAnimation:"stopAnimation",componentClick:"componentClick",move:"move",unmove:"unmove",hideArea:"hideArea",save:"save",preview:"preview",clearCanvas:"clearCanvas",importJson:"importJson",exportJson:"exportJson",openPage:"openPage",savePage:"savePage"},ot=new Map,ee=(n="default")=>{if(ot.has(n))return ot.get(n);const a=xt.defineStore(`editor-${n}`,{state:()=>({rule:{scale:1,minScale:.3,maxScale:3},areaData:{style:{top:0,left:0,width:0,height:0},components:[]},editor:null,editorInstance:null,isDarkMode:!1,lastScale:100,canvasStyleData:{width:1200,height:800,scale:100,color:"#000",opacity:1,background:"#fff",fontSize:14,screenAdapter:"no-adapter"},isInEditor:!1,componentData:[],dashBorderColor:"rgba(114, 114, 114, 1)",curComponent:null,curComponentIndex:null,isClickComponent:!1,snapshotData:[],snapshotIndex:-1,menuTop:0,menuLeft:0,menuShow:!1,copyData:null,isCut:!1,ruleReferenceLine:"#00FFFF",rulePresetLine:[]}),actions:{setRuleScale(o){let t=Number(o);t>0&&(t=t>this.rule.maxScale?this.rule.maxScale:t,t=t<this.rule.minScale?this.rule.minScale:t,this.rule.scale=t)},addRuleScale(o){let t=Number(o)||"0.1",s=this.rule.scale+t;this.setRuleScale(s)},subtractRuleScale(o){let t=Number(o)||"0.1",s=this.rule.scale-t;this.setRuleScale(s)},setEditor(o){this.editor=o},setEditorInstance(o){this.editorInstance=o},setAreaData(o){this.areaData=o},compose(){const o=[];this.areaData.components.forEach(s=>{if(s.component!="Group")o.push(s);else{const c={...s.style},d=s.propValue.components||[],l=this.getEditorBoundingClientRect(),i=this.getComponentRect(s.id);d.forEach(f=>{Dn(f,l,i,c)}),o.push(...s.propValue.components)}});const t={id:ce(fe.Component),component:"Group",label:"组合",icon:"svgcombination",...nn,style:{...tn,...this.areaData.style},propValue:{components:o}};na(t),this.addComponent(t),v.emit($.hideArea),this.batchDeleteComponent(o),this.setCurComponent(this.componentData[this.componentData.length-1],this.componentData.length-1),this.areaData.components=[]},batchDeleteComponent(o){for(let t=0;t<o.length;t++)for(let s=0,c=this.componentData.length;s<c;s++)if(o[t].id==this.componentData[s].id){this.componentData.splice(s,1);break}Se("debug","batchDeleteComponent 需要删除:",o.length,"删除后:",this.componentData.length)},decompose(){const o={...this.curComponent.style},t=this.curComponent.propValue?.components||[],s=this.getEditorBoundingClientRect(),c=this.getComponentRect(this.curComponent.id);this.deleteComponent(),Se("debug","decompose editorRect:",s),Se("debug","decompose parentRect:",c),Se("debug","decompose parentStyle:",o),t.forEach(d=>{Dn(d,s,c,o),Se("info","decompose component:",d.id,d.style),this.addComponent(d)})},getEditorBoundingClientRect(){return this.editor?.getBoundingClientRect()},setComponentData(o=[]){this.componentData=o},addComponent(o,t){t!==void 0?this.componentData.splice(t,0,o):this.componentData.push(o)},deleteComponent(o){o===void 0&&(o=this.curComponentIndex),o==this.curComponentIndex&&(this.curComponentIndex=null,this.curComponent=null),/\d/.test(o)&&this.componentData.splice(o,1)},setClickComponentStatus(o){this.isClickComponent=o},setCanvasStyle(o){this.canvasStyleData=o},setInEditorStatus(o){this.isInEditor=o},setCurComponent(o,t){this.curComponent=o,this.curComponentIndex=t},setShapeStyle({top:o,left:t,width:s,height:c,rotate:d,padding:l}){o!==void 0&&(this.curComponent.style.top=Math.round(o)),t!==void 0&&(this.curComponent.style.left=Math.round(t)),s&&(this.curComponent.style.width=Math.round(s)),l&&(this.curComponent.style.padding=Math.round(l)),c&&(this.curComponent.style.height=Math.round(c)),d&&(this.curComponent.style.rotate=Math.round(d))},setShapeSingleStyle({key:o,value:t}){this.curComponent.style[o]=t},recordSnapshot(){let o=Ce(this.componentData);o.forEach(t=>t.lastScale=this.lastScale),this.snapshotData[++this.snapshotIndex]=o,this.snapshotIndex<this.snapshotData.length-1&&(this.snapshotData=this.snapshotData.slice(0,this.snapshotIndex+1))},undo(){if(this.snapshotIndex>=0){this.snapshotIndex--;let o=Ce(this.snapshotData[this.snapshotIndex])||[];this.curComponent&&!o.find(s=>this.curComponent.id===s.id)&&this.setCurComponent({component:null,index:null}),o=sn(this,this.lastScale,o),this.setComponentData(o)}},redo(){if(this.snapshotIndex<this.snapshotData.length-1){this.snapshotIndex++;let o=sn(this,this.lastScale,Ce(this.snapshotData[this.snapshotIndex]));this.setComponentData(o)}},addAnimation(o){this.curComponent.animations.push(o)},removeAnimation(o){this.curComponent.animations.splice(o,1)},alterAnimation({index:o,data:t={}}){if(typeof o=="number"){const s=this.curComponent.animations[o];this.curComponent.animations[o]={...s,...t}}},addComponentEvent(o){this.curComponent.events[o.type]?this.curComponent.events[o.type].push(o):this.curComponent.events[o.type]=[o]},removeComponentEvent(o,t){this.curComponent.events[o]&&t>=0&&(this.curComponent.events[o].splice(t,1),this.curComponent.events[o].length==0&&delete this.curComponent.events[o])},alterComponentEvent(o,t,s={}){if(this.curComponent.events[o]&&t>=0){const c=this.curComponent.events[o][t];this.curComponent.events[o][t]={...c,...s}}},showContextMenu({top:o,left:t}){this.menuShow=!0,this.menuTop=o,this.menuLeft=t},hideContextMenu(){this.menuShow=!1},lock(){this.curComponent.isLock=!0},unlock(){this.curComponent.isLock=!1},copy(){if(!this.curComponent){oe("error","请选择组件");return}this._restorePreCutData(),this.copyData=this._copyCurrentData(),this.isCut=!1},paste(o){if(!this.copyData){oe("error","请选择组件");return}const t=this.copyData.data;o?(t.style.top=this.menuTop,t.style.left=this.menuLeft):(t.style.top+=30,t.style.left+=20),this.addComponent(this._deepCopyHelper(t),null),this.isCut&&(this.copyData=null)},cut(){if(!this.curComponent){oe("error","请选择组件");return}this._restorePreCutData(),this.copyData=this._copyCurrentData(),this.deleteComponent(),this.isCut=!0},upComponent(){this.curComponentIndex<this.componentData.length-1?(an(this.componentData,this.curComponentIndex,this.curComponentIndex+1),this.curComponentIndex=this.curComponentIndex+1):oe("error","已经到顶了")},downComponent(){this.curComponentIndex>0?(an(this.componentData,this.curComponentIndex,this.curComponentIndex-1),this.curComponentIndex=this.curComponentIndex-1):oe("error","已经到底了")},topComponent(){this.curComponentIndex<this.componentData.length-1?(this.componentData.splice(this.curComponentIndex,1),this.componentData.push(this.curComponent),this.curComponentIndex=this.componentData.length-1):oe("error","已经到顶了")},bottomComponent(){this.curComponentIndex>0?(this.componentData.splice(this.curComponentIndex,1),this.componentData.unshift(this.curComponent),this.curComponentIndex=0):oe("error","已经到底了")},leftAlign(){if(this.areaData.components.length>1){let o=Math.min(...this.areaData.components.map(t=>Y(t.style).left));this.areaData.components.forEach(t=>{let c=Y(t.style).left-o;this._changeAlign(t,{left:t.style.left-c})})}else{let o=Y(this.curComponent.style),t=this.curComponent.style.left-o.left;this._changeAlign(this.curComponent,{left:t})}},rightAlign(){if(this.areaData.components.length>1){let o=Math.max(...this.areaData.components.map(t=>Y(t.style).right));this.areaData.components.forEach(t=>{let s=Y(t.style),c=o-s.right;this._changeAlign(t,{left:t.style.left+c})})}else{let o=Y(this.curComponent.style),t=this.curComponent.style.left-o.left,s=this.canvasStyleData.width+t-o.width;this._changeAlign(this.curComponent,{left:s})}},centerAlign(){if(this.areaData.components.length>1){let o=Math.min(...this.areaData.components.map(c=>Y(c.style).left)),t=Math.max(...this.areaData.components.map(c=>Y(c.style).right)),s=(o+t)/2;this.areaData.components.forEach(c=>{let d=Y(c.style),l=(d.left+d.right)/2,i=s-l;this._changeAlign(c,{left:c.style.left+i})})}else{let o=Y(this.curComponent.style),t=this.canvasStyleData.width/2,s=(o.left+o.right)/2,c=this.curComponent.style.left+(t-s);this._changeAlign(this.curComponent,{left:c})}},topAlign(){if(this.areaData.components.length>1){let o=Math.min(...this.areaData.components.map(t=>Y(t.style).top));this.areaData.components.forEach(t=>{let c=Y(t.style).top-o;this._changeAlign(t,{top:t.style.top-c})})}else{let o=Y(this.curComponent.style),t=this.curComponent.style.top-o.top;this._changeAlign(this.curComponent,{top:t})}},bottomAlign(){if(this.areaData.components.length>1){let o=Math.max(...this.areaData.components.map(t=>Y(t.style).bottom));this.areaData.components.forEach(t=>{let s=Y(t.style),c=o-s.bottom;this._changeAlign(t,{top:t.style.top+c})})}else{let o=Y(this.curComponent.style),t=this.curComponent.style.top-o.top,s=this.canvasStyleData.height+t-o.height;this._changeAlign(this.curComponent,{top:s})}},middleAlign(){if(this.areaData.components.length>1){let o=Math.min(...this.areaData.components.map(c=>Y(c.style).top)),t=Math.max(...this.areaData.components.map(c=>Y(c.style).bottom)),s=(o+t)/2;this.areaData.components.forEach(c=>{let d=Y(c.style),l=(d.top+d.bottom)/2,i=s-l;this._changeAlign(c,{top:c.style.top+i})})}else{let o=Y(this.curComponent.style),t=this.canvasStyleData.height/2,s=(o.top+o.bottom)/2,c=this.curComponent.style.top+(t-s);this._changeAlign(this.curComponent,{top:c})}},verticalSpacing(){const{components:o}=this.areaData;if(o.length>2){let t=0;o.forEach(i=>{let f=Y(i.style);t+=f.height});const c=this.areaData.style.height-t,d=Math.floor(c/(o.length-1));o.sort((i,f)=>Y(i.style).top-Y(f.style).top);let l=0;o.forEach(i=>{this._changeAlign(i,{top:this.areaData.style.top+l}),l+=d+Y(i.style).height})}},horizontalSpacing(){const{components:o}=this.areaData;if(o.length>2){let t=0;o.forEach(i=>{let f=Y(i.style);t+=f.width});const c=this.areaData.style.width-t,d=Math.floor(c/(o.length-1));o.sort((i,f)=>Y(i.style).left-Y(f.style).left);let l=0;o.forEach(i=>{i.style.left=this.areaData.style.left+l,l+=d+Y(i.style).width})}},getComponentRect(o){let t=this.editorInstance.getComponentRef(o),s=this._getComponentDom(t);return s?s.getBoundingClientRect():null},_getComponentDom(o){return o?o.$.vnode?.el?o.$.vnode.el:o.$.subTree?.el?o.$.subTree.el:o.$el?o.$el:null:null},_changeAlign(o,t){if(Array.isArray(o)){o.forEach(s=>{this._changeAlign(s,t)});return}for(let s in t)t.hasOwnProperty(s)&&(o.style[s]=t[s])},_copyCurrentData(){return{data:Ce(this.curComponent),index:this.curComponentIndex}},_deepCopyHelper(o){const t=Ce(o);return t.id=ce(fe.Component),t.component==="Group"&&(t.propValue.components||[]).forEach((c,d)=>{t.propValue.components[d]=this._deepCopyHelper(c)}),t},_restorePreCutData(){if(this.isCut&&this.copyData){const o=Ce(this.copyData.data),t=this.copyData.index;this.addComponent(o,t),this.curComponentIndex>=t&&this.curComponentIndex++}}}})();return ot.set(n,a),a},bn=n=>{ot.delete(n)},aa={__name:"ComponentList",props:{pageId:{type:String,default:""},editorStore:{type:Object,default:()=>ee()}},setup(n,{expose:a}){a();const o=n,t=e.computed(()=>o.editorStore?.curComponent||{}),s=e.computed(()=>o.editorStore?.curComponentIndex||0),c=e.computed(()=>o.editorStore?.componentData||[]),d=C=>{let w=C.compName;return w&&w.length>0&&w.trim()!==""||(w=C.label),w},l=C=>i(C).icon||"",i=C=>c.value[c.value.length-1-C],f=C=>c.value.length-1-C,p=C=>{g(C)},h=()=>{setTimeout(()=>{o.editorStore.deleteComponent(),o.editorStore.recordSnapshot()})},V=()=>{setTimeout(()=>{o.editorStore.upComponent(),o.editorStore.recordSnapshot()})},N=()=>{setTimeout(()=>{o.editorStore.downComponent(),o.editorStore.recordSnapshot()})},g=C=>{o.editorStore.setCurComponent(c.value[C],C)},m={props:o,curComponent:t,curComponentIndex:s,componentData:c,getCompName:d,getComponentIcon:l,getComponent:i,transformIndex:f,onClick:p,deleteComponent:h,upComponent:V,downComponent:N,setCurComponent:g,isShowIcon:C=>i(C).style.isHide?"bukejian":"kejian",isSvgIcon:function(C){return ge(C)&&C.startsWith("svg")},spanIconClass:function(C){return ge(C)&&C.startsWith("el")?C:"iconfont icon-"+C},get useEditorStore(){return ee},computed:e.computed,watch:e.watch,get isNotEmpty(){return ge}};return Object.defineProperty(m,"__isScriptSetup",{enumerable:!1,value:!0}),m}};function la(n,a,o,t,s,c){const d=e.resolveComponent("ve-svg-icon");return e.openBlock(),e.createElementBlock("div",{class:"real-time-component-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.componentData,(l,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,class:e.normalizeClass(["list",{actived:t.transformIndex(i)===t.curComponentIndex}]),onClick:f=>t.onClick(t.transformIndex(i))},[e.createElementVNode("div",{class:"comp-icon"},[t.isSvgIcon(t.getComponentIcon(i))?(e.openBlock(),e.createBlock(d,{key:0,"icon-class":t.getComponentIcon(i).substring(3)},null,8,["icon-class"])):(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(t.spanIconClass(t.getComponentIcon(i)))},null,2))]),e.createTextVNode(),e.createElementVNode("span",{class:e.normalizeClass(["iconfont","icon-"+t.isShowIcon(i)])},null,2),e.createTextVNode(),e.createElementVNode("span",null,e.toDisplayString(t.getCompName(t.getComponent(i))),1),e.createTextVNode(),e.createElementVNode("div",{class:"icon-container"},[e.createElementVNode("span",{class:"iconfont icon-shangyi",onClick:f=>t.upComponent(t.transformIndex(i))},null,8,["onClick"]),e.createTextVNode(),e.createElementVNode("span",{class:"iconfont icon-xiayi",onClick:f=>t.downComponent(t.transformIndex(i))},null,8,["onClick"]),e.createTextVNode(),e.createElementVNode("span",{class:"iconfont icon-shanchu",onClick:f=>t.deleteComponent(t.transformIndex(i))},null,8,["onClick"])])],10,["onClick"]))),128))])}const ia=J(aa,[["render",la],["__scopeId","data-v-abecf561"],["__file","ComponentList.vue"]]),ra={__name:"index",props:{editorStore:{type:Object,default:()=>ee()},pageId:{type:String,default:""}},setup(n,{expose:a}){a();const o=n,t=e.ref("componentTab"),c={props:o,activeName:t,handleClick:()=>{},ref:e.ref,ComponentTab:Lo,get useEditorStore(){return ee},ComponentList:ia};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}};function sa(n,a,o,t,s,c){const d=e.resolveComponent("el-tab-pane"),l=e.resolveComponent("el-tabs");return e.openBlock(),e.createBlock(l,{modelValue:t.activeName,"onUpdate:modelValue":a[0]||(a[0]=i=>t.activeName=i),type:"border-card",class:"tabs",onTabClick:t.handleClick},{default:e.withCtx(()=>[e.createVNode(d,{label:"组件",name:"componentTab"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[e.createVNode(t.ComponentTab)],1024))]),_:1}),e.createTextVNode(),e.createVNode(d,{label:"组件列表",name:"componentTreeTab"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[e.createVNode(t.ComponentList,{"editor-store":t.props.editorStore,"page-id":t.props.pageId},null,8,["editor-store","page-id"])],1024))]),_:1})]),_:1},8,["modelValue"])}const ca=J(ra,[["render",sa],["__scopeId","data-v-f00af19f"],["__file","index.vue"]]),da=Object.assign({name:"CommonDialog"},{__name:"index",props:{width:{type:Number,default:500},title:{type:String,default:"对话框"},modal:{type:Boolean,default:!0}},emits:["confirm"],setup(n,{expose:a,emit:o}){const t=e.ref("弹框"),s=e.ref(!1),c=n,d=o;let l=null;const i=e.computed(()=>t.value&&Re(t.value)?t.value:c.title),f=()=>{d("confirm",{callBack:l})},p=()=>{s.value=!1},h=(N={})=>{s.value=!0,l=N.callBack,t.value=N.title||""};a({show:h,cancel:p});const V={showTitle:t,openDialog:s,props:c,emit:d,get callBack(){return l},set callBack(N){l=N},title:i,confirmInner:f,cancel:p,show:h,ref:e.ref,computed:e.computed,get isNotEmpty(){return Re}};return Object.defineProperty(V,"__isScriptSetup",{enumerable:!1,value:!0}),V}});function ua(n,a,o,t,s,c){const d=e.resolveComponent("el-button"),l=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(l,{title:t.title,modelValue:t.openDialog,"onUpdate:modelValue":a[0]||(a[0]=i=>t.openDialog=i),width:t.props.width,"before-close":t.cancel,"destroy-on-close":!0,modal:t.props.modal,"show-close":!1,"align-center":!0,draggable:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"dialog-content")]),footer:e.withCtx(()=>[e.createElementVNode("div",{class:"dialog-footer"},[e.createVNode(d,{type:"primary",onClick:t.confirmInner},{default:e.withCtx(()=>[e.createTextVNode("确定")]),_:1}),e.createTextVNode(),e.createVNode(d,{onClick:t.cancel},{default:e.withCtx(()=>[e.createTextVNode("关 闭")]),_:1})])]),_:3},8,["title","modelValue","width","modal"])}const yn=J(da,[["render",ua],["__file","index.vue"]]);function pa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Bt={exports:{}},qe={},at={exports:{}},St={},Ft={},Nn;function Ot(){if(Nn)return Ft;Nn=1;function n(t){this.__parent=t,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}n.prototype.clone_empty=function(){var t=new n(this.__parent);return t.set_indent(this.__indent_count,this.__alignment_count),t},n.prototype.item=function(t){return t<0?this.__items[this.__items.length+t]:this.__items[t]},n.prototype.has_match=function(t){for(var s=this.__items.length-1;s>=0;s--)if(this.__items[s].match(t))return!0;return!1},n.prototype.set_indent=function(t,s){this.is_empty()&&(this.__indent_count=t||0,this.__alignment_count=s||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},n.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},n.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},n.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var t=this.__parent.current_line;return t.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),t.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),t.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,t.__items[0]===" "&&(t.__items.splice(0,1),t.__character_count-=1),!0}return!1},n.prototype.is_empty=function(){return this.__items.length===0},n.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},n.prototype.push=function(t){this.__items.push(t);var s=t.lastIndexOf(`
|
|
22
22
|
`);s!==-1?this.__character_count=t.length-s:this.__character_count+=t.length},n.prototype.pop=function(){var t=null;return this.is_empty()||(t=this.__items.pop(),this.__character_count-=t.length),t},n.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},n.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},n.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},n.prototype.toString=function(){var t="";return this.is_empty()?this.__parent.indent_empty_lines&&(t=this.__parent.get_indent_string(this.__indent_count)):(t=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),t+=this.__items.join("")),t};function a(t,s){this.__cache=[""],this.__indent_size=t.indent_size,this.__indent_string=t.indent_char,t.indent_with_tabs||(this.__indent_string=new Array(t.indent_size+1).join(t.indent_char)),s=s||"",t.indent_level>0&&(s=new Array(t.indent_level+1).join(this.__indent_string)),this.__base_string=s,this.__base_string_length=s.length}a.prototype.get_indent_size=function(t,s){var c=this.__base_string_length;return s=s||0,t<0&&(c=0),c+=t*this.__indent_size,c+=s,c},a.prototype.get_indent_string=function(t,s){var c=this.__base_string;return s=s||0,t<0&&(t=0,c=""),s+=t*this.__indent_size,this.__ensure_cache(s),c+=this.__cache[s],c},a.prototype.__ensure_cache=function(t){for(;t>=this.__cache.length;)this.__add_column()},a.prototype.__add_column=function(){var t=this.__cache.length,s=0,c="";this.__indent_size&&t>=this.__indent_size&&(s=Math.floor(t/this.__indent_size),t-=s*this.__indent_size,c=new Array(s+1).join(this.__indent_string)),t&&(c+=new Array(t+1).join(" ")),this.__cache.push(c)};function o(t,s){this.__indent_cache=new a(t,s),this.raw=!1,this._end_with_newline=t.end_with_newline,this.indent_size=t.indent_size,this.wrap_line_length=t.wrap_line_length,this.indent_empty_lines=t.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new n(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}return o.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},o.prototype.get_line_number=function(){return this.__lines.length},o.prototype.get_indent_string=function(t,s){return this.__indent_cache.get_indent_string(t,s)},o.prototype.get_indent_size=function(t,s){return this.__indent_cache.get_indent_size(t,s)},o.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},o.prototype.add_new_line=function(t){return this.is_empty()||!t&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},o.prototype.get_code=function(t){this.trim(!0);var s=this.current_line.pop();s&&(s[s.length-1]===`
|
|
23
23
|
`&&(s=s.replace(/\n+$/g,"")),this.current_line.push(s)),this._end_with_newline&&this.__add_outputline();var c=this.__lines.join(`
|
|
24
24
|
`);return t!==`
|