itemUtil.d.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * Safari has the elasticity effect which provides negative `scrollTop` value.
  3. * We should ignore it since will make scroll animation shake.
  4. */
  5. export function alignScrollTop(scrollTop: any, scrollRange: any): any;
  6. /**
  7. * Get node `offsetHeight`. We prefer node is a dom element directly.
  8. * But if not provided, downgrade to `findDOMNode` to get the real dom element.
  9. */
  10. export function getNodeHeight(node: any): any;
  11. /**
  12. * Calculate the located item absolute top with whole scroll height
  13. */
  14. export function getItemAbsoluteTop({ scrollTop, ...rest }: {
  15. [x: string]: any;
  16. scrollTop: any;
  17. }): any;
  18. /**
  19. * Calculate the located item related top with current window height
  20. */
  21. export function getItemRelativeTop({ itemIndex, itemOffsetPtg, itemElementHeights, scrollPtg, clientHeight, getItemKey, }: {
  22. itemIndex: any;
  23. itemOffsetPtg: any;
  24. itemElementHeights: any;
  25. scrollPtg: any;
  26. clientHeight: any;
  27. getItemKey: any;
  28. }): number;
  29. export function getCompareItemRelativeTop({ locatedItemRelativeTop, locatedItemIndex, compareItemIndex, startIndex, endIndex, getItemKey, itemElementHeights, }: {
  30. locatedItemRelativeTop: any;
  31. locatedItemIndex: any;
  32. compareItemIndex: any;
  33. startIndex: any;
  34. endIndex: any;
  35. getItemKey: any;
  36. itemElementHeights: any;
  37. }): any;
  38. export function getScrollPercentage({ scrollTop, scrollHeight, clientHeight }: {
  39. scrollTop: any;
  40. scrollHeight: any;
  41. clientHeight: any;
  42. }): number;
  43. export function getElementScrollPercentage(element: any): number;
  44. /**
  45. * Get display items start, end, located item index. This is pure math calculation
  46. */
  47. export function getRangeIndex(scrollPtg: any, itemCount: any, visibleCount: any): {
  48. itemIndex: number;
  49. itemOffsetPtg: number;
  50. startIndex: number;
  51. endIndex: number;
  52. };
  53. export function requireVirtual(height: any, itemHeight: any, count: any, virtual: any): boolean;
  54. /**
  55. * Our algorithm have additional one ghost item
  56. * whose index as `data.length` to simplify the calculation
  57. */
  58. export const GHOST_ITEM_KEY: "__vc_ghost_item__";