vue-wiring-diagram 1.0.9 → 1.0.10
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.
|
@@ -34835,8 +34835,10 @@ const F$ = { class: "control-box" }, V$ = {
|
|
|
34835
34835
|
{ type: "number", message: "排序必须为数字值" }
|
|
34836
34836
|
]
|
|
34837
34837
|
}, a = U(""), l = (d) => {
|
|
34838
|
-
if (d.raw.type
|
|
34839
|
-
|
|
34838
|
+
if (d.raw.type.indexOf("image") === -1) {
|
|
34839
|
+
Ke.error("请上传图片格式的文件");
|
|
34840
|
+
return;
|
|
34841
|
+
}
|
|
34840
34842
|
const h = new FormData();
|
|
34841
34843
|
h.append("file", d.raw), HD("/cny/file/fileUpload", h).then((f) => {
|
|
34842
34844
|
f != null && f.isOk ? (a.value = ei.defaults.baseURL + "/cny/upload/" + (f == null ? void 0 : f.data), r.imageUrl = f == null ? void 0 : f.data) : Ke.error((f == null ? void 0 : f.msg) || "上传失败");
|
|
@@ -34970,7 +34972,7 @@ const F$ = { class: "control-box" }, V$ = {
|
|
|
34970
34972
|
]);
|
|
34971
34973
|
};
|
|
34972
34974
|
}
|
|
34973
|
-
}, K$ = /* @__PURE__ */ Ss(X$, [["__scopeId", "data-v-
|
|
34975
|
+
}, K$ = /* @__PURE__ */ Ss(X$, [["__scopeId", "data-v-c7d87a18"]]), Z$ = { class: "form-container" }, Q$ = { style: { padding: "0 10px", display: "flex", "flex-direction": "column", gap: "5px", "align-items": "flex-start" } }, e6 = ["src"], t6 = {
|
|
34974
34976
|
__name: "image-management",
|
|
34975
34977
|
setup(n) {
|
|
34976
34978
|
const e = Dt({
|
|
@@ -735,4 +735,4 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:s,curr
|
|
|
735
735
|
font-size: 10px;
|
|
736
736
|
background-color: #6a6b8a;
|
|
737
737
|
}
|
|
738
|
-
`;I.prototype.isSelectionEnabled=function(){const n=this.getPlugin("selection");return n?n.isEnabled():!1},I.prototype.enableSelection=function(){const n=this.getPlugin("selection");return n&&n.enable(),this},I.prototype.disableSelection=function(){const n=this.getPlugin("selection");return n&&n.disable(),this},I.prototype.toggleSelection=function(n){const t=this.getPlugin("selection");return t&&t.toggleEnabled(n),this},I.prototype.isMultipleSelection=function(){const n=this.getPlugin("selection");return n?n.isMultipleSelection():!1},I.prototype.enableMultipleSelection=function(){const n=this.getPlugin("selection");return n&&n.enableMultipleSelection(),this},I.prototype.disableMultipleSelection=function(){const n=this.getPlugin("selection");return n&&n.disableMultipleSelection(),this},I.prototype.toggleMultipleSelection=function(n){const t=this.getPlugin("selection");return t&&t.toggleMultipleSelection(n),this},I.prototype.isSelectionMovable=function(){const n=this.getPlugin("selection");return n?n.isSelectionMovable():!1},I.prototype.enableSelectionMovable=function(){const n=this.getPlugin("selection");return n&&n.enableSelectionMovable(),this},I.prototype.disableSelectionMovable=function(){const n=this.getPlugin("selection");return n&&n.disableSelectionMovable(),this},I.prototype.toggleSelectionMovable=function(n){const t=this.getPlugin("selection");return t&&t.toggleSelectionMovable(n),this},I.prototype.isRubberbandEnabled=function(){const n=this.getPlugin("selection");return n?n.isRubberbandEnabled():!1},I.prototype.enableRubberband=function(){const n=this.getPlugin("selection");return n&&n.enableRubberband(),this},I.prototype.disableRubberband=function(){const n=this.getPlugin("selection");return n&&n.disableRubberband(),this},I.prototype.toggleRubberband=function(n){const t=this.getPlugin("selection");return t&&t.toggleRubberband(n),this},I.prototype.isStrictRubberband=function(){const n=this.getPlugin("selection");return n?n.isStrictRubberband():!1},I.prototype.enableStrictRubberband=function(){const n=this.getPlugin("selection");return n&&n.enableStrictRubberband(),this},I.prototype.disableStrictRubberband=function(){const n=this.getPlugin("selection");return n&&n.disableStrictRubberband(),this},I.prototype.toggleStrictRubberband=function(n){const t=this.getPlugin("selection");return t&&t.toggleStrictRubberband(n),this},I.prototype.setRubberbandModifiers=function(n){const t=this.getPlugin("selection");return t&&t.setRubberbandModifiers(n),this},I.prototype.setSelectionFilter=function(n){const t=this.getPlugin("selection");return t&&t.setSelectionFilter(n),this},I.prototype.setSelectionDisplayContent=function(n){const t=this.getPlugin("selection");return t&&t.setSelectionDisplayContent(n),this},I.prototype.isSelectionEmpty=function(){const n=this.getPlugin("selection");return n?n.isEmpty():!0},I.prototype.cleanSelection=function(n){const t=this.getPlugin("selection");return t&&t.clean(n),this},I.prototype.resetSelection=function(n,t){const e=this.getPlugin("selection");return e&&e.reset(n,t),this},I.prototype.getSelectedCells=function(){const n=this.getPlugin("selection");return n?n.getSelectedCells():[]},I.prototype.getSelectedCellCount=function(){const n=this.getPlugin("selection");return n?n.getSelectedCellCount():0},I.prototype.isSelected=function(n){const t=this.getPlugin("selection");return t?t.isSelected(n):!1},I.prototype.select=function(n,t){const e=this.getPlugin("selection");return e&&e.select(n,t),this},I.prototype.unselect=function(n,t){const e=this.getPlugin("selection");return e&&e.unselect(n,t),this};var fj=function(n,t,e,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(t,e,i):o(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};class ii extends Nt{get rubberbandDisabled(){return this.options.enabled!==!0||this.options.rubberband!==!0}get disabled(){return this.options.enabled!==!0}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(t={}){super(),this.name="selection",this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},ii.defaultOptions),t),jr(this.name,dj)}init(t){this.graph=t,this.selectionImpl=new Ub(Object.assign(Object.assign({},this.options),{graph:t})),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(t){return t!=null?t!==this.isMultipleSelection()&&(t?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return this.options.movable!==!1}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(t){return t!=null?t!==this.isSelectionMovable()&&(t?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(t){return t!=null?t!==this.isRubberbandEnabled()&&(t?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return this.selectionImpl.options.strict===!0}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(t){return t!=null?t!==this.isStrictRubberband()&&(t?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}setRubberbandModifiers(t){this.setModifiers(t)}setSelectionFilter(t){return this.setFilter(t),this}setSelectionDisplayContent(t){return this.setContent(t),this}isEmpty(){return this.length<=0}clean(t={}){return this.selectionImpl.clean(t),this}reset(t,e={}){return this.selectionImpl.reset(t?this.getCells(t):[],e),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(t){return this.selectionImpl.isSelected(t)}select(t,e={}){const s=this.getCells(t);return s.length&&(this.isMultiple()?this.selectionImpl.select(s,e):this.reset(s.slice(0,1),e)),this}unselect(t,e={}){return this.selectionImpl.unselect(this.getCells(t),e),this}setup(){this.selectionImpl.on("*",(t,e)=>{this.trigger(t,e),this.graph.trigger(t,e)})}startListening(){this.graph.on("blank:mousedown",this.onBlankMouseDown,this),this.graph.on("blank:click",this.onBlankClick,this),this.graph.on("cell:mousemove",this.onCellMouseMove,this),this.graph.on("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.on("box:mousedown",this.onBoxMouseDown,this)}stopListening(){this.graph.off("blank:mousedown",this.onBlankMouseDown,this),this.graph.off("blank:click",this.onBlankClick,this),this.graph.off("cell:mousemove",this.onCellMouseMove,this),this.graph.off("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;const e=this.graph.panning.allowPanning(t,!0),s=this.graph.getPlugin("scroller"),r=s&&s.allowPanning(t,!0);(this.allowRubberband(t,!0)||this.allowRubberband(t)&&!r&&!e)&&this.startRubberband(t)}allowBlankMouseDown(t){const e=this.options.eventTypes;return(e==null?void 0:e.includes("leftMouseDown"))&&t.button===0||(e==null?void 0:e.includes("mouseWheelDown"))&&t.button===1}onBlankClick(){this.clean()}allowRubberband(t,e){return!this.rubberbandDisabled&&ms.isMatch(t,this.options.modifiers,e)}allowMultipleSelection(t){return this.isMultiple()&&ms.isMatch(t,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:t}){this.movedMap.set(t,!0)}onCellMouseUp({e:t,cell:e}){const s=this.options;let r=this.disabled;!r&&this.movedMap.has(e)&&(r=s.selectCellOnMoved===!1,r||(r=s.selectNodeOnMoved===!1&&e.isNode()),r||(r=s.selectEdgeOnMoved===!1&&e.isEdge())),r||(this.allowMultipleSelection(t)?this.unselectMap.has(e)?this.unselectMap.delete(e):this.isSelected(e)?this.unselect(e):this.select(e):this.reset(e)),this.movedMap.delete(e)}onBoxMouseDown({e:t,cell:e}){this.disabled||this.allowMultipleSelection(t)&&(this.unselect(e),this.unselectMap.set(e,!0))}getCells(t){return(Array.isArray(t)?t:[t]).map(e=>typeof e=="string"?this.graph.getCellById(e):e).filter(e=>e!=null)}startRubberband(t){return this.rubberbandDisabled||this.selectionImpl.startSelecting(t),this}isMultiple(){return this.options.multiple!==!1}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(t){return this.options.modifiers=t,this}setContent(t){return this.selectionImpl.setContent(t),this}setFilter(t){return this.selectionImpl.setFilter(t),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),$r(this.name)}}fj([Nt.dispose()],ii.prototype,"dispose",null),function(n){n.defaultOptions={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,multipleSelectionModifiers:["ctrl","meta"],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:["leftMouseDown","mouseWheelDown"]}}(ii||(ii={})),I.prototype.isHistoryEnabled=function(){const n=this.getPlugin("history");return n?n.isEnabled():!1},I.prototype.enableHistory=function(){const n=this.getPlugin("history");return n&&n.enable(),this},I.prototype.disableHistory=function(){const n=this.getPlugin("history");return n&&n.disable(),this},I.prototype.toggleHistory=function(n){const t=this.getPlugin("history");return t&&t.toggleEnabled(n),this},I.prototype.undo=function(n){const t=this.getPlugin("history");return t&&t.undo(n),this},I.prototype.redo=function(n){const t=this.getPlugin("history");return t&&t.redo(n),this},I.prototype.undoAndCancel=function(n){const t=this.getPlugin("history");return t&&t.cancel(n),this},I.prototype.canUndo=function(){const n=this.getPlugin("history");return n?n.canUndo():!1},I.prototype.canRedo=function(){const n=this.getPlugin("history");return n?n.canRedo():!1},I.prototype.cleanHistory=function(n){const t=this.getPlugin("history");return t&&t.clean(n),this},I.prototype.getHistoryStackSize=function(){return this.getPlugin("history").getSize()},I.prototype.getUndoStackSize=function(){return this.getPlugin("history").getUndoSize()},I.prototype.getRedoStackSize=function(){return this.getPlugin("history").getRedoSize()},I.prototype.getUndoRemainSize=function(){return this.getPlugin("history").getUndoRemainSize()};var Gb=function(n,t,e,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(t,e,i):o(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};class oi extends Nt{constructor(t={}){super(),this.name="history",this.batchCommands=null,this.batchLevel=0,this.lastBatchIndex=-1,this.freezed=!1,this.stackSize=0,this.handlers=[];const{stackSize:e=0}=t;this.stackSize=e,this.options=It.getOptions(t),this.validator=new oi.Validator({history:this,cancelInvalid:this.options.cancelInvalid})}init(t){this.graph=t,this.model=this.graph.model,this.clean(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}undo(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack.push(e),this.notify("undo",e,t))}return this}redo(t={}){if(!this.disabled){const e=this.redoStack.pop();e&&(this.applyCommand(e,t),this.undoStackPush(e),this.notify("redo",e,t))}return this}cancel(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack=[],this.notify("cancel",e,t))}return this}getSize(){return this.stackSize}getUndoRemainSize(){const t=this.undoStack.length;return this.stackSize-t}getUndoSize(){return this.undoStack.length}getRedoSize(){return this.redoStack.length}canUndo(){return!this.disabled&&this.undoStack.length>0}canRedo(){return!this.disabled&&this.redoStack.length>0}clean(t={}){return this.undoStack=[],this.redoStack=[],this.notify("clean",null,t),this}get disabled(){return this.options.enabled!==!0}validate(t,...e){return this.validator.validate(t,...e),this}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach((t,e)=>{this.handlers[e]=this.addCommand.bind(this,t),this.model.on(t,this.handlers[e])}),this.validator.on("invalid",t=>this.trigger("invalid",t))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach((t,e)=>{this.model.off(t,this.handlers[e])}),this.handlers.length=0),this.validator.off("invalid")}createCommand(t){return{batch:t?t.batch:!1,data:{}}}revertCommand(t,e){this.freezed=!0;const s=Array.isArray(t)?It.sortBatchCommands(t):[t];for(let r=s.length-1;r>=0;r-=1){const i=s[r],o=Object.assign(Object.assign({},e),Mc(i.options,this.options.revertOptionsList||[]));this.executeCommand(i,!0,o)}this.freezed=!1}applyCommand(t,e){this.freezed=!0;const s=Array.isArray(t)?It.sortBatchCommands(t):[t];for(let r=0;r<s.length;r+=1){const i=s[r],o=Object.assign(Object.assign({},e),Mc(i.options,this.options.applyOptionsList||[]));this.executeCommand(i,!1,o)}this.freezed=!1}executeCommand(t,e,s){const r=this.model,i=r.getCell(t.data.id),o=t.event;if(It.isAddEvent(o)&&e||It.isRemoveEvent(o)&&!e)i&&i.remove(s);else if(It.isAddEvent(o)&&!e||It.isRemoveEvent(o)&&e){const a=t.data;a.node?r.addNode(a.props,s):a.edge&&r.addEdge(a.props,s)}else if(It.isChangeEvent(o)){const a=t.data,l=a.key;if(l&&i){const u=e?a.prev[l]:a.next[l];a.key==="attrs"&&this.ensureUndefinedAttrs(u,e?a.next[l]:a.prev[l])&&(s.dirty=!0),i.prop(l,u,s)}}else{const a=this.options.executeCommand;a&&X(a,this,t,e,s)}}addCommand(t,e){if(this.freezed||this.disabled)return;const s=e,r=s.options||{};if(r.dryrun||It.isAddEvent(t)&&this.options.ignoreAdd||It.isRemoveEvent(t)&&this.options.ignoreRemove||It.isChangeEvent(t)&&this.options.ignoreChange)return;const i=this.options.beforeAddCommand;if(i!=null&&X(i,this,t,e)===!1)return;t==="cell:change:*"&&(t=`cell:change:${s.key}`);const o=s.cell,a=Zt.isModel(o);let l;if(this.batchCommands){l=this.batchCommands[Math.max(this.lastBatchIndex,0)];const h=a&&!l.modelChange||l.data.id!==o.id,f=l.event!==t;if(this.lastBatchIndex>=0&&(h||f)){const d=this.batchCommands.findIndex(g=>(a&&g.modelChange||g.data.id===o.id)&&g.event===t);d<0||It.isAddEvent(t)||It.isRemoveEvent(t)?l=this.createCommand({batch:!0}):(l=this.batchCommands[d],this.batchCommands.splice(d,1)),this.batchCommands.push(l),this.lastBatchIndex=this.batchCommands.length-1}}else l=this.createCommand({batch:!1});if(It.isAddEvent(t)||It.isRemoveEvent(t)){const h=l.data;return l.event=t,l.options=r,h.id=o.id,h.props=Tt(o.toJSON()),o.isEdge()?h.edge=!0:o.isNode()&&(h.node=!0),this.push(l,r)}if(It.isChangeEvent(t)){const h=e.key,f=l.data;return(!l.batch||!l.event)&&(l.event=t,l.options=r,f.key=h,f.prev==null&&(f.prev={}),f.prev[h]=Tt(o.previous(h)),a?l.modelChange=!0:f.id=o.id),f.next==null&&(f.next={}),f.next[h]=Tt(o.prop(h)),this.push(l,r)}const u=this.options.afterAddCommand;u&&X(u,this,t,e,l),this.push(l,r)}initBatchCommand(t){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(t){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){const e=this.filterBatchCommand(this.batchCommands);e.length>0&&(this.redoStack=[],this.undoStackPush(e),this.consolidateCommands(),this.notify("add",e,t)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(t){let e=t.slice();const s=[];for(;e.length>0;){const r=e.shift(),i=r.event,o=r.data.id;if(i!=null&&(o!=null||r.modelChange)){if(It.isAddEvent(i)){const a=e.findIndex(l=>It.isRemoveEvent(l.event)&&l.data.id===o);if(a>=0){e=e.filter((l,u)=>a<u||l.data.id!==o);continue}}else if(It.isRemoveEvent(i)){const a=e.findIndex(l=>It.isAddEvent(l.event)&&l.data.id===o);if(a>=0){e.splice(a,1);continue}}else if(It.isChangeEvent(i)){const a=r.data;if(wn(a.prev,a.next))continue}s.push(r)}}return s}notify(t,e,s){const r=e==null?null:Array.isArray(e)?e:[e];this.emit(t,{cmds:r,options:s}),this.graph.trigger(`history:${t}`,{cmds:r,options:s}),this.emit("change",{cmds:r,options:s}),this.graph.trigger("history:change",{cmds:r,options:s})}push(t,e){this.redoStack=[],t.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:t,options:e})):(this.undoStackPush(t),this.consolidateCommands(),this.notify("add",t,e))}consolidateCommands(){var t;const e=this.undoStack[this.undoStack.length-1],s=this.undoStack[this.undoStack.length-2];if(!Array.isArray(e))return;const r=new Set(e.map(o=>o.event));if(r.size!==2||!r.has("cell:change:parent")||!r.has("cell:change:children")||!e.every(o=>{var a;return o.batch&&((a=o.options)===null||a===void 0?void 0:a.ui)})||!Array.isArray(s)||s.length!==1)return;const i=s[0];i.event!=="cell:change:position"||!(!((t=i.options)===null||t===void 0)&&t.ui)||(s.push(...e),this.undoStack.pop())}undoStackPush(t){if(this.stackSize===0){this.undoStack.push(t);return}this.undoStack.length>=this.stackSize&&this.undoStack.shift(),this.undoStack.push(t)}ensureUndefinedAttrs(t,e){let s=!1;return t!==null&&e!==null&&typeof t=="object"&&typeof e=="object"&&Object.keys(e).forEach(r=>{t[r]===void 0&&e[r]!==void 0?(t[r]=void 0,s=!0):typeof t[r]=="object"&&typeof e[r]=="object"&&(s=this.ensureUndefinedAttrs(t[r],e[r]))}),s}dispose(){this.validator.dispose(),this.clean(),this.stopListening(),this.off()}}Gb([Nt.dispose()],oi.prototype,"dispose",null),function(n){class t extends Nt{constructor(s){super(),this.map={},this.command=s.history,this.cancelInvalid=s.cancelInvalid!==!1,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:s}){return Array.isArray(s)?s.every(r=>this.isValidCommand(r)):this.isValidCommand(s)}isValidCommand(s){if(s.options&&s.options.validation===!1)return!0;const r=s.event&&this.map[s.event]||[];let i=null;return r.forEach(o=>{let a=0;const l=u=>{const h=o[a];a+=1;try{if(h)h(u,s,l);else{i=u;return}}catch(f){l(f)}};l(i)}),i?(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:i}),!1):!0}validate(s,...r){const i=Array.isArray(s)?s:s.split(/\s+/);return r.forEach(o=>{if(typeof o!="function")throw new Error(`${i.join(" ")} requires callback functions.`)}),i.forEach(o=>{this.map[o]==null&&(this.map[o]=[]),this.map[o].push(r)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}Gb([Nt.dispose()],t.prototype,"dispose",null),n.Validator=t}(oi||(oi={}));var It;(function(n){function t(o){return o==="cell:added"}n.isAddEvent=t;function e(o){return o==="cell:removed"}n.isRemoveEvent=e;function s(o){return o!=null&&o.startsWith("cell:change:")}n.isChangeEvent=s;function r(o){const a=["cell:added","cell:removed","cell:change:*"],l=["batch:start","batch:stop"],u=o.eventNames?o.eventNames.filter(h=>!(n.isChangeEvent(h)||a.includes(h)||l.includes(h))):a;return Object.assign(Object.assign({enabled:!0},o),{eventNames:u,applyOptionsList:o.applyOptionsList||["propertyPath"],revertOptionsList:o.revertOptionsList||["propertyPath"]})}n.getOptions=r;function i(o){const a=[];for(let l=0,u=o.length;l<u;l+=1){const h=o[l];let f=null;if(n.isAddEvent(h.event)){const d=h.data.id;for(let g=0;g<l;g+=1)if(o[g].data.id===d){f=g;break}}f!==null?a.splice(f,0,h):a.push(h)}return a}n.sortBatchCommands=i})(It||(It={})),I.prototype.toSVG=function(n,t){const e=this.getPlugin("export");e&&e.toSVG(n,t)},I.prototype.toPNG=function(n,t){const e=this.getPlugin("export");e&&e.toPNG(n,t)},I.prototype.toJPEG=function(n,t){const e=this.getPlugin("export");e&&e.toJPEG(n,t)},I.prototype.exportPNG=function(n,t){const e=this.getPlugin("export");e&&e.exportPNG(n,t)},I.prototype.exportJPEG=function(n,t){const e=this.getPlugin("export");e&&e.exportJPEG(n,t)},I.prototype.exportSVG=function(n,t){const e=this.getPlugin("export");e&&e.exportSVG(n,t)};var gj=function(n,t,e,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(t,e,i):o(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};class Yb extends Nt{constructor(){super(),this.name="export"}get view(){return this.graph.view}init(t){this.graph=t}exportPNG(t="chart",e={}){this.toPNG(s=>{Ws.downloadDataUri(s,t)},e)}exportJPEG(t="chart",e={}){this.toPNG(s=>{Ws.downloadDataUri(s,t)},e)}exportSVG(t="chart",e={}){this.toSVG(s=>{Ws.downloadDataUri(Ws.svgToDataUrl(s),t)},e)}toSVG(t,e={}){this.notify("before:export",e);const s=this.view.svg,r=tt.create(s).clone();let i=r.node;const o=r.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),a=e.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),l=e.preserveDimensions;if(l){const f=typeof l=="boolean"?a:l;r.attr({width:f.width,height:f.height})}if(r.removeAttribute("style").attr("viewBox",[a.x,a.y,a.width,a.height].join(" ")),o.removeAttribute("transform"),e.copyStyles!==!1){const f=s.ownerDocument,d=Array.from(s.querySelectorAll("*")),g=Array.from(i.querySelectorAll("*")),p=f.styleSheets.length,m=[];for(let w=p-1;w>=0;w-=1)m[w]=f.styleSheets[w],f.styleSheets[w].disabled=!0;const y={};d.forEach((w,x)=>{const v=window.getComputedStyle(w,null),S={};Object.keys(v).forEach(E=>{S[E]=v.getPropertyValue(E)}),y[x]=S}),p!==f.styleSheets.length&&m.forEach((w,x)=>{f.styleSheets[x]=w});for(let w=0;w<p;w+=1)f.styleSheets[w].disabled=!1;const b={};d.forEach((w,x)=>{const v=window.getComputedStyle(w,null),S=y[x],E={};Object.keys(v).forEach(C=>{!Oc(C)&&v.getPropertyValue(C)!==S[C]&&(E[C]=v.getPropertyValue(C))}),b[x]=E}),g.forEach((w,x)=>{qt(w,b[x])})}const u=e.stylesheet;if(typeof u=="string"){const f=s.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(u);r.prepend(tt.create("style",{type:"text/css"},[f]))}const h=()=>{const f=e.beforeSerialize;if(typeof f=="function"){const g=X(f,this.graph,i);g instanceof SVGSVGElement&&(i=g)}const d=new XMLSerializer().serializeToString(i).replace(/ /g," ");this.notify("after:export",e),t(d)};if(e.serializeImages){const f=r.find("image").map(d=>new Promise(g=>{const p=d.attr("xlink:href")||d.attr("href");Ws.imageToDataUri(p,(m,y)=>{!m&&y&&d.attr("xlink:href",y),g()})}));Promise.all(f).then(h)}else h()}toDataURL(t,e){let s=e.viewBox||this.graph.getContentBBox();const r=ds(e.padding);e.width&&e.height&&(r.left+r.right>=e.width&&(r.left=r.right=0),r.top+r.bottom>=e.height&&(r.top=r.bottom=0));const i=new z(-r.left,-r.top,r.left+r.right,r.top+r.bottom);if(e.width&&e.height){const h=s.width+r.left+r.right,f=s.height+r.top+r.bottom;i.scale(h/e.width,f/e.height)}s=z.create(s).moveAndExpand(i);const o=typeof e.width=="number"&&typeof e.height=="number"?{width:e.width,height:e.height}:s;let a=e.ratio?parseFloat(e.ratio):1;(!Number.isFinite(a)||a===0)&&(a=1);const l={width:Math.max(Math.round(o.width*a),1),height:Math.max(Math.round(o.height*a),1)};{const h=document.createElement("canvas"),f=h.getContext("2d");h.width=l.width,h.height=l.height;const d=l.width-1,g=l.height-1;f.fillStyle="rgb(1,1,1)",f.fillRect(d,g,1,1);const p=f.getImageData(d,g,1,1).data;if(p[0]!==1||p[1]!==1||p[2]!==1)throw new Error("size exceeded")}const u=new Image;u.onload=()=>{const h=document.createElement("canvas");h.width=l.width,h.height=l.height;const f=h.getContext("2d");f.fillStyle=e.backgroundColor||"white",f.fillRect(0,0,l.width,l.height);try{f.drawImage(u,0,0,l.width,l.height);const d=h.toDataURL(e.type,e.quality);t(d)}catch{}},this.toSVG(h=>{u.src=`data:image/svg+xml,${encodeURIComponent(h)}`},Object.assign(Object.assign({},e),{viewBox:s,serializeImages:!0,preserveDimensions:Object.assign({},l)}))}toPNG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/png"}))}toJPEG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/jpeg"}))}notify(t,e){this.trigger(t,e),this.graph.trigger(t,e)}dispose(){this.off()}}gj([Nt.dispose()],Yb.prototype,"dispose",null);const pj={class:"control-box"},mj=Gn({__name:"index",props:{payload:Object},setup(n){const t=n,e=c.ref("3"),s=c.ref([]),r=()=>{s.value=JSON.parse(JSON.stringify(t.payload.getPorts().map(u=>({id:u.id,attrs:u.attrs,args:{x:Number(u.args.x.replace("%","")),y:Number(u.args.y.replace("%",""))}}))))},i=()=>{const u=za;u.attrs.text.text=`${t.payload.getPorts().length+1}`,u.args.x="50%",u.args.y="50%",t.payload.addPorts([{group:"ports",...u}]),r()},o=()=>{Wi("#drawing-board",!0)},a=(u,h,f)=>{t.payload.portProp(u,"args/"+h,f+"%"),r()},l=u=>{t.payload.removePort(u),r()};return c.onMounted(()=>{r()}),(u,h)=>{const f=c.resolveComponent("el-button"),d=c.resolveComponent("el-table-column"),g=c.resolveComponent("el-slider"),p=c.resolveComponent("el-icon"),m=c.resolveComponent("el-table"),y=c.resolveComponent("el-collapse-item"),b=c.resolveComponent("el-collapse");return c.openBlock(),c.createElementBlock("div",pj,[c.createVNode(b,{modelValue:e.value,"onUpdate:modelValue":h[0]||(h[0]=w=>e.value=w),accordion:""},{default:c.withCtx(()=>[c.createVNode(y,{title:"连接桩设置",name:"3"},{default:c.withCtx(()=>[c.createVNode(f,{type:"primary",onClick:i,size:"small"},{default:c.withCtx(()=>h[1]||(h[1]=[c.createTextVNode("添加连接桩")])),_:1}),c.createVNode(f,{type:"primary",onClick:o,size:"small"},{default:c.withCtx(()=>h[2]||(h[2]=[c.createTextVNode("显示连接桩")])),_:1}),c.createVNode(m,{data:s.value,border:"",size:"small",style:{"margin-top":"10px"}},{default:c.withCtx(()=>[c.createVNode(d,{label:"ID",width:"50",align:"center"},{default:c.withCtx(({row:w})=>[c.createTextVNode(c.toDisplayString(w.attrs.text.text),1)]),_:1}),c.createVNode(d,{label:"x",width:"100",align:"center"},{default:c.withCtx(({row:w})=>[c.createVNode(g,{modelValue:w.args.x,"onUpdate:modelValue":x=>w.args.x=x,min:0,max:100,step:1,onInput:x=>a(w.id,"x",x)},null,8,["modelValue","onUpdate:modelValue","onInput"])]),_:1}),c.createVNode(d,{label:"y",width:"100",align:"center"},{default:c.withCtx(({row:w})=>[c.createVNode(g,{modelValue:w.args.y,"onUpdate:modelValue":x=>w.args.y=x,min:0,max:100,step:1,onInput:x=>a(w.id,"y",x)},null,8,["modelValue","onUpdate:modelValue","onInput"])]),_:1}),c.createVNode(d,{label:"操作",width:"70",align:"center"},{default:c.withCtx(({row:w})=>[c.createVNode(f,{type:"danger",size:"small",onClick:x=>l(w.id)},{default:c.withCtx(()=>[c.createVNode(p,null,{default:c.withCtx(()=>[c.createVNode(c.unref(xg))]),_:1})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1},8,["modelValue"])])}}},[["__scopeId","data-v-b280098c"]]),yl=[{shape:"rect",width:60,height:5,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:0}},data:{type:"base-shape"}},{shape:"rect",width:60,height:20,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:1}},data:{type:"base-shape",label:"母线"}},{shape:"circle",width:40,height:40,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:1}},data:{type:"base-shape"}},{shape:"ellipse",width:60,height:40,attrs:{body:{fill:"#ffffff",stroke:"#ffffff"}},data:{type:"base-shape"}}],Wb={groups:{ports:{position:"absolute",args:{x:0,y:0},attrs:{circle:{magnet:!0,stroke:"#8f8f8f",r:4}},label:{position:"top"}}}},dh=Object.assign({name:"wiring-diagram-preview"},{__name:"index",props:{id:{type:String,default:""},background:{type:Object,default:()=>({})},grid:{type:Object,default:()=>({})},data:{type:Object,default:()=>({})}},setup(n){const t=n,e=c.ref([]),s=c.ref(),r=()=>{const y=document.getElementById("preview-container");s.value=new I({container:y,autoResize:!0,panning:!0,mousewheel:!0,connecting:{router:"orth",connectionPoint:{name:"anchor"},anchor:"center"},interacting:{nodeMovable:!1,magnetConnectable:!1,edgeMovable:!1,edgeLabelMovable:!1,arrowheadMovable:!1,vertexMovable:!1,vertexAddable:!1,vertexDeletable:!1}}),s.value.on("blank:dblclick",()=>{h()})},i=async()=>{let y,b,w;if(t.id){const{background:x,grid:v,data:S}=await _m(t.id);y=x,b={},w=S}else y=t.background,b={},w=t.data;s.value.drawBackground(y),s.value.drawGrid(b),s.value.fromJSON(w),l()},o=c.ref(null),a=c.ref([]),l=()=>{a.value=f();const y=/\$\{(.*?)\}/g;a.value.forEach(b=>{if(!b.data||!b.data.field)return;const w=b.data.content.match(y);e.value.push(...b.data.field),w&&(b.matches=w)}),a&&h()},u=c.ref(!0),h=async()=>{if(!e.value.length)return;if(!u.value){Bt.warning("数据正在更新中,请稍后再试");return}o.value&&clearInterval(o.value),u.value=!1;const y=await RD(e.value);if(u.value=!0,!Array.isArray(y)||!y.length)return;let b=0;a.value.forEach((w,x)=>{if(!w.data||!w.data.field)return;if(w.matches){const S=x===0?0:b||0,E=b=S+w.data.field.length;w.label=d(w.data.content,y.slice(S,E))}}),o.value=setTimeout(()=>{h()},1e4)},f=()=>s.value.getNodes().filter(b=>{var w;return((w=b.data)==null?void 0:w.type)==="text"}),d=(y,b)=>{let w=0;return y.replace(/\$\{.*?\}/g,()=>w<b.length?b[w++]:"--")},g=()=>{s.value.zoomToFit({maxScale:1,padding:20})},p=c.shallowRef(),m=()=>{new ResizeObserver(()=>{g()}).observe(p.value)};return c.onMounted(()=>{r(),i(),setTimeout(()=>{Wi("#preview-container",!1),g()},100),m()}),c.onUnmounted(()=>{clearInterval(o.value)}),(y,b)=>(c.openBlock(),c.createElementBlock("div",{id:"preview-container",ref_key:"previewRef",ref:p,onDblclick:g},null,544))}}),yj={class:"form-container"},bj={class:"footer"},wj=Gn({__name:"group-form",props:{payload:{type:Object,default:()=>({})}},emits:["close"],setup(n,{emit:t}){const e=n,s=t,r=c.reactive({groupName:"",sort:1,isShow:1}),i=c.reactive({groupName:[{required:!0,message:"请输入分组名称",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],sort:[{required:!0,message:"请输入排序",trigger:"blur"},{type:"number",message:"排序必须为数字值"}],isShow:[{required:!0,message:"请选择是否显示",trigger:"change"}]}),o=c.ref(),a=()=>{console.log(r),o.value.validate(u=>{if(u)r.id?$a("/cny/custom/updateGroup",r).then(h=>{h!=null&&h.isOk?(Bt.success("保存成功"),s("close",!0)):Bt.error((h==null?void 0:h.msg)||"保存失败")}):$a("/cny/custom/saveGroup",r).then(h=>{h!=null&&h.isOk?(Bt.success("保存成功"),s("close",!0)):Bt.error((h==null?void 0:h.msg)||"保存失败")});else return!1})},l=()=>{s("close",!1)};return c.onMounted(()=>{var u;(u=e.payload)!=null&&u.id&&(r.id=e.payload.id,r.groupName=e.payload.groupName,r.sort=e.payload.sort,r.isShow=e.payload.isShow)}),(u,h)=>{const f=c.resolveComponent("el-input"),d=c.resolveComponent("el-form-item"),g=c.resolveComponent("el-input-number"),p=c.resolveComponent("el-switch"),m=c.resolveComponent("el-button"),y=c.resolveComponent("el-form");return c.openBlock(),c.createElementBlock("div",yj,[c.createVNode(y,{ref_key:"form",ref:o,model:r,rules:i,"label-width":"90px","label-suffix":":"},{default:c.withCtx(()=>[c.createVNode(d,{label:"分组名称",prop:"groupName"},{default:c.withCtx(()=>[c.createVNode(f,{modelValue:r.groupName,"onUpdate:modelValue":h[0]||(h[0]=b=>r.groupName=b),placeholder:"请输入分组名称",clearable:""},null,8,["modelValue"])]),_:1}),c.createVNode(d,{label:"排序",prop:"sort"},{default:c.withCtx(()=>[c.createVNode(g,{modelValue:r.sort,"onUpdate:modelValue":h[1]||(h[1]=b=>r.sort=b),min:0,max:999,step:1,"controls-position":"right"},null,8,["modelValue"])]),_:1}),c.createVNode(d,{label:"是否显示",prop:"isShow"},{default:c.withCtx(()=>[c.createVNode(p,{modelValue:r.isShow,"onUpdate:modelValue":h[2]||(h[2]=b=>r.isShow=b),"active-value":1,"inactive-value":0,"active-color":"#13ce66","inactive-color":"#ff4949"},null,8,["modelValue"])]),_:1}),c.createElementVNode("div",bj,[c.createVNode(m,{type:"primary",onClick:a},{default:c.withCtx(()=>h[3]||(h[3]=[c.createTextVNode("保存")])),_:1}),c.createVNode(m,{onClick:l},{default:c.withCtx(()=>h[4]||(h[4]=[c.createTextVNode("取消")])),_:1})])]),_:1},8,["model","rules"])])}}},[["__scopeId","data-v-a2a7ce25"]]),xj={class:"form-container"},vj={class:"footer"},Cj=Gn({__name:"image-form",props:{payload:{type:Object,default:()=>({})}},emits:["close"],setup(n,{emit:t}){const e=t,s=n,r=c.shallowRef(null),i=c.reactive({groupId:"",id:"",imageName:"",sort:0,isShow:1,imageUrl:""}),o={imageName:[{required:!0,message:"请输入图片名称",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],sort:[{required:!0,message:"请输入排序",trigger:"blur"},{type:"number",message:"排序必须为数字值"}]},a=c.ref(""),l=f=>{if(f.raw.type!=="image/svg+xml")return Bt.error("上传图片只能是 svg 格式!"),!1;const d=new FormData;d.append("file",f.raw),DD("/cny/file/fileUpload",d).then(g=>{g!=null&&g.isOk?(a.value=hs.defaults.baseURL+"/cny/upload/"+(g==null?void 0:g.data),i.imageUrl=g==null?void 0:g.data):Bt.error((g==null?void 0:g.msg)||"上传失败")})},u=()=>{console.log(i),r.value.validate(f=>{if(f)$a("/cny/custom/savePicture",i).then(d=>{d!=null&&d.isOk?(Bt.success("保存成功"),e("close",!0)):Bt.error((d==null?void 0:d.msg)||"保存失败")});else return!1})},h=()=>{e("close",!1)};return c.onMounted(()=>{var f;(f=s.payload)!=null&&f.id&&(i.id=s.payload.id,i.imageName=s.payload.imageName,i.sort=s.payload.sort,i.isShow=s.payload.isShow,i.imageUrl=s.payload.imageUrl,a.value=i.imageUrl),i.groupId=s.payload.groupId}),(f,d)=>{const g=c.resolveComponent("el-input"),p=c.resolveComponent("el-form-item"),m=c.resolveComponent("el-input-number"),y=c.resolveComponent("el-switch"),b=c.resolveComponent("el-image"),w=c.resolveComponent("el-icon"),x=c.resolveComponent("el-upload"),v=c.resolveComponent("el-button"),S=c.resolveComponent("el-form");return c.openBlock(),c.createElementBlock("div",xj,[c.createVNode(S,{ref_key:"form",ref:r,model:i,rules:o,"label-width":"90px","label-suffix":":"},{default:c.withCtx(()=>[c.createVNode(p,{label:"图片名称",prop:"imageName"},{default:c.withCtx(()=>[c.createVNode(g,{modelValue:i.imageName,"onUpdate:modelValue":d[0]||(d[0]=E=>i.imageName=E),placeholder:"请输入图片名称"},null,8,["modelValue"])]),_:1}),c.createVNode(p,{label:"排序",prop:"sort"},{default:c.withCtx(()=>[c.createVNode(m,{modelValue:i.sort,"onUpdate:modelValue":d[1]||(d[1]=E=>i.sort=E),min:0,max:999,step:1,"controls-position":"right"},null,8,["modelValue"])]),_:1}),c.createVNode(p,{label:"是否显示",prop:"isShow"},{default:c.withCtx(()=>[c.createVNode(y,{modelValue:i.isShow,"onUpdate:modelValue":d[2]||(d[2]=E=>i.isShow=E),"active-value":1,"inactive-value":0,"active-color":"#13ce66","inactive-color":"#ff4949"},null,8,["modelValue"])]),_:1}),c.createVNode(p,{label:"上传",prop:"image"},{default:c.withCtx(()=>[c.createVNode(x,{action:"","list-type":"picture",class:"avatar-uploader","show-file-list":!1,"on-change":l,"auto-upload":!1},{default:c.withCtx(()=>[a.value?(c.openBlock(),c.createBlock(b,{key:0,src:a.value,fit:"cover",style:{width:"64px",height:"64px"}},null,8,["src"])):(c.openBlock(),c.createBlock(w,{key:1,class:"avatar-uploader-icon"},{default:c.withCtx(()=>[c.createVNode(c.unref(Z2))]),_:1}))]),_:1})]),_:1}),c.createElementVNode("div",vj,[c.createVNode(v,{type:"primary",onClick:u},{default:c.withCtx(()=>d[3]||(d[3]=[c.createTextVNode("保存")])),_:1}),c.createVNode(v,{onClick:h},{default:c.withCtx(()=>d[4]||(d[4]=[c.createTextVNode("取消")])),_:1})])]),_:1},8,["model"])])}}},[["__scopeId","data-v-73961934"]]),Sj={class:"form-container"},Ej={style:{padding:"0 10px",display:"flex","flex-direction":"column",gap:"5px","align-items":"flex-start"}},Oj=["src"],Mj=Gn({__name:"image-management",setup(n){const t=c.reactive({items:[]}),e=()=>{Yi("/cny/custom/groupList").then(d=>{t.items=d.data})},s=c.reactive({show:!1,title:"新增图片分组",payload:null}),r=()=>{s.show=!0,s.title="新增图片分组",s.payload=null},i=d=>{s.show=!0,s.title="编辑图片分组",s.payload={id:d.id,groupName:d.groupName,sort:d.sort,isShow:d.isShow}},o=d=>{iu.confirm("是否确定要删除该图片分组?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{Nm("/cny/custom/removeGroup/"+d).then(g=>{g.code===200?(Bt.success("删除成功"),e()):Bt.error(g.msg||"删除失败")})})},a=c.reactive({show:!1,title:"新增图片",payload:null}),l=d=>{a.show=!0,a.title="新增图片",a.payload={groupId:d}},u=d=>{a.show=!0,a.title="编辑图片",a.payload={id:d.id,groupId:d.groupId,imageName:d.imageName,sort:d.sort,isShow:d.isShow,imageUrl:d.imageUrl}},h=d=>{iu.confirm("是否确定要删除该图片?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{Nm("/cny/custom/removePicture/"+d).then(g=>{g.code===200?(Bt.success("删除成功"),e()):Bt.error(g.msg||"删除失败")})})},f=d=>{s.show=!1,a.show=!1,d&&e()};return c.onMounted(()=>{e()}),(d,g)=>{const p=c.resolveComponent("el-button"),m=c.resolveComponent("el-table-column"),y=c.resolveComponent("el-table"),b=c.resolveComponent("el-dialog");return c.openBlock(),c.createElementBlock("div",Sj,[c.createVNode(p,{type:"primary",onClick:r,size:"small"},{default:c.withCtx(()=>g[2]||(g[2]=[c.createTextVNode("新增图片分组")])),_:1}),c.createVNode(y,{data:t.items,border:"",height:"500"},{default:c.withCtx(()=>[c.createVNode(m,{type:"expand"},{default:c.withCtx(w=>[c.createElementVNode("div",Ej,[c.createVNode(p,{type:"primary",size:"small",onClick:x=>l(w.row.id)},{default:c.withCtx(()=>g[3]||(g[3]=[c.createTextVNode("新增图片")])),_:2},1032,["onClick"]),c.createVNode(y,{data:w.row.pictureList,border:"",size:"small"},{default:c.withCtx(()=>[c.createVNode(m,{label:"名称",prop:"imageName",align:"center"}),c.createVNode(m,{label:"图片",prop:"imageUrl",align:"center"},{default:c.withCtx(x=>[c.createElementVNode("img",{src:x.row.imageUrl,alt:"",style:{width:"64px",height:"64px"}},null,8,Oj)]),_:1}),c.createVNode(m,{label:"排序",prop:"sort",align:"center"}),c.createVNode(m,{label:"是否显示",prop:"isShow",align:"center"},{default:c.withCtx(x=>[c.createTextVNode(c.toDisplayString(x.row.isShow===1?"是":"否"),1)]),_:1}),c.createVNode(m,{label:"操作",align:"center"},{default:c.withCtx(x=>[c.createVNode(p,{type:"primary",size:"small",onClick:v=>u(x.row)},{default:c.withCtx(()=>g[4]||(g[4]=[c.createTextVNode("编辑")])),_:2},1032,["onClick"]),c.createVNode(p,{type:"danger",size:"small",onClick:v=>h(x.row.id)},{default:c.withCtx(()=>g[5]||(g[5]=[c.createTextVNode("删除")])),_:2},1032,["onClick"])]),_:1})]),_:2},1032,["data"])])]),_:1}),c.createVNode(m,{label:"分组名称",prop:"groupName",align:"center"}),c.createVNode(m,{label:"排序",prop:"sort",align:"center"}),c.createVNode(m,{label:"是否显示",prop:"isShow",align:"center"},{default:c.withCtx(w=>[c.createTextVNode(c.toDisplayString(w.row.isShow===1?"是":"否"),1)]),_:1}),c.createVNode(m,{label:"操作",align:"center"},{default:c.withCtx(w=>[c.createVNode(p,{type:"primary",size:"small",onClick:x=>i(w.row)},{default:c.withCtx(()=>g[6]||(g[6]=[c.createTextVNode("编辑")])),_:2},1032,["onClick"]),c.createVNode(p,{type:"danger",size:"small",onClick:x=>o(w.row.id)},{default:c.withCtx(()=>g[7]||(g[7]=[c.createTextVNode("删除")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"]),c.createVNode(b,{modelValue:s.show,"onUpdate:modelValue":g[0]||(g[0]=w=>s.show=w),title:s.title,width:"300","close-on-click-modal":!1,"close-on-press-escape":!1},{default:c.withCtx(()=>[s.show?(c.openBlock(),c.createBlock(wj,{key:0,payload:s.payload,onClose:f},null,8,["payload"])):c.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),c.createVNode(b,{modelValue:a.show,"onUpdate:modelValue":g[1]||(g[1]=w=>a.show=w),title:a.title,width:"300","close-on-click-modal":!1,"close-on-press-escape":!1},{default:c.withCtx(()=>[a.show?(c.openBlock(),c.createBlock(Cj,{key:0,payload:a.payload,onClose:f},null,8,["payload"])):c.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])])}}},[["__scopeId","data-v-9338a78d"]]),Pj={class:"page-container"},Aj={class:"tool-bar"},Tj={class:"action"},Nj={class:"el-dropdown-link"},_j={class:"action",style:{"margin-right":"50px"}},kj={class:"board"},Dj={class:"drawing-board-box"},Rj={id:"controls"},Ij={key:0,class:"controls-label"},Lj={style:{width:"100%",height:"100%",background:"black"}},qb=Gn(Object.assign({name:"editor"},{__name:"index",props:{id:{type:String,default:""}},emits:["getJson"],setup(n,{emit:t}){const e=n,s=c.ref(),r=c.reactive({label:null,component:c.shallowRef(null)}),i=c.ref(null),o=c.ref(null),a=()=>{const D=document.getElementById("drawing-board");window.__x6_instances__=[],s.value=new I({container:D,autoResize:!0,panning:!0,mousewheel:!0,connecting:{router:"orth",connectionPoint:{name:"anchor"},anchor:"center",createEdge(){return s.value.createEdge({inherit:"edge",attrs:{...Cu},zIndex:0})}}}),window.__x6_instances__.push(s.value),s.value.use(new er({resizing:{enabled:!0,preserveAspectRatio:!1},rotating:!0})),s.value.use(new Hb),s.value.use(new $b),s.value.use(new zb({format(N){return N.replace(/\s/g,"").replace("cmd","command")}})),s.value.use(new oi),s.value.use(new ii({enabled:!0,multiple:!0,rubberband:!0,modifiers:["alt"],showNodeSelectionBox:!0})),s.value.bindKey(["delete","backspace"],()=>{const N=s.value.getSelectedCells();return N.length&&s.value.removeCells(N),!1}),s.value.bindKey(["ctrl+c","cmd + c"],()=>{const N=s.value.getSelectedCells();return N.length&&(s.value.copy(N),Bt.success("复制成功")),!1}),s.value.bindKey(["ctrl+v","cmd + v"],()=>{if(!s.value.isClipboardEmpty()){const N=s.value.paste({offset:32});s.value.cleanSelection(),s.value.select(N),Bt.success("粘贴成功")}return!1}),s.value.bindKey(["ctrl+z","cmd + z"],()=>(s.value.canUndo()&&s.value.undo(),!1)),s.value.bindKey(["ctrl+y","cmd + y"],()=>(s.value.canRedo()&&s.value.redo(),!1)),s.value.on("blank:click",({e:N,x:V,y:A})=>{o.value=s,r.component=jD,r.label="画布属性",i.value=G().valueOf()}),s.value.on("cell:click",({cell:N})=>{var V,A,P;if(console.log("cell:click",N,((V=N==null?void 0:N.data)==null?void 0:V.type)??(N==null?void 0:N.shape)),o.value=N,i.value=G().valueOf(),((A=N.data)==null?void 0:A.type)==="text"){r.component=Rm,r.label="文本属性";return}if(((P=N.data)==null?void 0:P.type)==="base-shape"){r.component=Rm,r.label="基础图形属性";return}if((N==null?void 0:N.shape)==="edge"){r.component=WD,r.label="连线属性";return}if((N==null?void 0:N.shape)==="image"){r.component=mj,r.label="图片属性";return}r.component=null,r.label=null}),s.value.on("edge:mouseenter",({cell:N})=>{N.addTools([{name:"vertices",args:{snapRadius:3,attrs:{r:3,fill:"#239edd",cursor:"move","stroke-width":0},modifiers:["alt"]}}])}),s.value.on("edge:mouseleave",({cell:N})=>{N.removeTools()}),s.value.on("node:mouseenter",()=>{Wi("#drawing-board",!0)}),s.value.on("node:mouseleave",()=>{Wi("#drawing-board",!1)}),s.value.use(new Yb)},l=c.ref(),u=()=>{l.value=new si({target:s.value,...ID,groups:[{name:"基础组件",graphPadding:30}],search(V,A){var P;return((P=V.label)==null?void 0:P.indexOf(A))!==-1},placeholder:"搜索",notFoundText:"未找到匹配项",getDragNode:V=>{const A=V.clone({keepId:!0});return A.label!=="文本"&&(A.label=""),A},getDropNode:V=>V.clone({keepId:!0})});const D=s.value.createNode({...LD}),N=yl.map(V=>(V.ports=Wb,s.value.createNode(V)));l.value.load([D,...N],"基础组件"),Yi("/cny/custom/groupList").then(V=>{const A=(V==null?void 0:V.data)||[];A==null||A.forEach(P=>{l.value.addGroup({name:P==null?void 0:P.groupName,graphPadding:30});const L=P==null?void 0:P.pictureList.map(j=>{const Y={shape:"image",imageUrl:j==null?void 0:j.imageUrl,ports:Wb,width:64,height:64,label:j.imageName};return s.value.createNode(Y)});l.value.load(L,P==null?void 0:P.groupName),document.getElementById("stencil").appendChild(l.value.container)})}).finally(()=>{setTimeout(()=>{l.value.container.querySelectorAll(".x6-node").forEach((A,P)=>{if(P>yl.length){const L=A.querySelector("text");A.style.position="relative",L&&(L.style.display="none",L.setAttribute("x","0%"),L.setAttribute("y","30%"),L.style.fontSize="12px",L.style.fontWeight="bold",L.style.fill="#ffffff")}A.addEventListener("mouseenter",L=>{if(P>yl.length){const j=A.querySelector("text");j&&(j.style.display="block")}}),A.addEventListener("mouseleave",L=>{if(P>yl.length){const j=A.querySelector("text");j&&(j.style.display="none")}})})},20)})},h=D=>{switch(D){case"snapLine":s.value.isSnaplineEnabled()?(s.value.disableSnapline(),Bt.warning("关闭对齐线")):(s.value.enableSnapline(),Bt.success("开启对齐线"));break;case"select":s.value.isSelectionEnabled()?(s.value.disableSelection(),Bt.warning("关闭框选")):(s.value.enableSelection(),Bt.success("开启框选"));break;case"drawLine":g();break;case"adaptive":p();break;case"shortcuts":y();break;case"image":w();break;case"clear":x();break;case"export":v();break}},f=c.ref(!1),d=c.ref(null),g=()=>{f.value=!0;const D=new Date;s.value.startBatch(D),s.value.disablePanning(),s.value.once("blank:mousedown",({e:N,x:V,y:A})=>{f.value&&(d.value=s.value.addEdge({source:{x:V,y:A},target:{x:V,y:A},attrs:Cu,data:{type:"edge",isConnector:!1},zIndex:0}))}),s.value.on("blank:mousemove",({e:N,x:V,y:A})=>{f.value&&d.value.setTarget({x:V,y:A})}),s.value.on("blank:mouseup",({e:N,x:V,y:A})=>{f.value=!1,s.value.enablePanning(),s.value.stopBatch(D)})},p=()=>{s.value.zoomToFit({maxScale:1,padding:20})},m=c.reactive({show:!1}),y=()=>{m.show=!0},b=c.reactive({show:!1}),w=()=>{b.show=!0},x=()=>{s.value.clearCells(),s.value.drawBackground(km),s.value.drawGrid(Dm),Bt.success("清空成功")},v=()=>{const D=G().format("YYYYMMDDHHmmss");s.value.exportPNG(D,{padding:10,quality:1,backgroundColor:s.value.options.background.color})},S=t,E=c.reactive({show:!1,background:null,grid:null,data:null}),C=()=>{E.background=s.value.options.background,E.grid=s.value.options.grid,E.data=s.value.toJSON(),E.show=!0},M=()=>{S("getJson",{background:s.value.options.background,grid:s.value.options.grid,data:s.value.toJSON()})},T=async()=>{if(!e.id){s.value.drawBackground(km),s.value.drawGrid(Dm),s.value.fromJSON({cells:[]});return}const{background:D,grid:N,data:V}=await _m(e.id);s.value.drawBackground(D),s.value.drawGrid(N),s.value.fromJSON(V),p()},k=c.shallowRef(null),_=()=>{new ResizeObserver(()=>{p()}).observe(k.value)};return c.onMounted(()=>{a(),u(),T(),_()}),(D,N)=>{const V=c.resolveComponent("el-icon"),A=c.resolveComponent("el-button"),P=c.resolveComponent("el-dropdown-item"),L=c.resolveComponent("el-dropdown-menu"),j=c.resolveComponent("el-dropdown"),Y=c.resolveComponent("el-scrollbar"),ot=c.resolveComponent("el-dialog"),F=c.resolveComponent("el-drawer");return c.openBlock(),c.createElementBlock("div",Pj,[c.createElementVNode("div",Aj,[c.createElementVNode("div",Tj,[c.createVNode(j,{onCommand:h},{dropdown:c.withCtx(()=>[c.createVNode(L,null,{default:c.withCtx(()=>[c.createVNode(P,{command:"snapLine"},{default:c.withCtx(()=>N[4]||(N[4]=[c.createTextVNode("对齐线")])),_:1}),c.createVNode(P,{command:"select"},{default:c.withCtx(()=>N[5]||(N[5]=[c.createTextVNode("框选")])),_:1}),c.createVNode(P,{command:"drawLine"},{default:c.withCtx(()=>N[6]||(N[6]=[c.createTextVNode("绘制直线")])),_:1}),c.createVNode(P,{command:"adaptive"},{default:c.withCtx(()=>N[7]||(N[7]=[c.createTextVNode("视图自适应")])),_:1}),c.createVNode(P,{command:"shortcuts"},{default:c.withCtx(()=>N[8]||(N[8]=[c.createTextVNode("查看快捷键")])),_:1}),c.createVNode(P,{command:"image"},{default:c.withCtx(()=>N[9]||(N[9]=[c.createTextVNode("图片管理")])),_:1}),c.createVNode(P,{command:"clear"},{default:c.withCtx(()=>N[10]||(N[10]=[c.createTextVNode("清空画布")])),_:1}),c.createVNode(P,{command:"export"},{default:c.withCtx(()=>N[11]||(N[11]=[c.createTextVNode("导出成图片")])),_:1})]),_:1})]),default:c.withCtx(()=>[c.createElementVNode("span",Nj,[c.createVNode(A,{size:"small",text:""},{default:c.withCtx(()=>[N[3]||(N[3]=c.createTextVNode("工具 ")),c.createVNode(V,null,{default:c.withCtx(()=>[c.createVNode(c.unref(B2))]),_:1})]),_:1})])]),_:1})]),c.createElementVNode("div",_j,[c.createVNode(c.unref(Ip),{content:"预览",placement:"bottom"},{default:c.withCtx(()=>[c.createVNode(A,{size:"small",icon:c.unref(Sg),onClick:C},null,8,["icon"])]),_:1}),c.createVNode(c.unref(Ip),{content:"保存",placement:"bottom"},{default:c.withCtx(()=>[c.createVNode(A,{size:"small",icon:c.unref(Y2),onClick:M},null,8,["icon"])]),_:1})])]),c.createElementVNode("div",kj,[N[12]||(N[12]=c.createElementVNode("div",{id:"stencil"},null,-1)),c.createElementVNode("div",Dj,[c.createElementVNode("div",{id:"drawing-board",ref_key:"drawBoard",ref:k},null,512)]),c.createElementVNode("div",Rj,[r.label?(c.openBlock(),c.createElementBlock("div",Ij,c.toDisplayString(r.label),1)):c.createCommentVNode("",!0),c.createVNode(Y,null,{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(r.component),{graph:s.value,payload:o.value,key:i.value},null,8,["graph","payload"]))]),_:1})])]),c.createVNode(ot,{modelValue:m.show,"onUpdate:modelValue":N[0]||(N[0]=H=>m.show=H),width:"400px",title:"快捷键","close-on-click-modal":!1,"close-on-press-escape":!1},{default:c.withCtx(()=>[c.createVNode(JD)]),_:1},8,["modelValue"]),c.createVNode(ot,{modelValue:b.show,"onUpdate:modelValue":N[1]||(N[1]=H=>b.show=H),width:"800px",title:"图片管理","close-on-click-modal":!1,"close-on-press-escape":!1},{default:c.withCtx(()=>[c.createVNode(Mj)]),_:1},8,["modelValue"]),c.createVNode(F,{class:"no-border-drawer",modelValue:E.show,"onUpdate:modelValue":N[2]||(N[2]=H=>E.show=H),title:"预览",direction:"ttb",size:"100%"},{default:c.withCtx(()=>[c.createElementVNode("div",Lj,[E.show?(c.openBlock(),c.createBlock(dh,{key:0,background:E.background,grid:E.grid,data:E.data},null,8,["background","grid","data"])):c.createCommentVNode("",!0)])]),_:1},8,["modelValue"])])}}}),[["__scopeId","data-v-74192f25"]]),Bj=[qb,dh],Jb=(n,t)=>{Bj.forEach(e=>{n.component(e.name,e)})};typeof window<"u"&&window.Vue&&Jb(window.Vue);const Vj={install:Jb};Rt.WiringDiagramEditor=qb,Rt.WiringDiagramPreview=dh,Rt.default=Vj,Rt.setBaseURL=_D,Rt.setToken=kD,Object.defineProperties(Rt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
738
|
+
`;I.prototype.isSelectionEnabled=function(){const n=this.getPlugin("selection");return n?n.isEnabled():!1},I.prototype.enableSelection=function(){const n=this.getPlugin("selection");return n&&n.enable(),this},I.prototype.disableSelection=function(){const n=this.getPlugin("selection");return n&&n.disable(),this},I.prototype.toggleSelection=function(n){const t=this.getPlugin("selection");return t&&t.toggleEnabled(n),this},I.prototype.isMultipleSelection=function(){const n=this.getPlugin("selection");return n?n.isMultipleSelection():!1},I.prototype.enableMultipleSelection=function(){const n=this.getPlugin("selection");return n&&n.enableMultipleSelection(),this},I.prototype.disableMultipleSelection=function(){const n=this.getPlugin("selection");return n&&n.disableMultipleSelection(),this},I.prototype.toggleMultipleSelection=function(n){const t=this.getPlugin("selection");return t&&t.toggleMultipleSelection(n),this},I.prototype.isSelectionMovable=function(){const n=this.getPlugin("selection");return n?n.isSelectionMovable():!1},I.prototype.enableSelectionMovable=function(){const n=this.getPlugin("selection");return n&&n.enableSelectionMovable(),this},I.prototype.disableSelectionMovable=function(){const n=this.getPlugin("selection");return n&&n.disableSelectionMovable(),this},I.prototype.toggleSelectionMovable=function(n){const t=this.getPlugin("selection");return t&&t.toggleSelectionMovable(n),this},I.prototype.isRubberbandEnabled=function(){const n=this.getPlugin("selection");return n?n.isRubberbandEnabled():!1},I.prototype.enableRubberband=function(){const n=this.getPlugin("selection");return n&&n.enableRubberband(),this},I.prototype.disableRubberband=function(){const n=this.getPlugin("selection");return n&&n.disableRubberband(),this},I.prototype.toggleRubberband=function(n){const t=this.getPlugin("selection");return t&&t.toggleRubberband(n),this},I.prototype.isStrictRubberband=function(){const n=this.getPlugin("selection");return n?n.isStrictRubberband():!1},I.prototype.enableStrictRubberband=function(){const n=this.getPlugin("selection");return n&&n.enableStrictRubberband(),this},I.prototype.disableStrictRubberband=function(){const n=this.getPlugin("selection");return n&&n.disableStrictRubberband(),this},I.prototype.toggleStrictRubberband=function(n){const t=this.getPlugin("selection");return t&&t.toggleStrictRubberband(n),this},I.prototype.setRubberbandModifiers=function(n){const t=this.getPlugin("selection");return t&&t.setRubberbandModifiers(n),this},I.prototype.setSelectionFilter=function(n){const t=this.getPlugin("selection");return t&&t.setSelectionFilter(n),this},I.prototype.setSelectionDisplayContent=function(n){const t=this.getPlugin("selection");return t&&t.setSelectionDisplayContent(n),this},I.prototype.isSelectionEmpty=function(){const n=this.getPlugin("selection");return n?n.isEmpty():!0},I.prototype.cleanSelection=function(n){const t=this.getPlugin("selection");return t&&t.clean(n),this},I.prototype.resetSelection=function(n,t){const e=this.getPlugin("selection");return e&&e.reset(n,t),this},I.prototype.getSelectedCells=function(){const n=this.getPlugin("selection");return n?n.getSelectedCells():[]},I.prototype.getSelectedCellCount=function(){const n=this.getPlugin("selection");return n?n.getSelectedCellCount():0},I.prototype.isSelected=function(n){const t=this.getPlugin("selection");return t?t.isSelected(n):!1},I.prototype.select=function(n,t){const e=this.getPlugin("selection");return e&&e.select(n,t),this},I.prototype.unselect=function(n,t){const e=this.getPlugin("selection");return e&&e.unselect(n,t),this};var fj=function(n,t,e,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(t,e,i):o(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};class ii extends Nt{get rubberbandDisabled(){return this.options.enabled!==!0||this.options.rubberband!==!0}get disabled(){return this.options.enabled!==!0}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(t={}){super(),this.name="selection",this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},ii.defaultOptions),t),jr(this.name,dj)}init(t){this.graph=t,this.selectionImpl=new Ub(Object.assign(Object.assign({},this.options),{graph:t})),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(t){return t!=null?t!==this.isMultipleSelection()&&(t?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return this.options.movable!==!1}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(t){return t!=null?t!==this.isSelectionMovable()&&(t?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(t){return t!=null?t!==this.isRubberbandEnabled()&&(t?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return this.selectionImpl.options.strict===!0}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(t){return t!=null?t!==this.isStrictRubberband()&&(t?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}setRubberbandModifiers(t){this.setModifiers(t)}setSelectionFilter(t){return this.setFilter(t),this}setSelectionDisplayContent(t){return this.setContent(t),this}isEmpty(){return this.length<=0}clean(t={}){return this.selectionImpl.clean(t),this}reset(t,e={}){return this.selectionImpl.reset(t?this.getCells(t):[],e),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(t){return this.selectionImpl.isSelected(t)}select(t,e={}){const s=this.getCells(t);return s.length&&(this.isMultiple()?this.selectionImpl.select(s,e):this.reset(s.slice(0,1),e)),this}unselect(t,e={}){return this.selectionImpl.unselect(this.getCells(t),e),this}setup(){this.selectionImpl.on("*",(t,e)=>{this.trigger(t,e),this.graph.trigger(t,e)})}startListening(){this.graph.on("blank:mousedown",this.onBlankMouseDown,this),this.graph.on("blank:click",this.onBlankClick,this),this.graph.on("cell:mousemove",this.onCellMouseMove,this),this.graph.on("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.on("box:mousedown",this.onBoxMouseDown,this)}stopListening(){this.graph.off("blank:mousedown",this.onBlankMouseDown,this),this.graph.off("blank:click",this.onBlankClick,this),this.graph.off("cell:mousemove",this.onCellMouseMove,this),this.graph.off("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;const e=this.graph.panning.allowPanning(t,!0),s=this.graph.getPlugin("scroller"),r=s&&s.allowPanning(t,!0);(this.allowRubberband(t,!0)||this.allowRubberband(t)&&!r&&!e)&&this.startRubberband(t)}allowBlankMouseDown(t){const e=this.options.eventTypes;return(e==null?void 0:e.includes("leftMouseDown"))&&t.button===0||(e==null?void 0:e.includes("mouseWheelDown"))&&t.button===1}onBlankClick(){this.clean()}allowRubberband(t,e){return!this.rubberbandDisabled&&ms.isMatch(t,this.options.modifiers,e)}allowMultipleSelection(t){return this.isMultiple()&&ms.isMatch(t,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:t}){this.movedMap.set(t,!0)}onCellMouseUp({e:t,cell:e}){const s=this.options;let r=this.disabled;!r&&this.movedMap.has(e)&&(r=s.selectCellOnMoved===!1,r||(r=s.selectNodeOnMoved===!1&&e.isNode()),r||(r=s.selectEdgeOnMoved===!1&&e.isEdge())),r||(this.allowMultipleSelection(t)?this.unselectMap.has(e)?this.unselectMap.delete(e):this.isSelected(e)?this.unselect(e):this.select(e):this.reset(e)),this.movedMap.delete(e)}onBoxMouseDown({e:t,cell:e}){this.disabled||this.allowMultipleSelection(t)&&(this.unselect(e),this.unselectMap.set(e,!0))}getCells(t){return(Array.isArray(t)?t:[t]).map(e=>typeof e=="string"?this.graph.getCellById(e):e).filter(e=>e!=null)}startRubberband(t){return this.rubberbandDisabled||this.selectionImpl.startSelecting(t),this}isMultiple(){return this.options.multiple!==!1}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(t){return this.options.modifiers=t,this}setContent(t){return this.selectionImpl.setContent(t),this}setFilter(t){return this.selectionImpl.setFilter(t),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),$r(this.name)}}fj([Nt.dispose()],ii.prototype,"dispose",null),function(n){n.defaultOptions={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,multipleSelectionModifiers:["ctrl","meta"],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:["leftMouseDown","mouseWheelDown"]}}(ii||(ii={})),I.prototype.isHistoryEnabled=function(){const n=this.getPlugin("history");return n?n.isEnabled():!1},I.prototype.enableHistory=function(){const n=this.getPlugin("history");return n&&n.enable(),this},I.prototype.disableHistory=function(){const n=this.getPlugin("history");return n&&n.disable(),this},I.prototype.toggleHistory=function(n){const t=this.getPlugin("history");return t&&t.toggleEnabled(n),this},I.prototype.undo=function(n){const t=this.getPlugin("history");return t&&t.undo(n),this},I.prototype.redo=function(n){const t=this.getPlugin("history");return t&&t.redo(n),this},I.prototype.undoAndCancel=function(n){const t=this.getPlugin("history");return t&&t.cancel(n),this},I.prototype.canUndo=function(){const n=this.getPlugin("history");return n?n.canUndo():!1},I.prototype.canRedo=function(){const n=this.getPlugin("history");return n?n.canRedo():!1},I.prototype.cleanHistory=function(n){const t=this.getPlugin("history");return t&&t.clean(n),this},I.prototype.getHistoryStackSize=function(){return this.getPlugin("history").getSize()},I.prototype.getUndoStackSize=function(){return this.getPlugin("history").getUndoSize()},I.prototype.getRedoStackSize=function(){return this.getPlugin("history").getRedoSize()},I.prototype.getUndoRemainSize=function(){return this.getPlugin("history").getUndoRemainSize()};var Gb=function(n,t,e,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(t,e,i):o(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};class oi extends Nt{constructor(t={}){super(),this.name="history",this.batchCommands=null,this.batchLevel=0,this.lastBatchIndex=-1,this.freezed=!1,this.stackSize=0,this.handlers=[];const{stackSize:e=0}=t;this.stackSize=e,this.options=It.getOptions(t),this.validator=new oi.Validator({history:this,cancelInvalid:this.options.cancelInvalid})}init(t){this.graph=t,this.model=this.graph.model,this.clean(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}undo(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack.push(e),this.notify("undo",e,t))}return this}redo(t={}){if(!this.disabled){const e=this.redoStack.pop();e&&(this.applyCommand(e,t),this.undoStackPush(e),this.notify("redo",e,t))}return this}cancel(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack=[],this.notify("cancel",e,t))}return this}getSize(){return this.stackSize}getUndoRemainSize(){const t=this.undoStack.length;return this.stackSize-t}getUndoSize(){return this.undoStack.length}getRedoSize(){return this.redoStack.length}canUndo(){return!this.disabled&&this.undoStack.length>0}canRedo(){return!this.disabled&&this.redoStack.length>0}clean(t={}){return this.undoStack=[],this.redoStack=[],this.notify("clean",null,t),this}get disabled(){return this.options.enabled!==!0}validate(t,...e){return this.validator.validate(t,...e),this}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach((t,e)=>{this.handlers[e]=this.addCommand.bind(this,t),this.model.on(t,this.handlers[e])}),this.validator.on("invalid",t=>this.trigger("invalid",t))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach((t,e)=>{this.model.off(t,this.handlers[e])}),this.handlers.length=0),this.validator.off("invalid")}createCommand(t){return{batch:t?t.batch:!1,data:{}}}revertCommand(t,e){this.freezed=!0;const s=Array.isArray(t)?It.sortBatchCommands(t):[t];for(let r=s.length-1;r>=0;r-=1){const i=s[r],o=Object.assign(Object.assign({},e),Mc(i.options,this.options.revertOptionsList||[]));this.executeCommand(i,!0,o)}this.freezed=!1}applyCommand(t,e){this.freezed=!0;const s=Array.isArray(t)?It.sortBatchCommands(t):[t];for(let r=0;r<s.length;r+=1){const i=s[r],o=Object.assign(Object.assign({},e),Mc(i.options,this.options.applyOptionsList||[]));this.executeCommand(i,!1,o)}this.freezed=!1}executeCommand(t,e,s){const r=this.model,i=r.getCell(t.data.id),o=t.event;if(It.isAddEvent(o)&&e||It.isRemoveEvent(o)&&!e)i&&i.remove(s);else if(It.isAddEvent(o)&&!e||It.isRemoveEvent(o)&&e){const a=t.data;a.node?r.addNode(a.props,s):a.edge&&r.addEdge(a.props,s)}else if(It.isChangeEvent(o)){const a=t.data,l=a.key;if(l&&i){const u=e?a.prev[l]:a.next[l];a.key==="attrs"&&this.ensureUndefinedAttrs(u,e?a.next[l]:a.prev[l])&&(s.dirty=!0),i.prop(l,u,s)}}else{const a=this.options.executeCommand;a&&X(a,this,t,e,s)}}addCommand(t,e){if(this.freezed||this.disabled)return;const s=e,r=s.options||{};if(r.dryrun||It.isAddEvent(t)&&this.options.ignoreAdd||It.isRemoveEvent(t)&&this.options.ignoreRemove||It.isChangeEvent(t)&&this.options.ignoreChange)return;const i=this.options.beforeAddCommand;if(i!=null&&X(i,this,t,e)===!1)return;t==="cell:change:*"&&(t=`cell:change:${s.key}`);const o=s.cell,a=Zt.isModel(o);let l;if(this.batchCommands){l=this.batchCommands[Math.max(this.lastBatchIndex,0)];const h=a&&!l.modelChange||l.data.id!==o.id,f=l.event!==t;if(this.lastBatchIndex>=0&&(h||f)){const d=this.batchCommands.findIndex(g=>(a&&g.modelChange||g.data.id===o.id)&&g.event===t);d<0||It.isAddEvent(t)||It.isRemoveEvent(t)?l=this.createCommand({batch:!0}):(l=this.batchCommands[d],this.batchCommands.splice(d,1)),this.batchCommands.push(l),this.lastBatchIndex=this.batchCommands.length-1}}else l=this.createCommand({batch:!1});if(It.isAddEvent(t)||It.isRemoveEvent(t)){const h=l.data;return l.event=t,l.options=r,h.id=o.id,h.props=Tt(o.toJSON()),o.isEdge()?h.edge=!0:o.isNode()&&(h.node=!0),this.push(l,r)}if(It.isChangeEvent(t)){const h=e.key,f=l.data;return(!l.batch||!l.event)&&(l.event=t,l.options=r,f.key=h,f.prev==null&&(f.prev={}),f.prev[h]=Tt(o.previous(h)),a?l.modelChange=!0:f.id=o.id),f.next==null&&(f.next={}),f.next[h]=Tt(o.prop(h)),this.push(l,r)}const u=this.options.afterAddCommand;u&&X(u,this,t,e,l),this.push(l,r)}initBatchCommand(t){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(t){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){const e=this.filterBatchCommand(this.batchCommands);e.length>0&&(this.redoStack=[],this.undoStackPush(e),this.consolidateCommands(),this.notify("add",e,t)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(t){let e=t.slice();const s=[];for(;e.length>0;){const r=e.shift(),i=r.event,o=r.data.id;if(i!=null&&(o!=null||r.modelChange)){if(It.isAddEvent(i)){const a=e.findIndex(l=>It.isRemoveEvent(l.event)&&l.data.id===o);if(a>=0){e=e.filter((l,u)=>a<u||l.data.id!==o);continue}}else if(It.isRemoveEvent(i)){const a=e.findIndex(l=>It.isAddEvent(l.event)&&l.data.id===o);if(a>=0){e.splice(a,1);continue}}else if(It.isChangeEvent(i)){const a=r.data;if(wn(a.prev,a.next))continue}s.push(r)}}return s}notify(t,e,s){const r=e==null?null:Array.isArray(e)?e:[e];this.emit(t,{cmds:r,options:s}),this.graph.trigger(`history:${t}`,{cmds:r,options:s}),this.emit("change",{cmds:r,options:s}),this.graph.trigger("history:change",{cmds:r,options:s})}push(t,e){this.redoStack=[],t.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:t,options:e})):(this.undoStackPush(t),this.consolidateCommands(),this.notify("add",t,e))}consolidateCommands(){var t;const e=this.undoStack[this.undoStack.length-1],s=this.undoStack[this.undoStack.length-2];if(!Array.isArray(e))return;const r=new Set(e.map(o=>o.event));if(r.size!==2||!r.has("cell:change:parent")||!r.has("cell:change:children")||!e.every(o=>{var a;return o.batch&&((a=o.options)===null||a===void 0?void 0:a.ui)})||!Array.isArray(s)||s.length!==1)return;const i=s[0];i.event!=="cell:change:position"||!(!((t=i.options)===null||t===void 0)&&t.ui)||(s.push(...e),this.undoStack.pop())}undoStackPush(t){if(this.stackSize===0){this.undoStack.push(t);return}this.undoStack.length>=this.stackSize&&this.undoStack.shift(),this.undoStack.push(t)}ensureUndefinedAttrs(t,e){let s=!1;return t!==null&&e!==null&&typeof t=="object"&&typeof e=="object"&&Object.keys(e).forEach(r=>{t[r]===void 0&&e[r]!==void 0?(t[r]=void 0,s=!0):typeof t[r]=="object"&&typeof e[r]=="object"&&(s=this.ensureUndefinedAttrs(t[r],e[r]))}),s}dispose(){this.validator.dispose(),this.clean(),this.stopListening(),this.off()}}Gb([Nt.dispose()],oi.prototype,"dispose",null),function(n){class t extends Nt{constructor(s){super(),this.map={},this.command=s.history,this.cancelInvalid=s.cancelInvalid!==!1,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:s}){return Array.isArray(s)?s.every(r=>this.isValidCommand(r)):this.isValidCommand(s)}isValidCommand(s){if(s.options&&s.options.validation===!1)return!0;const r=s.event&&this.map[s.event]||[];let i=null;return r.forEach(o=>{let a=0;const l=u=>{const h=o[a];a+=1;try{if(h)h(u,s,l);else{i=u;return}}catch(f){l(f)}};l(i)}),i?(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:i}),!1):!0}validate(s,...r){const i=Array.isArray(s)?s:s.split(/\s+/);return r.forEach(o=>{if(typeof o!="function")throw new Error(`${i.join(" ")} requires callback functions.`)}),i.forEach(o=>{this.map[o]==null&&(this.map[o]=[]),this.map[o].push(r)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}Gb([Nt.dispose()],t.prototype,"dispose",null),n.Validator=t}(oi||(oi={}));var It;(function(n){function t(o){return o==="cell:added"}n.isAddEvent=t;function e(o){return o==="cell:removed"}n.isRemoveEvent=e;function s(o){return o!=null&&o.startsWith("cell:change:")}n.isChangeEvent=s;function r(o){const a=["cell:added","cell:removed","cell:change:*"],l=["batch:start","batch:stop"],u=o.eventNames?o.eventNames.filter(h=>!(n.isChangeEvent(h)||a.includes(h)||l.includes(h))):a;return Object.assign(Object.assign({enabled:!0},o),{eventNames:u,applyOptionsList:o.applyOptionsList||["propertyPath"],revertOptionsList:o.revertOptionsList||["propertyPath"]})}n.getOptions=r;function i(o){const a=[];for(let l=0,u=o.length;l<u;l+=1){const h=o[l];let f=null;if(n.isAddEvent(h.event)){const d=h.data.id;for(let g=0;g<l;g+=1)if(o[g].data.id===d){f=g;break}}f!==null?a.splice(f,0,h):a.push(h)}return a}n.sortBatchCommands=i})(It||(It={})),I.prototype.toSVG=function(n,t){const e=this.getPlugin("export");e&&e.toSVG(n,t)},I.prototype.toPNG=function(n,t){const e=this.getPlugin("export");e&&e.toPNG(n,t)},I.prototype.toJPEG=function(n,t){const e=this.getPlugin("export");e&&e.toJPEG(n,t)},I.prototype.exportPNG=function(n,t){const e=this.getPlugin("export");e&&e.exportPNG(n,t)},I.prototype.exportJPEG=function(n,t){const e=this.getPlugin("export");e&&e.exportJPEG(n,t)},I.prototype.exportSVG=function(n,t){const e=this.getPlugin("export");e&&e.exportSVG(n,t)};var gj=function(n,t,e,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(t,e,i):o(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};class Yb extends Nt{constructor(){super(),this.name="export"}get view(){return this.graph.view}init(t){this.graph=t}exportPNG(t="chart",e={}){this.toPNG(s=>{Ws.downloadDataUri(s,t)},e)}exportJPEG(t="chart",e={}){this.toPNG(s=>{Ws.downloadDataUri(s,t)},e)}exportSVG(t="chart",e={}){this.toSVG(s=>{Ws.downloadDataUri(Ws.svgToDataUrl(s),t)},e)}toSVG(t,e={}){this.notify("before:export",e);const s=this.view.svg,r=tt.create(s).clone();let i=r.node;const o=r.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),a=e.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),l=e.preserveDimensions;if(l){const f=typeof l=="boolean"?a:l;r.attr({width:f.width,height:f.height})}if(r.removeAttribute("style").attr("viewBox",[a.x,a.y,a.width,a.height].join(" ")),o.removeAttribute("transform"),e.copyStyles!==!1){const f=s.ownerDocument,d=Array.from(s.querySelectorAll("*")),g=Array.from(i.querySelectorAll("*")),p=f.styleSheets.length,m=[];for(let w=p-1;w>=0;w-=1)m[w]=f.styleSheets[w],f.styleSheets[w].disabled=!0;const y={};d.forEach((w,x)=>{const v=window.getComputedStyle(w,null),S={};Object.keys(v).forEach(E=>{S[E]=v.getPropertyValue(E)}),y[x]=S}),p!==f.styleSheets.length&&m.forEach((w,x)=>{f.styleSheets[x]=w});for(let w=0;w<p;w+=1)f.styleSheets[w].disabled=!1;const b={};d.forEach((w,x)=>{const v=window.getComputedStyle(w,null),S=y[x],E={};Object.keys(v).forEach(C=>{!Oc(C)&&v.getPropertyValue(C)!==S[C]&&(E[C]=v.getPropertyValue(C))}),b[x]=E}),g.forEach((w,x)=>{qt(w,b[x])})}const u=e.stylesheet;if(typeof u=="string"){const f=s.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(u);r.prepend(tt.create("style",{type:"text/css"},[f]))}const h=()=>{const f=e.beforeSerialize;if(typeof f=="function"){const g=X(f,this.graph,i);g instanceof SVGSVGElement&&(i=g)}const d=new XMLSerializer().serializeToString(i).replace(/ /g," ");this.notify("after:export",e),t(d)};if(e.serializeImages){const f=r.find("image").map(d=>new Promise(g=>{const p=d.attr("xlink:href")||d.attr("href");Ws.imageToDataUri(p,(m,y)=>{!m&&y&&d.attr("xlink:href",y),g()})}));Promise.all(f).then(h)}else h()}toDataURL(t,e){let s=e.viewBox||this.graph.getContentBBox();const r=ds(e.padding);e.width&&e.height&&(r.left+r.right>=e.width&&(r.left=r.right=0),r.top+r.bottom>=e.height&&(r.top=r.bottom=0));const i=new z(-r.left,-r.top,r.left+r.right,r.top+r.bottom);if(e.width&&e.height){const h=s.width+r.left+r.right,f=s.height+r.top+r.bottom;i.scale(h/e.width,f/e.height)}s=z.create(s).moveAndExpand(i);const o=typeof e.width=="number"&&typeof e.height=="number"?{width:e.width,height:e.height}:s;let a=e.ratio?parseFloat(e.ratio):1;(!Number.isFinite(a)||a===0)&&(a=1);const l={width:Math.max(Math.round(o.width*a),1),height:Math.max(Math.round(o.height*a),1)};{const h=document.createElement("canvas"),f=h.getContext("2d");h.width=l.width,h.height=l.height;const d=l.width-1,g=l.height-1;f.fillStyle="rgb(1,1,1)",f.fillRect(d,g,1,1);const p=f.getImageData(d,g,1,1).data;if(p[0]!==1||p[1]!==1||p[2]!==1)throw new Error("size exceeded")}const u=new Image;u.onload=()=>{const h=document.createElement("canvas");h.width=l.width,h.height=l.height;const f=h.getContext("2d");f.fillStyle=e.backgroundColor||"white",f.fillRect(0,0,l.width,l.height);try{f.drawImage(u,0,0,l.width,l.height);const d=h.toDataURL(e.type,e.quality);t(d)}catch{}},this.toSVG(h=>{u.src=`data:image/svg+xml,${encodeURIComponent(h)}`},Object.assign(Object.assign({},e),{viewBox:s,serializeImages:!0,preserveDimensions:Object.assign({},l)}))}toPNG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/png"}))}toJPEG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/jpeg"}))}notify(t,e){this.trigger(t,e),this.graph.trigger(t,e)}dispose(){this.off()}}gj([Nt.dispose()],Yb.prototype,"dispose",null);const pj={class:"control-box"},mj=Gn({__name:"index",props:{payload:Object},setup(n){const t=n,e=c.ref("3"),s=c.ref([]),r=()=>{s.value=JSON.parse(JSON.stringify(t.payload.getPorts().map(u=>({id:u.id,attrs:u.attrs,args:{x:Number(u.args.x.replace("%","")),y:Number(u.args.y.replace("%",""))}}))))},i=()=>{const u=za;u.attrs.text.text=`${t.payload.getPorts().length+1}`,u.args.x="50%",u.args.y="50%",t.payload.addPorts([{group:"ports",...u}]),r()},o=()=>{Wi("#drawing-board",!0)},a=(u,h,f)=>{t.payload.portProp(u,"args/"+h,f+"%"),r()},l=u=>{t.payload.removePort(u),r()};return c.onMounted(()=>{r()}),(u,h)=>{const f=c.resolveComponent("el-button"),d=c.resolveComponent("el-table-column"),g=c.resolveComponent("el-slider"),p=c.resolveComponent("el-icon"),m=c.resolveComponent("el-table"),y=c.resolveComponent("el-collapse-item"),b=c.resolveComponent("el-collapse");return c.openBlock(),c.createElementBlock("div",pj,[c.createVNode(b,{modelValue:e.value,"onUpdate:modelValue":h[0]||(h[0]=w=>e.value=w),accordion:""},{default:c.withCtx(()=>[c.createVNode(y,{title:"连接桩设置",name:"3"},{default:c.withCtx(()=>[c.createVNode(f,{type:"primary",onClick:i,size:"small"},{default:c.withCtx(()=>h[1]||(h[1]=[c.createTextVNode("添加连接桩")])),_:1}),c.createVNode(f,{type:"primary",onClick:o,size:"small"},{default:c.withCtx(()=>h[2]||(h[2]=[c.createTextVNode("显示连接桩")])),_:1}),c.createVNode(m,{data:s.value,border:"",size:"small",style:{"margin-top":"10px"}},{default:c.withCtx(()=>[c.createVNode(d,{label:"ID",width:"50",align:"center"},{default:c.withCtx(({row:w})=>[c.createTextVNode(c.toDisplayString(w.attrs.text.text),1)]),_:1}),c.createVNode(d,{label:"x",width:"100",align:"center"},{default:c.withCtx(({row:w})=>[c.createVNode(g,{modelValue:w.args.x,"onUpdate:modelValue":x=>w.args.x=x,min:0,max:100,step:1,onInput:x=>a(w.id,"x",x)},null,8,["modelValue","onUpdate:modelValue","onInput"])]),_:1}),c.createVNode(d,{label:"y",width:"100",align:"center"},{default:c.withCtx(({row:w})=>[c.createVNode(g,{modelValue:w.args.y,"onUpdate:modelValue":x=>w.args.y=x,min:0,max:100,step:1,onInput:x=>a(w.id,"y",x)},null,8,["modelValue","onUpdate:modelValue","onInput"])]),_:1}),c.createVNode(d,{label:"操作",width:"70",align:"center"},{default:c.withCtx(({row:w})=>[c.createVNode(f,{type:"danger",size:"small",onClick:x=>l(w.id)},{default:c.withCtx(()=>[c.createVNode(p,null,{default:c.withCtx(()=>[c.createVNode(c.unref(xg))]),_:1})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1},8,["modelValue"])])}}},[["__scopeId","data-v-b280098c"]]),yl=[{shape:"rect",width:60,height:5,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:0}},data:{type:"base-shape"}},{shape:"rect",width:60,height:20,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:1}},data:{type:"base-shape",label:"母线"}},{shape:"circle",width:40,height:40,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:1}},data:{type:"base-shape"}},{shape:"ellipse",width:60,height:40,attrs:{body:{fill:"#ffffff",stroke:"#ffffff"}},data:{type:"base-shape"}}],Wb={groups:{ports:{position:"absolute",args:{x:0,y:0},attrs:{circle:{magnet:!0,stroke:"#8f8f8f",r:4}},label:{position:"top"}}}},dh=Object.assign({name:"wiring-diagram-preview"},{__name:"index",props:{id:{type:String,default:""},background:{type:Object,default:()=>({})},grid:{type:Object,default:()=>({})},data:{type:Object,default:()=>({})}},setup(n){const t=n,e=c.ref([]),s=c.ref(),r=()=>{const y=document.getElementById("preview-container");s.value=new I({container:y,autoResize:!0,panning:!0,mousewheel:!0,connecting:{router:"orth",connectionPoint:{name:"anchor"},anchor:"center"},interacting:{nodeMovable:!1,magnetConnectable:!1,edgeMovable:!1,edgeLabelMovable:!1,arrowheadMovable:!1,vertexMovable:!1,vertexAddable:!1,vertexDeletable:!1}}),s.value.on("blank:dblclick",()=>{h()})},i=async()=>{let y,b,w;if(t.id){const{background:x,grid:v,data:S}=await _m(t.id);y=x,b={},w=S}else y=t.background,b={},w=t.data;s.value.drawBackground(y),s.value.drawGrid(b),s.value.fromJSON(w),l()},o=c.ref(null),a=c.ref([]),l=()=>{a.value=f();const y=/\$\{(.*?)\}/g;a.value.forEach(b=>{if(!b.data||!b.data.field)return;const w=b.data.content.match(y);e.value.push(...b.data.field),w&&(b.matches=w)}),a&&h()},u=c.ref(!0),h=async()=>{if(!e.value.length)return;if(!u.value){Bt.warning("数据正在更新中,请稍后再试");return}o.value&&clearInterval(o.value),u.value=!1;const y=await RD(e.value);if(u.value=!0,!Array.isArray(y)||!y.length)return;let b=0;a.value.forEach((w,x)=>{if(!w.data||!w.data.field)return;if(w.matches){const S=x===0?0:b||0,E=b=S+w.data.field.length;w.label=d(w.data.content,y.slice(S,E))}}),o.value=setTimeout(()=>{h()},1e4)},f=()=>s.value.getNodes().filter(b=>{var w;return((w=b.data)==null?void 0:w.type)==="text"}),d=(y,b)=>{let w=0;return y.replace(/\$\{.*?\}/g,()=>w<b.length?b[w++]:"--")},g=()=>{s.value.zoomToFit({maxScale:1,padding:20})},p=c.shallowRef(),m=()=>{new ResizeObserver(()=>{g()}).observe(p.value)};return c.onMounted(()=>{r(),i(),setTimeout(()=>{Wi("#preview-container",!1),g()},100),m()}),c.onUnmounted(()=>{clearInterval(o.value)}),(y,b)=>(c.openBlock(),c.createElementBlock("div",{id:"preview-container",ref_key:"previewRef",ref:p,onDblclick:g},null,544))}}),yj={class:"form-container"},bj={class:"footer"},wj=Gn({__name:"group-form",props:{payload:{type:Object,default:()=>({})}},emits:["close"],setup(n,{emit:t}){const e=n,s=t,r=c.reactive({groupName:"",sort:1,isShow:1}),i=c.reactive({groupName:[{required:!0,message:"请输入分组名称",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],sort:[{required:!0,message:"请输入排序",trigger:"blur"},{type:"number",message:"排序必须为数字值"}],isShow:[{required:!0,message:"请选择是否显示",trigger:"change"}]}),o=c.ref(),a=()=>{console.log(r),o.value.validate(u=>{if(u)r.id?$a("/cny/custom/updateGroup",r).then(h=>{h!=null&&h.isOk?(Bt.success("保存成功"),s("close",!0)):Bt.error((h==null?void 0:h.msg)||"保存失败")}):$a("/cny/custom/saveGroup",r).then(h=>{h!=null&&h.isOk?(Bt.success("保存成功"),s("close",!0)):Bt.error((h==null?void 0:h.msg)||"保存失败")});else return!1})},l=()=>{s("close",!1)};return c.onMounted(()=>{var u;(u=e.payload)!=null&&u.id&&(r.id=e.payload.id,r.groupName=e.payload.groupName,r.sort=e.payload.sort,r.isShow=e.payload.isShow)}),(u,h)=>{const f=c.resolveComponent("el-input"),d=c.resolveComponent("el-form-item"),g=c.resolveComponent("el-input-number"),p=c.resolveComponent("el-switch"),m=c.resolveComponent("el-button"),y=c.resolveComponent("el-form");return c.openBlock(),c.createElementBlock("div",yj,[c.createVNode(y,{ref_key:"form",ref:o,model:r,rules:i,"label-width":"90px","label-suffix":":"},{default:c.withCtx(()=>[c.createVNode(d,{label:"分组名称",prop:"groupName"},{default:c.withCtx(()=>[c.createVNode(f,{modelValue:r.groupName,"onUpdate:modelValue":h[0]||(h[0]=b=>r.groupName=b),placeholder:"请输入分组名称",clearable:""},null,8,["modelValue"])]),_:1}),c.createVNode(d,{label:"排序",prop:"sort"},{default:c.withCtx(()=>[c.createVNode(g,{modelValue:r.sort,"onUpdate:modelValue":h[1]||(h[1]=b=>r.sort=b),min:0,max:999,step:1,"controls-position":"right"},null,8,["modelValue"])]),_:1}),c.createVNode(d,{label:"是否显示",prop:"isShow"},{default:c.withCtx(()=>[c.createVNode(p,{modelValue:r.isShow,"onUpdate:modelValue":h[2]||(h[2]=b=>r.isShow=b),"active-value":1,"inactive-value":0,"active-color":"#13ce66","inactive-color":"#ff4949"},null,8,["modelValue"])]),_:1}),c.createElementVNode("div",bj,[c.createVNode(m,{type:"primary",onClick:a},{default:c.withCtx(()=>h[3]||(h[3]=[c.createTextVNode("保存")])),_:1}),c.createVNode(m,{onClick:l},{default:c.withCtx(()=>h[4]||(h[4]=[c.createTextVNode("取消")])),_:1})])]),_:1},8,["model","rules"])])}}},[["__scopeId","data-v-a2a7ce25"]]),xj={class:"form-container"},vj={class:"footer"},Cj=Gn({__name:"image-form",props:{payload:{type:Object,default:()=>({})}},emits:["close"],setup(n,{emit:t}){const e=t,s=n,r=c.shallowRef(null),i=c.reactive({groupId:"",id:"",imageName:"",sort:0,isShow:1,imageUrl:""}),o={imageName:[{required:!0,message:"请输入图片名称",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],sort:[{required:!0,message:"请输入排序",trigger:"blur"},{type:"number",message:"排序必须为数字值"}]},a=c.ref(""),l=f=>{if(f.raw.type.indexOf("image")===-1){Bt.error("请上传图片格式的文件");return}const d=new FormData;d.append("file",f.raw),DD("/cny/file/fileUpload",d).then(g=>{g!=null&&g.isOk?(a.value=hs.defaults.baseURL+"/cny/upload/"+(g==null?void 0:g.data),i.imageUrl=g==null?void 0:g.data):Bt.error((g==null?void 0:g.msg)||"上传失败")})},u=()=>{console.log(i),r.value.validate(f=>{if(f)$a("/cny/custom/savePicture",i).then(d=>{d!=null&&d.isOk?(Bt.success("保存成功"),e("close",!0)):Bt.error((d==null?void 0:d.msg)||"保存失败")});else return!1})},h=()=>{e("close",!1)};return c.onMounted(()=>{var f;(f=s.payload)!=null&&f.id&&(i.id=s.payload.id,i.imageName=s.payload.imageName,i.sort=s.payload.sort,i.isShow=s.payload.isShow,i.imageUrl=s.payload.imageUrl,a.value=i.imageUrl),i.groupId=s.payload.groupId}),(f,d)=>{const g=c.resolveComponent("el-input"),p=c.resolveComponent("el-form-item"),m=c.resolveComponent("el-input-number"),y=c.resolveComponent("el-switch"),b=c.resolveComponent("el-image"),w=c.resolveComponent("el-icon"),x=c.resolveComponent("el-upload"),v=c.resolveComponent("el-button"),S=c.resolveComponent("el-form");return c.openBlock(),c.createElementBlock("div",xj,[c.createVNode(S,{ref_key:"form",ref:r,model:i,rules:o,"label-width":"90px","label-suffix":":"},{default:c.withCtx(()=>[c.createVNode(p,{label:"图片名称",prop:"imageName"},{default:c.withCtx(()=>[c.createVNode(g,{modelValue:i.imageName,"onUpdate:modelValue":d[0]||(d[0]=E=>i.imageName=E),placeholder:"请输入图片名称"},null,8,["modelValue"])]),_:1}),c.createVNode(p,{label:"排序",prop:"sort"},{default:c.withCtx(()=>[c.createVNode(m,{modelValue:i.sort,"onUpdate:modelValue":d[1]||(d[1]=E=>i.sort=E),min:0,max:999,step:1,"controls-position":"right"},null,8,["modelValue"])]),_:1}),c.createVNode(p,{label:"是否显示",prop:"isShow"},{default:c.withCtx(()=>[c.createVNode(y,{modelValue:i.isShow,"onUpdate:modelValue":d[2]||(d[2]=E=>i.isShow=E),"active-value":1,"inactive-value":0,"active-color":"#13ce66","inactive-color":"#ff4949"},null,8,["modelValue"])]),_:1}),c.createVNode(p,{label:"上传",prop:"image"},{default:c.withCtx(()=>[c.createVNode(x,{action:"","list-type":"picture",class:"avatar-uploader","show-file-list":!1,"on-change":l,"auto-upload":!1},{default:c.withCtx(()=>[a.value?(c.openBlock(),c.createBlock(b,{key:0,src:a.value,fit:"cover",style:{width:"64px",height:"64px"}},null,8,["src"])):(c.openBlock(),c.createBlock(w,{key:1,class:"avatar-uploader-icon"},{default:c.withCtx(()=>[c.createVNode(c.unref(Z2))]),_:1}))]),_:1})]),_:1}),c.createElementVNode("div",vj,[c.createVNode(v,{type:"primary",onClick:u},{default:c.withCtx(()=>d[3]||(d[3]=[c.createTextVNode("保存")])),_:1}),c.createVNode(v,{onClick:h},{default:c.withCtx(()=>d[4]||(d[4]=[c.createTextVNode("取消")])),_:1})])]),_:1},8,["model"])])}}},[["__scopeId","data-v-c7d87a18"]]),Sj={class:"form-container"},Ej={style:{padding:"0 10px",display:"flex","flex-direction":"column",gap:"5px","align-items":"flex-start"}},Oj=["src"],Mj=Gn({__name:"image-management",setup(n){const t=c.reactive({items:[]}),e=()=>{Yi("/cny/custom/groupList").then(d=>{t.items=d.data})},s=c.reactive({show:!1,title:"新增图片分组",payload:null}),r=()=>{s.show=!0,s.title="新增图片分组",s.payload=null},i=d=>{s.show=!0,s.title="编辑图片分组",s.payload={id:d.id,groupName:d.groupName,sort:d.sort,isShow:d.isShow}},o=d=>{iu.confirm("是否确定要删除该图片分组?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{Nm("/cny/custom/removeGroup/"+d).then(g=>{g.code===200?(Bt.success("删除成功"),e()):Bt.error(g.msg||"删除失败")})})},a=c.reactive({show:!1,title:"新增图片",payload:null}),l=d=>{a.show=!0,a.title="新增图片",a.payload={groupId:d}},u=d=>{a.show=!0,a.title="编辑图片",a.payload={id:d.id,groupId:d.groupId,imageName:d.imageName,sort:d.sort,isShow:d.isShow,imageUrl:d.imageUrl}},h=d=>{iu.confirm("是否确定要删除该图片?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{Nm("/cny/custom/removePicture/"+d).then(g=>{g.code===200?(Bt.success("删除成功"),e()):Bt.error(g.msg||"删除失败")})})},f=d=>{s.show=!1,a.show=!1,d&&e()};return c.onMounted(()=>{e()}),(d,g)=>{const p=c.resolveComponent("el-button"),m=c.resolveComponent("el-table-column"),y=c.resolveComponent("el-table"),b=c.resolveComponent("el-dialog");return c.openBlock(),c.createElementBlock("div",Sj,[c.createVNode(p,{type:"primary",onClick:r,size:"small"},{default:c.withCtx(()=>g[2]||(g[2]=[c.createTextVNode("新增图片分组")])),_:1}),c.createVNode(y,{data:t.items,border:"",height:"500"},{default:c.withCtx(()=>[c.createVNode(m,{type:"expand"},{default:c.withCtx(w=>[c.createElementVNode("div",Ej,[c.createVNode(p,{type:"primary",size:"small",onClick:x=>l(w.row.id)},{default:c.withCtx(()=>g[3]||(g[3]=[c.createTextVNode("新增图片")])),_:2},1032,["onClick"]),c.createVNode(y,{data:w.row.pictureList,border:"",size:"small"},{default:c.withCtx(()=>[c.createVNode(m,{label:"名称",prop:"imageName",align:"center"}),c.createVNode(m,{label:"图片",prop:"imageUrl",align:"center"},{default:c.withCtx(x=>[c.createElementVNode("img",{src:x.row.imageUrl,alt:"",style:{width:"64px",height:"64px"}},null,8,Oj)]),_:1}),c.createVNode(m,{label:"排序",prop:"sort",align:"center"}),c.createVNode(m,{label:"是否显示",prop:"isShow",align:"center"},{default:c.withCtx(x=>[c.createTextVNode(c.toDisplayString(x.row.isShow===1?"是":"否"),1)]),_:1}),c.createVNode(m,{label:"操作",align:"center"},{default:c.withCtx(x=>[c.createVNode(p,{type:"primary",size:"small",onClick:v=>u(x.row)},{default:c.withCtx(()=>g[4]||(g[4]=[c.createTextVNode("编辑")])),_:2},1032,["onClick"]),c.createVNode(p,{type:"danger",size:"small",onClick:v=>h(x.row.id)},{default:c.withCtx(()=>g[5]||(g[5]=[c.createTextVNode("删除")])),_:2},1032,["onClick"])]),_:1})]),_:2},1032,["data"])])]),_:1}),c.createVNode(m,{label:"分组名称",prop:"groupName",align:"center"}),c.createVNode(m,{label:"排序",prop:"sort",align:"center"}),c.createVNode(m,{label:"是否显示",prop:"isShow",align:"center"},{default:c.withCtx(w=>[c.createTextVNode(c.toDisplayString(w.row.isShow===1?"是":"否"),1)]),_:1}),c.createVNode(m,{label:"操作",align:"center"},{default:c.withCtx(w=>[c.createVNode(p,{type:"primary",size:"small",onClick:x=>i(w.row)},{default:c.withCtx(()=>g[6]||(g[6]=[c.createTextVNode("编辑")])),_:2},1032,["onClick"]),c.createVNode(p,{type:"danger",size:"small",onClick:x=>o(w.row.id)},{default:c.withCtx(()=>g[7]||(g[7]=[c.createTextVNode("删除")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"]),c.createVNode(b,{modelValue:s.show,"onUpdate:modelValue":g[0]||(g[0]=w=>s.show=w),title:s.title,width:"300","close-on-click-modal":!1,"close-on-press-escape":!1},{default:c.withCtx(()=>[s.show?(c.openBlock(),c.createBlock(wj,{key:0,payload:s.payload,onClose:f},null,8,["payload"])):c.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),c.createVNode(b,{modelValue:a.show,"onUpdate:modelValue":g[1]||(g[1]=w=>a.show=w),title:a.title,width:"300","close-on-click-modal":!1,"close-on-press-escape":!1},{default:c.withCtx(()=>[a.show?(c.openBlock(),c.createBlock(Cj,{key:0,payload:a.payload,onClose:f},null,8,["payload"])):c.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])])}}},[["__scopeId","data-v-9338a78d"]]),Pj={class:"page-container"},Aj={class:"tool-bar"},Tj={class:"action"},Nj={class:"el-dropdown-link"},_j={class:"action",style:{"margin-right":"50px"}},kj={class:"board"},Dj={class:"drawing-board-box"},Rj={id:"controls"},Ij={key:0,class:"controls-label"},Lj={style:{width:"100%",height:"100%",background:"black"}},qb=Gn(Object.assign({name:"editor"},{__name:"index",props:{id:{type:String,default:""}},emits:["getJson"],setup(n,{emit:t}){const e=n,s=c.ref(),r=c.reactive({label:null,component:c.shallowRef(null)}),i=c.ref(null),o=c.ref(null),a=()=>{const D=document.getElementById("drawing-board");window.__x6_instances__=[],s.value=new I({container:D,autoResize:!0,panning:!0,mousewheel:!0,connecting:{router:"orth",connectionPoint:{name:"anchor"},anchor:"center",createEdge(){return s.value.createEdge({inherit:"edge",attrs:{...Cu},zIndex:0})}}}),window.__x6_instances__.push(s.value),s.value.use(new er({resizing:{enabled:!0,preserveAspectRatio:!1},rotating:!0})),s.value.use(new Hb),s.value.use(new $b),s.value.use(new zb({format(N){return N.replace(/\s/g,"").replace("cmd","command")}})),s.value.use(new oi),s.value.use(new ii({enabled:!0,multiple:!0,rubberband:!0,modifiers:["alt"],showNodeSelectionBox:!0})),s.value.bindKey(["delete","backspace"],()=>{const N=s.value.getSelectedCells();return N.length&&s.value.removeCells(N),!1}),s.value.bindKey(["ctrl+c","cmd + c"],()=>{const N=s.value.getSelectedCells();return N.length&&(s.value.copy(N),Bt.success("复制成功")),!1}),s.value.bindKey(["ctrl+v","cmd + v"],()=>{if(!s.value.isClipboardEmpty()){const N=s.value.paste({offset:32});s.value.cleanSelection(),s.value.select(N),Bt.success("粘贴成功")}return!1}),s.value.bindKey(["ctrl+z","cmd + z"],()=>(s.value.canUndo()&&s.value.undo(),!1)),s.value.bindKey(["ctrl+y","cmd + y"],()=>(s.value.canRedo()&&s.value.redo(),!1)),s.value.on("blank:click",({e:N,x:V,y:A})=>{o.value=s,r.component=jD,r.label="画布属性",i.value=G().valueOf()}),s.value.on("cell:click",({cell:N})=>{var V,A,P;if(console.log("cell:click",N,((V=N==null?void 0:N.data)==null?void 0:V.type)??(N==null?void 0:N.shape)),o.value=N,i.value=G().valueOf(),((A=N.data)==null?void 0:A.type)==="text"){r.component=Rm,r.label="文本属性";return}if(((P=N.data)==null?void 0:P.type)==="base-shape"){r.component=Rm,r.label="基础图形属性";return}if((N==null?void 0:N.shape)==="edge"){r.component=WD,r.label="连线属性";return}if((N==null?void 0:N.shape)==="image"){r.component=mj,r.label="图片属性";return}r.component=null,r.label=null}),s.value.on("edge:mouseenter",({cell:N})=>{N.addTools([{name:"vertices",args:{snapRadius:3,attrs:{r:3,fill:"#239edd",cursor:"move","stroke-width":0},modifiers:["alt"]}}])}),s.value.on("edge:mouseleave",({cell:N})=>{N.removeTools()}),s.value.on("node:mouseenter",()=>{Wi("#drawing-board",!0)}),s.value.on("node:mouseleave",()=>{Wi("#drawing-board",!1)}),s.value.use(new Yb)},l=c.ref(),u=()=>{l.value=new si({target:s.value,...ID,groups:[{name:"基础组件",graphPadding:30}],search(V,A){var P;return((P=V.label)==null?void 0:P.indexOf(A))!==-1},placeholder:"搜索",notFoundText:"未找到匹配项",getDragNode:V=>{const A=V.clone({keepId:!0});return A.label!=="文本"&&(A.label=""),A},getDropNode:V=>V.clone({keepId:!0})});const D=s.value.createNode({...LD}),N=yl.map(V=>(V.ports=Wb,s.value.createNode(V)));l.value.load([D,...N],"基础组件"),Yi("/cny/custom/groupList").then(V=>{const A=(V==null?void 0:V.data)||[];A==null||A.forEach(P=>{l.value.addGroup({name:P==null?void 0:P.groupName,graphPadding:30});const L=P==null?void 0:P.pictureList.map(j=>{const Y={shape:"image",imageUrl:j==null?void 0:j.imageUrl,ports:Wb,width:64,height:64,label:j.imageName};return s.value.createNode(Y)});l.value.load(L,P==null?void 0:P.groupName),document.getElementById("stencil").appendChild(l.value.container)})}).finally(()=>{setTimeout(()=>{l.value.container.querySelectorAll(".x6-node").forEach((A,P)=>{if(P>yl.length){const L=A.querySelector("text");A.style.position="relative",L&&(L.style.display="none",L.setAttribute("x","0%"),L.setAttribute("y","30%"),L.style.fontSize="12px",L.style.fontWeight="bold",L.style.fill="#ffffff")}A.addEventListener("mouseenter",L=>{if(P>yl.length){const j=A.querySelector("text");j&&(j.style.display="block")}}),A.addEventListener("mouseleave",L=>{if(P>yl.length){const j=A.querySelector("text");j&&(j.style.display="none")}})})},20)})},h=D=>{switch(D){case"snapLine":s.value.isSnaplineEnabled()?(s.value.disableSnapline(),Bt.warning("关闭对齐线")):(s.value.enableSnapline(),Bt.success("开启对齐线"));break;case"select":s.value.isSelectionEnabled()?(s.value.disableSelection(),Bt.warning("关闭框选")):(s.value.enableSelection(),Bt.success("开启框选"));break;case"drawLine":g();break;case"adaptive":p();break;case"shortcuts":y();break;case"image":w();break;case"clear":x();break;case"export":v();break}},f=c.ref(!1),d=c.ref(null),g=()=>{f.value=!0;const D=new Date;s.value.startBatch(D),s.value.disablePanning(),s.value.once("blank:mousedown",({e:N,x:V,y:A})=>{f.value&&(d.value=s.value.addEdge({source:{x:V,y:A},target:{x:V,y:A},attrs:Cu,data:{type:"edge",isConnector:!1},zIndex:0}))}),s.value.on("blank:mousemove",({e:N,x:V,y:A})=>{f.value&&d.value.setTarget({x:V,y:A})}),s.value.on("blank:mouseup",({e:N,x:V,y:A})=>{f.value=!1,s.value.enablePanning(),s.value.stopBatch(D)})},p=()=>{s.value.zoomToFit({maxScale:1,padding:20})},m=c.reactive({show:!1}),y=()=>{m.show=!0},b=c.reactive({show:!1}),w=()=>{b.show=!0},x=()=>{s.value.clearCells(),s.value.drawBackground(km),s.value.drawGrid(Dm),Bt.success("清空成功")},v=()=>{const D=G().format("YYYYMMDDHHmmss");s.value.exportPNG(D,{padding:10,quality:1,backgroundColor:s.value.options.background.color})},S=t,E=c.reactive({show:!1,background:null,grid:null,data:null}),C=()=>{E.background=s.value.options.background,E.grid=s.value.options.grid,E.data=s.value.toJSON(),E.show=!0},M=()=>{S("getJson",{background:s.value.options.background,grid:s.value.options.grid,data:s.value.toJSON()})},T=async()=>{if(!e.id){s.value.drawBackground(km),s.value.drawGrid(Dm),s.value.fromJSON({cells:[]});return}const{background:D,grid:N,data:V}=await _m(e.id);s.value.drawBackground(D),s.value.drawGrid(N),s.value.fromJSON(V),p()},k=c.shallowRef(null),_=()=>{new ResizeObserver(()=>{p()}).observe(k.value)};return c.onMounted(()=>{a(),u(),T(),_()}),(D,N)=>{const V=c.resolveComponent("el-icon"),A=c.resolveComponent("el-button"),P=c.resolveComponent("el-dropdown-item"),L=c.resolveComponent("el-dropdown-menu"),j=c.resolveComponent("el-dropdown"),Y=c.resolveComponent("el-scrollbar"),ot=c.resolveComponent("el-dialog"),F=c.resolveComponent("el-drawer");return c.openBlock(),c.createElementBlock("div",Pj,[c.createElementVNode("div",Aj,[c.createElementVNode("div",Tj,[c.createVNode(j,{onCommand:h},{dropdown:c.withCtx(()=>[c.createVNode(L,null,{default:c.withCtx(()=>[c.createVNode(P,{command:"snapLine"},{default:c.withCtx(()=>N[4]||(N[4]=[c.createTextVNode("对齐线")])),_:1}),c.createVNode(P,{command:"select"},{default:c.withCtx(()=>N[5]||(N[5]=[c.createTextVNode("框选")])),_:1}),c.createVNode(P,{command:"drawLine"},{default:c.withCtx(()=>N[6]||(N[6]=[c.createTextVNode("绘制直线")])),_:1}),c.createVNode(P,{command:"adaptive"},{default:c.withCtx(()=>N[7]||(N[7]=[c.createTextVNode("视图自适应")])),_:1}),c.createVNode(P,{command:"shortcuts"},{default:c.withCtx(()=>N[8]||(N[8]=[c.createTextVNode("查看快捷键")])),_:1}),c.createVNode(P,{command:"image"},{default:c.withCtx(()=>N[9]||(N[9]=[c.createTextVNode("图片管理")])),_:1}),c.createVNode(P,{command:"clear"},{default:c.withCtx(()=>N[10]||(N[10]=[c.createTextVNode("清空画布")])),_:1}),c.createVNode(P,{command:"export"},{default:c.withCtx(()=>N[11]||(N[11]=[c.createTextVNode("导出成图片")])),_:1})]),_:1})]),default:c.withCtx(()=>[c.createElementVNode("span",Nj,[c.createVNode(A,{size:"small",text:""},{default:c.withCtx(()=>[N[3]||(N[3]=c.createTextVNode("工具 ")),c.createVNode(V,null,{default:c.withCtx(()=>[c.createVNode(c.unref(B2))]),_:1})]),_:1})])]),_:1})]),c.createElementVNode("div",_j,[c.createVNode(c.unref(Ip),{content:"预览",placement:"bottom"},{default:c.withCtx(()=>[c.createVNode(A,{size:"small",icon:c.unref(Sg),onClick:C},null,8,["icon"])]),_:1}),c.createVNode(c.unref(Ip),{content:"保存",placement:"bottom"},{default:c.withCtx(()=>[c.createVNode(A,{size:"small",icon:c.unref(Y2),onClick:M},null,8,["icon"])]),_:1})])]),c.createElementVNode("div",kj,[N[12]||(N[12]=c.createElementVNode("div",{id:"stencil"},null,-1)),c.createElementVNode("div",Dj,[c.createElementVNode("div",{id:"drawing-board",ref_key:"drawBoard",ref:k},null,512)]),c.createElementVNode("div",Rj,[r.label?(c.openBlock(),c.createElementBlock("div",Ij,c.toDisplayString(r.label),1)):c.createCommentVNode("",!0),c.createVNode(Y,null,{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(r.component),{graph:s.value,payload:o.value,key:i.value},null,8,["graph","payload"]))]),_:1})])]),c.createVNode(ot,{modelValue:m.show,"onUpdate:modelValue":N[0]||(N[0]=H=>m.show=H),width:"400px",title:"快捷键","close-on-click-modal":!1,"close-on-press-escape":!1},{default:c.withCtx(()=>[c.createVNode(JD)]),_:1},8,["modelValue"]),c.createVNode(ot,{modelValue:b.show,"onUpdate:modelValue":N[1]||(N[1]=H=>b.show=H),width:"800px",title:"图片管理","close-on-click-modal":!1,"close-on-press-escape":!1},{default:c.withCtx(()=>[c.createVNode(Mj)]),_:1},8,["modelValue"]),c.createVNode(F,{class:"no-border-drawer",modelValue:E.show,"onUpdate:modelValue":N[2]||(N[2]=H=>E.show=H),title:"预览",direction:"ttb",size:"100%"},{default:c.withCtx(()=>[c.createElementVNode("div",Lj,[E.show?(c.openBlock(),c.createBlock(dh,{key:0,background:E.background,grid:E.grid,data:E.data},null,8,["background","grid","data"])):c.createCommentVNode("",!0)])]),_:1},8,["modelValue"])])}}}),[["__scopeId","data-v-74192f25"]]),Bj=[qb,dh],Jb=(n,t)=>{Bj.forEach(e=>{n.component(e.name,e)})};typeof window<"u"&&window.Vue&&Jb(window.Vue);const Vj={install:Jb};Rt.WiringDiagramEditor=qb,Rt.WiringDiagramPreview=dh,Rt.default=Vj,Rt.setBaseURL=_D,Rt.setToken=kD,Object.defineProperties(Rt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -79,9 +79,9 @@ const imageUrl = ref('')
|
|
|
79
79
|
* @param file
|
|
80
80
|
*/
|
|
81
81
|
const changeImage = (file) => {
|
|
82
|
-
if (file.raw.type
|
|
83
|
-
ElMessage.error('
|
|
84
|
-
return
|
|
82
|
+
if (file.raw.type.indexOf('image') === -1) {
|
|
83
|
+
ElMessage.error('请上传图片格式的文件')
|
|
84
|
+
return
|
|
85
85
|
}
|
|
86
86
|
const formData = new FormData();
|
|
87
87
|
formData.append('file', file.raw);
|