element-plus
Version:
A Component Library for Vue 3
1 lines • 5.76 kB
Source Map (JSON)
{"version":3,"file":"image-viewer.mjs","sources":["../../../../../../packages/components/image-viewer/src/image-viewer.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isNumber,\n mutable,\n} from '@element-plus/utils'\n\nimport type { Component, ExtractPublicPropTypes } from 'vue'\nimport type ImageViewer from './image-viewer.vue'\n\nexport type ImageViewerAction =\n | 'zoomIn'\n | 'zoomOut'\n | 'clockwise'\n | 'anticlockwise'\n\nexport type ImageViewerCrossorigin = 'anonymous' | 'use-credentials' | ''\n\nexport interface ImageViewerProps {\n /**\n * @description preview link list.\n */\n urlList?: string[]\n /**\n * @description preview backdrop z-index.\n */\n zIndex?: number\n /**\n * @description the initial preview image index, less than or equal to the length of `url-list`.\n */\n initialIndex?: number\n /**\n * @description whether preview is infinite.\n */\n infinite?: boolean\n /**\n * @description whether user can emit close event when clicking backdrop.\n */\n hideOnClickModal?: boolean\n /**\n * @description whether to append image itself to body. A nested parent element attribute transform should have this attribute set to `true`.\n */\n teleported?: boolean\n /**\n * @description whether the image-viewer can be closed by pressing ESC.\n */\n closeOnPressEscape?: boolean\n /**\n * @description the zoom rate of the image viewer zoom event.\n */\n zoomRate?: number\n /**\n * @description preview image scale.\n */\n scale?: number\n /**\n * @description the min scale of the image viewer zoom event.\n */\n minScale?: number\n /**\n * @description the max scale of the image viewer zoom event.\n */\n maxScale?: number\n /**\n * @description show preview image progress content.\n */\n showProgress?: boolean\n /**\n * @description set HTML attribute: crossorigin.\n */\n crossorigin?: ImageViewerCrossorigin\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ImageViewerProps` instead.\n */\nexport const imageViewerProps = buildProps({\n /**\n * @description preview link list.\n */\n urlList: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n /**\n * @description preview backdrop z-index.\n */\n zIndex: {\n type: Number,\n },\n /**\n * @description the initial preview image index, less than or equal to the length of `url-list`.\n */\n initialIndex: {\n type: Number,\n default: 0,\n },\n /**\n * @description whether preview is infinite.\n */\n infinite: {\n type: Boolean,\n default: true,\n },\n /**\n * @description whether user can emit close event when clicking backdrop.\n */\n hideOnClickModal: Boolean,\n /**\n * @description whether to append image itself to body. A nested parent element attribute transform should have this attribute set to `true`.\n */\n teleported: Boolean,\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<ImageViewerCrossorigin>(String),\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `ImageViewerProps` instead.\n */\nexport type ImageViewerPropsPublic = ExtractPublicPropTypes<\n typeof imageViewerProps\n>\n\nexport const imageViewerEmits = {\n close: () => true,\n error: (evt: Event) => evt instanceof Event,\n switch: (index: number) => isNumber(index),\n rotate: (deg: number) => isNumber(deg),\n}\nexport type ImageViewerEmits = typeof imageViewerEmits\n\nexport interface ImageViewerMode {\n name: string\n icon: Component\n}\n\nexport type ImageViewerInstance = InstanceType<typeof ImageViewer> & unknown\n"],"names":[],"mappings":";;;;AA4EO,MAAM,mBAAmB,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAIzC,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,eAAyB,KAAK,CAAA;AAAA,IACpC,OAAA,EAAS,MAAM,OAAA,CAAQ,EAAW;AAAA,GACpC;AAAA;AAAA;AAAA;AAAA,EAIA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA,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