import{defineComponent as $,shallowRef as h,ref as c,watch as r,onBeforeUnmount as x,nextTick as R,createVNode as u}from"vue";import f from"../../../_util/classNames.mjs";import{useInjectPanel as w}from"../../PanelContext.mjs";import{scrollTo as v,waitElementReady as k}from"../../utils/uiUtil.mjs";const N=$({name:"TimeUnitColumn",props:["prefixCls","units","onSelect","value","active","hideDisabledOptions"],setup(a){const{open:t}=w(),o=h(null),i=c(new Map),n=c();return r(()=>a.value,()=>{const e=i.value.get(a.value);e&&t.value!==!1&&v(o.value,e.offsetTop,120)}),x(()=>{n.value?.()}),r(t,()=>{n.value?.(),R(()=>{if(t.value){const e=i.value.get(a.value);e&&(n.value=k(e,()=>{v(o.value,e.offsetTop,0)}))}})},{immediate:!0,flush:"post"}),()=>{const{prefixCls:e,units:m,onSelect:d,value:p,active:b,hideDisabledOptions:C}=a,s=`${e}-cell`;return u("ul",{class:f(`${e}-column`,{[`${e}-column-active`]:b}),ref:o,style:{position:"relative"}},[m.map(l=>C&&l.disabled?null:u("li",{key:l.value,ref:T=>{i.value.set(l.value,T)},class:f(s,{[`${s}-disabled`]:l.disabled,[`${s}-selected`]:p===l.value}),onClick:()=>{l.disabled||d(l.value)}},[u("div",{class:`${s}-inner`},[l.label])]))])}}});export{N as default};
