index.d.ts 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 declare type AffixProps = Partial<ExtractPropTypes<ReturnType<typeof affixProps>>>;
  32. export declare type AffixEmits = {
  33. change: (lastAffix: boolean) => void;
  34. testUpdatePosition: () => void;
  35. };
  36. export declare type AffixExpose = {
  37. updatePosition: (...args: any[]) => void;
  38. lazyUpdatePosition: (...args: any[]) => void;
  39. };
  40. export declare type AffixInstance = ComponentPublicInstance<AffixProps, AffixExpose>;
  41. declare const _default: {
  42. new (...args: any[]): {
  43. $: import("vue").ComponentInternalInstance;
  44. $data: {};
  45. $props: Partial<{
  46. target: () => Window | HTMLElement;
  47. }> & Omit<Readonly<ExtractPropTypes<{
  48. /**
  49. * 距离窗口顶部达到指定偏移量后触发
  50. */
  51. offsetTop: NumberConstructor;
  52. /** 距离窗口底部达到指定偏移量后触发 */
  53. offsetBottom: NumberConstructor;
  54. /** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
  55. target: {
  56. type: PropType<() => Window | HTMLElement>;
  57. default: typeof getDefaultTarget;
  58. };
  59. prefixCls: StringConstructor;
  60. /** 固定状态改变时触发的回调函数 */
  61. onChange: PropType<(lastAffix: boolean) => void>;
  62. onTestUpdatePosition: PropType<() => void>;
  63. }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "target">;
  64. $attrs: {
  65. [x: string]: unknown;
  66. };
  67. $refs: {
  68. [x: string]: unknown;
  69. };
  70. $slots: Readonly<{
  71. [name: string]: import("vue").Slot;
  72. }>;
  73. $root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
  74. $parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
  75. $emit: (event: string, ...args: any[]) => void;
  76. $el: any;
  77. $options: import("vue").ComponentOptionsBase<Readonly<ExtractPropTypes<{
  78. /**
  79. * 距离窗口顶部达到指定偏移量后触发
  80. */
  81. offsetTop: NumberConstructor;
  82. /** 距离窗口底部达到指定偏移量后触发 */
  83. offsetBottom: NumberConstructor;
  84. /** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
  85. target: {
  86. type: PropType<() => Window | HTMLElement>;
  87. default: typeof getDefaultTarget;
  88. };
  89. prefixCls: StringConstructor;
  90. /** 固定状态改变时触发的回调函数 */
  91. onChange: PropType<(lastAffix: boolean) => void>;
  92. onTestUpdatePosition: PropType<() => void>;
  93. }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
  94. target: () => Window | HTMLElement;
  95. }> & {
  96. beforeCreate?: (() => void) | (() => void)[];
  97. created?: (() => void) | (() => void)[];
  98. beforeMount?: (() => void) | (() => void)[];
  99. mounted?: (() => void) | (() => void)[];
  100. beforeUpdate?: (() => void) | (() => void)[];
  101. updated?: (() => void) | (() => void)[];
  102. activated?: (() => void) | (() => void)[];
  103. deactivated?: (() => void) | (() => void)[];
  104. beforeDestroy?: (() => void) | (() => void)[];
  105. beforeUnmount?: (() => void) | (() => void)[];
  106. destroyed?: (() => void) | (() => void)[];
  107. unmounted?: (() => void) | (() => void)[];
  108. renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
  109. renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
  110. errorCaptured?: ((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void)[];
  111. };
  112. $forceUpdate: () => void;
  113. $nextTick: typeof import("vue").nextTick;
  114. $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean>): import("vue").WatchStopHandle;
  115. } & Readonly<ExtractPropTypes<{
  116. /**
  117. * 距离窗口顶部达到指定偏移量后触发
  118. */
  119. offsetTop: NumberConstructor;
  120. /** 距离窗口底部达到指定偏移量后触发 */
  121. offsetBottom: NumberConstructor;
  122. /** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
  123. target: {
  124. type: PropType<() => Window | HTMLElement>;
  125. default: typeof getDefaultTarget;
  126. };
  127. prefixCls: StringConstructor;
  128. /** 固定状态改变时触发的回调函数 */
  129. onChange: PropType<(lastAffix: boolean) => void>;
  130. onTestUpdatePosition: PropType<() => void>;
  131. }>> & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & import("vue").ComponentCustomProperties;
  132. __isFragment?: never;
  133. __isTeleport?: never;
  134. __isSuspense?: never;
  135. } & import("vue").ComponentOptionsBase<Readonly<ExtractPropTypes<{
  136. /**
  137. * 距离窗口顶部达到指定偏移量后触发
  138. */
  139. offsetTop: NumberConstructor;
  140. /** 距离窗口底部达到指定偏移量后触发 */
  141. offsetBottom: NumberConstructor;
  142. /** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
  143. target: {
  144. type: PropType<() => Window | HTMLElement>;
  145. default: typeof getDefaultTarget;
  146. };
  147. prefixCls: StringConstructor;
  148. /** 固定状态改变时触发的回调函数 */
  149. onChange: PropType<(lastAffix: boolean) => void>;
  150. onTestUpdatePosition: PropType<() => void>;
  151. }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
  152. target: () => Window | HTMLElement;
  153. }> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("@vue/runtime-core").Plugin;
  154. export default _default;