@element-plus/nightly 0.0.20241106 → 0.0.20241107
Sign up to get free protection for your applications and to get access to all the features.
- package/attributes.json +1 -1
- package/dist/index.full.js +33 -16
- package/dist/index.full.min.js +8 -8
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +9 -9
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +33 -16
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/my.js +1 -1
- package/dist/locale/my.min.js +1 -1
- package/dist/locale/my.min.mjs +1 -1
- package/dist/locale/my.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/drawer/index.mjs +2 -2
- package/es/components/drawer/src/drawer.mjs +27 -181
- package/es/components/drawer/src/drawer.mjs.map +1 -1
- package/es/components/drawer/src/drawer2.mjs +181 -27
- package/es/components/drawer/src/drawer2.mjs.map +1 -1
- package/es/components/index.mjs +3 -3
- package/es/components/segmented/src/segmented2.mjs +1 -0
- package/es/components/segmented/src/segmented2.mjs.map +1 -1
- package/es/components/select/src/option.mjs +2 -2
- package/es/components/select/src/option.mjs.map +1 -1
- package/es/components/select-v2/src/option-item.mjs +2 -2
- package/es/components/select-v2/src/option-item.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.d.ts +10 -1
- package/es/components/skeleton/src/skeleton.mjs +2 -2
- package/es/components/skeleton/src/skeleton.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.vue.d.ts +18 -2
- package/es/components/skeleton/src/skeleton2.mjs +1 -1
- package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/content2.mjs +1 -1
- package/es/components/upload/index.mjs +2 -2
- package/es/components/upload/src/upload-content.mjs +1 -1
- package/es/components/upload/src/upload-content2.mjs +1 -1
- package/es/components/upload/src/upload-list.mjs +1 -1
- package/es/components/upload/src/upload.mjs +126 -98
- package/es/components/upload/src/upload.mjs.map +1 -1
- package/es/components/upload/src/upload2.mjs +98 -126
- package/es/components/upload/src/upload2.mjs.map +1 -1
- package/es/components/upload/src/use-handlers.mjs +1 -1
- package/es/components/visual-hidden/index.mjs +3 -3
- package/es/components/visual-hidden/src/visual-hidden.mjs +35 -7
- package/es/components/visual-hidden/src/visual-hidden.mjs.map +1 -1
- package/es/components/visual-hidden/src/visual-hidden2.mjs +7 -35
- package/es/components/visual-hidden/src/visual-hidden2.mjs.map +1 -1
- package/es/components/watermark/index.mjs +2 -2
- package/es/components/watermark/src/watermark.mjs +210 -27
- package/es/components/watermark/src/watermark.mjs.map +1 -1
- package/es/components/watermark/src/watermark2.mjs +27 -210
- package/es/components/watermark/src/watermark2.mjs.map +1 -1
- package/es/hooks/use-throttle-render/index.d.ts +6 -1
- package/es/hooks/use-throttle-render/index.mjs +27 -8
- package/es/hooks/use-throttle-render/index.mjs.map +1 -1
- package/es/index.mjs +3 -3
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/drawer/index.js +2 -2
- package/lib/components/drawer/src/drawer.js +28 -181
- package/lib/components/drawer/src/drawer.js.map +1 -1
- package/lib/components/drawer/src/drawer2.js +181 -28
- package/lib/components/drawer/src/drawer2.js.map +1 -1
- package/lib/components/index.js +3 -3
- package/lib/components/segmented/src/segmented2.js +1 -0
- package/lib/components/segmented/src/segmented2.js.map +1 -1
- package/lib/components/select/src/option.js +2 -2
- package/lib/components/select/src/option.js.map +1 -1
- package/lib/components/select-v2/src/option-item.js +2 -2
- package/lib/components/select-v2/src/option-item.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.d.ts +10 -1
- package/lib/components/skeleton/src/skeleton.js +1 -1
- package/lib/components/skeleton/src/skeleton.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.vue.d.ts +18 -2
- package/lib/components/skeleton/src/skeleton2.js +1 -1
- package/lib/components/skeleton/src/skeleton2.js.map +1 -1
- package/lib/components/tooltip-v2/src/content2.js +1 -1
- package/lib/components/upload/index.js +2 -2
- package/lib/components/upload/src/upload-content.js +1 -1
- package/lib/components/upload/src/upload-content2.js +1 -1
- package/lib/components/upload/src/upload-list.js +1 -1
- package/lib/components/upload/src/upload.js +126 -101
- package/lib/components/upload/src/upload.js.map +1 -1
- package/lib/components/upload/src/upload2.js +101 -126
- package/lib/components/upload/src/upload2.js.map +1 -1
- package/lib/components/upload/src/use-handlers.js +1 -1
- package/lib/components/visual-hidden/index.js +2 -2
- package/lib/components/visual-hidden/src/visual-hidden.js +35 -7
- package/lib/components/visual-hidden/src/visual-hidden.js.map +1 -1
- package/lib/components/visual-hidden/src/visual-hidden2.js +7 -35
- package/lib/components/visual-hidden/src/visual-hidden2.js.map +1 -1
- package/lib/components/watermark/index.js +2 -2
- package/lib/components/watermark/src/watermark.js +210 -27
- package/lib/components/watermark/src/watermark.js.map +1 -1
- package/lib/components/watermark/src/watermark2.js +27 -210
- package/lib/components/watermark/src/watermark2.js.map +1 -1
- package/lib/hooks/use-throttle-render/index.d.ts +6 -1
- package/lib/hooks/use-throttle-render/index.js +27 -8
- package/lib/hooks/use-throttle-render/index.js.map +1 -1
- package/lib/index.js +3 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"watermark2.mjs","sources":["../../../../../../packages/components/watermark/src/watermark.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" :style=\"[style]\">\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n ref,\n shallowRef,\n watch,\n} from 'vue'\nimport { useMutationObserver } from '@vueuse/core'\nimport { isArray } from '@element-plus/utils'\nimport { watermarkProps } from './watermark'\nimport { getPixelRatio, getStyleStr, reRendering } from './utils'\nimport useClips, { FontGap } from './useClips'\nimport type { WatermarkProps } from './watermark'\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElWatermark',\n})\n\nconst style: CSSProperties = {\n position: 'relative',\n}\n\nconst props = defineProps(watermarkProps)\nconst color = computed(() => props.font?.color ?? 'rgba(0,0,0,.15)')\nconst fontSize = computed(() => props.font?.fontSize ?? 16)\nconst fontWeight = computed(() => props.font?.fontWeight ?? 'normal')\nconst fontStyle = computed(() => props.font?.fontStyle ?? 'normal')\nconst fontFamily = computed(() => props.font?.fontFamily ?? 'sans-serif')\nconst textAlign = computed(() => props.font?.textAlign ?? 'center')\nconst textBaseline = computed(() => props.font?.textBaseline ?? 'hanging')\n\nconst gapX = computed(() => props.gap[0])\nconst gapY = computed(() => props.gap[1])\nconst gapXCenter = computed(() => gapX.value / 2)\nconst gapYCenter = computed(() => gapY.value / 2)\nconst offsetLeft = computed(() => props.offset?.[0] ?? gapXCenter.value)\nconst offsetTop = computed(() => props.offset?.[1] ?? gapYCenter.value)\n\nconst getMarkStyle = () => {\n const markStyle: CSSProperties = {\n zIndex: props.zIndex,\n position: 'absolute',\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n backgroundRepeat: 'repeat',\n }\n\n /** Calculate the style of the offset */\n let positionLeft = offsetLeft.value - gapXCenter.value\n let positionTop = offsetTop.value - gapYCenter.value\n if (positionLeft > 0) {\n markStyle.left = `${positionLeft}px`\n markStyle.width = `calc(100% - ${positionLeft}px)`\n positionLeft = 0\n }\n if (positionTop > 0) {\n markStyle.top = `${positionTop}px`\n markStyle.height = `calc(100% - ${positionTop}px)`\n positionTop = 0\n }\n markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`\n\n return markStyle\n}\n\nconst containerRef = shallowRef<HTMLDivElement | null>(null)\nconst watermarkRef = shallowRef<HTMLDivElement>()\nconst stopObservation = ref(false)\n\nconst destroyWatermark = () => {\n if (watermarkRef.value) {\n watermarkRef.value.remove()\n watermarkRef.value = undefined\n }\n}\nconst appendWatermark = (base64Url: string, markWidth: number) => {\n if (containerRef.value && watermarkRef.value) {\n stopObservation.value = true\n watermarkRef.value.setAttribute(\n 'style',\n getStyleStr({\n ...getMarkStyle(),\n backgroundImage: `url('${base64Url}')`,\n backgroundSize: `${Math.floor(markWidth)}px`,\n })\n )\n containerRef.value?.append(watermarkRef.value)\n // Delayed execution\n setTimeout(() => {\n stopObservation.value = false\n })\n }\n}\n\n/**\n * Get the width and height of the watermark. The default values are as follows\n * Image: [120, 64]; Content: It's calculated by content;\n */\nconst getMarkSize = (ctx: CanvasRenderingContext2D) => {\n let defaultWidth = 120\n let defaultHeight = 64\n const image = props.image\n const content = props.content\n const width = props.width\n const height = props.height\n if (!image && ctx.measureText) {\n ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`\n const contents = isArray(content) ? content : [content]\n const sizes = contents.map((item) => {\n const metrics = ctx.measureText(item!)\n\n return [\n metrics.width,\n // Using `actualBoundingBoxAscent` to be compatible with lower version browsers (eg: Firefox < 116)\n metrics.fontBoundingBoxAscent !== undefined\n ? metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent\n : metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent,\n ]\n })\n defaultWidth = Math.ceil(Math.max(...sizes.map((size) => size[0])))\n defaultHeight =\n Math.ceil(Math.max(...sizes.map((size) => size[1]))) * contents.length +\n (contents.length - 1) * FontGap\n }\n return [width ?? defaultWidth, height ?? defaultHeight] as const\n}\n\nconst getClips = useClips()\n\nconst renderWatermark = () => {\n const canvas = document.createElement('canvas')\n const ctx = canvas.getContext('2d')\n const image = props.image\n const content = props.content\n const rotate = props.rotate\n\n if (ctx) {\n if (!watermarkRef.value) {\n watermarkRef.value = document.createElement('div')\n }\n\n const ratio = getPixelRatio()\n const [markWidth, markHeight] = getMarkSize(ctx)\n\n const drawCanvas = (\n drawContent?: NonNullable<WatermarkProps['content']> | HTMLImageElement\n ) => {\n const [textClips, clipWidth] = getClips(\n drawContent || '',\n rotate,\n ratio,\n markWidth,\n markHeight,\n {\n color: color.value,\n fontSize: fontSize.value,\n fontStyle: fontStyle.value,\n fontWeight: fontWeight.value,\n fontFamily: fontFamily.value,\n textAlign: textAlign.value,\n textBaseline: textBaseline.value,\n },\n gapX.value,\n gapY.value\n )\n\n appendWatermark(textClips, clipWidth)\n }\n\n if (image) {\n const img = new Image()\n img.onload = () => {\n drawCanvas(img)\n }\n img.onerror = () => {\n drawCanvas(content)\n }\n img.crossOrigin = 'anonymous'\n img.referrerPolicy = 'no-referrer'\n img.src = image\n } else {\n drawCanvas(content)\n }\n }\n}\n\nonMounted(() => {\n renderWatermark()\n})\n\nwatch(\n () => props,\n () => {\n renderWatermark()\n },\n {\n deep: true,\n flush: 'post',\n }\n)\n\nonBeforeUnmount(() => {\n destroyWatermark()\n})\n\nconst onMutate = (mutations: MutationRecord[]) => {\n if (stopObservation.value) {\n return\n }\n mutations.forEach((mutation) => {\n if (reRendering(mutation, watermarkRef.value)) {\n destroyWatermark()\n renderWatermark()\n }\n })\n}\n\nuseMutationObserver(containerRef, onMutate, {\n attributes: true,\n subtree: true,\n childList: true,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;mCAuBc,CAAA;AAAA,EACZ,IAAM,EAAA,aAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAEA,IAAA,MAAM,KAAuB,GAAA;AAAA,MAC3B,QAAU,EAAA,UAAA;AAAA,KACZ,CAAA;AAGA,IAAA,MAAM,QAAQ,QAAS,CAAA,MAAM;AAC7B,MAAA,IAAM;AACN,MAAA,mBAA4B,KAAA,CAAA,IAAA,KAAY,IAAA,GAAA,iBAAoB,KAAQ,IAAA,GAAA,EAAA,GAAA,iBAAA,CAAA;AACpE,KAAA,CAAA,CAAA;AACA,IAAA,MAAM,mBAAsB,CAAA,MAAA;AAC5B,MAAA,IAAM;AACN,MAAA,mBAAqB,KAAS,CAAA,IAAA,KAAM,IAAM,GAAA,KAAM,oBAAyB,IAAA,GAAA,EAAA,GAAA,EAAA,CAAA;AAEzE,KAAA,CAAA,CAAA;AACA,IAAA,MAAM,UAAgB,GAAA,QAAA,CAAM,MAAM;AAClC,MAAA,IAAM,EAAa,EAAA,EAAA,CAAA;AACnB,MAAA,OAAmB,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,KAAA,CAAA,IAAe,KAAA,YAAc,CAAA,GAAA,EAAA,CAAA,UAAA,KAAA,IAAA,GAAA,EAAA,GAAA,QAAA,CAAA;AAChD,KAAM,CAAA,CAAA;AACN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AA,GAAA,KAAA,CAAA;AAAA,SACC,MAAA;AAAA,UACT,UAAA,CAAA,OAAA,CAAA,CAAA;AAAA,SACF;AAEA,OAAA;AACE,KAAiB,CAAA;AAAA,IACnB,SAAC,CAAA,MAAA;AAED,MAAM,eAAW,EAAiC,CAAA;AAChD,KAAA,CAAA,CAAA;AACE,IAAA,KAAA,CAAA,MAAA,KAAA,EAAA,MAAA;AAAA,MACF,eAAA,EAAA,CAAA;AACA,KAAU,EAAA;AACR,MAAA,IAAA,EAAI,IAAY;AACd,MAAiB,KAAA,EAAA,MAAA;AACjB,KAAgB,CAAA,CAAA;AAAA,IAClB,eAAA,CAAA,MAAA;AAAA,MACF,gBAAC,EAAA,CAAA;AAAA,KACH,CAAA,CAAA;AAEA,IAAA,MAAA,QAAA,GAAA,CAAA;AAA4C,MAC1C,IAAY,eAAA,CAAA,KAAA,EAAA;AAAA,QACH,OAAA;AAAA,OACE;AAAA,MACZ,SAAA,CAAA,OAAA,CAAA,CAAA,QAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"watermark2.mjs","sources":["../../../../../../packages/components/watermark/src/watermark.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type Watermark from './watermark.vue'\n\nexport interface WatermarkFontType {\n color?: string\n fontSize?: number | string\n fontWeight?: 'normal' | 'light' | 'weight' | number\n fontStyle?: 'none' | 'normal' | 'italic' | 'oblique'\n fontFamily?: string\n textAlign?: 'start' | 'end' | 'left' | 'right' | 'center'\n textBaseline?:\n | 'top'\n | 'hanging'\n | 'middle'\n | 'alphabetic'\n | 'ideographic'\n | 'bottom'\n}\n\nexport const watermarkProps = buildProps({\n /**\n * @description The z-index of the appended watermark element\n */\n zIndex: {\n type: Number,\n default: 9,\n },\n /**\n * @description The rotation angle of the watermark\n */\n rotate: {\n type: Number,\n default: -22,\n },\n /**\n * @description The width of the watermark\n */\n width: Number,\n /**\n * @description The height of the watermark\n */\n height: Number,\n /**\n * @description Image source, it is recommended to export 2x or 3x image, high priority (support base64 format)\n */\n image: String,\n /**\n * @description Watermark text content\n */\n content: {\n type: definePropType<string | string[]>([String, Array]),\n default: 'Element Plus',\n },\n /**\n * @description Text style\n */\n font: {\n type: definePropType<WatermarkFontType>(Object),\n },\n /**\n * @description The spacing between watermarks\n */\n gap: {\n type: definePropType<[number, number]>(Array),\n default: () => [100, 100],\n },\n /**\n * @description The offset of the watermark from the upper left corner of the container. The default is gap/2\n */\n offset: {\n type: definePropType<[number, number]>(Array),\n },\n} as const)\n\nexport type WatermarkProps = ExtractPropTypes<typeof watermarkProps>\nexport type WatermarkInstance = InstanceType<typeof Watermark>\n"],"names":[],"mappings":";;;AACY,MAAC,cAAc,GAAG,UAAU,CAAC;AACzC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC,EAAE;AAChB,GAAG;AACH,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACzC,IAAI,OAAO,EAAE,cAAc;AAC3B,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;AAC7B,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,GAAG;AACH,CAAC;;;;"}
|
@@ -1,2 +1,7 @@
|
|
1
1
|
import type { Ref } from 'vue';
|
2
|
-
export
|
2
|
+
export type ThrottleType = {
|
3
|
+
leading?: number;
|
4
|
+
trailing?: number;
|
5
|
+
initVal?: boolean;
|
6
|
+
} | number;
|
7
|
+
export declare const useThrottleRender: (loading: Ref<boolean>, throttle?: ThrottleType) => Ref<boolean>;
|
@@ -1,25 +1,44 @@
|
|
1
1
|
import { ref, onMounted, watch } from 'vue';
|
2
|
+
import '../../utils/index.mjs';
|
3
|
+
import { isObject } from '@vue/shared';
|
4
|
+
import { isUndefined, isNumber } from '../../utils/types.mjs';
|
2
5
|
|
3
6
|
const useThrottleRender = (loading, throttle = 0) => {
|
4
7
|
if (throttle === 0)
|
5
8
|
return loading;
|
6
|
-
const
|
9
|
+
const initVal = isObject(throttle) && Boolean(throttle.initVal);
|
10
|
+
const throttled = ref(initVal);
|
7
11
|
let timeoutHandle = null;
|
8
|
-
const dispatchThrottling = () => {
|
12
|
+
const dispatchThrottling = (timer) => {
|
13
|
+
if (isUndefined(timer)) {
|
14
|
+
throttled.value = loading.value;
|
15
|
+
return;
|
16
|
+
}
|
9
17
|
if (timeoutHandle) {
|
10
18
|
clearTimeout(timeoutHandle);
|
11
19
|
}
|
12
20
|
timeoutHandle = setTimeout(() => {
|
13
21
|
throttled.value = loading.value;
|
14
|
-
},
|
22
|
+
}, timer);
|
15
23
|
};
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
24
|
+
const dispatcher = (type) => {
|
25
|
+
if (type === "leading") {
|
26
|
+
if (isNumber(throttle)) {
|
27
|
+
dispatchThrottling(throttle);
|
28
|
+
} else {
|
29
|
+
dispatchThrottling(throttle.leading);
|
30
|
+
}
|
20
31
|
} else {
|
21
|
-
|
32
|
+
if (isObject(throttle)) {
|
33
|
+
dispatchThrottling(throttle.trailing);
|
34
|
+
} else {
|
35
|
+
throttled.value = false;
|
36
|
+
}
|
22
37
|
}
|
38
|
+
};
|
39
|
+
onMounted(() => dispatcher("leading"));
|
40
|
+
watch(() => loading.value, (val) => {
|
41
|
+
dispatcher(val ? "leading" : "trailing");
|
23
42
|
});
|
24
43
|
return throttled;
|
25
44
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-throttle-render/index.ts"],"sourcesContent":["import { onMounted, ref, watch } from 'vue'\n\nimport type { Ref } from 'vue'\n\nexport const useThrottleRender = (loading: Ref<boolean
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-throttle-render/index.ts"],"sourcesContent":["import { onMounted, ref, watch } from 'vue'\nimport { isNumber, isObject, isUndefined } from '@element-plus/utils'\n\nimport type { Ref } from 'vue'\n\nexport type ThrottleType =\n | { leading?: number; trailing?: number; initVal?: boolean }\n | number\n\nexport const useThrottleRender = (\n loading: Ref<boolean>,\n throttle: ThrottleType = 0\n) => {\n if (throttle === 0) return loading\n const initVal = isObject(throttle) && Boolean(throttle.initVal)\n const throttled = ref(initVal)\n let timeoutHandle: ReturnType<typeof setTimeout> | null = null\n\n const dispatchThrottling = (timer: number | undefined) => {\n if (isUndefined(timer)) {\n throttled.value = loading.value\n return\n }\n if (timeoutHandle) {\n clearTimeout(timeoutHandle)\n }\n timeoutHandle = setTimeout(() => {\n throttled.value = loading.value\n }, timer)\n }\n\n const dispatcher = (type: 'leading' | 'trailing') => {\n if (type === 'leading') {\n if (isNumber(throttle)) {\n dispatchThrottling(throttle)\n } else {\n dispatchThrottling(throttle.leading)\n }\n } else {\n if (isObject(throttle)) {\n dispatchThrottling(throttle.trailing)\n } else {\n throttled.value = false\n }\n }\n }\n\n onMounted(() => dispatcher('leading'))\n\n watch(\n () => loading.value,\n (val) => {\n dispatcher(val ? 'leading' : 'trailing')\n }\n )\n\n return throttled\n}\n"],"names":[],"mappings":";;;;;AAEY,MAAC,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,GAAG,CAAC,KAAK;AAC5D,EA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,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AACzC,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK;AACtC,IAAI,UAAU,CAAC,GAAG,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;AAC7C,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,SAAS,CAAC;AACnB;;;;"}
|
package/es/index.mjs
CHANGED
@@ -73,7 +73,7 @@ export { dialogInjectionKey } from './components/dialog/src/constants.mjs';
|
|
73
73
|
export { ElDialog } from './components/dialog/index.mjs';
|
74
74
|
export { dividerProps } from './components/divider/src/divider.mjs';
|
75
75
|
export { ElDivider } from './components/divider/index.mjs';
|
76
|
-
export { drawerEmits, drawerProps } from './components/drawer/src/
|
76
|
+
export { drawerEmits, drawerProps } from './components/drawer/src/drawer.mjs';
|
77
77
|
export { ElDrawer } from './components/drawer/index.mjs';
|
78
78
|
export { DROPDOWN_COLLECTION_INJECTION_KEY, DROPDOWN_COLLECTION_ITEM_INJECTION_KEY, ElCollection, ElCollectionItem, FIRST_KEYS, FIRST_LAST_KEYS, LAST_KEYS, dropdownItemProps, dropdownMenuProps, dropdownProps } from './components/dropdown/src/dropdown.mjs';
|
79
79
|
export { DROPDOWN_INJECTION_KEY } from './components/dropdown/src/tokens.mjs';
|
@@ -199,7 +199,7 @@ export { ElTransfer } from './components/transfer/index.mjs';
|
|
199
199
|
export { ElTree } from './components/tree/index.mjs';
|
200
200
|
export { ElTreeSelect } from './components/tree-select/index.mjs';
|
201
201
|
export { ElTreeV2 } from './components/tree-v2/index.mjs';
|
202
|
-
export { genFileId, uploadBaseProps, uploadListTypes, uploadProps } from './components/upload/src/
|
202
|
+
export { genFileId, uploadBaseProps, uploadListTypes, uploadProps } from './components/upload/src/upload2.mjs';
|
203
203
|
export { uploadContentProps } from './components/upload/src/upload-content.mjs';
|
204
204
|
export { uploadListEmits, uploadListProps } from './components/upload/src/upload-list.mjs';
|
205
205
|
export { uploadDraggerEmits, uploadDraggerProps } from './components/upload/src/upload-dragger.mjs';
|
@@ -210,7 +210,7 @@ export { default as DynamicSizeList } from './components/virtual-list/src/compon
|
|
210
210
|
export { default as FixedSizeGrid } from './components/virtual-list/src/components/fixed-size-grid.mjs';
|
211
211
|
export { default as DynamicSizeGrid } from './components/virtual-list/src/components/dynamic-size-grid.mjs';
|
212
212
|
export { virtualizedGridProps, virtualizedListProps, virtualizedProps, virtualizedScrollbarProps } from './components/virtual-list/src/props.mjs';
|
213
|
-
export { watermarkProps } from './components/watermark/src/
|
213
|
+
export { watermarkProps } from './components/watermark/src/watermark2.mjs';
|
214
214
|
export { ElWatermark } from './components/watermark/index.mjs';
|
215
215
|
export { tourEmits, tourProps } from './components/tour/src/tour.mjs';
|
216
216
|
export { tourStepEmits, tourStepProps } from './components/tour/src/step.mjs';
|
package/es/version.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare const version = "0.0.
|
1
|
+
export declare const version = "0.0.20241107";
|
package/es/version.mjs
CHANGED
package/es/version.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20241107'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
|
@@ -3,8 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
require('../../utils/index.js');
|
6
|
-
var drawer$1 = require('./src/
|
7
|
-
var drawer = require('./src/
|
6
|
+
var drawer$1 = require('./src/drawer2.js');
|
7
|
+
var drawer = require('./src/drawer.js');
|
8
8
|
var install = require('../../utils/vue/install.js');
|
9
9
|
|
10
10
|
const ElDrawer = install.withInstall(drawer$1["default"]);
|
@@ -2,190 +2,37 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var vue = require('vue');
|
6
|
-
var iconsVue = require('@element-plus/icons-vue');
|
7
|
-
var index$4 = require('../../overlay/index.js');
|
8
|
-
require('../../focus-trap/index.js');
|
9
|
-
var index$3 = require('../../teleport/index.js');
|
10
|
-
require('../../dialog/index.js');
|
11
5
|
require('../../../utils/index.js');
|
12
|
-
|
13
|
-
require('../../../
|
14
|
-
var
|
15
|
-
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
16
|
-
var index = require('../../../hooks/use-deprecated/index.js');
|
17
|
-
var index$1 = require('../../../hooks/use-namespace/index.js');
|
18
|
-
var index$2 = require('../../../hooks/use-locale/index.js');
|
19
|
-
var useDialog = require('../../dialog/src/use-dialog.js');
|
20
|
-
var style = require('../../../utils/dom/style.js');
|
21
|
-
var focusTrap = require('../../focus-trap/src/focus-trap.js');
|
6
|
+
require('../../dialog/index.js');
|
7
|
+
var runtime = require('../../../utils/vue/props/runtime.js');
|
8
|
+
var dialog = require('../../dialog/src/dialog.js');
|
22
9
|
|
23
|
-
const
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
const {
|
46
|
-
afterEnter,
|
47
|
-
afterLeave,
|
48
|
-
beforeLeave,
|
49
|
-
visible,
|
50
|
-
rendered,
|
51
|
-
titleId,
|
52
|
-
bodyId,
|
53
|
-
zIndex,
|
54
|
-
onModalClick,
|
55
|
-
onOpenAutoFocus,
|
56
|
-
onCloseAutoFocus,
|
57
|
-
onFocusoutPrevented,
|
58
|
-
onCloseRequested,
|
59
|
-
handleClose
|
60
|
-
} = useDialog.useDialog(props, drawerRef);
|
61
|
-
const isHorizontal = vue.computed(() => props.direction === "rtl" || props.direction === "ltr");
|
62
|
-
const drawerSize = vue.computed(() => style.addUnit(props.size));
|
63
|
-
expose({
|
64
|
-
handleClose,
|
65
|
-
afterEnter,
|
66
|
-
afterLeave
|
67
|
-
});
|
68
|
-
return (_ctx, _cache) => {
|
69
|
-
return vue.openBlock(), vue.createBlock(vue.unref(index$3.ElTeleport), {
|
70
|
-
to: _ctx.appendTo,
|
71
|
-
disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
|
72
|
-
}, {
|
73
|
-
default: vue.withCtx(() => [
|
74
|
-
vue.createVNode(vue.Transition, {
|
75
|
-
name: vue.unref(ns).b("fade"),
|
76
|
-
onAfterEnter: vue.unref(afterEnter),
|
77
|
-
onAfterLeave: vue.unref(afterLeave),
|
78
|
-
onBeforeLeave: vue.unref(beforeLeave),
|
79
|
-
persisted: ""
|
80
|
-
}, {
|
81
|
-
default: vue.withCtx(() => [
|
82
|
-
vue.withDirectives(vue.createVNode(vue.unref(index$4.ElOverlay), {
|
83
|
-
mask: _ctx.modal,
|
84
|
-
"overlay-class": _ctx.modalClass,
|
85
|
-
"z-index": vue.unref(zIndex),
|
86
|
-
onClick: vue.unref(onModalClick)
|
87
|
-
}, {
|
88
|
-
default: vue.withCtx(() => [
|
89
|
-
vue.createVNode(vue.unref(focusTrap["default"]), {
|
90
|
-
loop: "",
|
91
|
-
trapped: vue.unref(visible),
|
92
|
-
"focus-trap-el": drawerRef.value,
|
93
|
-
"focus-start-el": focusStartRef.value,
|
94
|
-
onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
|
95
|
-
onFocusAfterReleased: vue.unref(onCloseAutoFocus),
|
96
|
-
onFocusoutPrevented: vue.unref(onFocusoutPrevented),
|
97
|
-
onReleaseRequested: vue.unref(onCloseRequested)
|
98
|
-
}, {
|
99
|
-
default: vue.withCtx(() => [
|
100
|
-
vue.createElementVNode("div", vue.mergeProps({
|
101
|
-
ref_key: "drawerRef",
|
102
|
-
ref: drawerRef,
|
103
|
-
"aria-modal": "true",
|
104
|
-
"aria-label": _ctx.title || void 0,
|
105
|
-
"aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
|
106
|
-
"aria-describedby": vue.unref(bodyId)
|
107
|
-
}, _ctx.$attrs, {
|
108
|
-
class: [vue.unref(ns).b(), _ctx.direction, vue.unref(visible) && "open"],
|
109
|
-
style: vue.unref(isHorizontal) ? "width: " + vue.unref(drawerSize) : "height: " + vue.unref(drawerSize),
|
110
|
-
role: "dialog",
|
111
|
-
onClick: vue.withModifiers(() => {
|
112
|
-
}, ["stop"])
|
113
|
-
}), [
|
114
|
-
vue.createElementVNode("span", {
|
115
|
-
ref_key: "focusStartRef",
|
116
|
-
ref: focusStartRef,
|
117
|
-
class: vue.normalizeClass(vue.unref(ns).e("sr-focus")),
|
118
|
-
tabindex: "-1"
|
119
|
-
}, null, 2),
|
120
|
-
_ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", {
|
121
|
-
key: 0,
|
122
|
-
class: vue.normalizeClass(vue.unref(ns).e("header"))
|
123
|
-
}, [
|
124
|
-
!_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
|
125
|
-
key: 0,
|
126
|
-
close: vue.unref(handleClose),
|
127
|
-
titleId: vue.unref(titleId),
|
128
|
-
titleClass: vue.unref(ns).e("title")
|
129
|
-
}, () => [
|
130
|
-
!_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
|
131
|
-
key: 0,
|
132
|
-
id: vue.unref(titleId),
|
133
|
-
role: "heading",
|
134
|
-
"aria-level": _ctx.headerAriaLevel,
|
135
|
-
class: vue.normalizeClass(vue.unref(ns).e("title"))
|
136
|
-
}, vue.toDisplayString(_ctx.title), 11, ["id", "aria-level"])) : vue.createCommentVNode("v-if", true)
|
137
|
-
]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
|
138
|
-
vue.createCommentVNode(" DEPRECATED SLOT ")
|
139
|
-
]),
|
140
|
-
_ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
|
141
|
-
key: 2,
|
142
|
-
"aria-label": vue.unref(t)("el.drawer.close"),
|
143
|
-
class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
|
144
|
-
type: "button",
|
145
|
-
onClick: vue.unref(handleClose)
|
146
|
-
}, [
|
147
|
-
vue.createVNode(vue.unref(index$5.ElIcon), {
|
148
|
-
class: vue.normalizeClass(vue.unref(ns).e("close"))
|
149
|
-
}, {
|
150
|
-
default: vue.withCtx(() => [
|
151
|
-
vue.createVNode(vue.unref(iconsVue.Close))
|
152
|
-
]),
|
153
|
-
_: 1
|
154
|
-
}, 8, ["class"])
|
155
|
-
], 10, ["aria-label", "onClick"])) : vue.createCommentVNode("v-if", true)
|
156
|
-
], 2)) : vue.createCommentVNode("v-if", true),
|
157
|
-
vue.unref(rendered) ? (vue.openBlock(), vue.createElementBlock("div", {
|
158
|
-
key: 1,
|
159
|
-
id: vue.unref(bodyId),
|
160
|
-
class: vue.normalizeClass(vue.unref(ns).e("body"))
|
161
|
-
}, [
|
162
|
-
vue.renderSlot(_ctx.$slots, "default")
|
163
|
-
], 10, ["id"])) : vue.createCommentVNode("v-if", true),
|
164
|
-
_ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
|
165
|
-
key: 2,
|
166
|
-
class: vue.normalizeClass(vue.unref(ns).e("footer"))
|
167
|
-
}, [
|
168
|
-
vue.renderSlot(_ctx.$slots, "footer")
|
169
|
-
], 2)) : vue.createCommentVNode("v-if", true)
|
170
|
-
], 16, ["aria-label", "aria-labelledby", "aria-describedby", "onClick"])
|
171
|
-
]),
|
172
|
-
_: 3
|
173
|
-
}, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
|
174
|
-
]),
|
175
|
-
_: 3
|
176
|
-
}, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
|
177
|
-
[vue.vShow, vue.unref(visible)]
|
178
|
-
])
|
179
|
-
]),
|
180
|
-
_: 3
|
181
|
-
}, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
|
182
|
-
]),
|
183
|
-
_: 3
|
184
|
-
}, 8, ["to", "disabled"]);
|
185
|
-
};
|
10
|
+
const drawerProps = runtime.buildProps({
|
11
|
+
...dialog.dialogProps,
|
12
|
+
direction: {
|
13
|
+
type: String,
|
14
|
+
default: "rtl",
|
15
|
+
values: ["ltr", "rtl", "ttb", "btt"]
|
16
|
+
},
|
17
|
+
size: {
|
18
|
+
type: [String, Number],
|
19
|
+
default: "30%"
|
20
|
+
},
|
21
|
+
withHeader: {
|
22
|
+
type: Boolean,
|
23
|
+
default: true
|
24
|
+
},
|
25
|
+
modalFade: {
|
26
|
+
type: Boolean,
|
27
|
+
default: true
|
28
|
+
},
|
29
|
+
headerAriaLevel: {
|
30
|
+
type: String,
|
31
|
+
default: "2"
|
186
32
|
}
|
187
33
|
});
|
188
|
-
|
34
|
+
const drawerEmits = dialog.dialogEmits;
|
189
35
|
|
190
|
-
exports
|
36
|
+
exports.drawerEmits = drawerEmits;
|
37
|
+
exports.drawerProps = drawerProps;
|
191
38
|
//# sourceMappingURL=drawer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"drawer.js","sources":["../../../../../../packages/components/drawer/src/drawer.
|
1
|
+
{"version":3,"file":"drawer.js","sources":["../../../../../../packages/components/drawer/src/drawer.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport { dialogEmits, dialogProps } from '@element-plus/components/dialog'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const drawerProps = buildProps({\n ...dialogProps,\n direction: {\n type: String,\n default: 'rtl',\n values: ['ltr', 'rtl', 'ttb', 'btt'],\n },\n size: {\n type: [String, Number],\n default: '30%',\n },\n withHeader: {\n type: Boolean,\n default: true,\n },\n modalFade: {\n type: Boolean,\n default: true,\n },\n headerAriaLevel: {\n type: String,\n default: '2',\n },\n} as const)\n\nexport type DrawerProps = ExtractPropTypes<typeof drawerProps>\n\nexport const drawerEmits = dialogEmits\n"],"names":["buildProps","dialogProps","dialogEmits"],"mappings":";;;;;;;;;AAEY,MAAC,WAAW,GAAGA,kBAAU,CAAC;AACtC,EAAE,GAAGC,kBAAW;AAChB,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK;AAClB,IAAI,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AACxC,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,WAAW,GAAGC;;;;;"}
|