interface.d.ts 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. import type { CSSProperties, ExtractPropTypes, TransitionProps, PropType } from 'vue';
  2. import type { VueNode } from '../_util/type';
  3. /** Two char of 't' 'b' 'c' 'l' 'r'. Example: 'lt' */
  4. export type AlignPoint = string;
  5. export type OffsetType = number | `${number}%`;
  6. export interface AlignType {
  7. /**
  8. * move point of source node to align with point of target node.
  9. * Such as ['tr','cc'], align top right point of source node with center point of target node.
  10. * Point can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right) */
  11. points?: (string | AlignPoint)[];
  12. /**
  13. * offset source node by offset[0] in x and offset[1] in y.
  14. * If offset contains percentage string value, it is relative to sourceNode region.
  15. */
  16. offset?: OffsetType[];
  17. /**
  18. * offset target node by offset[0] in x and offset[1] in y.
  19. * If targetOffset contains percentage string value, it is relative to targetNode region.
  20. */
  21. targetOffset?: OffsetType[];
  22. /**
  23. * If adjustX field is true, will adjust source node in x direction if source node is invisible.
  24. * If adjustY field is true, will adjust source node in y direction if source node is invisible.
  25. */
  26. overflow?: {
  27. adjustX?: boolean | number;
  28. adjustY?: boolean | number;
  29. shiftX?: boolean | number;
  30. shiftY?: boolean | number;
  31. };
  32. /** Auto adjust arrow position */
  33. autoArrow?: boolean;
  34. /**
  35. * Config visible region check of html node. Default `visible`:
  36. * - `visible`:
  37. * The visible region of user browser window.
  38. * Use `clientHeight` for check.
  39. * If `visible` region not satisfy, fallback to `scroll`.
  40. * - `scroll`:
  41. * The whole region of the html scroll area.
  42. * Use `scrollHeight` for check.
  43. * - `visibleFirst`:
  44. * Similar to `visible`, but if `visible` region not satisfy, fallback to `scroll`.
  45. */
  46. htmlRegion?: 'visible' | 'scroll' | 'visibleFirst';
  47. /**
  48. * Whether use css right instead of left to position
  49. */
  50. useCssRight?: boolean;
  51. /**
  52. * Whether use css bottom instead of top to position
  53. */
  54. useCssBottom?: boolean;
  55. /**
  56. * Whether use css transform instead of left/top/right/bottom to position if browser supports.
  57. * Defaults to false.
  58. */
  59. useCssTransform?: boolean;
  60. ignoreShake?: boolean;
  61. }
  62. export type BuildInPlacements = Record<string, AlignType>;
  63. export type StretchType = string;
  64. export type ActionType = string;
  65. export type AnimationType = string;
  66. export type TransitionNameType = string;
  67. export interface Point {
  68. pageX: number;
  69. pageY: number;
  70. }
  71. export interface CommonEventHandler {
  72. remove: () => void;
  73. }
  74. export interface MobileConfig {
  75. /** Set popup motion. You can ref `rc-motion` for more info. */
  76. popupMotion?: TransitionProps;
  77. popupClassName?: string;
  78. popupStyle?: CSSProperties;
  79. popupRender?: (originNode: VueNode) => VueNode;
  80. }
  81. export declare function noop(): void;
  82. export declare const triggerProps: () => {
  83. action: import("vue-types").VueTypeDef<string | string[]> & {
  84. default: string | (() => string[]);
  85. };
  86. showAction: import("vue-types").VueTypeValidableDef<any> & {
  87. default: any;
  88. };
  89. hideAction: import("vue-types").VueTypeValidableDef<any> & {
  90. default: any;
  91. };
  92. getPopupClassNameFromAlign: import("vue-types").VueTypeValidableDef<any> & {
  93. default: any;
  94. };
  95. onPopupVisibleChange: PropType<(open: boolean) => void>;
  96. afterPopupVisibleChange: import("vue-types").VueTypeValidableDef<(...args: any[]) => any> & {
  97. default: (...args: any[]) => any;
  98. } & {
  99. default: (...args: any[]) => any;
  100. };
  101. popup: import("vue-types").VueTypeValidableDef<any>;
  102. arrow: import("vue-types").VueTypeValidableDef<boolean> & {
  103. default: boolean;
  104. } & {
  105. default: boolean;
  106. };
  107. popupStyle: {
  108. type: PropType<CSSProperties>;
  109. default: CSSProperties;
  110. };
  111. prefixCls: import("vue-types").VueTypeValidableDef<string> & {
  112. default: string;
  113. } & {
  114. default: string;
  115. };
  116. popupClassName: import("vue-types").VueTypeValidableDef<string> & {
  117. default: string;
  118. } & {
  119. default: string;
  120. };
  121. popupPlacement: StringConstructor;
  122. builtinPlacements: import("vue-types").VueTypeValidableDef<{
  123. [key: string]: any;
  124. }> & {
  125. default: () => {
  126. [key: string]: any;
  127. };
  128. };
  129. popupTransitionName: StringConstructor;
  130. popupAnimation: import("vue-types").VueTypeValidableDef<any>;
  131. mouseEnterDelay: import("vue-types").VueTypeValidableDef<number> & {
  132. default: number;
  133. } & {
  134. default: number;
  135. };
  136. mouseLeaveDelay: import("vue-types").VueTypeValidableDef<number> & {
  137. default: number;
  138. } & {
  139. default: number;
  140. };
  141. zIndex: NumberConstructor;
  142. focusDelay: import("vue-types").VueTypeValidableDef<number> & {
  143. default: number;
  144. } & {
  145. default: number;
  146. };
  147. blurDelay: import("vue-types").VueTypeValidableDef<number> & {
  148. default: number;
  149. } & {
  150. default: number;
  151. };
  152. getPopupContainer: FunctionConstructor;
  153. getDocument: import("vue-types").VueTypeValidableDef<(...args: any[]) => any> & {
  154. default: (...args: any[]) => any;
  155. } & {
  156. default: (...args: any[]) => any;
  157. };
  158. forceRender: {
  159. type: BooleanConstructor;
  160. default: any;
  161. };
  162. destroyPopupOnHide: {
  163. type: BooleanConstructor;
  164. default: boolean;
  165. };
  166. mask: {
  167. type: BooleanConstructor;
  168. default: boolean;
  169. };
  170. maskClosable: {
  171. type: BooleanConstructor;
  172. default: boolean;
  173. };
  174. popupAlign: import("vue-types").VueTypeValidableDef<{
  175. [key: string]: any;
  176. }> & {
  177. default: () => {
  178. [key: string]: any;
  179. };
  180. } & {
  181. default: () => {
  182. [key: string]: any;
  183. };
  184. };
  185. popupVisible: {
  186. type: BooleanConstructor;
  187. default: any;
  188. };
  189. defaultPopupVisible: {
  190. type: BooleanConstructor;
  191. default: boolean;
  192. };
  193. maskTransitionName: StringConstructor;
  194. maskAnimation: StringConstructor;
  195. stretch: StringConstructor;
  196. alignPoint: {
  197. type: BooleanConstructor;
  198. default: any;
  199. };
  200. autoDestroy: {
  201. type: BooleanConstructor;
  202. default: boolean;
  203. };
  204. mobile: ObjectConstructor;
  205. getTriggerDOMNode: PropType<(d?: HTMLElement) => HTMLElement>;
  206. };
  207. export type TriggerProps = Partial<ExtractPropTypes<ReturnType<typeof triggerProps>>>;