Overflow.d.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import * as React from 'react';
  2. import type { ComponentType } from './RawItem';
  3. import RawItem from './RawItem';
  4. declare const RESPONSIVE: "responsive";
  5. declare const INVALIDATE: "invalidate";
  6. export { OverflowContext } from './context';
  7. export type { ComponentType } from './RawItem';
  8. export interface OverflowProps<ItemType> extends React.HTMLAttributes<any> {
  9. prefixCls?: string;
  10. className?: string;
  11. style?: React.CSSProperties;
  12. data?: ItemType[];
  13. itemKey?: React.Key | ((item: ItemType) => React.Key);
  14. /** Used for `responsive`. It will limit render node to avoid perf issue */
  15. itemWidth?: number;
  16. renderItem?: (item: ItemType, info: {
  17. index: number;
  18. }) => React.ReactNode;
  19. /** @private Do not use in your production. Render raw node that need wrap Item by developer self */
  20. renderRawItem?: (item: ItemType, index: number) => React.ReactElement;
  21. maxCount?: number | typeof RESPONSIVE | typeof INVALIDATE;
  22. renderRest?: React.ReactNode | ((omittedItems: ItemType[]) => React.ReactNode);
  23. /** @private Do not use in your production. Render raw node that need wrap Item by developer self */
  24. renderRawRest?: (omittedItems: ItemType[]) => React.ReactElement;
  25. suffix?: React.ReactNode;
  26. component?: ComponentType;
  27. itemComponent?: ComponentType;
  28. /** @private This API may be refactor since not well design */
  29. onVisibleChange?: (visibleCount: number) => void;
  30. /** When set to `full`, ssr will render full items by default and remove at client side */
  31. ssr?: 'full';
  32. }
  33. type ForwardOverflowType = <ItemType = any>(props: React.PropsWithChildren<OverflowProps<ItemType>> & {
  34. ref?: React.Ref<HTMLDivElement>;
  35. }) => React.ReactElement;
  36. type FilledOverflowType = ForwardOverflowType & {
  37. Item: typeof RawItem;
  38. RESPONSIVE: typeof RESPONSIVE;
  39. /** Will work as normal `component`. Skip patch props like `prefixCls`. */
  40. INVALIDATE: typeof INVALIDATE;
  41. };
  42. declare const _default: FilledOverflowType;
  43. export default _default;