You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
15 KiB

1 month ago
  1. {"ast":null,"code":"import { defineComponent, computed, unref, openBlock, createElementBlock, normalizeClass, withModifiers, createBlock, Transition, withCtx, withDirectives, createElementVNode, createVNode, vShow, createCommentVNode, normalizeStyle, renderSlot, Fragment, renderList, toDisplayString } from 'vue';\nimport { ElIcon } from '../../icon/index.mjs';\nimport { ArrowLeft, ArrowRight } from '@element-plus/icons-vue';\nimport { carouselProps, carouselEmits } from './carousel.mjs';\nimport { useCarousel } from './use-carousel.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\nimport { useLocale } from '../../../hooks/use-locale/index.mjs';\nconst COMPONENT_NAME = \"ElCarousel\";\nconst __default__ = defineComponent({\n name: COMPONENT_NAME\n});\nconst _sfc_main = /* @__PURE__ */defineComponent({\n ...__default__,\n props: carouselProps,\n emits: carouselEmits,\n setup(__props, {\n expose,\n emit\n }) {\n const props = __props;\n const {\n root,\n activeIndex,\n arrowDisplay,\n hasLabel,\n hover,\n isCardType,\n items,\n isVertical,\n containerStyle,\n handleButtonEnter,\n handleButtonLeave,\n isTransitioning,\n handleIndicatorClick,\n handleMouseEnter,\n handleMouseLeave,\n handleTransitionEnd,\n setActiveItem,\n prev,\n next,\n PlaceholderItem,\n isTwoLengthShow,\n throttledArrowClick,\n throttledIndicatorHover\n } = useCarousel(props, emit, COMPONENT_NAME);\n const ns = useNamespace(\"carousel\");\n const {\n t\n } = useLocale();\n const carouselClasses = computed(() => {\n const classes = [ns.b(), ns.m(props.direction)];\n if (unref(isCardType)) {\n classes.push(ns.m(\"card\"));\n }\n return classes;\n });\n const carouselContainer = computed(() => {\n const classes = [ns.e(\"container\")];\n if (props.motionBlur && unref(isTransitioning) && items.value.length > 1) {\n classes.push(unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`);\n }\n return classes;\n });\n const indicatorsClasses = computed(() => {\n const classes = [ns.e(\"indicators\"), ns.em(\"indicators\", props.direction)];\n if (unref(hasLabel)) {\n classes.push(ns.em(\"indicators\", \"labels\"));\n }\n if (props.indicatorPosition === \"outside\") {\n classes.push(ns.em(\"indicators\", \"outside\"));\n }\n if (unref(isVertical)) {\n classes.push(ns.em(\"indicators\", \"right\"));\n }\n return classes;\n });\n expose({\n activeIndex,\n setActiveItem,\n prev,\n next\n });\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"div\", {\n ref_key: \"root\",\n ref: root,\n class: normalizeClass(unref(carouselClasses)),\n onMouseenter: withModifiers(unref(handleMouseEnter), [\"stop\"]),\n onMouseleave: withModifiers(unref(handleMouseLeave), [\"stop\"])\n }, [unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {\n key: 0,\n name: \"carousel-arrow-left\",\n persisted: \"\"\n }, {\n default: withCtx(() => [withDirectives(createElementVNode(\"button\", {\n type: \"button\",\n class: normalizeClass([unref(ns).e(\"arrow\"), unref(ns).em(\"arrow\", \"left\")]),\n \"aria-label\": unref(t)(\"el.carousel.leftArrow\"),\n onMouseenter: $event => unref(handleButtonEnter)(\"left\"),\n onMouseleave: unref(handleButtonLeave),\n onClick: withModifiers($event => unref(throttledArrowClick)(unref(activeIndex) - 1), [\"stop\"])\n }, [createVNode(unref(ElIcon), null, {\n default: withCtx(() => [createVNode(unref(ArrowLeft))]),\n _: 1\n })], 42, [\"aria-label\", \"onMouseenter\", \"onMouseleave\", \"onClick\"]), [[vShow, (_ctx.ar