element-pe 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.full.js +1 -1
- package/dist/index.full.min.js +1 -1
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +1 -1
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +1 -1
- package/es/components/affix/index.mjs +2 -2
- package/es/components/affix/src/affix.mjs +114 -23
- package/es/components/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +23 -114
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/autocomplete/index.mjs +2 -2
- package/es/components/autocomplete/src/autocomplete.mjs +325 -67
- package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete2.mjs +67 -325
- package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
- package/es/components/backtop/index.mjs +2 -2
- package/es/components/backtop/src/backtop.mjs +100 -21
- package/es/components/backtop/src/backtop.mjs.map +1 -1
- package/es/components/backtop/src/backtop2.mjs +21 -100
- package/es/components/backtop/src/backtop2.mjs.map +1 -1
- package/es/components/breadcrumb/index.mjs +2 -2
- package/es/components/breadcrumb/src/breadcrumb-item.mjs +11 -57
- package/es/components/breadcrumb/src/breadcrumb-item.mjs.map +1 -1
- package/es/components/breadcrumb/src/breadcrumb-item2.mjs +57 -11
- package/es/components/breadcrumb/src/breadcrumb-item2.mjs.map +1 -1
- package/es/components/button/index.mjs +3 -3
- package/es/components/button/src/button-group.mjs +5 -30
- package/es/components/button/src/button-group.mjs.map +1 -1
- package/es/components/button/src/button-group2.mjs +30 -5
- package/es/components/button/src/button-group2.mjs.map +1 -1
- package/es/components/button/src/button.mjs +106 -51
- package/es/components/button/src/button.mjs.map +1 -1
- package/es/components/button/src/button2.mjs +51 -106
- package/es/components/button/src/button2.mjs.map +1 -1
- package/es/components/carousel/index.mjs +2 -2
- package/es/components/carousel/src/carousel.mjs +48 -319
- package/es/components/carousel/src/carousel.mjs.map +1 -1
- package/es/components/carousel/src/carousel2.mjs +319 -48
- package/es/components/carousel/src/carousel2.mjs.map +1 -1
- package/es/components/dialog/index.mjs +2 -2
- package/es/components/dialog/src/dialog.mjs +113 -70
- package/es/components/dialog/src/dialog.mjs.map +1 -1
- package/es/components/dialog/src/dialog2.mjs +70 -113
- package/es/components/dialog/src/dialog2.mjs.map +1 -1
- package/es/components/drawer/index.mjs +2 -2
- package/es/components/drawer/src/drawer.mjs +21 -126
- package/es/components/drawer/src/drawer.mjs.map +1 -1
- package/es/components/drawer/src/drawer2.mjs +126 -21
- package/es/components/drawer/src/drawer2.mjs.map +1 -1
- package/es/components/empty/index.mjs +2 -2
- package/es/components/empty/src/empty.mjs +11 -56
- package/es/components/empty/src/empty.mjs.map +1 -1
- package/es/components/empty/src/empty2.mjs +56 -11
- package/es/components/empty/src/empty2.mjs.map +1 -1
- package/es/components/form/index.mjs +2 -2
- package/es/components/form/src/form-item.mjs +43 -272
- package/es/components/form/src/form-item.mjs.map +1 -1
- package/es/components/form/src/form-item2.mjs +272 -43
- package/es/components/form/src/form-item2.mjs.map +1 -1
- package/es/components/icon/index.mjs +2 -2
- package/es/components/icon/src/icon.mjs +35 -8
- package/es/components/icon/src/icon.mjs.map +1 -1
- package/es/components/icon/src/icon2.mjs +8 -35
- package/es/components/icon/src/icon2.mjs.map +1 -1
- package/es/components/index.mjs +26 -26
- package/es/components/input/index.mjs +2 -2
- package/es/components/input/src/input.mjs +92 -433
- package/es/components/input/src/input.mjs.map +1 -1
- package/es/components/input/src/input2.mjs +433 -92
- package/es/components/input/src/input2.mjs.map +1 -1
- package/es/components/input-number/index.mjs +2 -2
- package/es/components/input-number/src/input-number.mjs +284 -53
- package/es/components/input-number/src/input-number.mjs.map +1 -1
- package/es/components/input-number/src/input-number2.mjs +53 -284
- package/es/components/input-number/src/input-number2.mjs.map +1 -1
- package/es/components/link/index.mjs +2 -2
- package/es/components/link/src/link.mjs +49 -22
- package/es/components/link/src/link.mjs.map +1 -1
- package/es/components/link/src/link2.mjs +22 -49
- package/es/components/link/src/link2.mjs.map +1 -1
- package/es/components/menu/index.mjs +2 -2
- package/es/components/menu/src/menu-item-group.mjs +4 -51
- package/es/components/menu/src/menu-item-group.mjs.map +1 -1
- package/es/components/menu/src/menu-item-group2.mjs +51 -4
- package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
- package/es/components/page-header/index.mjs +2 -2
- package/es/components/page-header/src/page-header.mjs +60 -17
- package/es/components/page-header/src/page-header.mjs.map +1 -1
- package/es/components/page-header/src/page-header2.mjs +17 -60
- package/es/components/page-header/src/page-header2.mjs.map +1 -1
- package/es/components/popconfirm/index.mjs +2 -2
- package/es/components/popconfirm/src/popconfirm.mjs +52 -119
- package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
- package/es/components/popconfirm/src/popconfirm2.mjs +119 -52
- package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/arrow.mjs +37 -7
- package/es/components/popper/src/arrow.mjs.map +1 -1
- package/es/components/popper/src/arrow2.mjs +7 -37
- package/es/components/popper/src/arrow2.mjs.map +1 -1
- package/es/components/progress/index.mjs +2 -2
- package/es/components/progress/src/progress.mjs +230 -57
- package/es/components/progress/src/progress.mjs.map +1 -1
- package/es/components/progress/src/progress2.mjs +57 -230
- package/es/components/progress/src/progress2.mjs.map +1 -1
- package/es/components/radio/index.mjs +2 -2
- package/es/components/radio/src/radio-group.mjs +20 -84
- package/es/components/radio/src/radio-group.mjs.map +1 -1
- package/es/components/radio/src/radio-group2.mjs +84 -20
- package/es/components/radio/src/radio-group2.mjs.map +1 -1
- package/es/components/rate/index.mjs +2 -2
- package/es/components/rate/src/rate.mjs +239 -88
- package/es/components/rate/src/rate.mjs.map +1 -1
- package/es/components/rate/src/rate2.mjs +88 -239
- package/es/components/rate/src/rate2.mjs.map +1 -1
- package/es/components/skeleton/index.mjs +2 -2
- package/es/components/skeleton/src/skeleton-item.mjs +18 -23
- package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton-item2.mjs +23 -18
- package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.mjs +1 -1
- package/es/components/switch/index.mjs +2 -2
- package/es/components/switch/src/switch.mjs +250 -87
- package/es/components/switch/src/switch.mjs.map +1 -1
- package/es/components/switch/src/switch2.mjs +87 -250
- package/es/components/switch/src/switch2.mjs.map +1 -1
- package/es/components/tabs/index.mjs +3 -3
- package/es/components/tabs/src/tab-bar.mjs +76 -7
- package/es/components/tabs/src/tab-bar.mjs.map +1 -1
- package/es/components/tabs/src/tab-bar2.mjs +7 -76
- package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
- package/es/components/tabs/src/tab-nav.mjs +1 -1
- package/es/components/tabs/src/tab-pane.mjs +60 -14
- package/es/components/tabs/src/tab-pane.mjs.map +1 -1
- package/es/components/tabs/src/tab-pane2.mjs +14 -60
- package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
- package/es/components/teleport/index.mjs +2 -2
- package/es/components/teleport/src/teleport.mjs +18 -43
- package/es/components/teleport/src/teleport.mjs.map +1 -1
- package/es/components/teleport/src/teleport2.mjs +43 -18
- package/es/components/teleport/src/teleport2.mjs.map +1 -1
- package/es/components/tooltip/src/tooltip2.mjs +2 -2
- package/es/components/tooltip-v2/index.mjs +3 -3
- package/es/components/tooltip-v2/src/arrow.mjs +22 -38
- package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
- package/es/components/tooltip-v2/src/arrow2.mjs +38 -22
- package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip.mjs +20 -73
- package/es/components/tooltip-v2/src/tooltip.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip2.mjs +73 -20
- package/es/components/tooltip-v2/src/tooltip2.mjs.map +1 -1
- package/es/index.mjs +26 -26
- package/lib/components/affix/index.js +2 -2
- package/lib/components/affix/src/affix.js +114 -24
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +24 -114
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/autocomplete/index.js +2 -2
- package/lib/components/autocomplete/src/autocomplete.js +324 -67
- package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete2.js +67 -324
- package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
- package/lib/components/backtop/index.js +2 -2
- package/lib/components/backtop/src/backtop.js +100 -22
- package/lib/components/backtop/src/backtop.js.map +1 -1
- package/lib/components/backtop/src/backtop2.js +22 -100
- package/lib/components/backtop/src/backtop2.js.map +1 -1
- package/lib/components/breadcrumb/index.js +2 -2
- package/lib/components/breadcrumb/src/breadcrumb-item.js +11 -57
- package/lib/components/breadcrumb/src/breadcrumb-item.js.map +1 -1
- package/lib/components/breadcrumb/src/breadcrumb-item2.js +57 -11
- package/lib/components/breadcrumb/src/breadcrumb-item2.js.map +1 -1
- package/lib/components/button/index.js +3 -3
- package/lib/components/button/src/button-group.js +5 -30
- package/lib/components/button/src/button-group.js.map +1 -1
- package/lib/components/button/src/button-group2.js +30 -5
- package/lib/components/button/src/button-group2.js.map +1 -1
- package/lib/components/button/src/button.js +106 -54
- package/lib/components/button/src/button.js.map +1 -1
- package/lib/components/button/src/button2.js +54 -106
- package/lib/components/button/src/button2.js.map +1 -1
- package/lib/components/carousel/index.js +2 -2
- package/lib/components/carousel/src/carousel.js +49 -319
- package/lib/components/carousel/src/carousel.js.map +1 -1
- package/lib/components/carousel/src/carousel2.js +319 -49
- package/lib/components/carousel/src/carousel2.js.map +1 -1
- package/lib/components/dialog/index.js +2 -2
- package/lib/components/dialog/src/dialog.js +113 -71
- package/lib/components/dialog/src/dialog.js.map +1 -1
- package/lib/components/dialog/src/dialog2.js +71 -113
- package/lib/components/dialog/src/dialog2.js.map +1 -1
- package/lib/components/drawer/index.js +2 -2
- package/lib/components/drawer/src/drawer.js +22 -126
- package/lib/components/drawer/src/drawer.js.map +1 -1
- package/lib/components/drawer/src/drawer2.js +126 -22
- package/lib/components/drawer/src/drawer2.js.map +1 -1
- package/lib/components/empty/index.js +2 -2
- package/lib/components/empty/src/empty.js +11 -56
- package/lib/components/empty/src/empty.js.map +1 -1
- package/lib/components/empty/src/empty2.js +56 -11
- package/lib/components/empty/src/empty2.js.map +1 -1
- package/lib/components/form/index.js +2 -2
- package/lib/components/form/src/form-item.js +44 -276
- package/lib/components/form/src/form-item.js.map +1 -1
- package/lib/components/form/src/form-item2.js +276 -44
- package/lib/components/form/src/form-item2.js.map +1 -1
- package/lib/components/icon/index.js +2 -2
- package/lib/components/icon/src/icon.js +35 -8
- package/lib/components/icon/src/icon.js.map +1 -1
- package/lib/components/icon/src/icon2.js +8 -35
- package/lib/components/icon/src/icon2.js.map +1 -1
- package/lib/components/index.js +26 -26
- package/lib/components/input/index.js +2 -2
- package/lib/components/input/src/input.js +92 -432
- package/lib/components/input/src/input.js.map +1 -1
- package/lib/components/input/src/input2.js +432 -92
- package/lib/components/input/src/input2.js.map +1 -1
- package/lib/components/input-number/index.js +2 -2
- package/lib/components/input-number/src/input-number.js +284 -54
- package/lib/components/input-number/src/input-number.js.map +1 -1
- package/lib/components/input-number/src/input-number2.js +54 -284
- package/lib/components/input-number/src/input-number2.js.map +1 -1
- package/lib/components/link/index.js +2 -2
- package/lib/components/link/src/link.js +49 -23
- package/lib/components/link/src/link.js.map +1 -1
- package/lib/components/link/src/link2.js +23 -49
- package/lib/components/link/src/link2.js.map +1 -1
- package/lib/components/menu/index.js +2 -2
- package/lib/components/menu/src/menu-item-group.js +4 -51
- package/lib/components/menu/src/menu-item-group.js.map +1 -1
- package/lib/components/menu/src/menu-item-group2.js +51 -4
- package/lib/components/menu/src/menu-item-group2.js.map +1 -1
- package/lib/components/page-header/index.js +2 -2
- package/lib/components/page-header/src/page-header.js +60 -18
- package/lib/components/page-header/src/page-header.js.map +1 -1
- package/lib/components/page-header/src/page-header2.js +18 -60
- package/lib/components/page-header/src/page-header2.js.map +1 -1
- package/lib/components/popconfirm/index.js +2 -2
- package/lib/components/popconfirm/src/popconfirm.js +52 -119
- package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
- package/lib/components/popconfirm/src/popconfirm2.js +119 -52
- package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/arrow.js +37 -7
- package/lib/components/popper/src/arrow.js.map +1 -1
- package/lib/components/popper/src/arrow2.js +7 -37
- package/lib/components/popper/src/arrow2.js.map +1 -1
- package/lib/components/progress/index.js +2 -2
- package/lib/components/progress/src/progress.js +230 -57
- package/lib/components/progress/src/progress.js.map +1 -1
- package/lib/components/progress/src/progress2.js +57 -230
- package/lib/components/progress/src/progress2.js.map +1 -1
- package/lib/components/radio/index.js +2 -2
- package/lib/components/radio/src/radio-group.js +21 -84
- package/lib/components/radio/src/radio-group.js.map +1 -1
- package/lib/components/radio/src/radio-group2.js +84 -21
- package/lib/components/radio/src/radio-group2.js.map +1 -1
- package/lib/components/rate/index.js +2 -2
- package/lib/components/rate/src/rate.js +239 -89
- package/lib/components/rate/src/rate.js.map +1 -1
- package/lib/components/rate/src/rate2.js +89 -239
- package/lib/components/rate/src/rate2.js.map +1 -1
- package/lib/components/skeleton/index.js +2 -2
- package/lib/components/skeleton/src/skeleton-item.js +18 -23
- package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
- package/lib/components/skeleton/src/skeleton-item2.js +23 -18
- package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.js +1 -1
- package/lib/components/switch/index.js +2 -2
- package/lib/components/switch/src/switch.js +249 -87
- package/lib/components/switch/src/switch.js.map +1 -1
- package/lib/components/switch/src/switch2.js +87 -249
- package/lib/components/switch/src/switch2.js.map +1 -1
- package/lib/components/tabs/index.js +3 -3
- package/lib/components/tabs/src/tab-bar.js +76 -7
- package/lib/components/tabs/src/tab-bar.js.map +1 -1
- package/lib/components/tabs/src/tab-bar2.js +7 -76
- package/lib/components/tabs/src/tab-bar2.js.map +1 -1
- package/lib/components/tabs/src/tab-nav.js +1 -1
- package/lib/components/tabs/src/tab-pane.js +60 -14
- package/lib/components/tabs/src/tab-pane.js.map +1 -1
- package/lib/components/tabs/src/tab-pane2.js +14 -60
- package/lib/components/tabs/src/tab-pane2.js.map +1 -1
- package/lib/components/teleport/index.js +2 -2
- package/lib/components/teleport/src/teleport.js +18 -43
- package/lib/components/teleport/src/teleport.js.map +1 -1
- package/lib/components/teleport/src/teleport2.js +43 -18
- package/lib/components/teleport/src/teleport2.js.map +1 -1
- package/lib/components/tooltip/src/tooltip2.js +2 -2
- package/lib/components/tooltip-v2/index.js +3 -3
- package/lib/components/tooltip-v2/src/arrow.js +23 -38
- package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
- package/lib/components/tooltip-v2/src/arrow2.js +38 -23
- package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip.js +20 -73
- package/lib/components/tooltip-v2/src/tooltip.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip2.js +73 -20
- package/lib/components/tooltip-v2/src/tooltip2.js.map +1 -1
- package/lib/index.js +26 -26
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.mjs","sources":["../../../../../../packages/components/button/src/button.
|
|
1
|
+
{"version":3,"file":"button.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<template>\n <button\n ref=\"_ref\"\n :class=\"[\n ns.b(),\n ns.m(_type),\n ns.m(_size),\n ns.is('disabled', _disabled),\n ns.is('loading', loading),\n ns.is('plain', plain),\n ns.is('round', round),\n ns.is('circle', circle),\n ]\"\n :disabled=\"_disabled || loading\"\n :autofocus=\"autofocus\"\n :type=\"nativeType\"\n :style=\"buttonStyle\"\n @click=\"handleClick\"\n >\n <template v-if=\"loading\">\n <slot v-if=\"$slots.loading\" name=\"loading\" />\n <el-icon v-else :class=\"ns.is('loading')\">\n <component :is=\"loadingIcon\" />\n </el-icon>\n </template>\n <el-icon v-else-if=\"icon || $slots.icon\">\n <component :is=\"icon\" v-if=\"icon\" />\n <slot v-else name=\"icon\" />\n </el-icon>\n <span\n v-if=\"$slots.default\"\n :class=\"{ [ns.em('text', 'expand')]: shouldAddSpace }\"\n >\n <slot />\n </span>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { Text, computed, inject, ref, useSlots } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n useDisabled,\n useFormItem,\n useGlobalConfig,\n useNamespace,\n useSize,\n} from '@element-plus/hooks'\nimport { buttonGroupContextKey } from '@element-plus/tokens'\nimport { buttonEmits, buttonProps } from './button'\nimport { useButtonCustomStyle } from './button-custom'\n\ndefineOptions({\n name: 'ElButton',\n})\n\nconst props = defineProps(buttonProps)\nconst emit = defineEmits(buttonEmits)\nconst slots = useSlots()\n\nconst buttonGroupContext = inject(buttonGroupContextKey, undefined)\nconst globalConfig = useGlobalConfig('button')\nconst ns = useNamespace('button')\nconst { form } = useFormItem()\nconst _size = useSize(computed(() => buttonGroupContext?.size))\nconst _disabled = useDisabled()\nconst _ref = ref<HTMLButtonElement>()\n\nconst _type = computed(() => props.type || buttonGroupContext?.type || '')\nconst autoInsertSpace = computed(\n () => props.autoInsertSpace ?? globalConfig.value?.autoInsertSpace ?? false\n)\n\n// add space between two characters in Chinese\nconst shouldAddSpace = computed(() => {\n const defaultSlot = slots.default?.()\n if (autoInsertSpace.value && defaultSlot?.length === 1) {\n const slot = defaultSlot[0]\n if (slot?.type === Text) {\n const text = slot.children as string\n return /^\\p{Unified_Ideograph}{2}$/u.test(text.trim())\n }\n }\n return false\n})\n\nconst buttonStyle = useButtonCustomStyle(props)\n\nconst handleClick = (evt: MouseEvent) => {\n if (props.nativeType === 'reset') {\n form?.resetFields()\n }\n emit('click', evt)\n}\n\ndefineExpose({\n /** @description button html element */\n ref: _ref,\n /** @description button size */\n size: _size,\n /** @description button type */\n type: _type,\n /** @description button disabled */\n disabled: _disabled,\n /** @description whether adding space */\n shouldAddSpace,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAA,MAAA,QAAA,QAAA,EAAA,CAAA;AAEA,IAAA,MAAA,kBAAA,GAAA,MAAA,CAAA,qBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,GAAA,gBAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,GAAA,aAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,SAAA,WAAA,EAAA,CAAA;AACA,IAAA,MAAA,QAAA,OAAA,CAAA,QAAA,CAAA,MAAA,kBAAA,QAAA,GAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,WAAA,EAAA,CAAA;AACA,IAAA,MAAA,OAAA,GAAA,EAAA,CAAA;AAEA,IAAA,MAAA,QAAA,QAAA,CAAA,MAAA,MAAA,IAAA,KAAA,kBAAA,WAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA;AACA,IAAA,MAAA,eAAA,GAAA,SACA,MAAA;AAIA,MAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AACA,MAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,qBAAA,KAAA,IAAA,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,YAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,eAAA,KAAA,IAAA,GAAA,EAAA,GAAA,KAAA,CAAA;AACA,KAAA,CAAA,CAAA;AACA,IAAA,MAAA,cAAA,GAAA,QAAA,CAAA,MAAA;AACA,MAAA,IAAA,EAAA,CAAA;AACA,MAAA,MAAA,WAAA,GAAA,CAAA,EAAA,GAAA,KAAA,CAAA,OAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAA;AACA,MAAA,IAAA,eAAA,CAAA,KAAA,IAAA,CAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,CAAA,MAAA,MAAA,CAAA,EAAA;AAAA,QACA,MAAA,IAAA,GAAA,WAAA,CAAA,CAAA,CAAA,CAAA;AAAA,QACA,IAAA,CAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAA,IAAA,MAAA,IAAA,EAAA;AACA,UAAA,MAAA,IAAA,GAAA,IAAA,CAAA,QAAA,CAAA;AAAA,UACA,OAAA,6BAAA,CAAA,IAAA,CAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA;AAEA,SAAA;AAEA,OAAA;AACA,MAAA,OAAA;AACA,KAAA,CAAA,CAAA;AAAA,IACA,MAAA,WAAA,GAAA,oBAAA,CAAA,KAAA,CAAA,CAAA;AACA,IAAA,MAAA,WAAA,GAAA,CAAA,GAAA,KAAA;AAAA,MACA,IAAA,KAAA,CAAA,UAAA,KAAA,OAAA,EAAA;AAEA,QAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAA,WAAA,EAAA,CAAA;AAAA,OAEA;AAAA,MAEA,IAAA,CAAA,OAAA,EAAA,GAAA,CAAA,CAAA;AAAA,KAAA,CAEA;AAAA,IAAA,MAEA,CAAA;AAAA,MAEA,GAAA,EAAA,IAAA;AAAA,MACA,IAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,112 +1,57 @@
|
|
|
1
|
-
import { defineComponent, useSlots, inject, computed, ref, Text, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, Fragment, renderSlot, createBlock, withCtx, resolveDynamicComponent, createCommentVNode } from 'vue';
|
|
2
|
-
import { ElIcon } from '../../icon/index.mjs';
|
|
3
1
|
import '../../../hooks/index.mjs';
|
|
4
|
-
import '../../../
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { useGlobalConfig } from '../../../hooks/use-global-config/index.mjs';
|
|
10
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
11
|
-
import { useFormItem } from '../../../hooks/use-form-item/index.mjs';
|
|
12
|
-
import { useSize, useDisabled } from '../../../hooks/use-common-props/index.mjs';
|
|
2
|
+
import '../../../utils/index.mjs';
|
|
3
|
+
import { Loading } from '@element-plus/icons-vue';
|
|
4
|
+
import { buildProps } from '../../../utils/vue/props.mjs';
|
|
5
|
+
import { useSizeProp } from '../../../hooks/use-common-props/index.mjs';
|
|
6
|
+
import { iconPropType } from '../../../utils/vue/icon.mjs';
|
|
13
7
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
expose({
|
|
57
|
-
ref: _ref,
|
|
58
|
-
size: _size,
|
|
59
|
-
type: _type,
|
|
60
|
-
disabled: _disabled,
|
|
61
|
-
shouldAddSpace
|
|
62
|
-
});
|
|
63
|
-
return (_ctx, _cache) => {
|
|
64
|
-
return openBlock(), createElementBlock("button", {
|
|
65
|
-
ref_key: "_ref",
|
|
66
|
-
ref: _ref,
|
|
67
|
-
class: normalizeClass([
|
|
68
|
-
unref(ns).b(),
|
|
69
|
-
unref(ns).m(unref(_type)),
|
|
70
|
-
unref(ns).m(unref(_size)),
|
|
71
|
-
unref(ns).is("disabled", unref(_disabled)),
|
|
72
|
-
unref(ns).is("loading", _ctx.loading),
|
|
73
|
-
unref(ns).is("plain", _ctx.plain),
|
|
74
|
-
unref(ns).is("round", _ctx.round),
|
|
75
|
-
unref(ns).is("circle", _ctx.circle)
|
|
76
|
-
]),
|
|
77
|
-
disabled: unref(_disabled) || _ctx.loading,
|
|
78
|
-
autofocus: _ctx.autofocus,
|
|
79
|
-
type: _ctx.nativeType,
|
|
80
|
-
style: normalizeStyle(unref(buttonStyle)),
|
|
81
|
-
onClick: handleClick
|
|
82
|
-
}, [
|
|
83
|
-
_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
84
|
-
_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
|
|
85
|
-
key: 1,
|
|
86
|
-
class: normalizeClass(unref(ns).is("loading"))
|
|
87
|
-
}, {
|
|
88
|
-
default: withCtx(() => [
|
|
89
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
|
|
90
|
-
]),
|
|
91
|
-
_: 1
|
|
92
|
-
}, 8, ["class"]))
|
|
93
|
-
], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
94
|
-
default: withCtx(() => [
|
|
95
|
-
_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
|
|
96
|
-
]),
|
|
97
|
-
_: 3
|
|
98
|
-
})) : createCommentVNode("v-if", true),
|
|
99
|
-
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
|
|
100
|
-
key: 2,
|
|
101
|
-
class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
|
|
102
|
-
}, [
|
|
103
|
-
renderSlot(_ctx.$slots, "default")
|
|
104
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
105
|
-
], 14, _hoisted_1);
|
|
106
|
-
};
|
|
8
|
+
const buttonTypes = [
|
|
9
|
+
"default",
|
|
10
|
+
"primary",
|
|
11
|
+
"success",
|
|
12
|
+
"warning",
|
|
13
|
+
"info",
|
|
14
|
+
"danger",
|
|
15
|
+
"text",
|
|
16
|
+
""
|
|
17
|
+
];
|
|
18
|
+
const buttonNativeTypes = ["button", "submit", "reset"];
|
|
19
|
+
const buttonProps = buildProps({
|
|
20
|
+
size: useSizeProp,
|
|
21
|
+
disabled: Boolean,
|
|
22
|
+
type: {
|
|
23
|
+
type: String,
|
|
24
|
+
values: buttonTypes,
|
|
25
|
+
default: ""
|
|
26
|
+
},
|
|
27
|
+
icon: {
|
|
28
|
+
type: iconPropType,
|
|
29
|
+
default: ""
|
|
30
|
+
},
|
|
31
|
+
nativeType: {
|
|
32
|
+
type: String,
|
|
33
|
+
values: buttonNativeTypes,
|
|
34
|
+
default: "button"
|
|
35
|
+
},
|
|
36
|
+
loading: Boolean,
|
|
37
|
+
loadingIcon: {
|
|
38
|
+
type: iconPropType,
|
|
39
|
+
default: () => Loading
|
|
40
|
+
},
|
|
41
|
+
plain: Boolean,
|
|
42
|
+
autofocus: Boolean,
|
|
43
|
+
round: Boolean,
|
|
44
|
+
circle: Boolean,
|
|
45
|
+
color: String,
|
|
46
|
+
dark: Boolean,
|
|
47
|
+
autoInsertSpace: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: void 0
|
|
107
50
|
}
|
|
108
51
|
});
|
|
109
|
-
|
|
52
|
+
const buttonEmits = {
|
|
53
|
+
click: (evt) => evt instanceof MouseEvent
|
|
54
|
+
};
|
|
110
55
|
|
|
111
|
-
export {
|
|
56
|
+
export { buttonEmits, buttonNativeTypes, buttonProps, buttonTypes };
|
|
112
57
|
//# sourceMappingURL=button2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button2.mjs","sources":["../../../../../../packages/components/button/src/button.
|
|
1
|
+
{"version":3,"file":"button2.mjs","sources":["../../../../../../packages/components/button/src/button.ts"],"sourcesContent":["import { useSizeProp } from '@element-plus/hooks'\nimport { buildProps, iconPropType } from '@element-plus/utils'\nimport { Loading } from '@element-plus/icons-vue'\nimport type { ExtractPropTypes } from 'vue'\nimport type button from './button.vue'\n\nexport const buttonTypes = [\n 'default',\n 'primary',\n 'success',\n 'warning',\n 'info',\n 'danger',\n 'text',\n '',\n] as const\nexport const buttonNativeTypes = ['button', 'submit', 'reset'] as const\n\nexport const buttonProps = buildProps({\n size: useSizeProp,\n disabled: Boolean,\n type: {\n type: String,\n values: buttonTypes,\n default: '',\n },\n icon: {\n type: iconPropType,\n default: '',\n },\n nativeType: {\n type: String,\n values: buttonNativeTypes,\n default: 'button',\n },\n loading: Boolean,\n loadingIcon: {\n type: iconPropType,\n default: () => Loading,\n },\n plain: Boolean,\n autofocus: Boolean,\n round: Boolean,\n circle: Boolean,\n color: String,\n dark: Boolean,\n autoInsertSpace: {\n type: Boolean,\n default: undefined,\n },\n} as const)\nexport const buttonEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\n\nexport type ButtonProps = ExtractPropTypes<typeof buttonProps>\nexport type ButtonEmits = typeof buttonEmits\n\nexport type ButtonType = ButtonProps['type']\nexport type ButtonNativeType = ButtonProps['nativeType']\n\nexport type ButtonInstance = InstanceType<typeof button>\n\nexport interface ButtonConfigContext {\n autoInsertSpace?: boolean\n}\n"],"names":[],"mappings":";;;;;;;AAGY,MAAC,WAAW,GAAG;AAC3B,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,MAAM;AACR,EAAE,QAAQ;AACV,EAAE,MAAM;AACR,EAAE,EAAE;AACJ,EAAE;AACU,MAAC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;AACnD,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,WAAW;AACvB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,iBAAiB;AAC7B,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,MAAM,OAAO;AAC1B,GAAG;AACH,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,IAAI,EAAE,OAAO;AACf,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,WAAW,GAAG;AAC3B,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC3C;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import Carousel from './src/
|
|
2
|
+
import Carousel from './src/carousel2.mjs';
|
|
3
3
|
import CarouselItem from './src/carousel-item.mjs';
|
|
4
|
-
export { carouselEmits, carouselProps } from './src/
|
|
4
|
+
export { carouselEmits, carouselProps } from './src/carousel.mjs';
|
|
5
5
|
export { carouselItemProps } from './src/carousel-item2.mjs';
|
|
6
6
|
import { withInstall, withNoopInstall } from '../../utils/vue/install.mjs';
|
|
7
7
|
|
|
@@ -1,325 +1,54 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, unref, watch, shallowRef, onMounted, nextTick, onBeforeUnmount, provide, openBlock, createElementBlock, normalizeClass, withModifiers, createElementVNode, normalizeStyle, createBlock, Transition, withCtx, withDirectives, createVNode, vShow, createCommentVNode, renderSlot, Fragment, renderList, toDisplayString } from 'vue';
|
|
2
|
-
import { throttle } from 'lodash-unified';
|
|
3
|
-
import { useResizeObserver } from '@vueuse/core';
|
|
4
1
|
import '../../../utils/index.mjs';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import '../../../hooks/index.mjs';
|
|
8
|
-
import '../../../tokens/index.mjs';
|
|
9
|
-
import { carouselProps, carouselEmits } from './carousel2.mjs';
|
|
10
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
11
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
12
|
-
import { isString } from '@vue/shared';
|
|
13
|
-
import { debugWarn } from '../../../utils/error.mjs';
|
|
14
|
-
import { carouselContextKey } from '../../../tokens/carousel.mjs';
|
|
2
|
+
import { buildProps } from '../../../utils/vue/props.mjs';
|
|
3
|
+
import { isNumber } from '@vueuse/core';
|
|
15
4
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const isVertical = computed(() => props.direction === "vertical");
|
|
59
|
-
const throttledArrowClick = throttle((index) => {
|
|
60
|
-
setActiveItem(index);
|
|
61
|
-
}, THROTTLE_TIME, { trailing: true });
|
|
62
|
-
const throttledIndicatorHover = throttle((index) => {
|
|
63
|
-
handleIndicatorHover(index);
|
|
64
|
-
}, THROTTLE_TIME);
|
|
65
|
-
function pauseTimer() {
|
|
66
|
-
if (timer.value) {
|
|
67
|
-
clearInterval(timer.value);
|
|
68
|
-
timer.value = null;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function startTimer() {
|
|
72
|
-
if (props.interval <= 0 || !props.autoplay || timer.value)
|
|
73
|
-
return;
|
|
74
|
-
timer.value = setInterval(() => playSlides(), props.interval);
|
|
75
|
-
}
|
|
76
|
-
const playSlides = () => {
|
|
77
|
-
if (activeIndex.value < items.value.length - 1) {
|
|
78
|
-
activeIndex.value = activeIndex.value + 1;
|
|
79
|
-
} else if (props.loop) {
|
|
80
|
-
activeIndex.value = 0;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
function setActiveItem(index) {
|
|
84
|
-
if (isString(index)) {
|
|
85
|
-
const filteredItems = items.value.filter((item) => item.props.name === index);
|
|
86
|
-
if (filteredItems.length > 0) {
|
|
87
|
-
index = items.value.indexOf(filteredItems[0]);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
index = Number(index);
|
|
91
|
-
if (Number.isNaN(index) || index !== Math.floor(index)) {
|
|
92
|
-
debugWarn(COMPONENT_NAME, "index must be integer.");
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const itemCount = items.value.length;
|
|
96
|
-
const oldIndex = activeIndex.value;
|
|
97
|
-
if (index < 0) {
|
|
98
|
-
activeIndex.value = props.loop ? itemCount - 1 : 0;
|
|
99
|
-
} else if (index >= itemCount) {
|
|
100
|
-
activeIndex.value = props.loop ? 0 : itemCount - 1;
|
|
101
|
-
} else {
|
|
102
|
-
activeIndex.value = index;
|
|
103
|
-
}
|
|
104
|
-
if (oldIndex === activeIndex.value) {
|
|
105
|
-
resetItemPosition(oldIndex);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function resetItemPosition(oldIndex) {
|
|
109
|
-
items.value.forEach((item, index) => {
|
|
110
|
-
item.translateItem(index, activeIndex.value, oldIndex);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function addItem(item) {
|
|
114
|
-
items.value.push(item);
|
|
115
|
-
}
|
|
116
|
-
function removeItem(uid) {
|
|
117
|
-
const index = items.value.findIndex((item) => item.uid === uid);
|
|
118
|
-
if (index !== -1) {
|
|
119
|
-
items.value.splice(index, 1);
|
|
120
|
-
if (activeIndex.value === index)
|
|
121
|
-
next();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function itemInStage(item, index) {
|
|
125
|
-
var _a, _b, _c, _d;
|
|
126
|
-
const _items = unref(items);
|
|
127
|
-
const itemCount = _items.length;
|
|
128
|
-
if (itemCount === 0 || !item.states.inStage)
|
|
129
|
-
return false;
|
|
130
|
-
const nextItemIndex = index + 1;
|
|
131
|
-
const prevItemIndex = index - 1;
|
|
132
|
-
const lastItemIndex = itemCount - 1;
|
|
133
|
-
const isLastItemActive = _items[lastItemIndex].states.active;
|
|
134
|
-
const isFirstItemActive = _items[0].states.active;
|
|
135
|
-
const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
|
|
136
|
-
const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
|
|
137
|
-
if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
|
|
138
|
-
return "left";
|
|
139
|
-
} else if (index === 0 && isLastItemActive || isPrevItemActive) {
|
|
140
|
-
return "right";
|
|
141
|
-
}
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
function handleMouseEnter() {
|
|
145
|
-
hover.value = true;
|
|
146
|
-
if (props.pauseOnHover) {
|
|
147
|
-
pauseTimer();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function handleMouseLeave() {
|
|
151
|
-
hover.value = false;
|
|
152
|
-
startTimer();
|
|
153
|
-
}
|
|
154
|
-
function handleButtonEnter(arrow) {
|
|
155
|
-
if (unref(isVertical))
|
|
156
|
-
return;
|
|
157
|
-
items.value.forEach((item, index) => {
|
|
158
|
-
if (arrow === itemInStage(item, index)) {
|
|
159
|
-
item.states.hover = true;
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
function handleButtonLeave() {
|
|
164
|
-
if (unref(isVertical))
|
|
165
|
-
return;
|
|
166
|
-
items.value.forEach((item) => {
|
|
167
|
-
item.states.hover = false;
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function handleIndicatorClick(index) {
|
|
171
|
-
activeIndex.value = index;
|
|
172
|
-
}
|
|
173
|
-
function handleIndicatorHover(index) {
|
|
174
|
-
if (props.trigger === "hover" && index !== activeIndex.value) {
|
|
175
|
-
activeIndex.value = index;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function prev() {
|
|
179
|
-
setActiveItem(activeIndex.value - 1);
|
|
180
|
-
}
|
|
181
|
-
function next() {
|
|
182
|
-
setActiveItem(activeIndex.value + 1);
|
|
183
|
-
}
|
|
184
|
-
watch(() => activeIndex.value, (current, prev2) => {
|
|
185
|
-
resetItemPosition(prev2);
|
|
186
|
-
if (prev2 > -1) {
|
|
187
|
-
emit("change", current, prev2);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
watch(() => props.autoplay, (autoplay) => {
|
|
191
|
-
autoplay ? startTimer() : pauseTimer();
|
|
192
|
-
});
|
|
193
|
-
watch(() => props.loop, () => {
|
|
194
|
-
setActiveItem(activeIndex.value);
|
|
195
|
-
});
|
|
196
|
-
const resizeObserver = shallowRef();
|
|
197
|
-
onMounted(async () => {
|
|
198
|
-
await nextTick();
|
|
199
|
-
resizeObserver.value = useResizeObserver(root.value, () => {
|
|
200
|
-
resetItemPosition();
|
|
201
|
-
});
|
|
202
|
-
if (props.initialIndex < items.value.length && props.initialIndex >= 0) {
|
|
203
|
-
activeIndex.value = props.initialIndex;
|
|
204
|
-
}
|
|
205
|
-
startTimer();
|
|
206
|
-
});
|
|
207
|
-
onBeforeUnmount(() => {
|
|
208
|
-
pauseTimer();
|
|
209
|
-
if (root.value && resizeObserver.value)
|
|
210
|
-
resizeObserver.value.stop();
|
|
211
|
-
});
|
|
212
|
-
provide(carouselContextKey, {
|
|
213
|
-
root,
|
|
214
|
-
isCardType,
|
|
215
|
-
isVertical,
|
|
216
|
-
items,
|
|
217
|
-
loop: props.loop,
|
|
218
|
-
addItem,
|
|
219
|
-
removeItem,
|
|
220
|
-
setActiveItem
|
|
221
|
-
});
|
|
222
|
-
expose({
|
|
223
|
-
setActiveItem,
|
|
224
|
-
prev,
|
|
225
|
-
next
|
|
226
|
-
});
|
|
227
|
-
return (_ctx, _cache) => {
|
|
228
|
-
return openBlock(), createElementBlock("div", {
|
|
229
|
-
ref_key: "root",
|
|
230
|
-
ref: root,
|
|
231
|
-
class: normalizeClass(unref(carouselClasses)),
|
|
232
|
-
onMouseenter: withModifiers(handleMouseEnter, ["stop"]),
|
|
233
|
-
onMouseleave: withModifiers(handleMouseLeave, ["stop"])
|
|
234
|
-
}, [
|
|
235
|
-
createElementVNode("div", {
|
|
236
|
-
class: normalizeClass(unref(ns).e("container")),
|
|
237
|
-
style: normalizeStyle({ height: _ctx.height })
|
|
238
|
-
}, [
|
|
239
|
-
unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
|
|
240
|
-
key: 0,
|
|
241
|
-
name: "carousel-arrow-left"
|
|
242
|
-
}, {
|
|
243
|
-
default: withCtx(() => [
|
|
244
|
-
withDirectives(createElementVNode("button", {
|
|
245
|
-
type: "button",
|
|
246
|
-
class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "left")]),
|
|
247
|
-
onMouseenter: _cache[0] || (_cache[0] = ($event) => handleButtonEnter("left")),
|
|
248
|
-
onMouseleave: handleButtonLeave,
|
|
249
|
-
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => unref(throttledArrowClick)(activeIndex.value - 1), ["stop"]))
|
|
250
|
-
}, [
|
|
251
|
-
createVNode(unref(ElIcon), null, {
|
|
252
|
-
default: withCtx(() => [
|
|
253
|
-
createVNode(unref(ArrowLeft))
|
|
254
|
-
]),
|
|
255
|
-
_: 1
|
|
256
|
-
})
|
|
257
|
-
], 34), [
|
|
258
|
-
[
|
|
259
|
-
vShow,
|
|
260
|
-
(_ctx.arrow === "always" || hover.value) && (props.loop || activeIndex.value > 0)
|
|
261
|
-
]
|
|
262
|
-
])
|
|
263
|
-
]),
|
|
264
|
-
_: 1
|
|
265
|
-
})) : createCommentVNode("v-if", true),
|
|
266
|
-
unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
|
|
267
|
-
key: 1,
|
|
268
|
-
name: "carousel-arrow-right"
|
|
269
|
-
}, {
|
|
270
|
-
default: withCtx(() => [
|
|
271
|
-
withDirectives(createElementVNode("button", {
|
|
272
|
-
type: "button",
|
|
273
|
-
class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "right")]),
|
|
274
|
-
onMouseenter: _cache[2] || (_cache[2] = ($event) => handleButtonEnter("right")),
|
|
275
|
-
onMouseleave: handleButtonLeave,
|
|
276
|
-
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(throttledArrowClick)(activeIndex.value + 1), ["stop"]))
|
|
277
|
-
}, [
|
|
278
|
-
createVNode(unref(ElIcon), null, {
|
|
279
|
-
default: withCtx(() => [
|
|
280
|
-
createVNode(unref(ArrowRight))
|
|
281
|
-
]),
|
|
282
|
-
_: 1
|
|
283
|
-
})
|
|
284
|
-
], 34), [
|
|
285
|
-
[
|
|
286
|
-
vShow,
|
|
287
|
-
(_ctx.arrow === "always" || hover.value) && (props.loop || activeIndex.value < items.value.length - 1)
|
|
288
|
-
]
|
|
289
|
-
])
|
|
290
|
-
]),
|
|
291
|
-
_: 1
|
|
292
|
-
})) : createCommentVNode("v-if", true),
|
|
293
|
-
renderSlot(_ctx.$slots, "default")
|
|
294
|
-
], 6),
|
|
295
|
-
_ctx.indicatorPosition !== "none" ? (openBlock(), createElementBlock("ul", {
|
|
296
|
-
key: 0,
|
|
297
|
-
class: normalizeClass(unref(indicatorsClasses))
|
|
298
|
-
}, [
|
|
299
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
300
|
-
return openBlock(), createElementBlock("li", {
|
|
301
|
-
key: index,
|
|
302
|
-
class: normalizeClass([
|
|
303
|
-
unref(ns).e("indicator"),
|
|
304
|
-
unref(ns).em("indicator", _ctx.direction),
|
|
305
|
-
unref(ns).is("active", index === activeIndex.value)
|
|
306
|
-
]),
|
|
307
|
-
onMouseenter: ($event) => unref(throttledIndicatorHover)(index),
|
|
308
|
-
onClick: withModifiers(($event) => handleIndicatorClick(index), ["stop"])
|
|
309
|
-
}, [
|
|
310
|
-
createElementVNode("button", {
|
|
311
|
-
class: normalizeClass(unref(ns).e("button"))
|
|
312
|
-
}, [
|
|
313
|
-
unref(hasLabel) ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(item.props.label), 1)) : createCommentVNode("v-if", true)
|
|
314
|
-
], 2)
|
|
315
|
-
], 42, _hoisted_2);
|
|
316
|
-
}), 128))
|
|
317
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
318
|
-
], 42, _hoisted_1);
|
|
319
|
-
};
|
|
5
|
+
const carouselProps = buildProps({
|
|
6
|
+
initialIndex: {
|
|
7
|
+
type: Number,
|
|
8
|
+
default: 0
|
|
9
|
+
},
|
|
10
|
+
height: { type: String, default: "" },
|
|
11
|
+
trigger: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: "hover"
|
|
14
|
+
},
|
|
15
|
+
autoplay: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: true
|
|
18
|
+
},
|
|
19
|
+
interval: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 3e3
|
|
22
|
+
},
|
|
23
|
+
indicatorPosition: { type: String, default: "" },
|
|
24
|
+
indicator: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true
|
|
27
|
+
},
|
|
28
|
+
arrow: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "hover"
|
|
31
|
+
},
|
|
32
|
+
type: { type: String, default: "" },
|
|
33
|
+
loop: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: true
|
|
36
|
+
},
|
|
37
|
+
direction: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "horizontal",
|
|
40
|
+
validator(val) {
|
|
41
|
+
return ["horizontal", "vertical"].includes(val);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
pauseOnHover: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: true
|
|
320
47
|
}
|
|
321
48
|
});
|
|
322
|
-
|
|
49
|
+
const carouselEmits = {
|
|
50
|
+
change: (current, prev) => [current, prev].every(isNumber)
|
|
51
|
+
};
|
|
323
52
|
|
|
324
|
-
export {
|
|
53
|
+
export { carouselEmits, carouselProps };
|
|
325
54
|
//# sourceMappingURL=carousel.mjs.map
|