hermes-web-ui 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -6
- package/bin/hermes-web-ui.mjs +34 -4
- package/dist/assets/Button-CQLKwjHl.js +109 -0
- package/dist/assets/ChannelsView-Bdv3P2Rv.js +1 -0
- package/dist/assets/ChatView-BGSDL0hI.js +142 -0
- package/dist/assets/{ChatView-BVHQ6KhU.css → ChatView-CGsFaSiv.css} +1 -1
- package/dist/assets/Close-inn9RP7R.js +45 -0
- package/dist/assets/FormItem-BvJieJmq.js +110 -0
- package/dist/assets/Input-edKmVCeM.js +234 -0
- package/dist/assets/InputNumber-BpYEJnKY.js +13 -0
- package/dist/assets/JobsView-Dx4HmGC6.js +2 -0
- package/dist/assets/LoginView-BHThbj0n.css +1 -0
- package/dist/assets/LoginView-CIQSZ6bh.js +1 -0
- package/dist/assets/LogsView-nn7t6RGX.js +1 -0
- package/dist/assets/{MarkdownRenderer-C2pkccH2.js → MarkdownRenderer-Yw5JS7CE.js} +9 -9
- package/dist/assets/MemoryView-CE9P7mef.js +5 -0
- package/dist/assets/Modal-CDRYujZp.js +232 -0
- package/dist/assets/ModelsView-B72PAvvd.js +1 -0
- package/dist/assets/Popover-CRhyj79I.js +117 -0
- package/dist/assets/Select-CXQmv_5e.js +340 -0
- package/dist/assets/SettingRow-B3O4TYKh.js +1 -0
- package/dist/assets/SettingsView-BF2Uh-Eo.js +352 -0
- package/dist/assets/SkillsView-Abm6Dt2r.css +1 -0
- package/dist/assets/SkillsView-CeUPV9g8.js +1 -0
- package/dist/assets/Spin-COypV4Iq.js +43 -0
- package/dist/assets/Suffix-Bs0SC_yA.js +101 -0
- package/dist/assets/Switch-BcUqwhfi.js +102 -0
- package/dist/assets/Tag-CVO-_zgr.js +71 -0
- package/dist/assets/Tooltip-BljrRE17.js +1 -0
- package/dist/assets/UsageView-CFH6hwxE.js +1 -0
- package/dist/assets/_plugin-vue_export-helper-DJRCopG_.js +3 -0
- package/dist/assets/app-BcCNNvPk.js +1 -0
- package/dist/assets/app-CMJknO_z.js +1 -0
- package/dist/assets/browser-BuJOvks2.js +47 -0
- package/dist/assets/chat-DIeO-6BT.js +6 -0
- package/dist/assets/context-C8Jv60vX.js +1 -0
- package/dist/assets/index-BZ3NfTDJ.css +1 -0
- package/dist/assets/index-Bj9YOu02.js +306 -0
- package/dist/assets/jobs-CnB9OiiZ.js +1 -0
- package/dist/assets/logo-CiQBpLPw.js +1 -0
- package/dist/assets/pinia-YU9i-6Bb.js +1 -0
- package/dist/assets/router--r9mOZY5.js +4 -0
- package/dist/assets/{sessions-DYkP_X2v.js → sessions-COjIc6fz.js} +1 -1
- package/dist/assets/{skills-C6QBmS9j.js → skills-C4yD0aCK.js} +1 -1
- package/dist/assets/use-message-D8bO1GLN.js +1 -0
- package/dist/index.html +18 -18
- package/dist/server/index.js +104 -61
- package/dist/server/routes/filesystem.js +38 -0
- package/dist/server/services/auth.d.ts +9 -0
- package/dist/server/services/auth.js +65 -0
- package/dist/server/services/hermes-cli.js +13 -1
- package/package.json +2 -2
- package/dist/assets/Button-CpNld4Mc.js +0 -109
- package/dist/assets/ChannelsView-BGXB46ZU.js +0 -1
- package/dist/assets/ChatView-CaO-j1NR.js +0 -142
- package/dist/assets/Close-BAvirVyH.js +0 -45
- package/dist/assets/FormItem-DUC1YCrh.js +0 -110
- package/dist/assets/Input-CCmp4iGM.js +0 -234
- package/dist/assets/InputNumber-DpIdrMEW.js +0 -13
- package/dist/assets/JobsView-t5o1pB0r.js +0 -2
- package/dist/assets/LogsView-QqOV3ZEf.js +0 -1
- package/dist/assets/MemoryView-oeAn8ZfB.js +0 -5
- package/dist/assets/Modal-BljFqAJF.js +0 -232
- package/dist/assets/ModelsView-DvK44HBy.js +0 -1
- package/dist/assets/Popover-BQMR8Xxo.js +0 -117
- package/dist/assets/Select-D33SMWcz.js +0 -340
- package/dist/assets/SettingRow-BxCsRfGG.js +0 -102
- package/dist/assets/SettingsView-CK9ArFcg.js +0 -352
- package/dist/assets/SkillsView-BvNhRbMq.css +0 -1
- package/dist/assets/SkillsView-_z2SQ9kJ.js +0 -1
- package/dist/assets/Spin-CwbBDHwW.js +0 -43
- package/dist/assets/Suffix-CKUJBJSi.js +0 -101
- package/dist/assets/Tag-87KswiOb.js +0 -71
- package/dist/assets/Tooltip-CuLVJgy8.js +0 -1
- package/dist/assets/UsageView-COiUupLe.js +0 -1
- package/dist/assets/_plugin-vue_export-helper-C7dadZ10.js +0 -49
- package/dist/assets/app-DX-WvBe8.js +0 -1
- package/dist/assets/app-DwI_Lyfm.js +0 -1
- package/dist/assets/chat-De2jGIM6.js +0 -6
- package/dist/assets/client-D-w1KhaU.js +0 -1
- package/dist/assets/context-vjXbZCu8.js +0 -1
- package/dist/assets/index-D3MGnlpF.js +0 -307
- package/dist/assets/index-DCNlSGk-.css +0 -1
- package/dist/assets/jobs-B2WdYQNb.js +0 -1
- package/dist/assets/pinia-B4dETPKk.js +0 -1
- package/dist/assets/preload-helper-D4M6sveU.js +0 -1
- package/dist/assets/use-message-BeTKmVAO.js +0 -1
- package/dist/assets/vue.runtime.esm-bundler-BoqZ7fRe.js +0 -3
- /package/dist/{assets/logo-BAarh-tH.png → logo.png} +0 -0
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,E as n,H as r,L as i,M as a,N as o,O as s,P as c,S as l,V as u,W as d,k as f,m as p,n as m,o as h,rt as g,u as _,w as v,z as y}from"./vue.runtime.esm-bundler-BoqZ7fRe.js";import{B as b,G as x,J as S,V as C,Z as w,c as T,dt as E,et as D,f as O,ft as k,i as A,l as j,lt as M,nt as N,ot as P,q as F,r as I,st as L,tt as R,ut as z,z as ee}from"./_plugin-vue_export-helper-C7dadZ10.js";import{C as B,L as V,M as H,R as te,S as U,T as ne,_ as W,a as G,b as K,i as q,j as J,l as Y,m as re,o as ie,s as ae,t as oe,w as se,y as X}from"./Popover-BQMR8Xxo.js";import{S as ce,b as Z,c as le,g as ue,h as Q,i as de,l as fe,m as pe,n as me,p as he,t as ge,x as _e,y as ve}from"./Suffix-CKUJBJSi.js";import{n as ye}from"./Close-BAvirVyH.js";import{t as be}from"./Tag-87KswiOb.js";function xe(e){return e&-e}var Se=class{constructor(e,t){this.l=e,this.min=t;let n=Array(e+1);for(let t=0;t<e+1;++t)n[t]=0;this.ft=n}add(e,t){if(t===0)return;let{l:n,ft:r}=this;for(e+=1;e<=n;)r[e]+=t,e+=xe(e)}get(e){return this.sum(e+1)-this.sum(e)}sum(e){if(e===void 0&&(e=this.l),e<=0)return 0;let{ft:t,min:n,l:r}=this;if(e>r)throw Error("[FinweckTree.sum]: `i` is larger than length.");let i=e*n;for(;e>0;)i+=t[e],e-=xe(e);return i}getBound(e){let t=0,n=this.l;for(;n>t;){let r=Math.floor((t+n)/2),i=this.sum(r);if(i>e){n=r;continue}else if(i<e){if(t===r)return this.sum(t+1)<=e?t+1:r;t=r}else return r}return t}},Ce;function we(){return typeof document>`u`?!1:(Ce===void 0&&(Ce=`matchMedia`in window?window.matchMedia(`(pointer:coarse)`).matches:!1),Ce)}var Te;function Ee(){return typeof document>`u`?1:(Te===void 0&&(Te=`chrome`in window?window.devicePixelRatio:1),Te)}var De=`VVirtualListXScroll`;function Oe({columnsRef:t,renderColRef:n,renderItemWithColsRef:r}){let a=e(0),o=e(0),s=p(()=>{let e=t.value;if(e.length===0)return null;let n=new Se(e.length,0);return e.forEach((e,t)=>{n.add(t,e.width)}),n});return i(De,{startIndexRef:R(()=>{let e=s.value;return e===null?0:Math.max(e.getBound(o.value)-1,0)}),endIndexRef:R(()=>{let e=s.value;return e===null?0:Math.min(e.getBound(o.value+a.value)+1,t.value.length-1)}),columnsRef:t,renderColRef:n,renderItemWithColsRef:r,getLeft:e=>{let t=s.value;return t===null?0:t.sum(e)}}),{listWidthRef:a,scrollLeftRef:o}}var ke=l({name:`VirtualListRow`,props:{index:{type:Number,required:!0},item:{type:Object,required:!0}},setup(){let{startIndexRef:e,endIndexRef:t,columnsRef:r,getLeft:i,renderColRef:a,renderItemWithColsRef:o}=n(De);return{startIndex:e,endIndex:t,columns:r,renderCol:a,renderItemWithCols:o,getLeft:i}},render(){let{startIndex:e,endIndex:t,columns:n,renderCol:r,renderItemWithCols:i,getLeft:a,item:o}=this;if(i!=null)return i({itemIndex:this.index,startColIndex:e,endColIndex:t,allColumns:n,item:o,getLeft:a});if(r!=null){let i=[];for(let s=e;s<=t;++s){let e=n[s];i.push(r({column:e,left:a(s),item:o}))}return i}return null}}),Ae=X(`.v-vl`,{maxHeight:`inherit`,height:`100%`,overflow:`auto`,minWidth:`1px`},[X(`&:not(.v-vl--show-scrollbar)`,{scrollbarWidth:`none`},[X(`&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb`,{width:0,height:0,display:`none`})])]),je=l({name:`VirtualList`,inheritAttrs:!1,props:{showScrollbar:{type:Boolean,default:!0},columns:{type:Array,default:()=>[]},renderCol:Function,renderItemWithCols:Function,items:{type:Array,default:()=>[]},itemSize:{type:Number,required:!0},itemResizable:Boolean,itemsStyle:[String,Object],visibleItemsTag:{type:[String,Object],default:`div`},visibleItemsProps:Object,ignoreItemResize:Boolean,onScroll:Function,onWheel:Function,onResize:Function,defaultScrollKey:[Number,String],defaultScrollIndex:Number,keyField:{type:String,default:`key`},paddingTop:{type:[Number,String],default:0},paddingBottom:{type:[Number,String],default:0}},setup(n){let r=w();Ae.mount({id:`vueuc/virtual-list`,head:!0,anchorMetaName:K,ssr:r}),c(()=>{let{defaultScrollIndex:e,defaultScrollKey:t}=n;e==null?t!=null&&S({key:t}):S({index:e})});let i=!1,a=!1;t(()=>{if(i=!1,!a){a=!0;return}S({top:y.value,left:u.value})}),o(()=>{i=!0,a||=!0});let s=R(()=>{if(n.renderCol==null&&n.renderItemWithCols==null||n.columns.length===0)return;let e=0;return n.columns.forEach(t=>{e+=t.width}),e}),l=p(()=>{let e=new Map,{keyField:t}=n;return n.items.forEach((n,r)=>{e.set(n[t],r)}),e}),{scrollLeftRef:u,listWidthRef:d}=Oe({columnsRef:g(n,`columns`),renderColRef:g(n,`renderCol`),renderItemWithColsRef:g(n,`renderItemWithCols`)}),f=e(null),m=e(void 0),h=new Map,_=p(()=>{let{items:e,itemSize:t,keyField:r}=n,i=new Se(e.length,t);return e.forEach((e,t)=>{let n=e[r],a=h.get(n);a!==void 0&&i.add(t,a)}),i}),v=e(0),y=e(0),b=R(()=>Math.max(_.value.getBound(y.value-ve(n.paddingTop))-1,0)),x=p(()=>{let{value:e}=m;if(e===void 0)return[];let{items:t,itemSize:r}=n,i=b.value,a=Math.min(i+Math.ceil(e/r+1),t.length-1),o=[];for(let e=i;e<=a;++e)o.push(t[e]);return o}),S=(e,t)=>{if(typeof e==`number`){D(e,t,`auto`);return}let{left:n,top:r,index:i,key:a,position:o,behavior:s,debounce:c=!0}=e;if(n!==void 0||r!==void 0)D(n,r,s);else if(i!==void 0)E(i,s,c);else if(a!==void 0){let e=l.value.get(a);e!==void 0&&E(e,s,c)}else o===`bottom`?D(0,2**53-1,s):o===`top`&&D(0,0,s)},C,T=null;function E(e,t,r){let{value:i}=_,a=i.sum(e)+ve(n.paddingTop);if(!r)f.value.scrollTo({left:0,top:a,behavior:t});else{C=e,T!==null&&window.clearTimeout(T),T=window.setTimeout(()=>{C=void 0,T=null},16);let{scrollTop:n,offsetHeight:r}=f.value;if(a>n){let o=i.get(e);a+o<=n+r||f.value.scrollTo({left:0,top:a+o-r,behavior:t})}else f.value.scrollTo({left:0,top:a,behavior:t})}}function D(e,t,n){f.value.scrollTo({left:e,top:t,behavior:n})}function O(e,t){if(i||n.ignoreItemResize||F(t.target))return;let{value:r}=_,a=l.value.get(e),o=r.get(a),s=t.borderBoxSize?.[0]?.blockSize??t.contentRect.height;if(s===o)return;s-n.itemSize===0?h.delete(e):h.set(e,s-n.itemSize);let c=s-o;if(c===0)return;r.add(a,c);let u=f.value;if(u!=null){if(C===void 0){let e=r.sum(a);u.scrollTop>e&&u.scrollBy(0,c)}else (a<C||a===C&&s+r.sum(a)>u.scrollTop+u.offsetHeight)&&u.scrollBy(0,c);P()}v.value++}let k=!we(),A=!1;function j(e){var t;(t=n.onScroll)==null||t.call(n,e),(!k||!A)&&P()}function M(e){var t;if((t=n.onWheel)==null||t.call(n,e),k){let t=f.value;if(t!=null){if(e.deltaX===0&&(t.scrollTop===0&&e.deltaY<=0||t.scrollTop+t.offsetHeight>=t.scrollHeight&&e.deltaY>=0))return;e.preventDefault(),t.scrollTop+=e.deltaY/Ee(),t.scrollLeft+=e.deltaX/Ee(),P(),A=!0,te(()=>{A=!1})}}}function N(e){if(i||F(e.target))return;if(n.renderCol==null&&n.renderItemWithCols==null){if(e.contentRect.height===m.value)return}else if(e.contentRect.height===m.value&&e.contentRect.width===d.value)return;m.value=e.contentRect.height,d.value=e.contentRect.width;let{onResize:t}=n;t!==void 0&&t(e)}function P(){let{value:e}=f;e!=null&&(y.value=e.scrollTop,u.value=e.scrollLeft)}function F(e){let t=e;for(;t!==null;){if(t.style.display===`none`)return!0;t=t.parentElement}return!1}return{listHeight:m,listStyle:{overflow:`auto`},keyToIndex:l,itemsStyle:p(()=>{let{itemResizable:e}=n,t=_e(_.value.sum());return v.value,[n.itemsStyle,{boxSizing:`content-box`,width:_e(s.value),height:e?``:t,minHeight:e?t:``,paddingTop:_e(n.paddingTop),paddingBottom:_e(n.paddingBottom)}]}),visibleItemsStyle:p(()=>(v.value,{transform:`translateY(${_e(_.value.sum(b.value))})`})),viewportItems:x,listElRef:f,itemsElRef:e(null),scrollTo:S,handleListResize:N,handleListScroll:j,handleListWheel:M,handleItemResize:O}},render(){let{itemResizable:e,keyField:t,keyToIndex:n,visibleItemsTag:r}=this;return v(pe,{onResize:this.handleListResize},{default:()=>{var i;return v(`div`,s(this.$attrs,{class:[`v-vl`,this.showScrollbar&&`v-vl--show-scrollbar`],onScroll:this.handleListScroll,onWheel:this.handleListWheel,ref:`listElRef`}),[this.items.length===0?(i=this.$slots).empty?.call(i):v(`div`,{ref:`itemsElRef`,class:`v-vl-items`,style:this.itemsStyle},[v(r,Object.assign({class:`v-vl-visible-items`,style:this.visibleItemsStyle},this.visibleItemsProps),{default:()=>{let{renderCol:r,renderItemWithCols:i}=this;return this.viewportItems.map(a=>{let o=a[t],s=n.get(o),c=r==null?void 0:v(ke,{index:s,item:a}),l=i==null?void 0:v(ke,{index:s,item:a}),u=this.$slots.default({item:a,renderedCols:c,renderedItemWithCols:l,index:s})[0];return e?v(pe,{key:o,onResize:e=>this.handleItemResize(o,e)},{default:()=>u}):(u.key=o,u)})}})])])}})}}),$=`v-hidden`,Me=X(`[v-hidden]`,{display:`none!important`}),Ne=l({name:`Overflow`,props:{getCounter:Function,getTail:Function,updateCounter:Function,onUpdateCount:Function,onUpdateOverflow:Function},setup(t,{slots:n}){let r=e(null),i=e(null);function a(e){let{value:a}=r,{getCounter:o,getTail:s}=t,c;if(c=o===void 0?i.value:o(),!a||!c)return;c.hasAttribute($)&&c.removeAttribute($);let{children:l}=a;if(e.showAllItemsBeforeCalculate)for(let e of l)e.hasAttribute($)&&e.removeAttribute($);let u=a.offsetWidth,d=[],f=n.tail?s?.():null,p=f?f.offsetWidth:0,m=!1,h=a.children.length-+!!n.tail;for(let e=0;e<h-1;++e){if(e<0)continue;let n=l[e];if(m){n.hasAttribute($)||n.setAttribute($,``);continue}else n.hasAttribute($)&&n.removeAttribute($);let r=n.offsetWidth;if(p+=r,d[e]=r,p>u){let{updateCounter:n}=t;for(let r=e;r>=0;--r){let i=h-1-r;n===void 0?c.textContent=`${i}`:n(i);let a=c.offsetWidth;if(p-=d[r],p+a<=u||r===0){m=!0,e=r-1,f&&(e===-1?(f.style.maxWidth=`${u-a}px`,f.style.boxSizing=`border-box`):f.style.maxWidth=``);let{onUpdateCount:n}=t;n&&n(i);break}}}}let{onUpdateOverflow:g}=t;m?g!==void 0&&g(!0):(g!==void 0&&g(!1),c.setAttribute($,``))}let o=w();return Me.mount({id:`vueuc/overflow`,head:!0,anchorMetaName:K,ssr:o}),c(()=>a({showAllItemsBeforeCalculate:!1})),{selfRef:r,counterRef:i,sync:a}},render(){let{$slots:e}=this;return f(()=>this.sync({showAllItemsBeforeCalculate:!1})),v(`div`,{class:`v-overflow`,ref:`selfRef`},[y(e,`default`),e.counter?e.counter():v(`span`,{style:{display:`inline-block`},ref:`counterRef`}),e.tail?e.tail():null])}});function Pe(e,t){t&&(c(()=>{let{value:n}=e;n&&Q.registerHandler(n,t)}),u(e,(e,t)=>{t&&Q.unregisterHandler(t)},{deep:!1}),a(()=>{let{value:t}=e;t&&Q.unregisterHandler(t)}))}function Fe(e){switch(typeof e){case`string`:return e||void 0;case`number`:return String(e);default:return}}function Ie(e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?t[0]:t=>{e.forEach(e=>{e&&e(t)})}}var Le=l({name:`Checkmark`,render(){return v(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`},v(`g`,{fill:`none`},v(`path`,{d:`M14.046 3.486a.75.75 0 0 1-.032 1.06l-7.93 7.474a.85.85 0 0 1-1.188-.022l-2.68-2.72a.75.75 0 1 1 1.068-1.053l2.234 2.267l7.468-7.038a.75.75 0 0 1 1.06.032z`,fill:`currentColor`})))}}),Re=l({name:`Empty`,render(){return v(`svg`,{viewBox:`0 0 28 28`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},v(`path`,{d:`M26 7.5C26 11.0899 23.0899 14 19.5 14C15.9101 14 13 11.0899 13 7.5C13 3.91015 15.9101 1 19.5 1C23.0899 1 26 3.91015 26 7.5ZM16.8536 4.14645C16.6583 3.95118 16.3417 3.95118 16.1464 4.14645C15.9512 4.34171 15.9512 4.65829 16.1464 4.85355L18.7929 7.5L16.1464 10.1464C15.9512 10.3417 15.9512 10.6583 16.1464 10.8536C16.3417 11.0488 16.6583 11.0488 16.8536 10.8536L19.5 8.20711L22.1464 10.8536C22.3417 11.0488 22.6583 11.0488 22.8536 10.8536C23.0488 10.6583 23.0488 10.3417 22.8536 10.1464L20.2071 7.5L22.8536 4.85355C23.0488 4.65829 23.0488 4.34171 22.8536 4.14645C22.6583 3.95118 22.3417 3.95118 22.1464 4.14645L19.5 6.79289L16.8536 4.14645Z`,fill:`currentColor`}),v(`path`,{d:`M25 22.75V12.5991C24.5572 13.0765 24.053 13.4961 23.5 13.8454V16H17.5L17.3982 16.0068C17.0322 16.0565 16.75 16.3703 16.75 16.75C16.75 18.2688 15.5188 19.5 14 19.5C12.4812 19.5 11.25 18.2688 11.25 16.75L11.2432 16.6482C11.1935 16.2822 10.8797 16 10.5 16H4.5V7.25C4.5 6.2835 5.2835 5.5 6.25 5.5H12.2696C12.4146 4.97463 12.6153 4.47237 12.865 4H6.25C4.45507 4 3 5.45507 3 7.25V22.75C3 24.5449 4.45507 26 6.25 26H21.75C23.5449 26 25 24.5449 25 22.75ZM4.5 22.75V17.5H9.81597L9.85751 17.7041C10.2905 19.5919 11.9808 21 14 21L14.215 20.9947C16.2095 20.8953 17.842 19.4209 18.184 17.5H23.5V22.75C23.5 23.7165 22.7165 24.5 21.75 24.5H6.25C5.2835 24.5 4.5 23.7165 4.5 22.75Z`,fill:`currentColor`}))}}),ze=l({props:{onFocus:Function,onBlur:Function},setup(e){return()=>v(`div`,{style:`width: 0; height: 0`,tabindex:0,onFocus:e.onFocus,onBlur:e.onBlur})}}),Be={iconSizeTiny:`28px`,iconSizeSmall:`34px`,iconSizeMedium:`40px`,iconSizeLarge:`46px`,iconSizeHuge:`52px`};function Ve(e){let{textColorDisabled:t,iconColor:n,textColor2:r,fontSizeTiny:i,fontSizeSmall:a,fontSizeMedium:o,fontSizeLarge:s,fontSizeHuge:c}=e;return Object.assign(Object.assign({},Be),{fontSizeTiny:i,fontSizeSmall:a,fontSizeMedium:o,fontSizeLarge:s,fontSizeHuge:c,textColor:t,iconColor:n,extraTextColor:r})}var He={name:`Empty`,common:I,self:Ve},Ue=L(`empty`,`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
align-items: center;
|
|
5
|
-
font-size: var(--n-font-size);
|
|
6
|
-
`,[M(`icon`,`
|
|
7
|
-
width: var(--n-icon-size);
|
|
8
|
-
height: var(--n-icon-size);
|
|
9
|
-
font-size: var(--n-icon-size);
|
|
10
|
-
line-height: var(--n-icon-size);
|
|
11
|
-
color: var(--n-icon-color);
|
|
12
|
-
transition:
|
|
13
|
-
color .3s var(--n-bezier);
|
|
14
|
-
`,[P(`+`,[M(`description`,`
|
|
15
|
-
margin-top: 8px;
|
|
16
|
-
`)])]),M(`description`,`
|
|
17
|
-
transition: color .3s var(--n-bezier);
|
|
18
|
-
color: var(--n-text-color);
|
|
19
|
-
`),M(`extra`,`
|
|
20
|
-
text-align: center;
|
|
21
|
-
transition: color .3s var(--n-bezier);
|
|
22
|
-
margin-top: 12px;
|
|
23
|
-
color: var(--n-extra-text-color);
|
|
24
|
-
`)]),We=l({name:`Empty`,props:Object.assign(Object.assign({},j.props),{description:String,showDescription:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0},size:{type:String,default:`medium`},renderIcon:Function}),slots:Object,setup(e){let{mergedClsPrefixRef:t,inlineThemeDisabled:n,mergedComponentPropsRef:r}=C(e),i=j(`Empty`,`-empty`,Ue,He,e,t),{localeRef:a}=fe(`Empty`),o=p(()=>e.description??r?.value?.Empty?.description),s=p(()=>r?.value?.Empty?.renderIcon||(()=>v(Re,null))),c=p(()=>{let{size:t}=e,{common:{cubicBezierEaseInOut:n},self:{[k(`iconSize`,t)]:r,[k(`fontSize`,t)]:a,textColor:o,iconColor:s,extraTextColor:c}}=i.value;return{"--n-icon-size":r,"--n-font-size":a,"--n-bezier":n,"--n-text-color":o,"--n-icon-color":s,"--n-extra-text-color":c}}),l=n?b(`empty`,p(()=>{let t=``,{size:n}=e;return t+=n[0],t}),c,e):void 0;return{mergedClsPrefix:t,mergedRenderIcon:s,localizedDescription:p(()=>o.value||a.value.description),cssVars:n?void 0:c,themeClass:l?.themeClass,onRender:l?.onRender}},render(){let{$slots:e,mergedClsPrefix:t,onRender:n}=this;return n?.(),v(`div`,{class:[`${t}-empty`,this.themeClass],style:this.cssVars},this.showIcon?v(`div`,{class:`${t}-empty__icon`},e.icon?e.icon():v(le,{clsPrefix:t},{default:this.mergedRenderIcon})):null,this.showDescription?v(`div`,{class:`${t}-empty__description`},e.default?e.default():this.localizedDescription):null,e.extra?v(`div`,{class:`${t}-empty__extra`},e.extra()):null)}}),Ge={height:`calc(var(--n-option-height) * 7.6)`,paddingTiny:`4px 0`,paddingSmall:`4px 0`,paddingMedium:`4px 0`,paddingLarge:`4px 0`,paddingHuge:`4px 0`,optionPaddingTiny:`0 12px`,optionPaddingSmall:`0 12px`,optionPaddingMedium:`0 12px`,optionPaddingLarge:`0 12px`,optionPaddingHuge:`0 12px`,loadingSize:`18px`};function Ke(e){let{borderRadius:t,popoverColor:n,textColor3:r,dividerColor:i,textColor2:a,primaryColorPressed:o,textColorDisabled:s,primaryColor:c,opacityDisabled:l,hoverColor:u,fontSizeTiny:d,fontSizeSmall:f,fontSizeMedium:p,fontSizeLarge:m,fontSizeHuge:h,heightTiny:g,heightSmall:_,heightMedium:v,heightLarge:y,heightHuge:b}=e;return Object.assign(Object.assign({},Ge),{optionFontSizeTiny:d,optionFontSizeSmall:f,optionFontSizeMedium:p,optionFontSizeLarge:m,optionFontSizeHuge:h,optionHeightTiny:g,optionHeightSmall:_,optionHeightMedium:v,optionHeightLarge:y,optionHeightHuge:b,borderRadius:t,color:n,groupHeaderTextColor:r,actionDividerColor:i,optionTextColor:a,optionTextColorPressed:o,optionTextColorDisabled:s,optionTextColorActive:c,optionOpacityDisabled:l,optionCheckColor:c,optionColorPending:u,optionColorActive:`rgba(0, 0, 0, 0)`,optionColorActivePending:u,actionTextColor:a,loadingColor:c})}var qe=T({name:`InternalSelectMenu`,common:I,peers:{Scrollbar:de,Empty:He},self:Ke}),Je=l({name:`NBaseSelectGroupHeader`,props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(){let{renderLabelRef:e,renderOptionRef:t,labelFieldRef:r,nodePropsRef:i}=n(H);return{labelField:r,nodeProps:i,renderLabel:e,renderOption:t}},render(){let{clsPrefix:e,renderLabel:t,renderOption:n,nodeProps:r,tmNode:{rawNode:i}}=this,a=r?.(i),o=t?t(i,!1):Y(i[this.labelField],i,!1),s=v(`div`,Object.assign({},a,{class:[`${e}-base-select-group-header`,a?.class]}),o);return i.render?i.render({node:s,option:i}):n?n({node:s,option:i,selected:!1}):s}});function Ye(e,t){return v(m,{name:`fade-in-scale-up-transition`},{default:()=>e?v(le,{clsPrefix:t,class:`${t}-base-select-option__check`},{default:()=>v(Le)}):null})}var Xe=l({name:`NBaseSelectOption`,props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(e){let{valueRef:t,pendingTmNodeRef:r,multipleRef:i,valueSetRef:a,renderLabelRef:o,renderOptionRef:s,labelFieldRef:c,valueFieldRef:l,showCheckmarkRef:u,nodePropsRef:d,handleOptionClick:f,handleOptionMouseEnter:p}=n(H),m=R(()=>{let{value:t}=r;return t?e.tmNode.key===t.key:!1});function h(t){let{tmNode:n}=e;n.disabled||f(t,n)}function g(t){let{tmNode:n}=e;n.disabled||p(t,n)}function _(t){let{tmNode:n}=e,{value:r}=m;n.disabled||r||p(t,n)}return{multiple:i,isGrouped:R(()=>{let{tmNode:t}=e,{parent:n}=t;return n&&n.rawNode.type===`group`}),showCheckmark:u,nodeProps:d,isPending:m,isSelected:R(()=>{let{value:n}=t,{value:r}=i;if(n===null)return!1;let o=e.tmNode.rawNode[l.value];if(r){let{value:e}=a;return e.has(o)}else return n===o}),labelField:c,renderLabel:o,renderOption:s,handleMouseMove:_,handleMouseEnter:g,handleClick:h}},render(){let{clsPrefix:e,tmNode:{rawNode:t},isSelected:n,isPending:r,isGrouped:i,showCheckmark:a,nodeProps:o,renderOption:s,renderLabel:c,handleClick:l,handleMouseEnter:u,handleMouseMove:d}=this,f=Ye(n,e),p=c?[c(t,n),a&&f]:[Y(t[this.labelField],t,n),a&&f],m=o?.(t),h=v(`div`,Object.assign({},m,{class:[`${e}-base-select-option`,t.class,m?.class,{[`${e}-base-select-option--disabled`]:t.disabled,[`${e}-base-select-option--selected`]:n,[`${e}-base-select-option--grouped`]:i,[`${e}-base-select-option--pending`]:r,[`${e}-base-select-option--show-checkmark`]:a}],style:[m?.style||``,t.style||``],onClick:Ie([l,m?.onClick]),onMouseenter:Ie([u,m?.onMouseenter]),onMousemove:Ie([d,m?.onMousemove])}),v(`div`,{class:`${e}-base-select-option__content`},p));return t.render?t.render({node:h,option:t,selected:n}):s?s({node:h,option:t,selected:n}):h}}),Ze=L(`base-select-menu`,`
|
|
25
|
-
line-height: 1.5;
|
|
26
|
-
outline: none;
|
|
27
|
-
z-index: 0;
|
|
28
|
-
position: relative;
|
|
29
|
-
border-radius: var(--n-border-radius);
|
|
30
|
-
transition:
|
|
31
|
-
background-color .3s var(--n-bezier),
|
|
32
|
-
box-shadow .3s var(--n-bezier);
|
|
33
|
-
background-color: var(--n-color);
|
|
34
|
-
`,[L(`scrollbar`,`
|
|
35
|
-
max-height: var(--n-height);
|
|
36
|
-
`),L(`virtual-list`,`
|
|
37
|
-
max-height: var(--n-height);
|
|
38
|
-
`),L(`base-select-option`,`
|
|
39
|
-
min-height: var(--n-option-height);
|
|
40
|
-
font-size: var(--n-option-font-size);
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
`,[M(`content`,`
|
|
44
|
-
z-index: 1;
|
|
45
|
-
white-space: nowrap;
|
|
46
|
-
text-overflow: ellipsis;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
`)]),L(`base-select-group-header`,`
|
|
49
|
-
min-height: var(--n-option-height);
|
|
50
|
-
font-size: .93em;
|
|
51
|
-
display: flex;
|
|
52
|
-
align-items: center;
|
|
53
|
-
`),L(`base-select-menu-option-wrapper`,`
|
|
54
|
-
position: relative;
|
|
55
|
-
width: 100%;
|
|
56
|
-
`),M(`loading, empty`,`
|
|
57
|
-
display: flex;
|
|
58
|
-
padding: 12px 32px;
|
|
59
|
-
flex: 1;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
`),M(`loading`,`
|
|
62
|
-
color: var(--n-loading-color);
|
|
63
|
-
font-size: var(--n-loading-size);
|
|
64
|
-
`),M(`header`,`
|
|
65
|
-
padding: 8px var(--n-option-padding-left);
|
|
66
|
-
font-size: var(--n-option-font-size);
|
|
67
|
-
transition:
|
|
68
|
-
color .3s var(--n-bezier),
|
|
69
|
-
border-color .3s var(--n-bezier);
|
|
70
|
-
border-bottom: 1px solid var(--n-action-divider-color);
|
|
71
|
-
color: var(--n-action-text-color);
|
|
72
|
-
`),M(`action`,`
|
|
73
|
-
padding: 8px var(--n-option-padding-left);
|
|
74
|
-
font-size: var(--n-option-font-size);
|
|
75
|
-
transition:
|
|
76
|
-
color .3s var(--n-bezier),
|
|
77
|
-
border-color .3s var(--n-bezier);
|
|
78
|
-
border-top: 1px solid var(--n-action-divider-color);
|
|
79
|
-
color: var(--n-action-text-color);
|
|
80
|
-
`),L(`base-select-group-header`,`
|
|
81
|
-
position: relative;
|
|
82
|
-
cursor: default;
|
|
83
|
-
padding: var(--n-option-padding);
|
|
84
|
-
color: var(--n-group-header-text-color);
|
|
85
|
-
`),L(`base-select-option`,`
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
position: relative;
|
|
88
|
-
padding: var(--n-option-padding);
|
|
89
|
-
transition:
|
|
90
|
-
color .3s var(--n-bezier),
|
|
91
|
-
opacity .3s var(--n-bezier);
|
|
92
|
-
box-sizing: border-box;
|
|
93
|
-
color: var(--n-option-text-color);
|
|
94
|
-
opacity: 1;
|
|
95
|
-
`,[z(`show-checkmark`,`
|
|
96
|
-
padding-right: calc(var(--n-option-padding-right) + 20px);
|
|
97
|
-
`),P(`&::before`,`
|
|
98
|
-
content: "";
|
|
99
|
-
position: absolute;
|
|
100
|
-
left: 4px;
|
|
101
|
-
right: 4px;
|
|
102
|
-
top: 0;
|
|
103
|
-
bottom: 0;
|
|
104
|
-
border-radius: var(--n-border-radius);
|
|
105
|
-
transition: background-color .3s var(--n-bezier);
|
|
106
|
-
`),P(`&:active`,`
|
|
107
|
-
color: var(--n-option-text-color-pressed);
|
|
108
|
-
`),z(`grouped`,`
|
|
109
|
-
padding-left: calc(var(--n-option-padding-left) * 1.5);
|
|
110
|
-
`),z(`pending`,[P(`&::before`,`
|
|
111
|
-
background-color: var(--n-option-color-pending);
|
|
112
|
-
`)]),z(`selected`,`
|
|
113
|
-
color: var(--n-option-text-color-active);
|
|
114
|
-
`,[P(`&::before`,`
|
|
115
|
-
background-color: var(--n-option-color-active);
|
|
116
|
-
`),z(`pending`,[P(`&::before`,`
|
|
117
|
-
background-color: var(--n-option-color-active-pending);
|
|
118
|
-
`)])]),z(`disabled`,`
|
|
119
|
-
cursor: not-allowed;
|
|
120
|
-
`,[E(`selected`,`
|
|
121
|
-
color: var(--n-option-text-color-disabled);
|
|
122
|
-
`),z(`selected`,`
|
|
123
|
-
opacity: var(--n-option-opacity-disabled);
|
|
124
|
-
`)]),M(`check`,`
|
|
125
|
-
font-size: 16px;
|
|
126
|
-
position: absolute;
|
|
127
|
-
right: calc(var(--n-option-padding-right) - 4px);
|
|
128
|
-
top: calc(50% - 7px);
|
|
129
|
-
color: var(--n-option-check-color);
|
|
130
|
-
transition: color .3s var(--n-bezier);
|
|
131
|
-
`,[G({enterScale:`0.5`})])])]),Qe=l({name:`InternalSelectMenu`,props:Object.assign(Object.assign({},j.props),{clsPrefix:{type:String,required:!0},scrollable:{type:Boolean,default:!0},treeMate:{type:Object,required:!0},multiple:Boolean,size:{type:String,default:`medium`},value:{type:[String,Number,Array],default:null},autoPending:Boolean,virtualScroll:{type:Boolean,default:!0},show:{type:Boolean,default:!0},labelField:{type:String,default:`label`},valueField:{type:String,default:`value`},loading:Boolean,focusable:Boolean,renderLabel:Function,renderOption:Function,nodeProps:Function,showCheckmark:{type:Boolean,default:!0},onMousedown:Function,onScroll:Function,onFocus:Function,onBlur:Function,onKeyup:Function,onKeydown:Function,onTabOut:Function,onMouseenter:Function,onMouseleave:Function,onResize:Function,resetMenuOnOptionsChange:{type:Boolean,default:!0},inlineThemeDisabled:Boolean,scrollbarProps:Object,onToggle:Function}),setup(t){let{mergedClsPrefixRef:n,mergedRtlRef:r,mergedComponentPropsRef:o}=C(t),s=O(`InternalSelectMenu`,r,n),l=j(`InternalSelectMenu`,`-internal-select-menu`,Ze,qe,t,g(t,`clsPrefix`)),d=e(null),m=e(null),h=e(null),_=p(()=>t.treeMate.getFlattenedNodes()),v=p(()=>ae(_.value)),y=e(null);function x(){let{treeMate:e}=t,n=null,{value:r}=t;r===null?n=e.getFirstAvailableNode():(n=t.multiple?e.getNode((r||[])[(r||[]).length-1]):e.getNode(r),(!n||n.disabled)&&(n=e.getFirstAvailableNode())),W(n||null)}function S(){let{value:e}=y;e&&!t.treeMate.getNode(e.key)&&(y.value=null)}let w;u(()=>t.show,e=>{e?w=u(()=>t.treeMate,()=>{t.resetMenuOnOptionsChange?(t.autoPending?x():S(),f(G)):S()},{immediate:!0}):w?.()},{immediate:!0}),a(()=>{w?.()});let T=p(()=>ve(l.value.self[k(`optionHeight`,t.size)])),E=p(()=>Z(l.value.self[k(`padding`,t.size)])),D=p(()=>t.multiple&&Array.isArray(t.value)?new Set(t.value):new Set),A=p(()=>{let e=_.value;return e&&e.length===0}),M=p(()=>o?.value?.Select?.renderEmpty);function N(e){let{onToggle:n}=t;n&&n(e)}function P(e){let{onScroll:n}=t;n&&n(e)}function F(e){var t;(t=h.value)==null||t.sync(),P(e)}function I(){var e;(e=h.value)==null||e.sync()}function L(){let{value:e}=y;return e||null}function R(e,t){t.disabled||W(t,!1)}function z(e,t){t.disabled||N(t)}function ee(e){var n;V(e,`action`)||(n=t.onKeyup)==null||n.call(t,e)}function B(e){var n;V(e,`action`)||(n=t.onKeydown)==null||n.call(t,e)}function te(e){var n;(n=t.onMousedown)==null||n.call(t,e),!t.focusable&&e.preventDefault()}function U(){let{value:e}=y;e&&W(e.getNext({loop:!0}),!0)}function ne(){let{value:e}=y;e&&W(e.getPrev({loop:!0}),!0)}function W(e,t=!1){y.value=e,t&&G()}function G(){var e,n;let r=y.value;if(!r)return;let i=v.value(r.key);i!==null&&(t.virtualScroll?(e=m.value)==null||e.scrollTo({index:i}):(n=h.value)==null||n.scrollTo({index:i,elSize:T.value}))}function K(e){var n;d.value?.contains(e.target)&&((n=t.onFocus)==null||n.call(t,e))}function q(e){var n;d.value?.contains(e.relatedTarget)||(n=t.onBlur)==null||n.call(t,e)}i(H,{handleOptionMouseEnter:R,handleOptionClick:z,valueSetRef:D,pendingTmNodeRef:y,nodePropsRef:g(t,`nodeProps`),showCheckmarkRef:g(t,`showCheckmark`),multipleRef:g(t,`multiple`),valueRef:g(t,`value`),renderLabelRef:g(t,`renderLabel`),renderOptionRef:g(t,`renderOption`),labelFieldRef:g(t,`labelField`),valueFieldRef:g(t,`valueField`)}),i(J,d),c(()=>{let{value:e}=h;e&&e.sync()});let Y=p(()=>{let{size:e}=t,{common:{cubicBezierEaseInOut:n},self:{height:r,borderRadius:i,color:a,groupHeaderTextColor:o,actionDividerColor:s,optionTextColorPressed:c,optionTextColor:u,optionTextColorDisabled:d,optionTextColorActive:f,optionOpacityDisabled:p,optionCheckColor:m,actionTextColor:h,optionColorPending:g,optionColorActive:_,loadingColor:v,loadingSize:y,optionColorActivePending:b,[k(`optionFontSize`,e)]:x,[k(`optionHeight`,e)]:S,[k(`optionPadding`,e)]:C}}=l.value;return{"--n-height":r,"--n-action-divider-color":s,"--n-action-text-color":h,"--n-bezier":n,"--n-border-radius":i,"--n-color":a,"--n-option-font-size":x,"--n-group-header-text-color":o,"--n-option-check-color":m,"--n-option-color-pending":g,"--n-option-color-active":_,"--n-option-color-active-pending":b,"--n-option-height":S,"--n-option-opacity-disabled":p,"--n-option-text-color":u,"--n-option-text-color-active":f,"--n-option-text-color-disabled":d,"--n-option-text-color-pressed":c,"--n-option-padding":C,"--n-option-padding-left":Z(C,`left`),"--n-option-padding-right":Z(C,`right`),"--n-loading-color":v,"--n-loading-size":y}}),{inlineThemeDisabled:re}=t,ie=re?b(`internal-select-menu`,p(()=>t.size[0]),Y,t):void 0,oe={selfRef:d,next:U,prev:ne,getPendingTmNode:L};return Pe(d,t.onResize),Object.assign({mergedTheme:l,mergedClsPrefix:n,rtlEnabled:s,virtualListRef:m,scrollbarRef:h,itemSize:T,padding:E,flattenedNodes:_,empty:A,mergedRenderEmpty:M,virtualListContainer(){let{value:e}=m;return e?.listElRef},virtualListContent(){let{value:e}=m;return e?.itemsElRef},doScroll:P,handleFocusin:K,handleFocusout:q,handleKeyUp:ee,handleKeyDown:B,handleMouseDown:te,handleVirtualListResize:I,handleVirtualListScroll:F,cssVars:re?void 0:Y,themeClass:ie?.themeClass,onRender:ie?.onRender},oe)},render(){let{$slots:e,virtualScroll:t,clsPrefix:n,mergedTheme:r,themeClass:i,onRender:a}=this;return a?.(),v(`div`,{ref:`selfRef`,tabindex:this.focusable?0:-1,class:[`${n}-base-select-menu`,`${n}-base-select-menu--${this.size}-size`,this.rtlEnabled&&`${n}-base-select-menu--rtl`,i,this.multiple&&`${n}-base-select-menu--multiple`],style:this.cssVars,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onKeyup:this.handleKeyUp,onKeydown:this.handleKeyDown,onMousedown:this.handleMouseDown,onMouseenter:this.onMouseenter,onMouseleave:this.onMouseleave},F(e.header,e=>e&&v(`div`,{class:`${n}-base-select-menu__header`,"data-header":!0,key:`header`},e)),this.loading?v(`div`,{class:`${n}-base-select-menu__loading`},v(A,{clsPrefix:n,strokeWidth:20})):this.empty?v(`div`,{class:`${n}-base-select-menu__empty`,"data-empty":!0},x(e.empty,()=>[this.mergedRenderEmpty?.call(this)||v(We,{theme:r.peers.Empty,themeOverrides:r.peerOverrides.Empty,size:this.size})])):v(me,Object.assign({ref:`scrollbarRef`,theme:r.peers.Scrollbar,themeOverrides:r.peerOverrides.Scrollbar,scrollable:this.scrollable,container:t?this.virtualListContainer:void 0,content:t?this.virtualListContent:void 0,onScroll:t?void 0:this.doScroll},this.scrollbarProps),{default:()=>t?v(je,{ref:`virtualListRef`,class:`${n}-virtual-list`,items:this.flattenedNodes,itemSize:this.itemSize,showScrollbar:!1,paddingTop:this.padding.top,paddingBottom:this.padding.bottom,onResize:this.handleVirtualListResize,onScroll:this.handleVirtualListScroll,itemResizable:!0},{default:({item:e})=>e.isGroup?v(Je,{key:e.key,clsPrefix:n,tmNode:e}):e.ignored?null:v(Xe,{clsPrefix:n,key:e.key,tmNode:e})}):v(`div`,{class:`${n}-base-select-menu-option-wrapper`,style:{paddingTop:this.padding.top,paddingBottom:this.padding.bottom}},this.flattenedNodes.map(e=>e.isGroup?v(Je,{key:e.key,clsPrefix:n,tmNode:e}):v(Xe,{clsPrefix:n,key:e.key,tmNode:e})))}),F(e.action,e=>e&&[v(`div`,{class:`${n}-base-select-menu__action`,"data-action":!0,key:`action`},e),v(ze,{onFocus:this.onTabOut,key:`focus-detector`})]))}}),$e={paddingSingle:`0 26px 0 12px`,paddingMultiple:`3px 26px 0 12px`,clearSize:`16px`,arrowSize:`16px`};function et(e){let{borderRadius:t,textColor2:n,textColorDisabled:r,inputColor:i,inputColorDisabled:a,primaryColor:o,primaryColorHover:s,warningColor:c,warningColorHover:l,errorColor:u,errorColorHover:d,borderColor:f,iconColor:p,iconColorDisabled:m,clearColor:h,clearColorHover:g,clearColorPressed:_,placeholderColor:v,placeholderColorDisabled:y,fontSizeTiny:b,fontSizeSmall:x,fontSizeMedium:S,fontSizeLarge:C,heightTiny:w,heightSmall:T,heightMedium:E,heightLarge:D,fontWeight:O}=e;return Object.assign(Object.assign({},$e),{fontSizeTiny:b,fontSizeSmall:x,fontSizeMedium:S,fontSizeLarge:C,heightTiny:w,heightSmall:T,heightMedium:E,heightLarge:D,borderRadius:t,fontWeight:O,textColor:n,textColorDisabled:r,placeholderColor:v,placeholderColorDisabled:y,color:i,colorDisabled:a,colorActive:i,border:`1px solid ${f}`,borderHover:`1px solid ${s}`,borderActive:`1px solid ${o}`,borderFocus:`1px solid ${s}`,boxShadowHover:`none`,boxShadowActive:`0 0 0 2px ${N(o,{alpha:.2})}`,boxShadowFocus:`0 0 0 2px ${N(o,{alpha:.2})}`,caretColor:o,arrowColor:p,arrowColorDisabled:m,loadingColor:o,borderWarning:`1px solid ${c}`,borderHoverWarning:`1px solid ${l}`,borderActiveWarning:`1px solid ${c}`,borderFocusWarning:`1px solid ${l}`,boxShadowHoverWarning:`none`,boxShadowActiveWarning:`0 0 0 2px ${N(c,{alpha:.2})}`,boxShadowFocusWarning:`0 0 0 2px ${N(c,{alpha:.2})}`,colorActiveWarning:i,caretColorWarning:c,borderError:`1px solid ${u}`,borderHoverError:`1px solid ${d}`,borderActiveError:`1px solid ${u}`,borderFocusError:`1px solid ${d}`,boxShadowHoverError:`none`,boxShadowActiveError:`0 0 0 2px ${N(u,{alpha:.2})}`,boxShadowFocusError:`0 0 0 2px ${N(u,{alpha:.2})}`,colorActiveError:i,caretColorError:u,clearColor:h,clearColorHover:g,clearColorPressed:_})}var tt=T({name:`InternalSelection`,common:I,peers:{Popover:q},self:et}),nt=P([L(`base-selection`,`
|
|
132
|
-
--n-padding-single: var(--n-padding-single-top) var(--n-padding-single-right) var(--n-padding-single-bottom) var(--n-padding-single-left);
|
|
133
|
-
--n-padding-multiple: var(--n-padding-multiple-top) var(--n-padding-multiple-right) var(--n-padding-multiple-bottom) var(--n-padding-multiple-left);
|
|
134
|
-
position: relative;
|
|
135
|
-
z-index: auto;
|
|
136
|
-
box-shadow: none;
|
|
137
|
-
width: 100%;
|
|
138
|
-
max-width: 100%;
|
|
139
|
-
display: inline-block;
|
|
140
|
-
vertical-align: bottom;
|
|
141
|
-
border-radius: var(--n-border-radius);
|
|
142
|
-
min-height: var(--n-height);
|
|
143
|
-
line-height: 1.5;
|
|
144
|
-
font-size: var(--n-font-size);
|
|
145
|
-
`,[L(`base-loading`,`
|
|
146
|
-
color: var(--n-loading-color);
|
|
147
|
-
`),L(`base-selection-tags`,`min-height: var(--n-height);`),M(`border, state-border`,`
|
|
148
|
-
position: absolute;
|
|
149
|
-
left: 0;
|
|
150
|
-
right: 0;
|
|
151
|
-
top: 0;
|
|
152
|
-
bottom: 0;
|
|
153
|
-
pointer-events: none;
|
|
154
|
-
border: var(--n-border);
|
|
155
|
-
border-radius: inherit;
|
|
156
|
-
transition:
|
|
157
|
-
box-shadow .3s var(--n-bezier),
|
|
158
|
-
border-color .3s var(--n-bezier);
|
|
159
|
-
`),M(`state-border`,`
|
|
160
|
-
z-index: 1;
|
|
161
|
-
border-color: #0000;
|
|
162
|
-
`),L(`base-suffix`,`
|
|
163
|
-
cursor: pointer;
|
|
164
|
-
position: absolute;
|
|
165
|
-
top: 50%;
|
|
166
|
-
transform: translateY(-50%);
|
|
167
|
-
right: 10px;
|
|
168
|
-
`,[M(`arrow`,`
|
|
169
|
-
font-size: var(--n-arrow-size);
|
|
170
|
-
color: var(--n-arrow-color);
|
|
171
|
-
transition: color .3s var(--n-bezier);
|
|
172
|
-
`)]),L(`base-selection-overlay`,`
|
|
173
|
-
display: flex;
|
|
174
|
-
align-items: center;
|
|
175
|
-
white-space: nowrap;
|
|
176
|
-
pointer-events: none;
|
|
177
|
-
position: absolute;
|
|
178
|
-
top: 0;
|
|
179
|
-
right: 0;
|
|
180
|
-
bottom: 0;
|
|
181
|
-
left: 0;
|
|
182
|
-
padding: var(--n-padding-single);
|
|
183
|
-
transition: color .3s var(--n-bezier);
|
|
184
|
-
`,[M(`wrapper`,`
|
|
185
|
-
flex-basis: 0;
|
|
186
|
-
flex-grow: 1;
|
|
187
|
-
overflow: hidden;
|
|
188
|
-
text-overflow: ellipsis;
|
|
189
|
-
`)]),L(`base-selection-placeholder`,`
|
|
190
|
-
color: var(--n-placeholder-color);
|
|
191
|
-
`,[M(`inner`,`
|
|
192
|
-
max-width: 100%;
|
|
193
|
-
overflow: hidden;
|
|
194
|
-
`)]),L(`base-selection-tags`,`
|
|
195
|
-
cursor: pointer;
|
|
196
|
-
outline: none;
|
|
197
|
-
box-sizing: border-box;
|
|
198
|
-
position: relative;
|
|
199
|
-
z-index: auto;
|
|
200
|
-
display: flex;
|
|
201
|
-
padding: var(--n-padding-multiple);
|
|
202
|
-
flex-wrap: wrap;
|
|
203
|
-
align-items: center;
|
|
204
|
-
width: 100%;
|
|
205
|
-
vertical-align: bottom;
|
|
206
|
-
background-color: var(--n-color);
|
|
207
|
-
border-radius: inherit;
|
|
208
|
-
transition:
|
|
209
|
-
color .3s var(--n-bezier),
|
|
210
|
-
box-shadow .3s var(--n-bezier),
|
|
211
|
-
background-color .3s var(--n-bezier);
|
|
212
|
-
`),L(`base-selection-label`,`
|
|
213
|
-
height: var(--n-height);
|
|
214
|
-
display: inline-flex;
|
|
215
|
-
width: 100%;
|
|
216
|
-
vertical-align: bottom;
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
outline: none;
|
|
219
|
-
z-index: auto;
|
|
220
|
-
box-sizing: border-box;
|
|
221
|
-
position: relative;
|
|
222
|
-
transition:
|
|
223
|
-
color .3s var(--n-bezier),
|
|
224
|
-
box-shadow .3s var(--n-bezier),
|
|
225
|
-
background-color .3s var(--n-bezier);
|
|
226
|
-
border-radius: inherit;
|
|
227
|
-
background-color: var(--n-color);
|
|
228
|
-
align-items: center;
|
|
229
|
-
`,[L(`base-selection-input`,`
|
|
230
|
-
font-size: inherit;
|
|
231
|
-
line-height: inherit;
|
|
232
|
-
outline: none;
|
|
233
|
-
cursor: pointer;
|
|
234
|
-
box-sizing: border-box;
|
|
235
|
-
border:none;
|
|
236
|
-
width: 100%;
|
|
237
|
-
padding: var(--n-padding-single);
|
|
238
|
-
background-color: #0000;
|
|
239
|
-
color: var(--n-text-color);
|
|
240
|
-
transition: color .3s var(--n-bezier);
|
|
241
|
-
caret-color: var(--n-caret-color);
|
|
242
|
-
`,[M(`content`,`
|
|
243
|
-
text-overflow: ellipsis;
|
|
244
|
-
overflow: hidden;
|
|
245
|
-
white-space: nowrap;
|
|
246
|
-
`)]),M(`render-label`,`
|
|
247
|
-
color: var(--n-text-color);
|
|
248
|
-
`)]),E(`disabled`,[P(`&:hover`,[M(`state-border`,`
|
|
249
|
-
box-shadow: var(--n-box-shadow-hover);
|
|
250
|
-
border: var(--n-border-hover);
|
|
251
|
-
`)]),z(`focus`,[M(`state-border`,`
|
|
252
|
-
box-shadow: var(--n-box-shadow-focus);
|
|
253
|
-
border: var(--n-border-focus);
|
|
254
|
-
`)]),z(`active`,[M(`state-border`,`
|
|
255
|
-
box-shadow: var(--n-box-shadow-active);
|
|
256
|
-
border: var(--n-border-active);
|
|
257
|
-
`),L(`base-selection-label`,`background-color: var(--n-color-active);`),L(`base-selection-tags`,`background-color: var(--n-color-active);`)])]),z(`disabled`,`cursor: not-allowed;`,[M(`arrow`,`
|
|
258
|
-
color: var(--n-arrow-color-disabled);
|
|
259
|
-
`),L(`base-selection-label`,`
|
|
260
|
-
cursor: not-allowed;
|
|
261
|
-
background-color: var(--n-color-disabled);
|
|
262
|
-
`,[L(`base-selection-input`,`
|
|
263
|
-
cursor: not-allowed;
|
|
264
|
-
color: var(--n-text-color-disabled);
|
|
265
|
-
`),M(`render-label`,`
|
|
266
|
-
color: var(--n-text-color-disabled);
|
|
267
|
-
`)]),L(`base-selection-tags`,`
|
|
268
|
-
cursor: not-allowed;
|
|
269
|
-
background-color: var(--n-color-disabled);
|
|
270
|
-
`),L(`base-selection-placeholder`,`
|
|
271
|
-
cursor: not-allowed;
|
|
272
|
-
color: var(--n-placeholder-color-disabled);
|
|
273
|
-
`)]),L(`base-selection-input-tag`,`
|
|
274
|
-
height: calc(var(--n-height) - 6px);
|
|
275
|
-
line-height: calc(var(--n-height) - 6px);
|
|
276
|
-
outline: none;
|
|
277
|
-
display: none;
|
|
278
|
-
position: relative;
|
|
279
|
-
margin-bottom: 3px;
|
|
280
|
-
max-width: 100%;
|
|
281
|
-
vertical-align: bottom;
|
|
282
|
-
`,[M(`input`,`
|
|
283
|
-
font-size: inherit;
|
|
284
|
-
font-family: inherit;
|
|
285
|
-
min-width: 1px;
|
|
286
|
-
padding: 0;
|
|
287
|
-
background-color: #0000;
|
|
288
|
-
outline: none;
|
|
289
|
-
border: none;
|
|
290
|
-
max-width: 100%;
|
|
291
|
-
overflow: hidden;
|
|
292
|
-
width: 1em;
|
|
293
|
-
line-height: inherit;
|
|
294
|
-
cursor: pointer;
|
|
295
|
-
color: var(--n-text-color);
|
|
296
|
-
caret-color: var(--n-caret-color);
|
|
297
|
-
`),M(`mirror`,`
|
|
298
|
-
position: absolute;
|
|
299
|
-
left: 0;
|
|
300
|
-
top: 0;
|
|
301
|
-
white-space: pre;
|
|
302
|
-
visibility: hidden;
|
|
303
|
-
user-select: none;
|
|
304
|
-
-webkit-user-select: none;
|
|
305
|
-
opacity: 0;
|
|
306
|
-
`)]),[`warning`,`error`].map(e=>z(`${e}-status`,[M(`state-border`,`border: var(--n-border-${e});`),E(`disabled`,[P(`&:hover`,[M(`state-border`,`
|
|
307
|
-
box-shadow: var(--n-box-shadow-hover-${e});
|
|
308
|
-
border: var(--n-border-hover-${e});
|
|
309
|
-
`)]),z(`active`,[M(`state-border`,`
|
|
310
|
-
box-shadow: var(--n-box-shadow-active-${e});
|
|
311
|
-
border: var(--n-border-active-${e});
|
|
312
|
-
`),L(`base-selection-label`,`background-color: var(--n-color-active-${e});`),L(`base-selection-tags`,`background-color: var(--n-color-active-${e});`)]),z(`focus`,[M(`state-border`,`
|
|
313
|
-
box-shadow: var(--n-box-shadow-focus-${e});
|
|
314
|
-
border: var(--n-border-focus-${e});
|
|
315
|
-
`)])])]))]),L(`base-selection-popover`,`
|
|
316
|
-
margin-bottom: -3px;
|
|
317
|
-
display: flex;
|
|
318
|
-
flex-wrap: wrap;
|
|
319
|
-
margin-right: -8px;
|
|
320
|
-
`),L(`base-selection-tag-wrapper`,`
|
|
321
|
-
max-width: 100%;
|
|
322
|
-
display: inline-flex;
|
|
323
|
-
padding: 0 7px 3px 0;
|
|
324
|
-
`,[P(`&:last-child`,`padding-right: 0;`),L(`tag`,`
|
|
325
|
-
font-size: 14px;
|
|
326
|
-
max-width: 100%;
|
|
327
|
-
`,[M(`content`,`
|
|
328
|
-
line-height: 1.25;
|
|
329
|
-
text-overflow: ellipsis;
|
|
330
|
-
overflow: hidden;
|
|
331
|
-
`)])])]),rt=l({name:`InternalSelection`,props:Object.assign(Object.assign({},j.props),{clsPrefix:{type:String,required:!0},bordered:{type:Boolean,default:void 0},active:Boolean,pattern:{type:String,default:``},placeholder:String,selectedOption:{type:Object,default:null},selectedOptions:{type:Array,default:null},labelField:{type:String,default:`label`},valueField:{type:String,default:`value`},multiple:Boolean,filterable:Boolean,clearable:Boolean,disabled:Boolean,size:{type:String,default:`medium`},loading:Boolean,autofocus:Boolean,showArrow:{type:Boolean,default:!0},inputProps:Object,focused:Boolean,renderTag:Function,onKeydown:Function,onClick:Function,onBlur:Function,onFocus:Function,onDeleteOption:Function,maxTagCount:[String,Number],ellipsisTagPopoverProps:Object,onClear:Function,onPatternInput:Function,onPatternFocus:Function,onPatternBlur:Function,renderLabel:Function,status:String,inlineThemeDisabled:Boolean,ignoreComposition:{type:Boolean,default:!0},onResize:Function}),setup(t){let{mergedClsPrefixRef:n,mergedRtlRef:i}=C(t),a=O(`InternalSelection`,i,n),o=e(null),s=e(null),l=e(null),d=e(null),m=e(null),h=e(null),_=e(null),v=e(null),y=e(null),x=e(null),S=e(!1),w=e(!1),T=e(!1),E=j(`InternalSelection`,`-internal-selection`,nt,tt,t,g(t,`clsPrefix`)),D=p(()=>t.clearable&&!t.disabled&&(T.value||t.active)),A=p(()=>t.selectedOption?t.renderTag?t.renderTag({option:t.selectedOption,handleClose:()=>{}}):t.renderLabel?t.renderLabel(t.selectedOption,!0):Y(t.selectedOption[t.labelField],t.selectedOption,!0):t.placeholder),M=p(()=>{let e=t.selectedOption;if(e)return e[t.labelField]}),N=p(()=>t.multiple?!!(Array.isArray(t.selectedOptions)&&t.selectedOptions.length):t.selectedOption!==null);function P(){var e;let{value:n}=o;if(n){let{value:r}=s;r&&(r.style.width=`${n.offsetWidth}px`,t.maxTagCount!==`responsive`&&((e=y.value)==null||e.sync({showAllItemsBeforeCalculate:!1})))}}function F(){let{value:e}=x;e&&(e.style.display=`none`)}function I(){let{value:e}=x;e&&(e.style.display=`inline-block`)}u(g(t,`active`),e=>{e||F()}),u(g(t,`pattern`),()=>{t.multiple&&f(P)});function L(e){let{onFocus:n}=t;n&&n(e)}function R(e){let{onBlur:n}=t;n&&n(e)}function z(e){let{onDeleteOption:n}=t;n&&n(e)}function ee(e){let{onClear:n}=t;n&&n(e)}function B(e){let{onPatternInput:n}=t;n&&n(e)}function V(e){(!e.relatedTarget||!l.value?.contains(e.relatedTarget))&&L(e)}function H(e){l.value?.contains(e.relatedTarget)||R(e)}function te(e){ee(e)}function U(){T.value=!0}function ne(){T.value=!1}function W(e){!t.active||!t.filterable||e.target!==s.value&&e.preventDefault()}function G(e){z(e)}let K=e(!1);function q(e){if(e.key===`Backspace`&&!K.value&&!t.pattern.length){let{selectedOptions:e}=t;e?.length&&G(e[e.length-1])}}let J=null;function re(e){let{value:n}=o;n&&(n.textContent=e.target.value,P()),t.ignoreComposition&&K.value?J=e:B(e)}function ie(){K.value=!0}function ae(){K.value=!1,t.ignoreComposition&&B(J),J=null}function oe(e){var n;w.value=!0,(n=t.onPatternFocus)==null||n.call(t,e)}function se(e){var n;w.value=!1,(n=t.onPatternBlur)==null||n.call(t,e)}function X(){var e,n;if(t.filterable)w.value=!1,(e=h.value)==null||e.blur(),(n=s.value)==null||n.blur();else if(t.multiple){let{value:e}=d;e?.blur()}else{let{value:e}=m;e?.blur()}}function ce(){var e,n,r;t.filterable?(w.value=!1,(e=h.value)==null||e.focus()):t.multiple?(n=d.value)==null||n.focus():(r=m.value)==null||r.focus()}function le(){let{value:e}=s;e&&(I(),e.focus())}function ue(){let{value:e}=s;e&&e.blur()}function Q(e){let{value:t}=_;t&&t.setTextContent(`+${e}`)}function de(){let{value:e}=v;return e}function fe(){return s.value}let pe=null;function me(){pe!==null&&window.clearTimeout(pe)}function he(){t.active||(me(),pe=window.setTimeout(()=>{N.value&&(S.value=!0)},100))}function ge(){me()}function _e(e){e||(me(),S.value=!1)}u(N,e=>{e||(S.value=!1)}),c(()=>{r(()=>{let e=h.value;e&&(t.disabled?e.removeAttribute(`tabindex`):e.tabIndex=w.value?-1:0)})}),Pe(l,t.onResize);let{inlineThemeDisabled:ve}=t,ye=p(()=>{let{size:e}=t,{common:{cubicBezierEaseInOut:n},self:{fontWeight:r,borderRadius:i,color:a,placeholderColor:o,textColor:s,paddingSingle:c,paddingMultiple:l,caretColor:u,colorDisabled:d,textColorDisabled:f,placeholderColorDisabled:p,colorActive:m,boxShadowFocus:h,boxShadowActive:g,boxShadowHover:_,border:v,borderFocus:y,borderHover:b,borderActive:x,arrowColor:S,arrowColorDisabled:C,loadingColor:w,colorActiveWarning:T,boxShadowFocusWarning:D,boxShadowActiveWarning:O,boxShadowHoverWarning:A,borderWarning:j,borderFocusWarning:M,borderHoverWarning:N,borderActiveWarning:P,colorActiveError:F,boxShadowFocusError:I,boxShadowActiveError:L,boxShadowHoverError:R,borderError:z,borderFocusError:ee,borderHoverError:B,borderActiveError:V,clearColor:H,clearColorHover:te,clearColorPressed:U,clearSize:ne,arrowSize:W,[k(`height`,e)]:G,[k(`fontSize`,e)]:K}}=E.value,q=Z(c),J=Z(l);return{"--n-bezier":n,"--n-border":v,"--n-border-active":x,"--n-border-focus":y,"--n-border-hover":b,"--n-border-radius":i,"--n-box-shadow-active":g,"--n-box-shadow-focus":h,"--n-box-shadow-hover":_,"--n-caret-color":u,"--n-color":a,"--n-color-active":m,"--n-color-disabled":d,"--n-font-size":K,"--n-height":G,"--n-padding-single-top":q.top,"--n-padding-multiple-top":J.top,"--n-padding-single-right":q.right,"--n-padding-multiple-right":J.right,"--n-padding-single-left":q.left,"--n-padding-multiple-left":J.left,"--n-padding-single-bottom":q.bottom,"--n-padding-multiple-bottom":J.bottom,"--n-placeholder-color":o,"--n-placeholder-color-disabled":p,"--n-text-color":s,"--n-text-color-disabled":f,"--n-arrow-color":S,"--n-arrow-color-disabled":C,"--n-loading-color":w,"--n-color-active-warning":T,"--n-box-shadow-focus-warning":D,"--n-box-shadow-active-warning":O,"--n-box-shadow-hover-warning":A,"--n-border-warning":j,"--n-border-focus-warning":M,"--n-border-hover-warning":N,"--n-border-active-warning":P,"--n-color-active-error":F,"--n-box-shadow-focus-error":I,"--n-box-shadow-active-error":L,"--n-box-shadow-hover-error":R,"--n-border-error":z,"--n-border-focus-error":ee,"--n-border-hover-error":B,"--n-border-active-error":V,"--n-clear-size":ne,"--n-clear-color":H,"--n-clear-color-hover":te,"--n-clear-color-pressed":U,"--n-arrow-size":W,"--n-font-weight":r}}),be=ve?b(`internal-selection`,p(()=>t.size[0]),ye,t):void 0;return{mergedTheme:E,mergedClearable:D,mergedClsPrefix:n,rtlEnabled:a,patternInputFocused:w,filterablePlaceholder:A,label:M,selected:N,showTagsPanel:S,isComposing:K,counterRef:_,counterWrapperRef:v,patternInputMirrorRef:o,patternInputRef:s,selfRef:l,multipleElRef:d,singleElRef:m,patternInputWrapperRef:h,overflowRef:y,inputTagElRef:x,handleMouseDown:W,handleFocusin:V,handleClear:te,handleMouseEnter:U,handleMouseLeave:ne,handleDeleteOption:G,handlePatternKeyDown:q,handlePatternInputInput:re,handlePatternInputBlur:se,handlePatternInputFocus:oe,handleMouseEnterCounter:he,handleMouseLeaveCounter:ge,handleFocusout:H,handleCompositionEnd:ae,handleCompositionStart:ie,onPopoverUpdateShow:_e,focus:ce,focusInput:le,blur:X,blurInput:ue,updateCounter:Q,getCounter:de,getTail:fe,renderLabel:t.renderLabel,cssVars:ve?void 0:ye,themeClass:be?.themeClass,onRender:be?.onRender}},render(){let{status:e,multiple:t,size:n,disabled:r,filterable:i,maxTagCount:a,bordered:o,clsPrefix:s,ellipsisTagPopoverProps:c,onRender:l,renderTag:u,renderLabel:d}=this;l?.();let f=a===`responsive`,p=typeof a==`number`,m=f||p,h=v(he,null,{default:()=>v(ge,{clsPrefix:s,loading:this.loading,showArrow:this.showArrow,showClear:this.mergedClearable&&this.selected,onClear:this.handleClear},{default:()=>{var e;return(e=this.$slots).arrow?.call(e)}})}),g;if(t){let{labelField:e}=this,t=t=>v(`div`,{class:`${s}-base-selection-tag-wrapper`,key:t.value},u?u({option:t,handleClose:()=>{this.handleDeleteOption(t)}}):v(be,{size:n,closable:!t.disabled,disabled:r,onClose:()=>{this.handleDeleteOption(t)},internalCloseIsButtonTag:!1,internalCloseFocusable:!1},{default:()=>d?d(t,!0):Y(t[e],t,!0)})),o=()=>(p?this.selectedOptions.slice(0,a):this.selectedOptions).map(t),l=i?v(`div`,{class:`${s}-base-selection-input-tag`,ref:`inputTagElRef`,key:`__input-tag__`},v(`input`,Object.assign({},this.inputProps,{ref:`patternInputRef`,tabindex:-1,disabled:r,value:this.pattern,autofocus:this.autofocus,class:`${s}-base-selection-input-tag__input`,onBlur:this.handlePatternInputBlur,onFocus:this.handlePatternInputFocus,onKeydown:this.handlePatternKeyDown,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),v(`span`,{ref:`patternInputMirrorRef`,class:`${s}-base-selection-input-tag__mirror`},this.pattern)):null,y=f?()=>v(`div`,{class:`${s}-base-selection-tag-wrapper`,ref:`counterWrapperRef`},v(be,{size:n,ref:`counterRef`,onMouseenter:this.handleMouseEnterCounter,onMouseleave:this.handleMouseLeaveCounter,disabled:r})):void 0,b;if(p){let e=this.selectedOptions.length-a;e>0&&(b=v(`div`,{class:`${s}-base-selection-tag-wrapper`,key:`__counter__`},v(be,{size:n,ref:`counterRef`,onMouseenter:this.handleMouseEnterCounter,disabled:r},{default:()=>`+${e}`})))}let x=f?i?v(Ne,{ref:`overflowRef`,updateCounter:this.updateCounter,getCounter:this.getCounter,getTail:this.getTail,style:{width:`100%`,display:`flex`,overflow:`hidden`}},{default:o,counter:y,tail:()=>l}):v(Ne,{ref:`overflowRef`,updateCounter:this.updateCounter,getCounter:this.getCounter,style:{width:`100%`,display:`flex`,overflow:`hidden`}},{default:o,counter:y}):p&&b?o().concat(b):o(),S=m?()=>v(`div`,{class:`${s}-base-selection-popover`},f?o():this.selectedOptions.map(t)):void 0,C=m?Object.assign({show:this.showTagsPanel,trigger:`hover`,overlap:!0,placement:`top`,width:`trigger`,onUpdateShow:this.onPopoverUpdateShow,theme:this.mergedTheme.peers.Popover,themeOverrides:this.mergedTheme.peerOverrides.Popover},c):null,w=!this.selected&&(!this.active||!this.pattern&&!this.isComposing)?v(`div`,{class:`${s}-base-selection-placeholder ${s}-base-selection-overlay`},v(`div`,{class:`${s}-base-selection-placeholder__inner`},this.placeholder)):null,T=i?v(`div`,{ref:`patternInputWrapperRef`,class:`${s}-base-selection-tags`},x,f?null:l,h):v(`div`,{ref:`multipleElRef`,class:`${s}-base-selection-tags`,tabindex:r?void 0:0},x,h);g=v(_,null,m?v(oe,Object.assign({},C,{scrollable:!0,style:`max-height: calc(var(--v-target-height) * 6.6);`}),{trigger:()=>T,default:S}):T,w)}else if(i){let e=this.pattern||this.isComposing,t=this.active?!e:!this.selected,n=this.active?!1:this.selected;g=v(`div`,{ref:`patternInputWrapperRef`,class:`${s}-base-selection-label`,title:this.patternInputFocused?void 0:Fe(this.label)},v(`input`,Object.assign({},this.inputProps,{ref:`patternInputRef`,class:`${s}-base-selection-input`,value:this.active?this.pattern:``,placeholder:``,readonly:r,disabled:r,tabindex:-1,autofocus:this.autofocus,onFocus:this.handlePatternInputFocus,onBlur:this.handlePatternInputBlur,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),n?v(`div`,{class:`${s}-base-selection-label__render-label ${s}-base-selection-overlay`,key:`input`},v(`div`,{class:`${s}-base-selection-overlay__wrapper`},u?u({option:this.selectedOption,handleClose:()=>{}}):d?d(this.selectedOption,!0):Y(this.label,this.selectedOption,!0))):null,t?v(`div`,{class:`${s}-base-selection-placeholder ${s}-base-selection-overlay`,key:`placeholder`},v(`div`,{class:`${s}-base-selection-overlay__wrapper`},this.filterablePlaceholder)):null,h)}else g=v(`div`,{ref:`singleElRef`,class:`${s}-base-selection-label`,tabindex:this.disabled?void 0:0},this.label===void 0?v(`div`,{class:`${s}-base-selection-placeholder ${s}-base-selection-overlay`,key:`placeholder`},v(`div`,{class:`${s}-base-selection-placeholder__inner`},this.placeholder)):v(`div`,{class:`${s}-base-selection-input`,title:Fe(this.label),key:`input`},v(`div`,{class:`${s}-base-selection-input__content`},u?u({option:this.selectedOption,handleClose:()=>{}}):d?d(this.selectedOption,!0):Y(this.label,this.selectedOption,!0))),h);return v(`div`,{ref:`selfRef`,class:[`${s}-base-selection`,this.rtlEnabled&&`${s}-base-selection--rtl`,this.themeClass,e&&`${s}-base-selection--${e}-status`,{[`${s}-base-selection--active`]:this.active,[`${s}-base-selection--selected`]:this.selected||this.active&&this.pattern,[`${s}-base-selection--disabled`]:this.disabled,[`${s}-base-selection--multiple`]:this.multiple,[`${s}-base-selection--focus`]:this.focused}],style:this.cssVars,onClick:this.onClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onKeydown:this.onKeydown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onMousedown:this.handleMouseDown},g,o?v(`div`,{class:`${s}-base-selection__border`}):null,o?v(`div`,{class:`${s}-base-selection__state-border`}):null)}});function it(e){return e.type===`group`}function at(e){return e.type===`ignored`}function ot(e,t){try{return!!(1+t.toString().toLowerCase().indexOf(e.trim().toLowerCase()))}catch{return!1}}function st(e,t){return{getIsGroup:it,getIgnored:at,getKey(t){return it(t)?t.name||t.key||`key-required`:t[e]},getChildren(e){return e[t]}}}function ct(e,t,n,r){if(!t)return e;function i(e){if(!Array.isArray(e))return[];let a=[];for(let o of e)if(it(o)){let e=i(o[r]);e.length&&a.push(Object.assign({},o,{[r]:e}))}else if(at(o))continue;else t(n,o)&&a.push(o);return a}return i(e)}function lt(e,t,n){let r=new Map;return e.forEach(e=>{it(e)?e[n].forEach(e=>{r.set(e[t],e)}):r.set(e[t],e)}),r}function ut(e){let{boxShadow2:t}=e;return{menuBoxShadow:t}}var dt=T({name:`Select`,common:I,peers:{InternalSelection:tt,InternalSelectMenu:qe},self:ut}),ft=P([L(`select`,`
|
|
332
|
-
z-index: auto;
|
|
333
|
-
outline: none;
|
|
334
|
-
width: 100%;
|
|
335
|
-
position: relative;
|
|
336
|
-
font-weight: var(--n-font-weight);
|
|
337
|
-
`),L(`select-menu`,`
|
|
338
|
-
margin: 4px 0;
|
|
339
|
-
box-shadow: var(--n-menu-box-shadow);
|
|
340
|
-
`,[G({originalTransition:`background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)`})])]),pt=l({name:`Select`,props:Object.assign(Object.assign({},j.props),{to:ne.propTo,bordered:{type:Boolean,default:void 0},clearable:Boolean,clearCreatedOptionsOnClear:{type:Boolean,default:!0},clearFilterAfterSelect:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},defaultValue:{type:[String,Number,Array],default:null},keyboard:{type:Boolean,default:!0},value:[String,Number,Array],placeholder:String,menuProps:Object,multiple:Boolean,size:String,menuSize:{type:String},filterable:Boolean,disabled:{type:Boolean,default:void 0},remote:Boolean,loading:Boolean,filter:Function,placement:{type:String,default:`bottom-start`},widthMode:{type:String,default:`trigger`},tag:Boolean,onCreate:Function,fallbackOption:{type:[Function,Boolean],default:void 0},show:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:!0},maxTagCount:[Number,String],ellipsisTagPopoverProps:Object,consistentMenuWidth:{type:Boolean,default:!0},virtualScroll:{type:Boolean,default:!0},labelField:{type:String,default:`label`},valueField:{type:String,default:`value`},childrenField:{type:String,default:`children`},renderLabel:Function,renderOption:Function,renderTag:Function,"onUpdate:value":[Function,Array],inputProps:Object,nodeProps:Function,ignoreComposition:{type:Boolean,default:!0},showOnFocus:Boolean,onUpdateValue:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onFocus:[Function,Array],onScroll:[Function,Array],onSearch:[Function,Array],onUpdateShow:[Function,Array],"onUpdate:show":[Function,Array],displayDirective:{type:String,default:`show`},resetMenuOnOptionsChange:{type:Boolean,default:!0},status:String,showCheckmark:{type:Boolean,default:!0},scrollbarProps:Object,onChange:[Function,Array],items:Array}),slots:Object,setup(t){let{mergedClsPrefixRef:n,mergedBorderedRef:r,namespaceRef:i,inlineThemeDisabled:a,mergedComponentPropsRef:o}=C(t),s=j(`Select`,`-select`,ft,dt,t,n),c=e(t.defaultValue),l=ue(g(t,`value`),c),d=e(!1),f=e(``),m=ye(t,[`items`,`options`]),h=e([]),_=e([]),v=p(()=>_.value.concat(h.value).concat(m.value)),y=p(()=>{let{filter:e}=t;if(e)return e;let{labelField:n,valueField:r}=t;return(e,t)=>{if(!t)return!1;let i=t[n];if(typeof i==`string`)return ot(e,i);let a=t[r];return typeof a==`string`?ot(e,a):typeof a==`number`?ot(e,String(a)):!1}}),x=p(()=>{if(t.remote)return m.value;{let{value:e}=v,{value:n}=f;return!n.length||!t.filterable?e:ct(e,y.value,n,t.childrenField)}}),w=p(()=>{let{valueField:e,childrenField:n}=t,r=st(e,n);return ie(x.value,r)}),T=p(()=>lt(v.value,t.valueField,t.childrenField)),E=e(!1),O=ue(g(t,`show`),E),k=e(null),A=e(null),M=e(null),{localeRef:N}=fe(`Select`),P=p(()=>t.placeholder??N.value.placeholder),F=[],I=e(new Map),L=p(()=>{let{fallbackOption:e}=t;if(e===void 0){let{labelField:e,valueField:n}=t;return t=>({[e]:String(t),[n]:t})}return e===!1?!1:t=>Object.assign(e(t),{value:t})});function R(e){let n=t.remote,{value:r}=I,{value:i}=T,{value:a}=L,o=[];return e.forEach(e=>{if(i.has(e))o.push(i.get(e));else if(n&&r.has(e))o.push(r.get(e));else if(a){let t=a(e);t&&o.push(t)}}),o}let z=p(()=>{if(t.multiple){let{value:e}=l;return Array.isArray(e)?R(e):[]}return null}),B=p(()=>{let{value:e}=l;return!t.multiple&&!Array.isArray(e)?e===null?null:R([e])[0]||null:null}),H=ee(t,{mergedSize:e=>{let{size:n}=t;if(n)return n;let{mergedSize:r}=e||{};return r?.value?r.value:o?.value?.Select?.size||`medium`}}),{mergedSizeRef:te,mergedDisabledRef:U,mergedStatusRef:W}=H;function G(e,n){let{onChange:r,"onUpdate:value":i,onUpdateValue:a}=t,{nTriggerFormChange:o,nTriggerFormInput:s}=H;r&&S(r,e,n),a&&S(a,e,n),i&&S(i,e,n),c.value=e,o(),s()}function K(e){let{onBlur:n}=t,{nTriggerFormBlur:r}=H;n&&S(n,e),r()}function q(){let{onClear:e}=t;e&&S(e)}function J(e){let{onFocus:n,showOnFocus:r}=t,{nTriggerFormFocus:i}=H;n&&S(n,e),i(),r&&X()}function Y(e){let{onSearch:n}=t;n&&S(n,e)}function ae(e){let{onScroll:n}=t;n&&S(n,e)}function oe(){var e;let{remote:n,multiple:r}=t;if(n){let{value:n}=I;if(r){let{valueField:r}=t;(e=z.value)==null||e.forEach(e=>{n.set(e[r],e)})}else{let e=B.value;e&&n.set(e[t.valueField],e)}}}function se(e){let{onUpdateShow:n,"onUpdate:show":r}=t;n&&S(n,e),r&&S(r,e),E.value=e}function X(){U.value||(se(!0),E.value=!0,t.filterable&&$())}function Z(){se(!1)}function le(){f.value=``,_.value=F}let Q=e(!1);function de(){t.filterable&&(Q.value=!0)}function pe(){t.filterable&&(Q.value=!1,O.value||le())}function me(){U.value||(O.value?t.filterable?$():Z():X())}function he(e){(M.value?.selfRef)?.contains(e.relatedTarget)||(d.value=!1,K(e),Z())}function ge(e){J(e),d.value=!0}function _e(){d.value=!0}function ve(e){k.value?.$el.contains(e.relatedTarget)||(d.value=!1,K(e),Z())}function be(){var e;(e=k.value)==null||e.focus(),Z()}function xe(e){O.value&&(k.value?.$el.contains(ce(e))||Z())}function Se(e){if(!Array.isArray(e))return[];if(L.value)return Array.from(e);{let{remote:n}=t,{value:r}=T;if(n){let{value:t}=I;return e.filter(e=>r.has(e)||t.has(e))}else return e.filter(e=>r.has(e))}}function Ce(e){we(e.rawNode)}function we(e){if(U.value)return;let{tag:n,remote:r,clearFilterAfterSelect:i,valueField:a}=t;if(n&&!r){let{value:e}=_,t=e[0]||null;if(t){let e=h.value;e.length?e.push(t):h.value=[t],_.value=F}}if(r&&I.value.set(e[a],e),t.multiple){let t=Se(l.value),o=t.findIndex(t=>t===e[a]);if(~o){if(t.splice(o,1),n&&!r){let t=Te(e[a]);~t&&(h.value.splice(t,1),i&&(f.value=``))}}else t.push(e[a]),i&&(f.value=``);G(t,R(t))}else{if(n&&!r){let t=Te(e[a]);~t?h.value=[h.value[t]]:h.value=F}je(),Z(),G(e[a],e)}}function Te(e){return h.value.findIndex(n=>n[t.valueField]===e)}function Ee(e){O.value||X();let{value:n}=e.target;f.value=n;let{tag:r,remote:i}=t;if(Y(n),r&&!i){if(!n){_.value=F;return}let{onCreate:e}=t,r=e?e(n):{[t.labelField]:n,[t.valueField]:n},{valueField:i,labelField:a}=t;m.value.some(e=>e[i]===r[i]||e[a]===r[a])||h.value.some(e=>e[i]===r[i]||e[a]===r[a])?_.value=F:_.value=[r]}}function De(e){e.stopPropagation();let{multiple:n,tag:r,remote:i,clearCreatedOptionsOnClear:a}=t;!n&&t.filterable&&Z(),r&&!i&&a&&(h.value=F),q(),n?G([],[]):G(null,null)}function Oe(e){!V(e,`action`)&&!V(e,`empty`)&&!V(e,`header`)&&e.preventDefault()}function ke(e){ae(e)}function Ae(e){var n,r,i;if(!t.keyboard){e.preventDefault();return}switch(e.key){case` `:if(t.filterable)break;e.preventDefault();case`Enter`:if(!k.value?.isComposing){if(O.value){let e=M.value?.getPendingTmNode();e?Ce(e):t.filterable||(Z(),je())}else if(X(),t.tag&&Q.value){let e=_.value[0];if(e){let n=e[t.valueField],{value:r}=l;t.multiple&&Array.isArray(r)&&r.includes(n)||we(e)}}}e.preventDefault();break;case`ArrowUp`:if(e.preventDefault(),t.loading)return;O.value&&((n=M.value)==null||n.prev());break;case`ArrowDown`:if(e.preventDefault(),t.loading)return;O.value?(r=M.value)==null||r.next():X();break;case`Escape`:O.value&&(re(e),Z()),(i=k.value)==null||i.focus();break}}function je(){var e;(e=k.value)==null||e.focus()}function $(){var e;(e=k.value)==null||e.focusInput()}function Me(){var e;O.value&&((e=A.value)==null||e.syncPosition())}oe(),u(g(t,`options`),oe);let Ne={focus:()=>{var e;(e=k.value)==null||e.focus()},focusInput:()=>{var e;(e=k.value)==null||e.focusInput()},blur:()=>{var e;(e=k.value)==null||e.blur()},blurInput:()=>{var e;(e=k.value)==null||e.blurInput()}},Pe=p(()=>{let{self:{menuBoxShadow:e}}=s.value;return{"--n-menu-box-shadow":e}}),Fe=a?b(`select`,void 0,Pe,t):void 0;return Object.assign(Object.assign({},Ne),{mergedStatus:W,mergedClsPrefix:n,mergedBordered:r,namespace:i,treeMate:w,isMounted:D(),triggerRef:k,menuRef:M,pattern:f,uncontrolledShow:E,mergedShow:O,adjustedTo:ne(t),uncontrolledValue:c,mergedValue:l,followerRef:A,localizedPlaceholder:P,selectedOption:B,selectedOptions:z,mergedSize:te,mergedDisabled:U,focused:d,activeWithoutMenuOpen:Q,inlineThemeDisabled:a,onTriggerInputFocus:de,onTriggerInputBlur:pe,handleTriggerOrMenuResize:Me,handleMenuFocus:_e,handleMenuBlur:ve,handleMenuTabOut:be,handleTriggerClick:me,handleToggle:Ce,handleDeleteOption:we,handlePatternInput:Ee,handleClear:De,handleTriggerBlur:he,handleTriggerFocus:ge,handleKeydown:Ae,handleMenuAfterLeave:le,handleMenuClickOutside:xe,handleMenuScroll:ke,handleMenuKeydown:Ae,handleMenuMousedown:Oe,mergedTheme:s,cssVars:a?void 0:Pe,themeClass:Fe?.themeClass,onRender:Fe?.onRender})},render(){return v(`div`,{class:`${this.mergedClsPrefix}-select`},v(se,null,{default:()=>[v(B,null,{default:()=>v(rt,{ref:`triggerRef`,inlineThemeDisabled:this.inlineThemeDisabled,status:this.mergedStatus,inputProps:this.inputProps,clsPrefix:this.mergedClsPrefix,showArrow:this.showArrow,maxTagCount:this.maxTagCount,ellipsisTagPopoverProps:this.ellipsisTagPopoverProps,bordered:this.mergedBordered,active:this.activeWithoutMenuOpen||this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,renderTag:this.renderTag,renderLabel:this.renderLabel,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,labelField:this.labelField,valueField:this.valueField,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,loading:this.loading,focused:this.focused,onClick:this.handleTriggerClick,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onClear:this.handleClear,onBlur:this.handleTriggerBlur,onFocus:this.handleTriggerFocus,onKeydown:this.handleKeydown,onPatternBlur:this.onTriggerInputBlur,onPatternFocus:this.onTriggerInputFocus,onResize:this.handleTriggerOrMenuResize,ignoreComposition:this.ignoreComposition},{arrow:()=>{var e;return[(e=this.$slots).arrow?.call(e)]}})}),v(W,{ref:`followerRef`,show:this.mergedShow,to:this.adjustedTo,teleportDisabled:this.adjustedTo===ne.tdkey,containerClass:this.namespace,width:this.consistentMenuWidth?`target`:void 0,minWidth:`target`,placement:this.placement},{default:()=>v(m,{name:`fade-in-scale-up-transition`,appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var e;return this.mergedShow||this.displayDirective===`show`?((e=this.onRender)==null||e.call(this),d(v(Qe,Object.assign({},this.menuProps,{ref:`menuRef`,onResize:this.handleTriggerOrMenuResize,inlineThemeDisabled:this.inlineThemeDisabled,virtualScroll:this.consistentMenuWidth&&this.virtualScroll,class:[`${this.mergedClsPrefix}-select-menu`,this.themeClass,this.menuProps?.class],clsPrefix:this.mergedClsPrefix,focusable:!0,labelField:this.labelField,valueField:this.valueField,autoPending:!0,nodeProps:this.nodeProps,theme:this.mergedTheme.peers.InternalSelectMenu,themeOverrides:this.mergedTheme.peerOverrides.InternalSelectMenu,treeMate:this.treeMate,multiple:this.multiple,size:this.menuSize,renderOption:this.renderOption,renderLabel:this.renderLabel,value:this.mergedValue,style:[this.menuProps?.style,this.cssVars],onToggle:this.handleToggle,onScroll:this.handleMenuScroll,onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onTabOut:this.handleMenuTabOut,onMousedown:this.handleMenuMousedown,show:this.mergedShow,showCheckmark:this.showCheckmark,resetMenuOnOptionsChange:this.resetMenuOnOptionsChange,scrollbarProps:this.scrollbarProps}),{empty:()=>{var e;return[(e=this.$slots).empty?.call(e)]},header:()=>{var e;return[(e=this.$slots).header?.call(e)]},action:()=>{var e;return[(e=this.$slots).action?.call(e)]}}),this.displayDirective===`show`?[[h,this.mergedShow],[U,this.handleMenuClickOutside,void 0,{capture:!0}]]:[[U,this.handleMenuClickOutside,void 0,{capture:!0}]])):null}})})]}))}});export{pt as t};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import{$ as e,I as t,S as n,_ as r,ct as i,h as a,m as o,rt as s,v as c,w as l,z as u}from"./vue.runtime.esm-bundler-BoqZ7fRe.js";import{n as d}from"./pinia-B4dETPKk.js";import{B as f,J as p,V as m,W as h,dt as g,ft as _,i as v,l as y,lt as b,nt as x,o as S,ot as C,q as w,r as T,s as E,st as D,t as O,ut as k,z as A}from"./_plugin-vue_export-helper-C7dadZ10.js";import{g as j,x as M,y as N}from"./Suffix-CKUJBJSi.js";import{n as P}from"./client-D-w1KhaU.js";var F={buttonHeightSmall:`14px`,buttonHeightMedium:`18px`,buttonHeightLarge:`22px`,buttonWidthSmall:`14px`,buttonWidthMedium:`18px`,buttonWidthLarge:`22px`,buttonWidthPressedSmall:`20px`,buttonWidthPressedMedium:`24px`,buttonWidthPressedLarge:`28px`,railHeightSmall:`18px`,railHeightMedium:`22px`,railHeightLarge:`26px`,railWidthSmall:`32px`,railWidthMedium:`40px`,railWidthLarge:`48px`};function I(e){let{primaryColor:t,opacityDisabled:n,borderRadius:r,textColor3:i}=e;return Object.assign(Object.assign({},F),{iconColor:i,textColor:`white`,loadingColor:t,opacityDisabled:n,railColor:`rgba(0, 0, 0, .14)`,railColorActive:t,buttonBoxShadow:`0 1px 4px 0 rgba(0, 0, 0, 0.3), inset 0 0 1px 0 rgba(0, 0, 0, 0.05)`,buttonColor:`#FFF`,railBorderRadiusSmall:r,railBorderRadiusMedium:r,railBorderRadiusLarge:r,buttonBorderRadiusSmall:r,buttonBorderRadiusMedium:r,buttonBorderRadiusLarge:r,boxShadowFocus:`0 0 0 2px ${x(t,{alpha:.2})}`})}var L={name:`Switch`,common:T,self:I},R=D(`switch`,`
|
|
2
|
-
height: var(--n-height);
|
|
3
|
-
min-width: var(--n-width);
|
|
4
|
-
vertical-align: middle;
|
|
5
|
-
user-select: none;
|
|
6
|
-
-webkit-user-select: none;
|
|
7
|
-
display: inline-flex;
|
|
8
|
-
outline: none;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
align-items: center;
|
|
11
|
-
`,[b(`children-placeholder`,`
|
|
12
|
-
height: var(--n-rail-height);
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
overflow: hidden;
|
|
16
|
-
pointer-events: none;
|
|
17
|
-
visibility: hidden;
|
|
18
|
-
`),b(`rail-placeholder`,`
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-wrap: none;
|
|
21
|
-
`),b(`button-placeholder`,`
|
|
22
|
-
width: calc(1.75 * var(--n-rail-height));
|
|
23
|
-
height: var(--n-rail-height);
|
|
24
|
-
`),D(`base-loading`,`
|
|
25
|
-
position: absolute;
|
|
26
|
-
top: 50%;
|
|
27
|
-
left: 50%;
|
|
28
|
-
transform: translateX(-50%) translateY(-50%);
|
|
29
|
-
font-size: calc(var(--n-button-width) - 4px);
|
|
30
|
-
color: var(--n-loading-color);
|
|
31
|
-
transition: color .3s var(--n-bezier);
|
|
32
|
-
`,[S({left:`50%`,top:`50%`,originalTransform:`translateX(-50%) translateY(-50%)`})]),b(`checked, unchecked`,`
|
|
33
|
-
transition: color .3s var(--n-bezier);
|
|
34
|
-
color: var(--n-text-color);
|
|
35
|
-
box-sizing: border-box;
|
|
36
|
-
position: absolute;
|
|
37
|
-
white-space: nowrap;
|
|
38
|
-
top: 0;
|
|
39
|
-
bottom: 0;
|
|
40
|
-
display: flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
line-height: 1;
|
|
43
|
-
`),b(`checked`,`
|
|
44
|
-
right: 0;
|
|
45
|
-
padding-right: calc(1.25 * var(--n-rail-height) - var(--n-offset));
|
|
46
|
-
`),b(`unchecked`,`
|
|
47
|
-
left: 0;
|
|
48
|
-
justify-content: flex-end;
|
|
49
|
-
padding-left: calc(1.25 * var(--n-rail-height) - var(--n-offset));
|
|
50
|
-
`),C(`&:focus`,[b(`rail`,`
|
|
51
|
-
box-shadow: var(--n-box-shadow-focus);
|
|
52
|
-
`)]),k(`round`,[b(`rail`,`border-radius: calc(var(--n-rail-height) / 2);`,[b(`button`,`border-radius: calc(var(--n-button-height) / 2);`)])]),g(`disabled`,[g(`icon`,[k(`rubber-band`,[k(`pressed`,[b(`rail`,[b(`button`,`max-width: var(--n-button-width-pressed);`)])]),b(`rail`,[C(`&:active`,[b(`button`,`max-width: var(--n-button-width-pressed);`)])]),k(`active`,[k(`pressed`,[b(`rail`,[b(`button`,`left: calc(100% - var(--n-offset) - var(--n-button-width-pressed));`)])]),b(`rail`,[C(`&:active`,[b(`button`,`left: calc(100% - var(--n-offset) - var(--n-button-width-pressed));`)])])])])])]),k(`active`,[b(`rail`,[b(`button`,`left: calc(100% - var(--n-button-width) - var(--n-offset))`)])]),b(`rail`,`
|
|
53
|
-
overflow: hidden;
|
|
54
|
-
height: var(--n-rail-height);
|
|
55
|
-
min-width: var(--n-rail-width);
|
|
56
|
-
border-radius: var(--n-rail-border-radius);
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
position: relative;
|
|
59
|
-
transition:
|
|
60
|
-
opacity .3s var(--n-bezier),
|
|
61
|
-
background .3s var(--n-bezier),
|
|
62
|
-
box-shadow .3s var(--n-bezier);
|
|
63
|
-
background-color: var(--n-rail-color);
|
|
64
|
-
`,[b(`button-icon`,`
|
|
65
|
-
color: var(--n-icon-color);
|
|
66
|
-
transition: color .3s var(--n-bezier);
|
|
67
|
-
font-size: calc(var(--n-button-height) - 4px);
|
|
68
|
-
position: absolute;
|
|
69
|
-
left: 0;
|
|
70
|
-
right: 0;
|
|
71
|
-
top: 0;
|
|
72
|
-
bottom: 0;
|
|
73
|
-
display: flex;
|
|
74
|
-
justify-content: center;
|
|
75
|
-
align-items: center;
|
|
76
|
-
line-height: 1;
|
|
77
|
-
`,[S()]),b(`button`,`
|
|
78
|
-
align-items: center;
|
|
79
|
-
top: var(--n-offset);
|
|
80
|
-
left: var(--n-offset);
|
|
81
|
-
height: var(--n-button-height);
|
|
82
|
-
width: var(--n-button-width-pressed);
|
|
83
|
-
max-width: var(--n-button-width);
|
|
84
|
-
border-radius: var(--n-button-border-radius);
|
|
85
|
-
background-color: var(--n-button-color);
|
|
86
|
-
box-shadow: var(--n-button-box-shadow);
|
|
87
|
-
box-sizing: border-box;
|
|
88
|
-
cursor: inherit;
|
|
89
|
-
content: "";
|
|
90
|
-
position: absolute;
|
|
91
|
-
transition:
|
|
92
|
-
background-color .3s var(--n-bezier),
|
|
93
|
-
left .3s var(--n-bezier),
|
|
94
|
-
opacity .3s var(--n-bezier),
|
|
95
|
-
max-width .3s var(--n-bezier),
|
|
96
|
-
box-shadow .3s var(--n-bezier);
|
|
97
|
-
`)]),k(`active`,[b(`rail`,`background-color: var(--n-rail-color-active);`)]),k(`loading`,[b(`rail`,`
|
|
98
|
-
cursor: wait;
|
|
99
|
-
`)]),k(`disabled`,[b(`rail`,`
|
|
100
|
-
cursor: not-allowed;
|
|
101
|
-
opacity: .5;
|
|
102
|
-
`)])]),z=Object.assign(Object.assign({},y.props),{size:String,value:{type:[String,Number,Boolean],default:void 0},loading:Boolean,defaultValue:{type:[String,Number,Boolean],default:!1},disabled:{type:Boolean,default:void 0},round:{type:Boolean,default:!0},"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],checkedValue:{type:[String,Number,Boolean],default:!0},uncheckedValue:{type:[String,Number,Boolean],default:!1},railStyle:Function,rubberBand:{type:Boolean,default:!0},spinProps:Object,onChange:[Function,Array]}),B,V=n({name:`Switch`,props:z,slots:Object,setup(t){B===void 0&&(B=typeof CSS<`u`?CSS.supports===void 0?!1:CSS.supports(`width`,`max(1px)`):!0);let{mergedClsPrefixRef:n,inlineThemeDisabled:r,mergedComponentPropsRef:i}=m(t),a=y(`Switch`,`-switch`,R,L,t,n),c=A(t,{mergedSize(e){return t.size===void 0?e?e.mergedSize.value:i?.value?.Switch?.size||`medium`:t.size}}),{mergedSizeRef:l,mergedDisabledRef:u}=c,d=e(t.defaultValue),h=j(s(t,`value`),d),g=o(()=>h.value===t.checkedValue),v=e(!1),b=e(!1),x=o(()=>{let{railStyle:e}=t;if(e)return e({focused:b.value,checked:g.value})});function S(e){let{"onUpdate:value":n,onChange:r,onUpdateValue:i}=t,{nTriggerFormInput:a,nTriggerFormChange:o}=c;n&&p(n,e),i&&p(i,e),r&&p(r,e),d.value=e,a(),o()}function C(){let{nTriggerFormFocus:e}=c;e()}function w(){let{nTriggerFormBlur:e}=c;e()}function T(){t.loading||u.value||(h.value===t.checkedValue?S(t.uncheckedValue):S(t.checkedValue))}function E(){b.value=!0,C()}function D(){b.value=!1,w(),v.value=!1}function O(e){t.loading||u.value||e.key===` `&&(h.value===t.checkedValue?S(t.uncheckedValue):S(t.checkedValue),v.value=!1)}function k(e){t.loading||u.value||e.key===` `&&(e.preventDefault(),v.value=!0)}let P=o(()=>{let{value:e}=l,{self:{opacityDisabled:t,railColor:n,railColorActive:r,buttonBoxShadow:i,buttonColor:o,boxShadowFocus:s,loadingColor:c,textColor:u,iconColor:d,[_(`buttonHeight`,e)]:f,[_(`buttonWidth`,e)]:p,[_(`buttonWidthPressed`,e)]:m,[_(`railHeight`,e)]:h,[_(`railWidth`,e)]:g,[_(`railBorderRadius`,e)]:v,[_(`buttonBorderRadius`,e)]:y},common:{cubicBezierEaseInOut:b}}=a.value,x,S,C;return B?(x=`calc((${h} - ${f}) / 2)`,S=`max(${h}, ${f})`,C=`max(${g}, calc(${g} + ${f} - ${h}))`):(x=M((N(h)-N(f))/2),S=M(Math.max(N(h),N(f))),C=N(h)>N(f)?g:M(N(g)+N(f)-N(h))),{"--n-bezier":b,"--n-button-border-radius":y,"--n-button-box-shadow":i,"--n-button-color":o,"--n-button-width":p,"--n-button-width-pressed":m,"--n-button-height":f,"--n-height":S,"--n-offset":x,"--n-opacity-disabled":t,"--n-rail-border-radius":v,"--n-rail-color":n,"--n-rail-color-active":r,"--n-rail-height":h,"--n-rail-width":g,"--n-width":C,"--n-box-shadow-focus":s,"--n-loading-color":c,"--n-text-color":u,"--n-icon-color":d}}),F=r?f(`switch`,o(()=>l.value[0]),P,t):void 0;return{handleClick:T,handleBlur:D,handleFocus:E,handleKeyup:O,handleKeydown:k,mergedRailStyle:x,pressed:v,mergedClsPrefix:n,mergedValue:h,checked:g,mergedDisabled:u,cssVars:r?void 0:P,themeClass:F?.themeClass,onRender:F?.onRender}},render(){let{mergedClsPrefix:e,mergedDisabled:t,checked:n,mergedRailStyle:r,onRender:i,$slots:a}=this;i?.();let{checked:o,unchecked:s,icon:c,"checked-icon":u,"unchecked-icon":d}=a,f=!(h(c)&&h(u)&&h(d));return l(`div`,{role:`switch`,"aria-checked":n,class:[`${e}-switch`,this.themeClass,f&&`${e}-switch--icon`,n&&`${e}-switch--active`,t&&`${e}-switch--disabled`,this.round&&`${e}-switch--round`,this.loading&&`${e}-switch--loading`,this.pressed&&`${e}-switch--pressed`,this.rubberBand&&`${e}-switch--rubber-band`],tabindex:this.mergedDisabled?void 0:0,style:this.cssVars,onClick:this.handleClick,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyup:this.handleKeyup,onKeydown:this.handleKeydown},l(`div`,{class:`${e}-switch__rail`,"aria-hidden":`true`,style:r},w(o,t=>w(s,n=>t||n?l(`div`,{"aria-hidden":!0,class:`${e}-switch__children-placeholder`},l(`div`,{class:`${e}-switch__rail-placeholder`},l(`div`,{class:`${e}-switch__button-placeholder`}),t),l(`div`,{class:`${e}-switch__rail-placeholder`},l(`div`,{class:`${e}-switch__button-placeholder`}),n)):null)),l(`div`,{class:`${e}-switch__button`},w(c,t=>w(u,n=>w(d,r=>l(E,null,{default:()=>this.loading?l(v,Object.assign({key:`loading`,clsPrefix:e,strokeWidth:20},this.spinProps)):this.checked&&(n||t)?l(`div`,{class:`${e}-switch__button-icon`,key:n?`checked-icon`:`icon`},n||t):!this.checked&&(r||t)?l(`div`,{class:`${e}-switch__button-icon`,key:r?`unchecked-icon`:`icon`},r||t):null})))),w(o,t=>t&&l(`div`,{key:`checked`,class:`${e}-switch__checked`},t)),w(s,t=>t&&l(`div`,{key:`unchecked`,class:`${e}-switch__unchecked`},t)))))}});async function H(e){return P(`/api/config${e?`?sections=${e.join(`,`)}`:``}`)}async function U(e,t){await P(`/api/config`,{method:`PUT`,body:JSON.stringify({section:e,values:t})})}async function W(e,t){await P(`/api/config/credentials`,{method:`PUT`,body:JSON.stringify({platform:e,values:t})})}async function G(){return P(`/api/weixin/qrcode`)}async function K(e){return P(`/api/weixin/qrcode/status?qrcode=${encodeURIComponent(e)}`)}async function q(e){await P(`/api/weixin/save`,{method:`POST`,body:JSON.stringify(e)})}var J=d(`settings`,()=>{let t=e(!1),n=e({}),r=e({}),i=e({}),a=e({}),o=e({}),s=e({}),c=e({}),l=e({}),u=e({}),d=e({}),f=e({}),p=e({}),m=e({}),h=e({}),g=e({});async function _(){t.value=!0;try{let e=await H();n.value=e.display||{},r.value=e.agent||{},i.value=e.memory||{},a.value=e.session_reset||{},o.value=e.privacy||{},s.value=e.telegram||{},c.value=e.discord||{},l.value=e.slack||{},u.value=e.whatsapp||{},d.value=e.matrix||{},f.value=e.wecom||{},p.value=e.feishu||{},m.value=e.dingtalk||{},h.value=e.weixin||{},g.value=e.platforms||{}}catch(e){console.error(`Failed to fetch settings:`,e)}finally{t.value=!1}}async function v(e,t){switch(await U(e,t),e){case`display`:n.value={...n.value,...t};break;case`agent`:r.value={...r.value,...t};break;case`memory`:i.value={...i.value,...t};break;case`session_reset`:a.value={...a.value,...t};break;case`privacy`:o.value={...o.value,...t};break;case`telegram`:s.value={...s.value,...t};break;case`discord`:c.value={...c.value,...t};break;case`slack`:l.value={...l.value,...t};break;case`whatsapp`:u.value={...u.value,...t};break;case`matrix`:d.value={...d.value,...t};break;case`wechat`:case`wecom`:f.value={...f.value,...t};break;case`feishu`:p.value={...p.value,...t};break;case`dingtalk`:m.value={...m.value,...t};break;case`weixin`:h.value={...h.value,...t};break;case`platforms`:for(let[e,n]of Object.entries(t))g.value={...g.value,[e]:{...g.value[e]||{},...n}};break}}return{loading:t,display:n,agent:r,memory:i,sessionReset:a,privacy:o,telegram:s,discord:c,slack:l,whatsapp:u,matrix:d,wecom:f,feishu:p,dingtalk:m,weixin:h,platforms:g,fetchSettings:_,saveSection:v}}),Y={class:`setting-row`},X={class:`setting-info`},Z={class:`setting-label`},Q={key:0,class:`setting-hint`},$={class:`setting-control`},ee=O(n({__name:`SettingRow`,props:{label:{},hint:{}},setup(e){return(n,o)=>(t(),c(`div`,Y,[a(`div`,X,[a(`label`,Z,i(e.label),1),e.hint?(t(),c(`p`,Q,i(e.hint),1)):r(``,!0)]),a(`div`,$,[u(n.$slots,`default`,{},void 0,!0)])]))}}),[[`__scopeId`,`data-v-9295f7e8`]]);export{W as a,K as i,J as n,q as o,G as r,V as s,ee as t};
|