2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
|
import{_ as e,d as o,f as n,r as t,j as l,o as r,g as a,aF as i,p as d,b as s,h as u,F as c,bz as p,aN as f,bA as v,D as m,bB as g,be as b,m as w,e as h,w as y,N as I,bk as E,bl as C,i as _,a3 as F,bC as T,Y as S,bD as R,c as k,al as x,bE as B,J as O,n as $,aj as D,E as M,bF as K,ap as L,bi as P,an as N,a as G,u as A,X as z,ab as H,B as j,az as J,k as Y,ai as U,l as q,q as V,Q as W,a7 as Q,bG as X,bH as Z,$ as ee,bI as oe,v as ne,s as te}from"./index.ZCt2DURL.js";var le=e(o({inheritAttrs:!1}),[["render",function(e,o,t,l,r,a){return n(e.$slots,"default")}],["__file","collection.vue"]]);var re=e(o({name:"ElCollectionItem",inheritAttrs:!1}),[["render",function(e,o,t,l,r,a){return n(e.$slots,"default")}],["__file","collection-item.vue"]]);const ae="data-el-collection-item",ie=e=>{const o=`El${e}Collection`,n=`${o}Item`,s=Symbol(o),u=Symbol(n),c={...le,name:o,setup(){const e=t(),o=new Map;d(s,{itemMap:o,getItems:()=>{const n=a(e);if(!n)return[];const t=Array.from(n.querySelectorAll(`[${ae}]`));return[...o.values()].sort((e,o)=>t.indexOf(e.ref)-t.indexOf(o.ref))},collectionRef:e})}},p={...re,name:n,setup(e,{attrs:o}){const n=t(),c=l(s,void 0);d(u,{collectionItemRef:n}),r(()=>{const e=a(n);e&&c.itemMap.set(e,{ref:e,...o})}),i(()=>{const e=a(n);c.itemMap.delete(e)})}};return{COLLECTION_INJECTION_KEY:s,COLLECTION_ITEM_INJECTION_KEY:u,ElCollection:c,ElCollectionItem:p}},de=s({style:{type:u([String,Array,Object])},currentTabId:{type:u(String)},defaultCurrentTabId:String,loop:Boolean,dir:{type:String,values:["ltr","rtl"],default:"ltr"},orientation:{type:u(String)},onBlur:Function,onFocus:Function,onMousedown:Function}),{ElCollection:se,ElCollectionItem:ue,COLLECTION_INJECTION_KEY:ce,COLLECTION_ITEM_INJECTION_KEY:pe}=ie("RovingFocusGroup"),fe=Symbol("elRovingFocusGroup"),ve=Symbol("elRovingFocusGroupItem"),me={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"},ge=e=>{const{activeElement:o}=document;for(const n of e){if(n===o)return;if(n.focus(),o!==document.activeElement)return}},be="currentTabIdChange",we="rovingFocusGroup.entryFocus",he={bubbles:!1,cancelable:!0},ye=o({name:"ElRovingFocusGroupImpl",inheritAttrs:!1,props:de,emits:[be,"entryFocus"],setup(e,{emit:o}){var n;const r=t(null!=(n=e.currentTabId||e.defaultCurrentTabId)?n:null),i=t(!1),s=t(!1),u=t(),{getItems:b}=l(ce,void 0),w=c(()=>[{outline:"none"},e.style]),h=p(o=>{var n;null==(n=e.onMousedown)||n.call(e,o)},()=>{s.value=!0}),y=p(o=>{var n;null==(n=e.onFocus)||n.call(e,o)},e=>{const o=!a(s),{target:n,currentTarget:t}=e;if(n===t&&o&&!a(i)){const e=new Event(we,he);if(null==t||t.dispatchEvent(e),!e.defaultPrevented){const e=b().filter(e=>e.focusable),o=[e.find(e=>e.active),e.find(e=>e.id===a(r)),...e].filter(Boolean).map(e=>e.ref);ge(o)}}s.value=!1}),I=p(o=>{var n;null==(n=e.onBlur)||n.call(e,o)},()=>{i.value=!1});d(fe,{currentTabbedId:v(r),loop:f(e,"loop"),tabIndex:c(()=>a(i)?-1:0),rovingFocusGroupRef:u,rovingFocusGroupRootStyle:w,orientation:f(e,"orientation"),dir:f(e,"dir"),onItemFocus:e=>{o(be,e)},onItemShiftTab:()=>{i.value=!0},onBlur:I,onFocus:y,onMousedown:h}),m(()=>e.currentTabId,e=>{r.value=null!=e?e:null}),g(u,we,(...e)=>{o("entryFocus",...e)})}});var Ie=e(o({name:"ElRovingFocusGroup",components:{ElFocusGroupCollection:se,ElRovingFocusGroupImpl:e(ye,[["render",function(e,o,t,l,r,a){return n(e.$slots,"default")}],["__file","roving-focus-group-impl.vue"]])}}),[["render",function(e,o,t,l,r,a){const i=b("el-roving-focus-group-impl"),d=b("el-focus-group-collection");return h(),w(d,null,{default:y(()=>[I(i,E(C(e.$attrs)),{default:y(()=>[n(e.$slots,"default")]),_:3},16)]),_:3})}],["__file","roving-focus-group.vue"]]);const Ee=s({trigger:R.trigger,triggerKeys:{type:u(Array),default:()=>[S.enter,S.numpadEnter,S.space,S.down]},effect:{...F.effect,default:"light"},type:{type:u(String)},placement:{type:u(String),default:"bottom"},popperOptions:{type:u(Object),default:()=>({})},id:String,size:{type:String,default:""},splitButton:Boolean,hideOnClick:{type:Boolean,default:!0},loop:{type:Boolean,default:!0},
|