mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2026-01-20 16:53:37 +08:00
4 lines
26 KiB
JavaScript
4 lines
26 KiB
JavaScript
import{P as ge,n as me,a as be,r as we,x as Ne,d as ke,g as Ce,j as xe,p as je,F as Oe}from"./index-BXySHhHT.js";var Se={207:(e,r,o)=>{e.exports=o(452)},452:e=>{var r=(function(o){var c,P=Object.prototype,C=P.hasOwnProperty,I=typeof Symbol=="function"?Symbol:{},p=I.iterator||"@@iterator",j=I.asyncIterator||"@@asyncIterator",N=I.toStringTag||"@@toStringTag";function S(t,n,l){return Object.defineProperty(t,n,{value:l,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{S({},"")}catch(t){S=function(n,l,h){return n[l]=h}}function B(t,n,l,h){var u=n&&n.prototype instanceof K?n:K,g=Object.create(u.prototype),w=new s(h||[]);return g._invoke=(function(x,L,d){var k=Q;return function(E,J){if(k===M)throw new Error("Generator is already running");if(k===V){if(E==="throw")throw J;return y()}for(d.method=E,d.arg=J;;){var Z=d.delegate;if(Z){var ee=q(Z,d);if(ee){if(ee===O)continue;return ee}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(k===Q)throw k=V,d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);k=M;var W=_(x,L,d);if(W.type==="normal"){if(k=d.done?V:Y,W.arg===O)continue;return{value:W.arg,done:d.done}}W.type==="throw"&&(k=V,d.method="throw",d.arg=W.arg)}}})(t,l,w),g}function _(t,n,l){try{return{type:"normal",arg:t.call(n,l)}}catch(h){return{type:"throw",arg:h}}}o.wrap=B;var Q="suspendedStart",Y="suspendedYield",M="executing",V="completed",O={};function K(){}function R(){}function H(){}var z={};S(z,p,(function(){return this}));var b=Object.getPrototypeOf,v=b&&b(b(f([])));v&&v!==P&&C.call(v,p)&&(z=v);var m=H.prototype=K.prototype=Object.create(z);function F(t){["next","throw","return"].forEach((function(n){S(t,n,(function(l){return this._invoke(n,l)}))}))}function T(t,n){function l(u,g,w,x){var L=_(t[u],t,g);if(L.type!=="throw"){var d=L.arg,k=d.value;return k&&typeof k=="object"&&C.call(k,"__await")?n.resolve(k.__await).then((function(E){l("next",E,w,x)}),(function(E){l("throw",E,w,x)})):n.resolve(k).then((function(E){d.value=E,w(d)}),(function(E){return l("throw",E,w,x)}))}x(L.arg)}var h;this._invoke=function(u,g){function w(){return new n((function(x,L){l(u,g,x,L)}))}return h=h?h.then(w,w):w()}}function q(t,n){var l=t.iterator[n.method];if(l===c){if(n.delegate=null,n.method==="throw"){if(t.iterator.return&&(n.method="return",n.arg=c,q(t,n),n.method==="throw"))return O;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return O}var h=_(l,t.iterator,n.arg);if(h.type==="throw")return n.method="throw",n.arg=h.arg,n.delegate=null,O;var u=h.arg;return u?u.done?(n[t.resultName]=u.value,n.next=t.nextLoc,n.method!=="return"&&(n.method="next",n.arg=c),n.delegate=null,O):u:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,O)}function A(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function a(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function s(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function f(t){if(t){var n=t[p];if(n)return n.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var l=-1,h=function u(){for(;++l<t.length;)if(C.call(t,l))return u.value=t[l],u.done=!1,u;return u.value=c,u.done=!0,u};return h.next=h}}return{next:y}}function y(){return{value:c,done:!0}}return R.prototype=H,S(m,"constructor",H),S(H,"constructor",R),R.displayName=S(H,N,"GeneratorFunction"),o.isGeneratorFunction=function(t){var n=typeof t=="function"&&t.constructor;return!!n&&(n===R||(n.displayName||n.name)==="GeneratorFunction")},o.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,H):(t.__proto__=H,S(t,N,"GeneratorFunction")),t.prototype=Object.create(m),t},o.awrap=function(t){return{__await:t}},F(T.prototype),S(T.prototype,j,(function(){return this})),o.AsyncIterator=T,o.async=function(t,n,l,h,u){u===void 0&&(u=Promise);var g=new T(B(t,n,l,h),u);return o.isGeneratorFunction(n)?g:g.next().then((function(w){return w.done?w.value:g.next()}))},F(m),S(m,N,"Generator"),S(m,p,(function(){return this})),S(m,"toString",(function(){return"[object Generator]"})),o.keys=function(t){var n=[];for(var l in t)n.push(l);return n.reverse(),function h(){for(;n.length;){var u=n.pop();if(u in t)return h.value=u,h.done=!1,h}return h.done=!0,h}},o.values=f,s.prototype={constructor:s,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(a),!t)for(var n in this)n.charAt(0)==="t"&&C.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function l(L,d){return g.type="throw",g.arg=t,n.next=L,d&&(n.method="next",n.arg=c),!!d}for(var h=this.tryEntries.length-1;h>=0;--h){var u=this.tryEntries[h],g=u.completion;if(u.tryLoc==="root")return l("end");if(u.tryLoc<=this.prev){var w=C.call(u,"catchLoc"),x=C.call(u,"finallyLoc");if(w&&x){if(this.prev<u.catchLoc)return l(u.catchLoc,!0);if(this.prev<u.finallyLoc)return l(u.finallyLoc)}else if(w){if(this.prev<u.catchLoc)return l(u.catchLoc,!0)}else{if(!x)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return l(u.finallyLoc)}}}},abrupt:function(t,n){for(var l=this.tryEntries.length-1;l>=0;--l){var h=this.tryEntries[l];if(h.tryLoc<=this.prev&&C.call(h,"finallyLoc")&&this.prev<h.finallyLoc){var u=h;break}}u&&(t==="break"||t==="continue")&&u.tryLoc<=n&&n<=u.finallyLoc&&(u=null);var g=u?u.completion:{};return g.type=t,g.arg=n,u?(this.method="next",this.next=u.finallyLoc,O):this.complete(g)},complete:function(t,n){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&n&&(this.next=n),O},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.finallyLoc===t)return this.complete(l.completion,l.afterLoc),a(l),O}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.tryLoc===t){var h=l.completion;if(h.type==="throw"){var u=h.arg;a(l)}return u}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,l){return this.delegate={iterator:f(t),resultName:n,nextLoc:l},this.method==="next"&&(this.arg=c),O}},o})(e.exports);try{regeneratorRuntime=r}catch(o){typeof globalThis=="object"?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}},ae={};function G(e){var r=ae[e];if(r!==void 0)return r.exports;var o=ae[e]={exports:{}};return Se[e](o,o.exports,G),o.exports}G.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return G.d(r,{a:r}),r},G.d=(e,r)=>{for(var o in r)G.o(r,o)&&!G.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},G.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var fe={};function ne(e,r){(r==null||r>e.length)&&(r=e.length);for(var o=0,c=new Array(r);o<r;o++)c[o]=e[o];return c}function pe(e,r){if(e){if(typeof e=="string")return ne(e,r);var o=Object.prototype.toString.call(e).slice(8,-1);return o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set"?Array.from(e):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?ne(e,r):void 0}}function X(e){return(function(r){if(Array.isArray(r))return ne(r)})(e)||(function(r){if(typeof Symbol!="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)})(e)||pe(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function U(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}G.d(fe,{A:()=>Ae});const i=(ie={Fragment:()=>Oe,computed:()=>je,createTextVNode:()=>xe,createVNode:()=>Ce,defineComponent:()=>ke,nextTick:()=>Ne,reactive:()=>we,ref:()=>be,watch:()=>me,watchEffect:()=>ge},te={},G.d(te,ie),te),Ve=(0,i.defineComponent)({props:{data:{required:!0,type:String},onClick:Function},render:function(){var e=this.data,r=this.onClick;return(0,i.createVNode)("span",{class:"vjs-tree-brackets",onClick:r},[e])}}),Le=(0,i.defineComponent)({emits:["change","update:modelValue"],props:{checked:{type:Boolean,default:!1},isMultiple:Boolean,onChange:Function},setup:function(e,r){var o=r.emit;return{uiType:(0,i.computed)((function(){return e.isMultiple?"checkbox":"radio"})),model:(0,i.computed)({get:function(){return e.checked},set:function(c){return o("update:modelValue",c)}})}},render:function(){var e=this.uiType,r=this.model,o=this.$emit;return(0,i.createVNode)("label",{class:["vjs-check-controller",r?"is-checked":""],onClick:function(c){return c.stopPropagation()}},[(0,i.createVNode)("span",{class:"vjs-check-controller-inner is-".concat(e)},null),(0,i.createVNode)("input",{checked:r,class:"vjs-check-controller-original is-".concat(e),type:e,onChange:function(){return o("change",r)}},null)])}}),Pe=(0,i.defineComponent)({props:{nodeType:{required:!0,type:String},onClick:Function},render:function(){var e=this.nodeType,r=this.onClick,o=e==="objectStart"||e==="arrayStart";return o||e==="objectCollapsed"||e==="arrayCollapsed"?(0,i.createVNode)("span",{class:"vjs-carets vjs-carets-".concat(o?"open":"close"),onClick:r},[(0,i.createVNode)("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},[(0,i.createVNode)("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"},null)])]):null}});var ie,te;function re(e){return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},re(e)}function ve(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function $(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"root",o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,c=(arguments.length>3?arguments[3]:void 0)||{},P=c.key,C=c.index,I=c.type,p=I===void 0?"content":I,j=c.showComma,N=j!==void 0&&j,S=c.length,B=S===void 0?1:S,_=ve(e);if(_==="array"){var Q=le(e.map((function(V,O,K){return $(V,"".concat(r,"[").concat(O,"]"),o+1,{index:O,showComma:O!==K.length-1,length:B,type:p})})));return[$("[",r,o,{showComma:!1,key:P,length:e.length,type:"arrayStart"})[0]].concat(Q,$("]",r,o,{showComma:N,length:e.length,type:"arrayEnd"})[0])}if(_==="object"){var Y=Object.keys(e),M=le(Y.map((function(V,O,K){return $(e[V],/^[a-zA-Z_]\w*$/.test(V)?"".concat(r,".").concat(V):"".concat(r,'["').concat(V,'"]'),o+1,{key:V,showComma:O!==K.length-1,length:B,type:p})})));return[$("{",r,o,{showComma:!1,key:P,index:C,length:Y.length,type:"objectStart"})[0]].concat(M,$("}",r,o,{showComma:N,length:Y.length,type:"objectEnd"})[0])}return[{content:e,level:o,key:P,index:C,path:r,showComma:N,length:B,type:p}]}function le(e){if(typeof Array.prototype.flat=="function")return e.flat();for(var r=X(e),o=[];r.length;){var c=r.shift();Array.isArray(c)?r.unshift.apply(r,X(c)):o.push(c)}return o}function oe(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new WeakMap;if(e==null)return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(re(e)!=="object")return e;if(r.get(e))return r.get(e);if(Array.isArray(e)){var o=e.map((function(C){return oe(C,r)}));return r.set(e,o),o}var c={};for(var P in e)c[P]=oe(e[P],r);return r.set(e,c),c}function ce(e,r,o,c,P,C,I){try{var p=e[C](I),j=p.value}catch(N){return void o(N)}p.done?r(j):Promise.resolve(j).then(c,P)}var Te=G(207),ue=G.n(Te);function se(e,r){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);r&&(c=c.filter((function(P){return Object.getOwnPropertyDescriptor(e,P).enumerable}))),o.push.apply(o,c)}return o}function de(e){for(var r=1;r<arguments.length;r++){var o=arguments[r]!=null?arguments[r]:{};r%2?se(Object(o),!0).forEach((function(c){U(e,c,o[c])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):se(Object(o)).forEach((function(c){Object.defineProperty(e,c,Object.getOwnPropertyDescriptor(o,c))}))}return e}var ye={data:{type:[String,Number,Boolean,Array,Object],default:null},rootPath:{type:String,default:"root"},indent:{type:Number,default:2},showLength:{type:Boolean,default:!1},showDoubleQuotes:{type:Boolean,default:!0},renderNodeKey:Function,renderNodeValue:Function,renderNodeActions:{type:[Boolean,Function],default:void 0},selectableType:String,showSelectController:{type:Boolean,default:!1},showLine:{type:Boolean,default:!0},showLineNumber:{type:Boolean,default:!1},selectOnClickNode:{type:Boolean,default:!0},nodeSelectable:{type:Function,default:function(){return!0}},highlightSelectedNode:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!1},theme:{type:String,default:"light"},showKeyValueSpace:{type:Boolean,default:!0},editable:{type:Boolean,default:!1},editableTrigger:{type:String,default:"click"},onNodeClick:{type:Function},onNodeMouseover:{type:Function},onBracketsClick:{type:Function},onIconClick:{type:Function},onValueChange:{type:Function}};const Ee=(0,i.defineComponent)({name:"TreeNode",props:de(de({},ye),{},{node:{type:Object,required:!0},collapsed:Boolean,checked:Boolean,style:Object,onSelectedChange:{type:Function}}),emits:["nodeClick","nodeMouseover","bracketsClick","iconClick","selectedChange","valueChange"],setup:function(e,r){var o=r.emit,c=(0,i.computed)((function(){return ve(e.node.content)})),P=(0,i.computed)((function(){return"vjs-value vjs-value-".concat(c.value)})),C=(0,i.computed)((function(){return e.showDoubleQuotes?'"'.concat(e.node.key,'"'):e.node.key})),I=(0,i.computed)((function(){return e.selectableType==="multiple"})),p=(0,i.computed)((function(){return e.selectableType==="single"})),j=(0,i.computed)((function(){return e.nodeSelectable(e.node)&&(I.value||p.value)})),N=(0,i.reactive)({editing:!1}),S=function(b){var v,m,F=(m=(v=b.target)===null||v===void 0?void 0:v.value)==="null"?null:m==="undefined"?void 0:m==="true"||m!=="false"&&(m[0]+m[m.length-1]==='""'||m[0]+m[m.length-1]==="''"?m.slice(1,-1):typeof Number(m)=="number"&&!isNaN(Number(m))||m==="NaN"?Number(m):m);o("valueChange",F,e.node.path)},B=(0,i.computed)((function(){var b,v=(b=e.node)===null||b===void 0?void 0:b.content;return v===null?v="null":v===void 0&&(v="undefined"),c.value==="string"?'"'.concat(v,'"'):v+""})),_=function(){var b=e.renderNodeValue;return b?b({node:e.node,defaultValue:B.value}):B.value},Q=function(){o("bracketsClick",!e.collapsed,e.node)},Y=function(){o("iconClick",!e.collapsed,e.node)},M=function(){o("selectedChange",e.node)},V=function(){o("nodeClick",e.node),j.value&&e.selectOnClickNode&&o("selectedChange",e.node)},O=function(){o("nodeMouseover",e.node)},K=function(b){if(e.editable&&!N.editing){N.editing=!0;var v=function m(F){var T;F.target!==b.target&&((T=F.target)===null||T===void 0?void 0:T.parentElement)!==b.target&&(N.editing=!1,document.removeEventListener("click",m))};document.removeEventListener("click",v),document.addEventListener("click",v)}},R=(function(){var b=(0,i.ref)(!1),v=(function(){var m,F=(m=ue().mark((function T(q){return ue().wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.prev=0,A.next=3,navigator.clipboard.writeText(q);case 3:b.value=!0,setTimeout((function(){b.value=!1}),300),A.next=10;break;case 7:A.prev=7,A.t0=A.catch(0),console.error("[vue-json-pretty] Copy failed: ",A.t0);case 10:case"end":return A.stop()}}),T,null,[[0,7]])})),function(){var T=this,q=arguments;return new Promise((function(A,a){var s=m.apply(T,q);function f(t){ce(s,A,a,f,y,"next",t)}function y(t){ce(s,A,a,f,y,"throw",t)}f(void 0)}))});return function(T){return F.apply(this,arguments)}})();return{copy:v}})().copy,H=function(){var b=e.node,v=b.key,m=b.path,F=e.rootPath,T=new Function("data","return data".concat(m.slice(F.length)))(e.data),q=JSON.stringify(v?U({},v,T):T,null,2);R(q)},z=function(){var b=e.renderNodeActions;if(!b)return null;var v={copy:H};return typeof b=="function"?b({node:e.node,defaultActions:v}):(0,i.createVNode)("span",{onClick:H,class:"vjs-tree-node-actions-item"},[(0,i.createTextVNode)("copy")])};return function(){var b,v=e.node;return(0,i.createVNode)("div",{class:{"vjs-tree-node":!0,"has-selector":e.showSelectController,"has-carets":e.showIcon,"is-highlight":e.highlightSelectedNode&&e.checked,dark:e.theme==="dark"},onClick:V,onMouseover:O,style:e.style},[e.showLineNumber&&(0,i.createVNode)("span",{class:"vjs-node-index"},[v.id+1]),e.showSelectController&&j.value&&v.type!=="objectEnd"&&v.type!=="arrayEnd"&&(0,i.createVNode)(Le,{isMultiple:I.value,checked:e.checked,onChange:M},null),(0,i.createVNode)("div",{class:"vjs-indent"},[Array.from(Array(v.level)).map((function(m,F){return(0,i.createVNode)("div",{key:F,class:{"vjs-indent-unit":!0,"has-line":e.showLine}},[Array.from(Array(e.indent)).map((function(){return(0,i.createVNode)(i.Fragment,null,[(0,i.createTextVNode)(" ")])}))])})),e.showIcon&&(0,i.createVNode)(Pe,{nodeType:v.type,onClick:Y},null)]),v.key&&(0,i.createVNode)("span",{class:"vjs-key"},[(b=e.renderNodeKey,b?b({node:e.node,defaultKey:C.value||""}):C.value),(0,i.createVNode)("span",{class:"vjs-colon"},[":".concat(e.showKeyValueSpace?" ":"")])]),(0,i.createVNode)("span",null,[v.type!=="content"&&v.content?(0,i.createVNode)(Ve,{data:v.content.toString(),onClick:Q},null):(0,i.createVNode)("span",{class:P.value,onClick:!e.editable||e.editableTrigger&&e.editableTrigger!=="click"?void 0:K,onDblclick:e.editable&&e.editableTrigger==="dblclick"?K:void 0},[e.editable&&N.editing?(0,i.createVNode)("input",{value:B.value,onChange:S,style:{padding:"3px 8px",border:"1px solid #eee",boxShadow:"none",boxSizing:"border-box",borderRadius:5,fontFamily:"inherit"}},null):_()]),v.showComma&&(0,i.createVNode)("span",null,[","]),e.showLength&&e.collapsed&&(0,i.createVNode)("span",{class:"vjs-comment"},[(0,i.createTextVNode)(" // "),v.length,(0,i.createTextVNode)(" items ")])]),e.renderNodeActions&&(0,i.createVNode)("span",{class:"vjs-tree-node-actions"},[z()])])}}});function he(e,r){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);r&&(c=c.filter((function(P){return Object.getOwnPropertyDescriptor(e,P).enumerable}))),o.push.apply(o,c)}return o}function D(e){for(var r=1;r<arguments.length;r++){var o=arguments[r]!=null?arguments[r]:{};r%2?he(Object(o),!0).forEach((function(c){U(e,c,o[c])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):he(Object(o)).forEach((function(c){Object.defineProperty(e,c,Object.getOwnPropertyDescriptor(o,c))}))}return e}const Ae=(0,i.defineComponent)({name:"Tree",props:D(D({},ye),{},{collapsedNodeLength:{type:Number,default:1/0},deep:{type:Number,default:1/0},pathCollapsible:{type:Function,default:function(){return!1}},virtual:{type:Boolean,default:!1},height:{type:Number,default:400},itemHeight:{type:Number,default:20},dynamicHeight:{type:Boolean,default:!0},selectedValue:{type:[String,Array],default:function(){return""}},collapsedOnClickBrackets:{type:Boolean,default:!0},style:Object,onSelectedChange:{type:Function},theme:{type:String,default:"light"}}),slots:["renderNodeKey","renderNodeValue","renderNodeActions"],emits:["nodeClick","nodeMouseover","bracketsClick","iconClick","selectedChange","update:selectedValue","update:data"],setup:function(e,r){var o=r.emit,c=r.slots,P=(0,i.ref)(),C=(0,i.computed)((function(){return $(e.data,e.rootPath)})),I=function(a,s){return C.value.reduce((function(f,y){var t,n=y.level>=a||y.length>=s,l=(t=e.pathCollapsible)===null||t===void 0?void 0:t.call(e,y);return y.type!=="objectStart"&&y.type!=="arrayStart"||!n&&!l?f:D(D({},f),{},U({},y.path,1))}),{})},p=(0,i.reactive)({translateY:0,visibleData:null,hiddenPaths:I(e.deep,e.collapsedNodeLength),startIndex:0,endIndex:0}),j=[],N=[],S=0,B={},_=function(a){j=Array(a).fill(0).map((function(){return e.itemHeight||20})),(N=new Array(a+1))[0]=0;for(var s=0;s<a;s++)N[s+1]=N[s]+j[s];S=N[a]||0},Q=function(a){var s=j.length;a<0&&(a=0),a>s&&(a=s);for(var f=a;f<s;f++)N[f+1]=N[f]+j[f];S=N[s]||0},Y=function(a,s){for(var f=0,y=a.length-1;f<y;){var t=f+y>>>1;a[t]<s?f=t+1:y=t}return f},M=(0,i.computed)((function(){for(var a=null,s=[],f=C.value.length,y=0;y<f;y++){var t=D(D({},C.value[y]),{},{id:y}),n=p.hiddenPaths[t.path];if(a&&a.path===t.path){var l=a.type==="objectStart",h=D(D(D({},t),a),{},{showComma:t.showComma,content:l?"{...}":"[...]",type:l?"objectCollapsed":"arrayCollapsed"});a=null,s.push(h)}else{if(n&&!a){a=t;continue}if(a)continue;s.push(t)}}return s})),V=(0,i.computed)((function(){var a=e.selectedValue;return a&&e.selectableType==="multiple"&&Array.isArray(a)?a:[a]})),O=(0,i.computed)((function(){return!e.selectableType||e.selectOnClickNode||e.showSelectController?"":"When selectableType is not null, selectOnClickNode and showSelectController cannot be false at the same time, because this will cause the selection to fail."})),K=(0,i.computed)((function(){return e.dynamicHeight?S||0:M.value.length*e.itemHeight})),R=function a(){var s=M.value;if(s)if(e.virtual){var f,y=((f=P.value)===null||f===void 0?void 0:f.scrollTop)||0;if(e.dynamicHeight){j.length!==s.length&&_(s.length);var t=(function(L){var d=Y(N,L+1e-4);return Math.max(0,Math.min(d-1,j.length-1))})(y),n=(function(L,d){var k=Y(N,L+d);return Math.max(0,Math.min(k+1,j.length))})(y,e.height),l=Math.max(0,t-5),h=Math.min(s.length,n+5);p.startIndex=l,p.endIndex=h,p.translateY=N[l]||0,p.visibleData=s.slice(l,h),(0,i.nextTick)().then((function(){for(var L=!1,d=p.startIndex;d<p.endIndex;d++){var k=B[d];if(k){var E=k.offsetHeight;E&&j[d]!==E&&(j[d]=E,N[d+1]=N[d]+j[d],Q(d+1),L=!0)}}L&&a()}))}else{var u=e.height/e.itemHeight,g=Math.floor(y/e.itemHeight),w=g<0?0:g+u>s.length?s.length-u:g;w<0&&(w=0);var x=w+u;p.translateY=w*e.itemHeight,p.startIndex=w,p.endIndex=x,p.visibleData=s.slice(w,x)}}else p.translateY=0,p.startIndex=0,p.endIndex=s.length,p.visibleData=s},H=null,z=function(){H&&cancelAnimationFrame(H),H=requestAnimationFrame((function(){R()}))},b=function(a){var s,f,y=a.path,t=e.selectableType;if(t==="multiple"){var n=V.value.findIndex((function(g){return g===y})),l=X(V.value);n!==-1?l.splice(n,1):l.push(y),o("update:selectedValue",l),o("selectedChange",l,X(V.value))}else if(t==="single"&&V.value[0]!==y){var h=(s=V.value,f=1,(function(g){if(Array.isArray(g))return g})(s)||(function(g,w){var x=g==null?null:typeof Symbol!="undefined"&&g[Symbol.iterator]||g["@@iterator"];if(x!=null){var L,d,k=[],E=!0,J=!1;try{for(x=x.call(g);!(E=(L=x.next()).done)&&(k.push(L.value),!w||k.length!==w);E=!0);}catch(Z){J=!0,d=Z}finally{try{E||x.return==null||x.return()}finally{if(J)throw d}}return k}})(s,f)||pe(s,f)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})())[0],u=y;o("update:selectedValue",u),o("selectedChange",u,h)}},v=function(a){o("nodeClick",a)},m=function(a){o("nodeMouseover",a)},F=function(a,s){if(a)p.hiddenPaths=D(D({},p.hiddenPaths),{},U({},s,1));else{var f=D({},p.hiddenPaths);delete f[s],p.hiddenPaths=f}},T=function(a,s){e.collapsedOnClickBrackets&&F(a,s.path),o("bracketsClick",a,s)},q=function(a,s){F(a,s.path),o("iconClick",a,s)},A=function(a,s){var f=oe(e.data),y=e.rootPath;new Function("data","val","data".concat(s.slice(y.length),"=val"))(f,a),o("update:data",f)};return(0,i.watchEffect)((function(){O.value&&(function(a){throw new Error("[VueJSONPretty] ".concat(a))})(O.value)})),(0,i.watchEffect)((function(){M.value&&(e.virtual&&e.dynamicHeight&&j.length!==M.value.length&&_(M.value.length),R())})),(0,i.watch)((function(){return[e.dynamicHeight,e.itemHeight,C.value.length]}),(function(){e.virtual&&e.dynamicHeight&&(_(M.value.length),(0,i.nextTick)(R))})),(0,i.watch)((function(){return e.deep}),(function(a){a&&(p.hiddenPaths=I(a,e.collapsedNodeLength))})),(0,i.watch)((function(){return e.collapsedNodeLength}),(function(a){a&&(p.hiddenPaths=I(e.deep,a))})),function(){var a,s,f,y,t,n=(a=e.renderNodeKey)!==null&&a!==void 0?a:c.renderNodeKey,l=(s=e.renderNodeValue)!==null&&s!==void 0?s:c.renderNodeValue,h=(f=(y=e.renderNodeActions)!==null&&y!==void 0?y:c.renderNodeActions)!==null&&f!==void 0&&f,u=(t=p.visibleData)===null||t===void 0?void 0:t.map((function(g,w){var x=p.startIndex+w;return(0,i.createVNode)("div",{key:g.id,ref:function(L){return(function(d,k){k?B[d]=k:delete B[d]})(x,L||null)}},[(0,i.createVNode)(Ee,{data:e.data,rootPath:e.rootPath,indent:e.indent,node:g,collapsed:!!p.hiddenPaths[g.path],theme:e.theme,showDoubleQuotes:e.showDoubleQuotes,showLength:e.showLength,checked:V.value.includes(g.path),selectableType:e.selectableType,showLine:e.showLine,showLineNumber:e.showLineNumber,showSelectController:e.showSelectController,selectOnClickNode:e.selectOnClickNode,nodeSelectable:e.nodeSelectable,highlightSelectedNode:e.highlightSelectedNode,editable:e.editable,editableTrigger:e.editableTrigger,showIcon:e.showIcon,showKeyValueSpace:e.showKeyValueSpace,renderNodeKey:n,renderNodeValue:l,renderNodeActions:h,onNodeClick:v,onNodeMouseover:m,onBracketsClick:T,onIconClick:q,onSelectedChange:b,onValueChange:A,class:e.dynamicHeight?"dynamic-height":void 0,style:e.dynamicHeight?{}:e.itemHeight&&e.itemHeight!==20?{lineHeight:"".concat(e.itemHeight,"px")}:{}},null)])}));return(0,i.createVNode)("div",{ref:P,class:{"vjs-tree":!0,"is-virtual":e.virtual,dark:e.theme==="dark"},onScroll:e.virtual?z:void 0,style:e.showLineNumber?D({paddingLeft:"".concat(12*Number(C.value.length.toString().length),"px")},e.style):e.style},[e.virtual?(0,i.createVNode)("div",{class:"vjs-tree-list",style:{height:"".concat(e.height,"px")}},[(0,i.createVNode)("div",{class:"vjs-tree-list-holder",style:{height:"".concat(K.value,"px")}},[(0,i.createVNode)("div",{class:"vjs-tree-list-holder-inner",style:{transform:"translateY(".concat(p.translateY,"px)")}},[u])])]):u])}}});var Ie=fe.A;export{Ie as P};
|