You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
773 B

var s=(f,l,e)=>new Promise((a,c)=>{var r=t=>{try{o(e.next(t))}catch(i){c(i)}},n=t=>{try{o(e.throw(t))}catch(i){c(i)}},o=t=>t.done?a(t.value):Promise.resolve(t.value).then(r,n);o((e=e.apply(f,l)).next())});import{u,J as S}from"./index-f4658ae7.js";function m(f,l){let e;function a(r){return s(this,null,function*(){var t;const{id:n}=r,o=e==null?void 0:e.querySelector(`[data-row-key="${n}"]`);yield S(),e==null||e.scrollTo({top:(t=o==null?void 0:o.offsetTop)!=null?t:0,behavior:"smooth"})})}function c(r){const n=u(f);if(!n)return;const o=n.$el;if(!o||!e&&(e=o.querySelector(".ant-table-body"),!e))return;const t=u(l);if(t)if(r==="top")a(t[0]);else if(r==="bottom")a(t[t.length-1]);else{const i=t.find(T=>T.id===r);i&&a(i)}}return{scrollTo:c}}export{m as useTableScrollTo};