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