11 lines
14 KiB
JavaScript
11 lines
14 KiB
JavaScript
import"./index.755e9586.js";import{_ as K}from"./main.0fecd54d.js";import{aa as J,ae as X,y as I,N as z,W as Q,r as b,o as y,b as D,e as $,a as A,w,c as k,k as N,F as B,m as P,t as V,d as H}from"./vendor.160e93e4.js";import{a as ee}from"./index.3d03ec9c.js";function te(e,t={}){t.filter=t.filter||(()=>!0);function f(){return c()||E()||o()||p()}function l(){return m(/\s*/),c(!0)||o()||F()||d(!1)}function x(){const i=v(),n=[];let a,g=l();for(;g;){if(g.node.type==="Element"){if(a)throw new Error("Found multiple root nodes");a=g.node}g.excluded||n.push(g.node),g=l()}if(!a)throw new Error("Failed to parse XML");return{declaration:i?i.node:null,root:a,children:n}}function v(){return d(!0)}function d(i){const n=m(i?/^<\?(xml)\s*/:/^<\?([\w-:.]+)\s*/);if(!n)return;const a={name:n[1],type:"ProcessingInstruction",attributes:{}};for(;!(_()||h("?>"));){const g=s();if(!g)return a;a.attributes[g.name]=g.value}return m(/\?>/),{excluded:i?!1:t.filter(a)===!1,node:a}}function c(i){const n=m(/^<([\w-:.]+)\s*/);if(!n)return;const a={type:"Element",name:n[1],attributes:{},children:[]};for(;!(_()||h(">")||h("?>")||h("/>"));){const R=s();if(!R)return a;a.attributes[R.name]=R.value}const g=i?!1:t.filter(a)===!1;if(m(/^\s*\/>/))return a.children=null,{excluded:g,node:a};if(m(/\??>/),!g){let R=f();for(;R;)R.excluded||a.children.push(R.node),R=f()}return m(/^<\/[\w-:.]+>/),{excluded:g,node:a}}function F(){const i=m(/^<!DOCTYPE\s+[^>]*>/);if(i){const n={type:"DocumentType",content:i[0]};return{excluded:t.filter(n)===!1,node:n}}}function p(){if(e.startsWith("<![CDATA[")){const i=e.indexOf("]]>");if(i>-1){const n=i+3,a={type:"CDATA",content:e.substring(0,n)};return e=e.slice(n),{excluded:t.filter(a)===!1,node:a}}}}function o(){const i=m(/^<!--[\s\S]*?-->/);if(i){const n={type:"Comment",content:i[0]};return{excluded:t.filter(n)===!1,node:n}}}function E(){const i=m(/^([^<]+)/);if(i){const n={type:"Text",content:i[1]};return{excluded:t.filter(n)===!1,node:n}}}function s(){const i=m(/([\w-:.]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!!i)return{name:i[1],value:r(i[2])}}function r(i){return i.replace(/^['"]|['"]$/g,"")}function m(i){const n=e.match(i);if(!!n)return e=e.slice(n[0].length),n}function _(){return e.length===0}function h(i){return e.indexOf(i)===0}return e=e.trim(),x()}var ne=te;function j(e){if(!e.options.indentation&&!e.options.lineSeparator)return;e.content+=e.options.lineSeparator;let t;for(t=0;t<e.level;t++)e.content+=e.options.indentation}function S(e,t){e.content+=t}function W(e,t,f){if(typeof e.content=="string")ae(e,t,f);else if(e.type==="Element")le(e,t,f);else if(e.type==="ProcessingInstruction")G(e,t);else throw new Error("Unknown node type: "+e.type)}function ae(e,t,f){f||(e.content=e.content.trim()),e.content.length>0&&(!f&&t.content.length>0&&j(t),S(t,e.content))}function le(e,t,f){if(!f&&t.content.length>0&&j(t),S(t,"<"+e.name),Y(t,e.attributes),e.children===null){const l=t.options.whiteSpaceAtEndOfSelfclosingTag?" />":"/>";S(t,l)}else if(e.children.length===0)S(t,"></"+e.name+">");else{S(t,">"),t.level++;let l=e.attributes["xml:space"]==="preserve";if(!l&&t.options.collapseContent){let x=!1,v=!1,d=!1;e.children.forEach(function(c,F){c.type==="Text"?(c.content.includes(`
|
|
`)?(v=!0,c.content=c.content.trim()):(F===0||F===e.children.length-1)&&c.content.trim().length===0&&(c.content=""),c.content.length>0&&(x=!0)):d=!0}),x&&(!d||!v)&&(l=!0)}e.children.forEach(function(x){W(x,t,f||l,t.options)}),t.level--,!f&&!l&&j(t),S(t,"</"+e.name+">")}}function Y(e,t){Object.keys(t).forEach(function(f){const l=t[f].replace(/"/g,""");S(e," "+f+'="'+l+'"')})}function G(e,t){t.content.length>0&&j(t),S(t,"<?"+e.name),Y(t,e.attributes),S(t,"?>")}function re(e,t={}){t.indentation="indentation"in t?t.indentation:" ",t.collapseContent=t.collapseContent===!0,t.lineSeparator="lineSeparator"in t?t.lineSeparator:`\r
|
|
`,t.whiteSpaceAtEndOfSelfclosingTag=!!t.whiteSpaceAtEndOfSelfclosingTag;const l=ne(e,{filter:t.filter}),x={content:"",level:0,options:t};return l.declaration&&G(l.declaration,x),l.children.forEach(function(v){W(v,x,!1)}),x.content.replace(/\r\n/g,`
|
|
`).replace(/\n/g,t.lineSeparator)}var Re=re;const ue={props:{paramList:{type:Array,required:!0},showType:{type:Boolean}},components:{CloseOutlined:J,UploadOutlined:X},emits:["update:selected"],setup(e,{attrs:t,slots:f,emit:l,expose:x}){let v=I([]),d=1e4,c=I([]);z(()=>e.paramList,()=>{F()}),Q(()=>{F()});const F=()=>{c.value=e.paramList,(c.value.length<=0||!c.value[c.value.length-1].isLastRow)&&e.paramList.push({name:"",value:void 0,type:"integer",key:++d,isLastRow:!0}),c.value.forEach(u=>{u.value=u.value||u.example||void 0,(u.enum&&u.type==="array"||u.type==="file"||u.subType==="MultipartFile")&&(u.value=[]),v.value.push(u.key)})},p=(u,C)=>{v.value=u},o=u=>{u.isLastRow&&(u.isLastRow=!1,e.paramList.push({name:"",value:void 0,type:"integer",key:++d,isLastRow:!0}),v.value.push(d))},E=u=>{if(!u.isLastRow){let C=e.paramList.findIndex(T=>T===u);e.paramList.splice(C,1)}};let s=I([]);s.value.push({title:"\u53C2\u6570\u540D",dataIndex:"name",width:250}),e.showType,s.value.push({title:"\u53C2\u6570\u503C",dataIndex:"value"}),s.value.push({title:"",dataIndex:"action",width:40});const r=(u,C)=>(C.type!=="array"||!(C.value instanceof Array)||C.value.length<=0?C.value=[u]:C.value=[...C.value,u],!1),m=(u,C)=>{C.value=C.value.filter(T=>T!==u)},_=u=>u.type==="file"||u.subType==="file"||u.subType==="MultipartFile";let h=I(!1),i=I("");const n=()=>{h.value=!0,i.value=c.value.filter(u=>u.name||u.value).map(u=>_(u)?(u.name||"")+":":(u.name||"")+":"+(u.value||"")).join(`
|
|
`)},a=()=>{g(),h.value=!1},g=()=>{if(!h.value)return;let u={};e.paramList.forEach(L=>u[L.name]=L);let C=i.value.split(`
|
|
`),T=[];C.forEach(L=>{if(!L)return;let O=L.indexOf(":");if(O>=0){let U=L.substring(0,O),q=L.substring(O+1);if(U||q){let M=u[U]||{name:U,value:q,type:"integer",key:++d};M.value=q,T.push(M)}}else{let U=u[L]||{name:L,value:void 0,type:"integer",key:++d};T.push(U)}}),T.push({name:"",value:void 0,type:"integer",key:++d,isLastRow:!0}),v.value=[],e.paramList.splice(0,e.paramList.length),T.forEach(L=>{e.paramList.push(L),v.value.push(L.key)})};return{paramListRef:c,queryParamSelectedRowKeys:v,queryParamRowSelectionChange:p,queryParamChange:o,queryParamRemove:E,beforeUpload:r,handleRemove:m,paramListColumns:s,isFileType:_,getSelectedRowKeys:()=>(g(),v.value),multilineEdit:h,multilineEditValue:i,toMultilineEdit:n,toKeyValueEdit:a,convertKeyValueEdit:g}}},ie={key:0},oe={style:{"text-align":"right"}},se=P("\u8868\u5355\u7F16\u8F91"),ce={key:1},fe=P("\u591A\u884C\u7F16\u8F91"),pe=P("Integer"),de=P("String"),me=P("File"),he=P("Integer"),ve=P("String"),ye=P("TRUE"),ge=P("FALSE"),xe=P("\u9009\u62E9\u6587\u4EF6");function _e(e,t,f,l,x,v){const d=b("a-button"),c=b("a-textarea"),F=b("a-input"),p=b("a-select-option"),o=b("a-select"),E=b("a-tag"),s=b("upload-outlined"),r=b("a-upload"),m=b("CloseOutlined"),_=b("a-table");return l.multilineEdit?(y(),D("div",ie,[$("div",oe,[A(d,{onClick:l.toKeyValueEdit,type:"link"},{default:w(()=>[se]),_:1},8,["onClick"])]),A(c,{value:l.multilineEditValue,"onUpdate:value":t[0]||(t[0]=h=>l.multilineEditValue=h),"auto-size":{minRows:14,maxRows:14}},null,8,["value"])])):(y(),D("div",ce,[A(_,{"row-selection":{selectedRowKeys:l.queryParamSelectedRowKeys,onChange:l.queryParamRowSelectionChange},dataSource:l.paramListRef,columns:l.paramListColumns,size:"small",pagination:!1,scroll:{y:"300px"}},{headerCell:w(({column:h})=>[h.dataIndex==="action"?(y(),k(d,{key:0,onClick:l.toMultilineEdit,type:"link",style:{"margin-left":"-50px"}},{default:w(()=>[fe]),_:1},8,["onClick"])):N("",!0)]),bodyCell:w(({column:h,text:i,record:n})=>[h.dataIndex==="name"?(y(),k(F,{key:0,placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570\u540D",value:n.name,"onUpdate:value":a=>n.name=a,onChange:a=>l.queryParamChange(n)},null,8,["value","onUpdate:value","onChange"])):N("",!0),h.dataIndex==="type"?(y(),D(B,{key:1},[n.key>=1e4?(y(),k(o,{key:0,value:n.type,"onUpdate:value":a=>n.type=a},{default:w(()=>[A(p,{value:"integer"},{default:w(()=>[pe]),_:1}),A(p,{value:"string"},{default:w(()=>[de]),_:1}),A(p,{value:"file"},{default:w(()=>[me]),_:1})]),_:2},1032,["value","onUpdate:value"])):i==="integer"?(y(),k(E,{key:1,color:"pink"},{default:w(()=>[he]),_:1})):i==="string"?(y(),k(E,{key:2,color:"red"},{default:w(()=>[ve]),_:1})):(y(),k(E,{key:3,color:"green"},{default:w(()=>[P(V(i||"-"),1)]),_:2},1024))],64)):N("",!0),h.dataIndex==="value"?(y(),D(B,{key:2},[n.enum&&n.type==="array"?(y(),k(o,{key:0,value:n.value,"onUpdate:value":a=>n.value=a,mode:"multiple",placeholder:n.description||"\u8BF7\u9009\u62E9\u679A\u4E3E\u503C",style:{width:"100%"}},{default:w(()=>[(y(!0),D(B,null,H(n.enum,a=>(y(),k(p,{value:a},{default:w(()=>[P(V(a),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["value","onUpdate:value","placeholder"])):n.enum?(y(),k(o,{key:1,value:n.value,"onUpdate:value":a=>n.value=a,placeholder:n.description||"\u8BF7\u9009\u62E9\u679A\u4E3E\u503C",style:{width:"100%"}},{default:w(()=>[(y(!0),D(B,null,H(n.enum,a=>(y(),k(p,{value:a},{default:w(()=>[P(V(a),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["value","onUpdate:value","placeholder"])):n.type==="boolean"?(y(),k(o,{key:2,value:n.value,"onUpdate:value":a=>n.value=a,placeholder:n.description||"\u8BF7\u9009\u62E9\u53C2\u6570\u503C",style:{width:"100%"}},{default:w(()=>[A(p,{value:"true"},{default:w(()=>[ye]),_:1}),A(p,{value:"false"},{default:w(()=>[ge]),_:1})]),_:2},1032,["value","onUpdate:value","placeholder"])):l.isFileType(n)?(y(),k(r,{key:3,"file-list":n.value,name:"file",multiple:n.type==="array","before-upload":a=>l.beforeUpload(a,n),remove:a=>l.handleRemove(a,n)},{default:w(()=>[A(d,null,{default:w(()=>[A(s),xe]),_:1})]),_:2},1032,["file-list","multiple","before-upload","remove"])):(y(),k(F,{key:4,placeholder:n.description||"\u8BF7\u8F93\u5165\u53C2\u6570\u503C",value:n.value,"onUpdate:value":a=>n.value=a,onChange:a=>l.queryParamChange(n)},null,8,["placeholder","value","onUpdate:value","onChange"]))],64)):N("",!0),h.dataIndex==="action"?(y(),D(B,{key:3},[n.isLastRow?N("",!0):(y(),k(m,{key:0,onClick:a=>l.queryParamRemove(n),style:{cursor:"pointer"}},null,8,["onClick"]))],64)):N("",!0)]),_:1},8,["row-selection","dataSource","columns"])]))}var Te=K(ue,[["render",_e]]),Z={exports:{}};(function(e){var t="a-zA-Z_\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FFF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",f="-.0-9\xB7\u0300-\u036F\u203F\u2040",l=new RegExp("^([^"+t+"])|^((x|X)(m|M)(l|L))|([^"+t+f+"])","g"),x=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,v=function(p,o){var E=function(s,r,m,_,h){var i=o.indent!==void 0?o.indent:" ",n=o.prettyPrint?`
|
|
`+new Array(_).join(i):"";o.removeIllegalNameCharacters&&(s=s.replace(l,"_"));var a=[n,"<",s,m||""];return r&&r.length>0||o.html?(a.push(">"),a.push(r),h&&a.push(n),a.push("</"),a.push(s),a.push(">")):a.push("/>"),a.join("")};return function s(r,m,_){var h=typeof r;switch((Array.isArray?Array.isArray(r):r instanceof Array)?h="array":r instanceof Date&&(h="date"),h){case"array":var i=[];return r.map(function(L){i.push(s(L,1,_+1))}),o.prettyPrint&&i.push(`
|
|
`),i.join("");case"date":return r.toJSON?r.toJSON():r+"";case"object":if(m==1&&r.name){var n=[],a=[];if(r.attrs)if(typeof r.attrs!="object")a.push(" "),a.push(r.attrs);else for(var g in r.attrs){var R=r.attrs[g];a.push(" "),a.push(g),a.push('="'),a.push(o.escape?c(R):R),a.push('"')}if(typeof r.value!="undefined"){var u=""+r.value;n.push(o.escape&&!r.noescape?c(u):u)}else if(typeof r.text!="undefined"){var u=""+r.text;n.push(o.escape&&!r.noescape?c(u):u)}return r.children&&n.push(s(r.children,0,_+1)),E(r.name,n.join(""),a.join(""),_,!!r.children)}else{var C=[];for(var T in r)C.push(E(T,s(r[T],0,_+1),null,_+1));return o.prettyPrint&&C.length>0&&C.push(`
|
|
`),C.join("")}case"function":return r();default:return o.escape?c(r):""+r}}(p,0,0)},d=function(p){var o=['<?xml version="1.0" encoding="utf-8"'];return p&&o.push(' standalone="yes"'),o.push("?>"),o.join("")};e.exports=function(p,o){var E=typeof Buffer!="undefined"?Buffer:function(){};if(typeof p=="string"||p instanceof E)try{p=JSON.parse(p.toString())}catch{return!1}var s="",r="";o&&(typeof o=="object"?(o.xmlHeader&&(s=d(!!o.xmlHeader.standalone)),typeof o.docType!="undefined"&&(r="<!DOCTYPE "+o.docType+">")):s=d()),o=o||{};var m=[s,o.prettyPrint&&r?`
|
|
`:"",r,v(p,o)];return m.join("")},e.exports.json_to_xml=e.exports.obj_to_xml=e.exports,e.exports.escape=c;function c(p){return(""+p).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(x,"")}e.exports.cdata=F;function F(p){return p?"<![CDATA["+p.replace(/]]>/g,"")+"]]>":"<![CDATA[]]>"}})(Z);var we=Z.exports;const Ce={props:{paramList:{type:Array,required:!0},rowLang:{type:String,required:!0}},components:{CloseOutlined:J,UploadOutlined:X,aceEditor:ee},emits:[],setup(e,{attrs:t,slots:f,emit:l,expose:x}){let v=e.paramList,d="",c=s=>{if(s.children){let m={};return s.children.forEach(_=>m[_.name]=c(_)),s.type==="array"?[m]:m}let r=s.example||"";return s.type==="array"?r?[r]:[]:r};v.length===1?d=c(v[0]):v.length>1&&v.forEach(s=>{d[s.name]=c(s)});let F=I("");d&&(e.rowLang==="json"?F.value=JSON.stringify(d,null,4):e.rowLang==="xml"&&(F.value=we(d,{html:!0,prettyPrint:!0,xmlHeader:!0})));const p=()=>F.value;let o=I();return{getParam:p,rowParamInit:s=>{o.value=s,o.value.setFontSize(16)},bodyRowParam:F,rowParamConfig:{wrap:!0,autoScrollEditorIntoView:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,minLines:18,maxLines:18}}}};function Fe(e,t,f,l,x,v){const d=b("ace-editor");return y(),k(d,{value:l.bodyRowParam,"onUpdate:value":t[0]||(t[0]=c=>l.bodyRowParam=c),onInit:l.rowParamInit,lang:f.rowLang,theme:"monokai",width:"100%",height:"100",options:l.rowParamConfig},null,8,["value","onInit","lang","options"])}var be=K(Ce,[["render",Fe]]),Ae={formatSeconds(e){let t=parseInt(e),f=t/1e3,l=Math.floor(f%60),x=t%1e3;return l>0?`${l}.${x} s`:`${x} ms`},formatFileSize(e){if(!e)return"0 B";let t="";e<.1*1024?t=e.toFixed(2)+" B":e<.1*1024*1024?t=(e/1024).toFixed(2)+" KB":e<.1*1024*1024*1024?t=(e/(1024*1024)).toFixed(2)+" MB":t=(e/(1024*1024*1024)).toFixed(2)+" GB";let f=t+"",l=f.indexOf(".");return f.substr(l+1,2)=="00"?f.substring(0,l)+f.substr(l+3,2):t}};export{Te as P,be as a,Ae as u,Re as x};
|