mower-ng/ui/dist/assets/manager.js
2024-11-25 11:58:42 +08:00

24 lines
7.6 KiB
JavaScript

import{N as X,an as Y,ar as R,as as G,ay as q,B as J,ax as Q,j as Z,aY as ee,bA as H,H as A,aF as te,bB as ne,F as E,bm as P,br as oe,r as z,s as re,bt as u,bC as w,bo as r,bD as F,bx as f,bu as k,bv as n,bw as e,k as ae,aX as le,b3 as se,by as S,bE as I,i as ie,b9 as ce,bz as ue}from"./_plugin-vue_export-helper.js";import{_ as de,a as _e}from"./Play.js";import{_ as pe}from"./TrashOutline.js";import{_ as me}from"./Input.js";import"./use-locale.js";let T=!1;function he(){if(X&&window.CSS&&!T&&(T=!0,"registerProperty"in(window==null?void 0:window.CSS)))try{CSS.registerProperty({name:"--n-color-start",syntax:"<color>",inherits:!1,initialValue:"#0000"}),CSS.registerProperty({name:"--n-color-end",syntax:"<color>",inherits:!1,initialValue:"#0000"})}catch{}}function fe(s){const{heightSmall:i,heightMedium:a,heightLarge:t,borderRadius:l}=s;return{color:"#eee",colorEnd:"#ddd",borderRadius:l,heightSmall:i,heightMedium:a,heightLarge:t}}const ve={name:"Skeleton",common:Y,self:fe},we=R([G("skeleton",`
height: 1em;
width: 100%;
transition:
--n-color-start .3s var(--n-bezier),
--n-color-end .3s var(--n-bezier),
background-color .3s var(--n-bezier);
animation: 2s skeleton-loading infinite cubic-bezier(0.36, 0, 0.64, 1);
background-color: var(--n-color-start);
`),R("@keyframes skeleton-loading",`
0% {
background: var(--n-color-start);
}
40% {
background: var(--n-color-end);
}
80% {
background: var(--n-color-start);
}
100% {
background: var(--n-color-start);
}
`)]),ke=Object.assign(Object.assign({},q.props),{text:Boolean,round:Boolean,circle:Boolean,height:[String,Number],width:[String,Number],size:String,repeat:{type:Number,default:1},animated:{type:Boolean,default:!0},sharp:{type:Boolean,default:!0}}),ge=J({name:"Skeleton",inheritAttrs:!1,props:ke,setup(s){he();const{mergedClsPrefixRef:i}=Q(s),a=q("Skeleton","-skeleton",we,ve,s,i);return{mergedClsPrefix:i,style:Z(()=>{var t,l;const y=a.value,{common:{cubicBezierEaseInOut:M}}=y,x=y.self,{color:V,colorEnd:j,borderRadius:O}=x;let b;const{circle:o,sharp:m,round:$,width:_,height:d,size:p,text:B,animated:v}=s;p!==void 0&&(b=x[ee("height",p)]);const c=o?(t=_??d)!==null&&t!==void 0?t:b:_,h=(l=o?_??d:d)!==null&&l!==void 0?l:b;return{display:B?"inline-block":"",verticalAlign:B?"-0.125em":"",borderRadius:o?"50%":$?"4096px":m?"":O,width:typeof c=="number"?H(c):c,height:typeof h=="number"?H(h):h,animation:v?"":"none","--n-bezier":M,"--n-color-start":V,"--n-color-end":j}})}},render(){const{repeat:s,style:i,mergedClsPrefix:a,$attrs:t}=this,l=A("div",te({class:`${a}-skeleton`,style:i},t));return s>1?A(E,null,ne(s,null).map(y=>[l,`
`])):l}});var D={};Object.defineProperty(D,"__esModule",{value:!0});const L=P,ye={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},be=(0,L.createElementVNode)("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M416 128L192 384l-96-96"},null,-1),Ce=[be];var xe=D.default=(0,L.defineComponent)({name:"CheckmarkSharp",render:function(i,a){return(0,L.openBlock)(),(0,L.createElementBlock)("svg",ye,Ce)}}),K={};Object.defineProperty(K,"__esModule",{value:!0});const N=P,$e={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Be=(0,N.createElementVNode)("path",{d:"M400 145.49L366.51 112L256 222.51L145.49 112L112 145.49L222.51 256L112 366.51L145.49 400L256 289.49L366.51 400L400 366.51L289.49 256L400 145.49z",fill:"currentColor"},null,-1),ze=[Be];var Se=K.default=(0,N.defineComponent)({name:"CloseSharp",render:function(i,a){return(0,N.openBlock)(),(0,N.createElementBlock)("svg",$e,ze)}}),U={};Object.defineProperty(U,"__esModule",{value:!0});const g=P,Ee={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Le=(0,g.createElementVNode)("circle",{cx:"256",cy:"256",r:"48",fill:"currentColor"},null,-1),Ne=(0,g.createElementVNode)("circle",{cx:"416",cy:"256",r:"48",fill:"currentColor"},null,-1),Pe=(0,g.createElementVNode)("circle",{cx:"96",cy:"256",r:"48",fill:"currentColor"},null,-1),Me=[Le,Ne,Pe];var Ve=U.default=(0,g.defineComponent)({name:"EllipsisHorizontal",render:function(i,a){return(0,g.openBlock)(),(0,g.createElementBlock)("svg",Ee,Me)}}),W={};Object.defineProperty(W,"__esModule",{value:!0});const C=P,je={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Oe=(0,C.createElementVNode)("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"44",d:"M358.62 129.28L86.49 402.08L70 442l39.92-16.49l272.8-272.13l-24.1-24.1z"},null,-1),Re=(0,C.createElementVNode)("path",{d:"M413.07 74.84l-11.79 11.78l24.1 24.1l11.79-11.79a16.51 16.51 0 0 0 0-23.34l-.75-.75a16.51 16.51 0 0 0-23.35 0z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"44"},null,-1),He=[Oe,Re];var Ae=W.default=(0,C.defineComponent)({name:"Pencil",render:function(i,a){return(0,C.openBlock)(),(0,C.createElementBlock)("svg",je,He)}});const Fe={class:"mower-list"},Ie={class:"header"},Te={class:"header"},qe={key:0},De={key:3,class:"expand"},Ke={class:"folder"},Ue={class:"folder-content"},We={__name:"MowerManager",setup(s){const i=z(!0),a=z([]),t=z(-1),l=z("");re(()=>{window.addEventListener("pywebviewready",async()=>{a.value=await pywebview.api.get_instances(),i.value=!1})});async function y(){a.value.push({name:"新实例",path:""}),await pywebview.api.add("新实例","")}async function M(o){a.value.splice(o,1),await pywebview.api.remove(o)}function x(o){t.value=o,l.value=a.value[o].name}async function V(){const o=t.value;t.value=-1,a.value[o].name=l.value,await pywebview.api.rename(o,l.value)}function j(){t.value=-1}async function O(o){const m=await pywebview.api.select_path(o);m&&(a.value[o].path=m)}async function b(o){await pywebview.api.start(o)}return(o,m)=>{const $=ge,_=ce,d=le,p=se,B=me;return u(),w("div",Fe,[r(i)?(u(),w(E,{key:0},F(3,v=>e(_,{size:"small",key:v},{header:n(()=>[S("div",Ie,[e($,{text:"",width:"40%"})])]),default:n(()=>[e($,{text:""})]),_:2},1024)),64)):f("",!0),(u(!0),w(E,null,F(r(a),(v,c)=>(u(),k(_,{size:"small",key:c},{header:n(()=>[S("div",Te,[r(t)!=c?(u(),w("div",qe,I(v.name),1)):f("",!0),r(t)==-1?(u(),k(p,{key:1,size:"tiny",onClick:h=>x(c)},{icon:n(()=>[e(d,null,{default:n(()=>[e(r(Ae))]),_:1})]),_:2},1032,["onClick"])):f("",!0),r(t)==-1?(u(),k(p,{key:2,type:"error",ghost:"",size:"tiny",onClick:h=>M(c)},{icon:n(()=>[e(d,null,{default:n(()=>[e(r(pe))]),_:1})]),_:2},1032,["onClick"])):f("",!0),r(t)!=c?(u(),w("div",De)):f("",!0),r(t)==-1?(u(),k(p,{key:4,type:"primary",size:"small",disabled:!v.path,onClick:h=>b(c)},{icon:n(()=>[e(d,null,{default:n(()=>[e(r(_e))]),_:1})]),_:2},1032,["disabled","onClick"])):f("",!0),r(t)==c?(u(),w(E,{key:5},[e(B,{placeholder:"实例名称",value:r(l),"onUpdate:value":m[0]||(m[0]=h=>ie(l)?l.value=h:null)},null,8,["value"]),e(p,{type:"primary",size:"tiny",circle:"",onClick:V},{icon:n(()=>[e(d,null,{default:n(()=>[e(r(xe))]),_:1})]),_:1}),e(p,{type:"error",size:"tiny",circle:"",onClick:j},{icon:n(()=>[e(d,null,{default:n(()=>[e(r(Se))]),_:1})]),_:1})],64)):f("",!0)])]),default:n(()=>[S("div",Ke,[S("code",Ue,I(v.path||"请选择该实例配置文件的保存路径"),1),r(t)==-1?(u(),k(p,{key:0,size:"tiny",onClick:h=>O(c)},{icon:n(()=>[e(d,null,{default:n(()=>[e(r(Ve))]),_:1})]),_:2},1032,["onClick"])):f("",!0)])]),_:2},1024))),128)),r(i)?f("",!0):(u(),k(p,{key:1,size:"large",dashed:"",onClick:y},{icon:n(()=>[e(d,null,{default:n(()=>[e(r(de))]),_:1})]),default:n(()=>[m[1]||(m[1]=ae(" 添加实例 "))]),_:1}))])}}},Xe=oe(We,[["__scopeId","data-v-ac66f2e7"]]),Ye=ue(Xe);Ye.mount("#app");