element-plus
Version:
A Component Library for Vue 3
1 lines • 5.29 kB
Source Map (JSON)
{"version":3,"file":"image.mjs","sources":["../../../../../../packages/components/image/src/image.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isNumber,\n mutable,\n} from '@element-plus/utils'\n\nimport type { ExtractPropTypes, ExtractPublicPropTypes } from 'vue'\nimport type Image from './image.vue'\n\nexport const imageProps = buildProps({\n /**\n * @description when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode.\n */\n hideOnClickModal: Boolean,\n /**\n * @description image source, same as native.\n */\n src: {\n type: String,\n default: '',\n },\n /**\n * @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).\n */\n fit: {\n type: String,\n values: ['', 'contain', 'cover', 'fill', 'none', 'scale-down'],\n default: '',\n },\n /**\n * @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)\n */\n loading: {\n type: String,\n values: ['eager', 'lazy'],\n },\n /**\n * @description whether to use lazy load.\n */\n lazy: Boolean,\n /**\n * @description the container to add scroll listener when using lazy load.\n */\n scrollContainer: {\n type: definePropType<string | HTMLElement | undefined>([String, Object]),\n },\n /**\n * @description allow big image preview.\n */\n previewSrcList: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n /**\n * @description whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`.\n */\n previewTeleported: Boolean,\n /**\n * @description set image preview z-index.\n */\n zIndex: {\n type: Number,\n },\n /**\n * @description initial preview image index, less than the length of `url-list`.\n */\n initialIndex: {\n type: Number,\n default: 0,\n },\n /**\n * @description whether the viewer preview is infinite.\n */\n infinite: {\n type: Boolean,\n default: true,\n },\n /**\n * @description whether the image-viewer can be closed by pressing ESC.\n */\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n /**\n * @description the zoom rate of the image viewer zoom event\n */\n zoomRate: {\n type: Number,\n default: 1.2,\n },\n /**\n * @description preview image scale.\n */\n scale: {\n type: Number,\n default: 1,\n },\n /**\n * @description the min scale of the image viewer zoom event.\n */\n minScale: {\n type: Number,\n default: 0.2,\n },\n /**\n * @description the max scale of the image viewer zoom event.\n */\n maxScale: {\n type: Number,\n default: 7,\n },\n /**\n * @description show preview image progress content.\n */\n showProgress: Boolean,\n /**\n * @description set HTML attribute: crossorigin.\n */\n crossorigin: {\n type: definePropType<'anonymous' | 'use-credentials' | ''>(String),\n },\n} as const)\nexport type ImageProps = ExtractPropTypes<typeof imageProps>\nexport type ImagePropsPublic = ExtractPublicPropTypes<typeof imageProps>\n\nexport const imageEmits = {\n load: (evt: Event) => evt instanceof Event,\n error: (evt: Event) => evt instanceof Event,\n switch: (val: number) => isNumber(val),\n close: () => true,\n show: () => true,\n}\nexport type ImageEmits = typeof imageEmits\nexport type ImageInstance = InstanceType<typeof Image> & unknown\n"],"names":[],"mappings":";;;;AAUO,MAAM,aAAa,UAAW,CAAA;AAAA,EAInC,gBAAkB,EAAA,OAAA;AAAA,EAIlB,GAAK,EAAA;AAAA,IACH,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AAAA,EAIA,GAAK,EAAA;AAAA,IACH,IAAM,EAAA,MAAA;AAAA,IACN,QAAQ,CAAC,EAAA,EAAI,WAAW,OAAS,EAAA,MAAA,EAAQ,QAAQ,YAAY,CAAA;AAAA,IAC7D,OAAS,EAAA,EAAA;AAAA,GACX;AAAA,EAIA,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,MAAA;AAAA,IACN,MAAA,EAAQ,CAAC,OAAA,EAAS,MAAM,CAAA;AAAA,GAC1B;AAAA,EAIA,IAAM,EAAA,OAAA;AAAA,EAIN,eAAiB,EAAA;AAAA,IACf,IAAM,EAAA,cAAA,CAAiD,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,GACzE;AAAA,EAIA,cAAgB,EAAA;AAAA,IACd,IAAA,EAAM,eAAyB,KAAK,CAAA;AAA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