image.d.ts 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
  2. import "../../../utils/index.js";
  3. import { _default } from "./image.vue.js";
  4. import * as vue from "vue";
  5. import { ExtractPublicPropTypes } from "vue";
  6. //#region ../../packages/components/image/src/image.d.ts
  7. type ImageFitType = '' | 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
  8. type ImageCrossorigin = 'anonymous' | 'use-credentials' | '';
  9. interface ImageProps {
  10. /**
  11. * @description when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode.
  12. */
  13. hideOnClickModal?: boolean;
  14. /**
  15. * @description image source, same as native.
  16. */
  17. src?: string;
  18. /**
  19. * @description indicate how the image should be resized to fit its container, same as [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit).
  20. */
  21. fit?: ImageFitType;
  22. /**
  23. * @description Indicates how the browser should load the image, same as [native](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#loading)
  24. */
  25. loading?: 'eager' | 'lazy';
  26. /**
  27. * @description whether to use lazy load.
  28. */
  29. lazy?: boolean;
  30. /**
  31. * @description the container to add scroll listener when using lazy load.
  32. */
  33. scrollContainer?: string | HTMLElement;
  34. /**
  35. * @description allow big image preview.
  36. */
  37. previewSrcList?: string[];
  38. /**
  39. * @description whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`.
  40. */
  41. previewTeleported?: boolean;
  42. /**
  43. * @description set image preview z-index.
  44. */
  45. zIndex?: number;
  46. /**
  47. * @description initial preview image index, less than the length of `url-list`.
  48. */
  49. initialIndex?: number;
  50. /**
  51. * @description whether the viewer preview is infinite.
  52. */
  53. infinite?: boolean;
  54. /**
  55. * @description whether the image-viewer can be closed by pressing ESC.
  56. */
  57. closeOnPressEscape?: boolean;
  58. /**
  59. * @description the zoom rate of the image viewer zoom event
  60. */
  61. zoomRate?: number;
  62. /**
  63. * @description preview image scale.
  64. */
  65. scale?: number;
  66. /**
  67. * @description the min scale of the image viewer zoom event.
  68. */
  69. minScale?: number;
  70. /**
  71. * @description the max scale of the image viewer zoom event.
  72. */
  73. maxScale?: number;
  74. /**
  75. * @description show preview image progress content.
  76. */
  77. showProgress?: boolean;
  78. /**
  79. * @description set HTML attribute: crossorigin.
  80. */
  81. crossorigin?: ImageCrossorigin;
  82. }
  83. /**
  84. * @deprecated Removed after 3.0.0, Use `ImageProps` instead.
  85. */
  86. declare const imageProps: {
  87. readonly hideOnClickModal: BooleanConstructor;
  88. readonly src: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
  89. readonly fit: EpPropFinalized<StringConstructor, "" | "fill" | "none" | "contain" | "cover" | "scale-down", unknown, "", boolean>;
  90. readonly loading: {
  91. readonly type: vue.PropType<EpPropMergeType<StringConstructor, "lazy" | "eager", unknown>>;
  92. readonly required: false;
  93. readonly validator: ((val: unknown) => boolean) | undefined;
  94. __epPropKey: true;
  95. };
  96. readonly lazy: BooleanConstructor;
  97. readonly scrollContainer: {
  98. readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement | undefined) | ((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement | undefined))[], unknown, unknown>>;
  99. readonly required: false;
  100. readonly validator: ((val: unknown) => boolean) | undefined;
  101. __epPropKey: true;
  102. };
  103. readonly previewSrcList: EpPropFinalized<(new (...args: any[]) => string[]) | (() => string[]) | ((new (...args: any[]) => string[]) | (() => string[]))[], unknown, unknown, () => [], boolean>;
  104. readonly previewTeleported: BooleanConstructor;
  105. readonly zIndex: {
  106. readonly type: vue.PropType<number>;
  107. readonly required: false;
  108. readonly validator: ((val: unknown) => boolean) | undefined;
  109. __epPropKey: true;
  110. };
  111. readonly initialIndex: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
  112. readonly infinite: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
  113. readonly closeOnPressEscape: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
  114. readonly zoomRate: EpPropFinalized<NumberConstructor, unknown, unknown, 1.2, boolean>;
  115. readonly scale: EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
  116. readonly minScale: EpPropFinalized<NumberConstructor, unknown, unknown, 0.2, boolean>;
  117. readonly maxScale: EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
  118. readonly showProgress: BooleanConstructor;
  119. readonly crossorigin: {
  120. readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => ImageCrossorigin) | ((new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => ImageCrossorigin))[], unknown, unknown>>;
  121. readonly required: false;
  122. readonly validator: ((val: unknown) => boolean) | undefined;
  123. __epPropKey: true;
  124. };
  125. };
  126. /**
  127. * @deprecated Removed after 3.0.0, Use `ImageProps` instead.
  128. */
  129. type ImagePropsPublic = ExtractPublicPropTypes<typeof imageProps>;
  130. declare const imageEmits: {
  131. load: (evt: Event) => boolean;
  132. error: (evt: Event) => boolean;
  133. switch: (val: number) => boolean;
  134. close: () => boolean;
  135. show: () => boolean;
  136. };
  137. type ImageEmits = typeof imageEmits;
  138. type ImageInstance = InstanceType<typeof _default> & unknown;
  139. //#endregion
  140. export { ImageCrossorigin, ImageEmits, ImageFitType, ImageInstance, ImageProps, ImagePropsPublic, imageEmits, imageProps };