index.d.ts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import type { ComponentPublicInstance, CSSProperties, ExtractPropTypes, PropType } from 'vue';
  2. declare function getDefaultTarget(): Window & typeof globalThis;
  3. declare enum AffixStatus {
  4. None = 0,
  5. Prepare = 1
  6. }
  7. export interface AffixState {
  8. affixStyle?: CSSProperties;
  9. placeholderStyle?: CSSProperties;
  10. status: AffixStatus;
  11. lastAffix: boolean;
  12. prevTarget: Window | HTMLElement | null;
  13. }
  14. export declare const affixProps: () => {
  15. /**
  16. * 距离窗口顶部达到指定偏移量后触发
  17. */
  18. offsetTop: NumberConstructor;
  19. /** 距离窗口底部达到指定偏移量后触发 */
  20. offsetBottom: NumberConstructor;
  21. /** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
  22. target: {
  23. type: PropType<() => Window | HTMLElement | null>;
  24. default: typeof getDefaultTarget;
  25. };
  26. prefixCls: StringConstructor;
  27. /** 固定状态改变时触发的回调函数 */
  28. onChange: PropType<(lastAffix: boolean) => void>;
  29. onTestUpdatePosition: PropType<() => void>;
  30. };
  31. export type AffixProps = Partial<ExtractPropTypes<ReturnType<typeof affixProps>>>;
  32. export type AffixEmits = {
  33. change: (lastAffix: boolean) => void;
  34. testUpdatePosition: () => void;
  35. };
  36. export type AffixExpose = {
  37. updatePosition: (...args: any[]) => void;
  38. lazyUpdatePosition: (...args: any[]) => void;
  39. };
  40. export type AffixInstance = ComponentPublicInstance<AffixProps, AffixExpose>;
  41. declare const _default: {
  42. new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<ExtractPropTypes<{
  43. /**
  44. * 距离窗口顶部达到指定偏移量后触发
  45. */
  46. offsetTop: NumberConstructor;
  47. /** 距离窗口底部达到指定偏移量后触发 */
  48. offsetBottom: NumberConstructor;
  49. /** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
  50. target: {
  51. type: PropType<() => Window | HTMLElement>;
  52. default: typeof getDefaultTarget;
  53. };
  54. prefixCls: StringConstructor;
  55. /** 固定状态改变时触发的回调函数 */
  56. onChange: PropType<(lastAffix: boolean) => void>;
  57. onTestUpdatePosition: PropType<() => void>;
  58. }>> & Readonly<{}>, () => import("../_util/type").VueNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
  59. target: () => Window | HTMLElement;
  60. }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
  61. P: {};
  62. B: {};
  63. D: {};
  64. C: {};
  65. M: {};
  66. Defaults: {};
  67. }, Readonly<ExtractPropTypes<{
  68. /**
  69. * 距离窗口顶部达到指定偏移量后触发
  70. */
  71. offsetTop: NumberConstructor;
  72. /** 距离窗口底部达到指定偏移量后触发 */
  73. offsetBottom: NumberConstructor;
  74. /** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
  75. target: {
  76. type: PropType<() => Window | HTMLElement>;
  77. default: typeof getDefaultTarget;
  78. };
  79. prefixCls: StringConstructor;
  80. /** 固定状态改变时触发的回调函数 */
  81. onChange: PropType<(lastAffix: boolean) => void>;
  82. onTestUpdatePosition: PropType<() => void>;
  83. }>> & Readonly<{}>, () => import("../_util/type").VueNode, {}, {}, {}, {
  84. target: () => Window | HTMLElement;
  85. }>;
  86. __isFragment?: never;
  87. __isTeleport?: never;
  88. __isSuspense?: never;
  89. } & import("vue").ComponentOptionsBase<Readonly<ExtractPropTypes<{
  90. /**
  91. * 距离窗口顶部达到指定偏移量后触发
  92. */
  93. offsetTop: NumberConstructor;
  94. /** 距离窗口底部达到指定偏移量后触发 */
  95. offsetBottom: NumberConstructor;
  96. /** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
  97. target: {
  98. type: PropType<() => Window | HTMLElement>;
  99. default: typeof getDefaultTarget;
  100. };
  101. prefixCls: StringConstructor;
  102. /** 固定状态改变时触发的回调函数 */
  103. onChange: PropType<(lastAffix: boolean) => void>;
  104. onTestUpdatePosition: PropType<() => void>;
  105. }>> & Readonly<{}>, () => import("../_util/type").VueNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
  106. target: () => Window | HTMLElement;
  107. }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin<any[]>;
  108. export default _default;