element-plus 2.2.19 → 2.2.20
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +672 -550
- package/dist/index.full.min.js +20 -20
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +20 -20
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +673 -551
- 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.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/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/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/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/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +2 -1
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/alert/index.d.ts +1 -0
- package/es/components/alert/index.mjs.map +1 -1
- package/es/components/alert/src/alert.d.ts +0 -2
- package/es/components/alert/src/alert.mjs.map +1 -1
- package/es/components/alert/src/instance.d.ts +2 -0
- package/es/components/alert/src/instance.mjs +2 -0
- package/es/components/alert/src/instance.mjs.map +1 -0
- package/es/components/autocomplete/index.d.ts +1 -66
- package/es/components/autocomplete/src/autocomplete.vue.d.ts +1 -66
- package/es/components/calendar/index.d.ts +1 -1
- package/es/components/calendar/src/calendar.vue.d.ts +3 -3
- package/es/components/calendar/src/calendar2.mjs +7 -3
- package/es/components/calendar/src/calendar2.mjs.map +1 -1
- package/es/components/calendar/src/use-calendar.d.ts +0 -2
- package/es/components/calendar/src/use-calendar.mjs +30 -35
- package/es/components/calendar/src/use-calendar.mjs.map +1 -1
- package/es/components/carousel/index.d.ts +31 -60
- package/es/components/carousel/index.mjs.map +1 -1
- package/es/components/carousel/src/carousel-item.d.ts +0 -2
- package/es/components/carousel/src/carousel-item.mjs.map +1 -1
- package/es/components/carousel/src/carousel-item.vue.d.ts +13 -20
- package/es/components/carousel/src/carousel-item2.mjs +21 -114
- package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
- package/es/components/carousel/src/carousel.d.ts +0 -2
- package/es/components/carousel/src/carousel.mjs.map +1 -1
- package/es/components/carousel/src/carousel.vue.d.ts +67 -84
- package/es/components/carousel/src/carousel2.mjs +40 -205
- package/es/components/carousel/src/carousel2.mjs.map +1 -1
- package/es/components/carousel/src/instance.d.ts +4 -0
- package/es/components/carousel/src/instance.mjs +2 -0
- package/es/components/carousel/src/instance.mjs.map +1 -0
- package/es/components/carousel/src/use-carousel-item.d.ts +13 -0
- package/es/components/carousel/src/use-carousel-item.mjs +125 -0
- package/es/components/carousel/src/use-carousel-item.mjs.map +1 -0
- package/es/components/carousel/src/use-carousel.d.ts +22 -0
- package/es/components/carousel/src/use-carousel.mjs +211 -0
- package/es/components/carousel/src/use-carousel.mjs.map +1 -0
- package/es/components/cascader/index.d.ts +4 -84
- package/es/components/cascader/src/index.mjs +7 -12
- package/es/components/cascader/src/index.mjs.map +1 -1
- package/es/components/cascader/src/index.vue.d.ts +2 -42
- package/es/components/checkbox/src/composables/use-checkbox.mjs +4 -5
- package/es/components/checkbox/src/composables/use-checkbox.mjs.map +1 -1
- package/es/components/collapse/index.d.ts +20 -59
- package/es/components/collapse/index.mjs.map +1 -1
- package/es/components/collapse/src/collapse-item.d.ts +0 -2
- package/es/components/collapse/src/collapse-item.mjs.map +1 -1
- package/es/components/collapse/src/collapse-item.vue.d.ts +21 -32
- package/es/components/collapse/src/collapse-item2.mjs +34 -55
- package/es/components/collapse/src/collapse-item2.mjs.map +1 -1
- package/es/components/collapse/src/collapse.d.ts +0 -2
- package/es/components/collapse/src/collapse.mjs.map +1 -1
- package/es/components/collapse/src/collapse.vue.d.ts +6 -25
- package/es/components/collapse/src/collapse2.mjs +5 -39
- package/es/components/collapse/src/collapse2.mjs.map +1 -1
- package/es/components/collapse/src/instance.d.ts +4 -0
- package/es/components/collapse/src/instance.mjs +2 -0
- package/es/components/collapse/src/instance.mjs.map +1 -0
- package/es/components/collapse/src/use-collapse-item.d.ts +20 -0
- package/es/components/collapse/src/use-collapse-item.mjs +75 -0
- package/es/components/collapse/src/use-collapse-item.mjs.map +1 -0
- package/es/components/collapse/src/use-collapse.d.ts +9 -0
- package/es/components/collapse/src/use-collapse.mjs +52 -0
- package/es/components/collapse/src/use-collapse.mjs.map +1 -0
- package/es/components/color-picker/index.d.ts +1 -66
- package/es/components/color-picker/src/color-picker.vue.d.ts +1 -66
- package/es/components/date-picker/src/composables/use-month-range-header.mjs +2 -2
- package/es/components/date-picker/src/composables/use-month-range-header.mjs.map +1 -1
- package/es/components/dialog/index.d.ts +1 -1
- package/es/components/dialog/src/dialog.vue.d.ts +1 -1
- package/es/components/drawer/index.d.ts +1 -1
- package/es/components/drawer/src/drawer.vue.d.ts +1 -1
- package/es/components/dropdown/index.d.ts +4 -42
- package/es/components/dropdown/src/dropdown.d.ts +1 -0
- package/es/components/dropdown/src/dropdown.mjs +2 -1
- package/es/components/dropdown/src/dropdown.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown.vue.d.ts +4 -42
- package/es/components/dropdown/src/dropdown2.mjs +2 -2
- package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
- package/es/components/form/src/form2.mjs +2 -0
- package/es/components/form/src/form2.mjs.map +1 -1
- package/es/components/input/index.d.ts +2 -0
- package/es/components/input/index.mjs.map +1 -1
- package/es/components/input-number/src/input-number2.mjs +2 -2
- package/es/components/input-number/src/input-number2.mjs.map +1 -1
- package/es/components/pagination/src/components/sizes.vue.d.ts +1 -42
- package/es/components/popconfirm/index.d.ts +1 -66
- package/es/components/popconfirm/src/popconfirm.vue.d.ts +1 -66
- package/es/components/popover/index.d.ts +1 -66
- package/es/components/popover/src/popover.vue.d.ts +1 -66
- package/es/components/popover/style/css.d.ts +1 -1
- package/es/components/popover/style/css.mjs +1 -1
- package/es/components/popover/style/index.d.ts +1 -1
- package/es/components/popover/style/index.mjs +1 -1
- package/es/components/popper/src/utils.d.ts +0 -4
- package/es/components/popper/src/utils.mjs +1 -2
- package/es/components/popper/src/utils.mjs.map +1 -1
- package/es/components/select/index.d.ts +1 -42
- package/es/components/select/src/select.vue.d.ts +1 -42
- package/es/components/select/src/useSelect.d.ts +1 -42
- package/es/components/select/src/useSelect.mjs +9 -9
- package/es/components/select/src/useSelect.mjs.map +1 -1
- package/es/components/select-v2/index.d.ts +4 -86
- package/es/components/select-v2/src/select.vue.d.ts +2 -43
- package/es/components/select-v2/src/useSelect.d.ts +2 -43
- package/es/components/select-v2/src/useSelect.mjs +5 -5
- package/es/components/select-v2/src/useSelect.mjs.map +1 -1
- package/es/components/slider/index.d.ts +0 -120
- package/es/components/slider/src/button.vue.d.ts +0 -24
- package/es/components/slider/src/composables/use-slide.d.ts +0 -96
- package/es/components/slider/src/slider.vue.d.ts +0 -120
- package/es/components/table/src/filter-panel.vue.d.ts +1 -42
- package/es/components/table/src/store/watcher.mjs +10 -0
- package/es/components/table/src/store/watcher.mjs.map +1 -1
- package/es/components/table/src/table-body/styles-helper.mjs +2 -2
- package/es/components/table/src/table-body/styles-helper.mjs.map +1 -1
- package/es/components/table/src/table-header/style.helper.mjs +2 -2
- package/es/components/table/src/table-header/style.helper.mjs.map +1 -1
- package/es/components/table/src/util.d.ts +4 -4
- package/es/components/table/src/util.mjs +44 -31
- package/es/components/table/src/util.mjs.map +1 -1
- package/es/components/tabs/src/tabs.mjs +14 -22
- package/es/components/tabs/src/tabs.mjs.map +1 -1
- package/es/components/time-picker/src/common/picker.vue.d.ts +1 -66
- package/es/components/time-select/index.d.ts +4 -168
- package/es/components/time-select/src/time-select.vue.d.ts +2 -84
- package/es/components/tooltip/index.d.ts +0 -24
- package/es/components/tooltip/src/tooltip.d.ts +0 -7
- package/es/components/tooltip/src/tooltip.mjs +0 -7
- package/es/components/tooltip/src/tooltip.mjs.map +1 -1
- package/es/components/tooltip/src/tooltip.vue.d.ts +3 -25
- package/es/components/tooltip/src/tooltip2.mjs +5 -19
- package/es/components/tooltip/src/tooltip2.mjs.map +1 -1
- package/es/components/tree-v2/index.d.ts +0 -1
- package/es/components/tree-v2/src/tree-node.mjs +2 -2
- package/es/components/tree-v2/src/tree-node.mjs.map +1 -1
- package/es/components/tree-v2/src/tree-node.vue.d.ts +0 -1
- package/es/components/tree-v2/src/tree.vue.d.ts +0 -1
- package/es/components/upload/src/use-handlers.mjs +3 -0
- package/es/components/upload/src/use-handlers.mjs.map +1 -1
- package/es/hooks/index.d.ts +0 -1
- package/es/utils/dom/style.mjs +4 -4
- package/es/utils/dom/style.mjs.map +1 -1
- package/es/utils/index.mjs +1 -1
- package/es/utils/types.d.ts +1 -0
- package/es/utils/types.mjs +8 -2
- package/es/utils/types.mjs.map +1 -1
- package/es/utils/vue/vnode.mjs +4 -0
- package/es/utils/vue/vnode.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +2 -1
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/alert/index.d.ts +1 -0
- package/lib/components/alert/index.js.map +1 -1
- package/lib/components/alert/src/alert.d.ts +0 -2
- package/lib/components/alert/src/alert.js.map +1 -1
- package/lib/components/alert/src/instance.d.ts +2 -0
- package/lib/components/alert/src/instance.js +3 -0
- package/lib/components/alert/src/instance.js.map +1 -0
- package/lib/components/autocomplete/index.d.ts +1 -66
- package/lib/components/autocomplete/src/autocomplete.vue.d.ts +1 -66
- package/lib/components/calendar/index.d.ts +1 -1
- package/lib/components/calendar/src/calendar.vue.d.ts +3 -3
- package/lib/components/calendar/src/calendar2.js +11 -7
- package/lib/components/calendar/src/calendar2.js.map +1 -1
- package/lib/components/calendar/src/use-calendar.d.ts +0 -2
- package/lib/components/calendar/src/use-calendar.js +30 -35
- package/lib/components/calendar/src/use-calendar.js.map +1 -1
- package/lib/components/carousel/index.d.ts +31 -60
- package/lib/components/carousel/index.js.map +1 -1
- package/lib/components/carousel/src/carousel-item.d.ts +0 -2
- package/lib/components/carousel/src/carousel-item.js.map +1 -1
- package/lib/components/carousel/src/carousel-item.vue.d.ts +13 -20
- package/lib/components/carousel/src/carousel-item2.js +20 -113
- package/lib/components/carousel/src/carousel-item2.js.map +1 -1
- package/lib/components/carousel/src/carousel.d.ts +0 -2
- package/lib/components/carousel/src/carousel.js.map +1 -1
- package/lib/components/carousel/src/carousel.vue.d.ts +67 -84
- package/lib/components/carousel/src/carousel2.js +42 -207
- package/lib/components/carousel/src/carousel2.js.map +1 -1
- package/lib/components/carousel/src/instance.d.ts +4 -0
- package/lib/components/carousel/src/instance.js +3 -0
- package/lib/components/carousel/src/instance.js.map +1 -0
- package/lib/components/carousel/src/use-carousel-item.d.ts +13 -0
- package/lib/components/carousel/src/use-carousel-item.js +129 -0
- package/lib/components/carousel/src/use-carousel-item.js.map +1 -0
- package/lib/components/carousel/src/use-carousel.d.ts +22 -0
- package/lib/components/carousel/src/use-carousel.js +215 -0
- package/lib/components/carousel/src/use-carousel.js.map +1 -0
- package/lib/components/cascader/index.d.ts +4 -84
- package/lib/components/cascader/src/index.js +7 -12
- package/lib/components/cascader/src/index.js.map +1 -1
- package/lib/components/cascader/src/index.vue.d.ts +2 -42
- package/lib/components/checkbox/src/composables/use-checkbox.js +4 -5
- package/lib/components/checkbox/src/composables/use-checkbox.js.map +1 -1
- package/lib/components/collapse/index.d.ts +20 -59
- package/lib/components/collapse/index.js.map +1 -1
- package/lib/components/collapse/src/collapse-item.d.ts +0 -2
- package/lib/components/collapse/src/collapse-item.js.map +1 -1
- package/lib/components/collapse/src/collapse-item.vue.d.ts +21 -32
- package/lib/components/collapse/src/collapse-item2.js +37 -58
- package/lib/components/collapse/src/collapse-item2.js.map +1 -1
- package/lib/components/collapse/src/collapse.d.ts +0 -2
- package/lib/components/collapse/src/collapse.js.map +1 -1
- package/lib/components/collapse/src/collapse.vue.d.ts +6 -25
- package/lib/components/collapse/src/collapse2.js +4 -38
- package/lib/components/collapse/src/collapse2.js.map +1 -1
- package/lib/components/collapse/src/instance.d.ts +4 -0
- package/lib/components/collapse/src/instance.js +3 -0
- package/lib/components/collapse/src/instance.js.map +1 -0
- package/lib/components/collapse/src/use-collapse-item.d.ts +20 -0
- package/lib/components/collapse/src/use-collapse-item.js +80 -0
- package/lib/components/collapse/src/use-collapse-item.js.map +1 -0
- package/lib/components/collapse/src/use-collapse.d.ts +9 -0
- package/lib/components/collapse/src/use-collapse.js +57 -0
- package/lib/components/collapse/src/use-collapse.js.map +1 -0
- package/lib/components/color-picker/index.d.ts +1 -66
- package/lib/components/color-picker/src/color-picker.vue.d.ts +1 -66
- package/lib/components/date-picker/src/composables/use-month-range-header.js +2 -2
- package/lib/components/date-picker/src/composables/use-month-range-header.js.map +1 -1
- package/lib/components/dialog/index.d.ts +1 -1
- package/lib/components/dialog/src/dialog.vue.d.ts +1 -1
- package/lib/components/drawer/index.d.ts +1 -1
- package/lib/components/drawer/src/drawer.vue.d.ts +1 -1
- package/lib/components/dropdown/index.d.ts +4 -42
- package/lib/components/dropdown/src/dropdown.d.ts +1 -0
- package/lib/components/dropdown/src/dropdown.js +2 -1
- package/lib/components/dropdown/src/dropdown.js.map +1 -1
- package/lib/components/dropdown/src/dropdown.vue.d.ts +4 -42
- package/lib/components/dropdown/src/dropdown2.js +2 -2
- package/lib/components/dropdown/src/dropdown2.js.map +1 -1
- package/lib/components/form/src/form2.js +2 -0
- package/lib/components/form/src/form2.js.map +1 -1
- package/lib/components/input/index.d.ts +2 -0
- package/lib/components/input/index.js.map +1 -1
- package/lib/components/input-number/src/input-number2.js +2 -2
- package/lib/components/input-number/src/input-number2.js.map +1 -1
- package/lib/components/pagination/src/components/sizes.vue.d.ts +1 -42
- package/lib/components/popconfirm/index.d.ts +1 -66
- package/lib/components/popconfirm/src/popconfirm.vue.d.ts +1 -66
- package/lib/components/popover/index.d.ts +1 -66
- package/lib/components/popover/src/popover.vue.d.ts +1 -66
- package/lib/components/popover/style/css.d.ts +1 -1
- package/lib/components/popover/style/css.js +1 -1
- package/lib/components/popover/style/index.d.ts +1 -1
- package/lib/components/popover/style/index.js +1 -1
- package/lib/components/popper/src/utils.d.ts +0 -4
- package/lib/components/popper/src/utils.js +1 -2
- package/lib/components/popper/src/utils.js.map +1 -1
- package/lib/components/select/index.d.ts +1 -42
- package/lib/components/select/src/select.vue.d.ts +1 -42
- package/lib/components/select/src/useSelect.d.ts +1 -42
- package/lib/components/select/src/useSelect.js +7 -7
- package/lib/components/select/src/useSelect.js.map +1 -1
- package/lib/components/select-v2/index.d.ts +4 -86
- package/lib/components/select-v2/src/select.vue.d.ts +2 -43
- package/lib/components/select-v2/src/useSelect.d.ts +2 -43
- package/lib/components/select-v2/src/useSelect.js +5 -5
- package/lib/components/select-v2/src/useSelect.js.map +1 -1
- package/lib/components/slider/index.d.ts +0 -120
- package/lib/components/slider/src/button.vue.d.ts +0 -24
- package/lib/components/slider/src/composables/use-slide.d.ts +0 -96
- package/lib/components/slider/src/slider.vue.d.ts +0 -120
- package/lib/components/table/src/filter-panel.vue.d.ts +1 -42
- package/lib/components/table/src/store/watcher.js +10 -0
- package/lib/components/table/src/store/watcher.js.map +1 -1
- package/lib/components/table/src/table-body/styles-helper.js +2 -2
- package/lib/components/table/src/table-body/styles-helper.js.map +1 -1
- package/lib/components/table/src/table-header/style.helper.js +2 -2
- package/lib/components/table/src/table-header/style.helper.js.map +1 -1
- package/lib/components/table/src/util.d.ts +4 -4
- package/lib/components/table/src/util.js +44 -31
- package/lib/components/table/src/util.js.map +1 -1
- package/lib/components/tabs/src/tabs.js +17 -25
- package/lib/components/tabs/src/tabs.js.map +1 -1
- package/lib/components/time-picker/src/common/picker.vue.d.ts +1 -66
- package/lib/components/time-select/index.d.ts +4 -168
- package/lib/components/time-select/src/time-select.vue.d.ts +2 -84
- package/lib/components/tooltip/index.d.ts +0 -24
- package/lib/components/tooltip/src/tooltip.d.ts +0 -7
- package/lib/components/tooltip/src/tooltip.js +0 -7
- package/lib/components/tooltip/src/tooltip.js.map +1 -1
- package/lib/components/tooltip/src/tooltip.vue.d.ts +3 -25
- package/lib/components/tooltip/src/tooltip2.js +4 -18
- package/lib/components/tooltip/src/tooltip2.js.map +1 -1
- package/lib/components/tree-v2/index.d.ts +0 -1
- package/lib/components/tree-v2/src/tree-node.js +2 -2
- package/lib/components/tree-v2/src/tree-node.js.map +1 -1
- package/lib/components/tree-v2/src/tree-node.vue.d.ts +0 -1
- package/lib/components/tree-v2/src/tree.vue.d.ts +0 -1
- package/lib/components/upload/src/use-handlers.js +3 -0
- package/lib/components/upload/src/use-handlers.js.map +1 -1
- package/lib/hooks/index.d.ts +0 -1
- package/lib/utils/dom/style.js +4 -4
- package/lib/utils/dom/style.js.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/types.d.ts +1 -0
- package/lib/utils/types.js +7 -0
- package/lib/utils/types.js.map +1 -1
- package/lib/utils/vue/vnode.js +4 -0
- package/lib/utils/vue/vnode.js.map +1 -1
- 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/tags.json +1 -1
- package/theme-chalk/el-cascader.css +1 -1
- package/theme-chalk/el-date-picker.css +1 -1
- package/theme-chalk/el-input-number.css +1 -1
- package/theme-chalk/el-input.css +1 -1
- package/theme-chalk/el-loading.css +1 -1
- package/theme-chalk/el-popover.css +1 -1
- package/theme-chalk/el-select.css +1 -1
- package/theme-chalk/el-slider.css +1 -1
- package/theme-chalk/el-time-picker.css +1 -1
- package/theme-chalk/el-time-select.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/cascader.scss +2 -0
- package/theme-chalk/src/date-picker/picker.scss +4 -0
- package/theme-chalk/src/input-number.scss +1 -1
- package/theme-chalk/src/input.scss +4 -0
- package/theme-chalk/src/loading.scss +0 -2
- package/theme-chalk/src/popover.scss +10 -1
- package/theme-chalk/src/select.scss +4 -0
- package/theme-chalk/src/slider.scss +1 -0
- package/web-types.json +1 -1
- package/es/components/tabs/src/utils/pane.d.ts +0 -22
- package/es/components/tabs/src/utils/pane.mjs +0 -19
- package/es/components/tabs/src/utils/pane.mjs.map +0 -1
- package/lib/components/tabs/src/utils/pane.d.ts +0 -22
- package/lib/components/tabs/src/utils/pane.js +0 -24
- package/lib/components/tabs/src/utils/pane.js.map +0 -1
|
@@ -3,28 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var vue = require('vue');
|
|
6
|
-
var
|
|
7
|
-
var core = require('@vueuse/core');
|
|
8
|
-
require('../../../utils/index.js');
|
|
9
|
-
var index$2 = require('../../icon/index.js');
|
|
6
|
+
var index$1 = require('../../icon/index.js');
|
|
10
7
|
var iconsVue = require('@element-plus/icons-vue');
|
|
11
8
|
require('../../../hooks/index.js');
|
|
12
|
-
require('../../../tokens/index.js');
|
|
13
9
|
var carousel = require('./carousel.js');
|
|
10
|
+
var useCarousel = require('./use-carousel.js');
|
|
14
11
|
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
15
12
|
var index = require('../../../hooks/use-namespace/index.js');
|
|
16
|
-
var index$1 = require('../../../hooks/use-ordered-children/index.js');
|
|
17
|
-
var shared = require('@vue/shared');
|
|
18
|
-
var error = require('../../../utils/error.js');
|
|
19
|
-
var carousel$1 = require('../../../tokens/carousel.js');
|
|
20
13
|
|
|
21
|
-
const _hoisted_1 = ["onMouseenter", "
|
|
22
|
-
const _hoisted_2 =
|
|
23
|
-
const _hoisted_3 = { key: 0 };
|
|
14
|
+
const _hoisted_1 = ["onMouseenter", "onClick"];
|
|
15
|
+
const _hoisted_2 = { key: 0 };
|
|
24
16
|
const COMPONENT_NAME = "ElCarousel";
|
|
25
|
-
const THROTTLE_TIME = 300;
|
|
26
17
|
const __default__ = vue.defineComponent({
|
|
27
|
-
name:
|
|
18
|
+
name: COMPONENT_NAME
|
|
28
19
|
});
|
|
29
20
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
30
21
|
...__default__,
|
|
@@ -32,20 +23,26 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
32
23
|
emits: carousel.carouselEmits,
|
|
33
24
|
setup(__props, { expose, emit }) {
|
|
34
25
|
const props = __props;
|
|
35
|
-
const ns = index.useNamespace("carousel");
|
|
36
26
|
const {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
root,
|
|
28
|
+
activeIndex,
|
|
29
|
+
arrowDisplay,
|
|
30
|
+
hasLabel,
|
|
31
|
+
hover,
|
|
32
|
+
isCardType,
|
|
33
|
+
items,
|
|
34
|
+
handleButtonEnter,
|
|
35
|
+
handleButtonLeave,
|
|
36
|
+
handleIndicatorClick,
|
|
37
|
+
handleMouseEnter,
|
|
38
|
+
handleMouseLeave,
|
|
39
|
+
setActiveItem,
|
|
40
|
+
prev,
|
|
41
|
+
next,
|
|
42
|
+
throttledArrowClick,
|
|
43
|
+
throttledIndicatorHover
|
|
44
|
+
} = useCarousel.useCarousel(props, emit, COMPONENT_NAME);
|
|
45
|
+
const ns = index.useNamespace("carousel");
|
|
49
46
|
const carouselClasses = vue.computed(() => {
|
|
50
47
|
const classes = [ns.b(), ns.m(props.direction)];
|
|
51
48
|
if (vue.unref(isCardType)) {
|
|
@@ -55,7 +52,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
55
52
|
});
|
|
56
53
|
const indicatorsClasses = vue.computed(() => {
|
|
57
54
|
const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
|
|
58
|
-
if (hasLabel
|
|
55
|
+
if (vue.unref(hasLabel)) {
|
|
59
56
|
classes.push(ns.em("indicators", "labels"));
|
|
60
57
|
}
|
|
61
58
|
if (props.indicatorPosition === "outside" || vue.unref(isCardType)) {
|
|
@@ -63,168 +60,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
63
60
|
}
|
|
64
61
|
return classes;
|
|
65
62
|
});
|
|
66
|
-
const isCardType = vue.computed(() => props.type === "card");
|
|
67
|
-
const isVertical = vue.computed(() => props.direction === "vertical");
|
|
68
|
-
const throttledArrowClick = lodashUnified.throttle((index) => {
|
|
69
|
-
setActiveItem(index);
|
|
70
|
-
}, THROTTLE_TIME, { trailing: true });
|
|
71
|
-
const throttledIndicatorHover = lodashUnified.throttle((index) => {
|
|
72
|
-
handleIndicatorHover(index);
|
|
73
|
-
}, THROTTLE_TIME);
|
|
74
|
-
function pauseTimer() {
|
|
75
|
-
if (timer.value) {
|
|
76
|
-
clearInterval(timer.value);
|
|
77
|
-
timer.value = null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function startTimer() {
|
|
81
|
-
if (props.interval <= 0 || !props.autoplay || timer.value)
|
|
82
|
-
return;
|
|
83
|
-
timer.value = setInterval(() => playSlides(), props.interval);
|
|
84
|
-
}
|
|
85
|
-
const playSlides = () => {
|
|
86
|
-
if (activeIndex.value < items.value.length - 1) {
|
|
87
|
-
activeIndex.value = activeIndex.value + 1;
|
|
88
|
-
} else if (props.loop) {
|
|
89
|
-
activeIndex.value = 0;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
function setActiveItem(index) {
|
|
93
|
-
if (shared.isString(index)) {
|
|
94
|
-
const filteredItems = items.value.filter((item) => item.props.name === index);
|
|
95
|
-
if (filteredItems.length > 0) {
|
|
96
|
-
index = items.value.indexOf(filteredItems[0]);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
index = Number(index);
|
|
100
|
-
if (Number.isNaN(index) || index !== Math.floor(index)) {
|
|
101
|
-
error.debugWarn(COMPONENT_NAME, "index must be integer.");
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const itemCount = items.value.length;
|
|
105
|
-
const oldIndex = activeIndex.value;
|
|
106
|
-
if (index < 0) {
|
|
107
|
-
activeIndex.value = props.loop ? itemCount - 1 : 0;
|
|
108
|
-
} else if (index >= itemCount) {
|
|
109
|
-
activeIndex.value = props.loop ? 0 : itemCount - 1;
|
|
110
|
-
} else {
|
|
111
|
-
activeIndex.value = index;
|
|
112
|
-
}
|
|
113
|
-
if (oldIndex === activeIndex.value) {
|
|
114
|
-
resetItemPosition(oldIndex);
|
|
115
|
-
}
|
|
116
|
-
resetTimer();
|
|
117
|
-
}
|
|
118
|
-
function resetItemPosition(oldIndex) {
|
|
119
|
-
items.value.forEach((item, index) => {
|
|
120
|
-
item.translateItem(index, activeIndex.value, oldIndex);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function itemInStage(item, index) {
|
|
124
|
-
var _a, _b, _c, _d;
|
|
125
|
-
const _items = vue.unref(items);
|
|
126
|
-
const itemCount = _items.length;
|
|
127
|
-
if (itemCount === 0 || !item.states.inStage)
|
|
128
|
-
return false;
|
|
129
|
-
const nextItemIndex = index + 1;
|
|
130
|
-
const prevItemIndex = index - 1;
|
|
131
|
-
const lastItemIndex = itemCount - 1;
|
|
132
|
-
const isLastItemActive = _items[lastItemIndex].states.active;
|
|
133
|
-
const isFirstItemActive = _items[0].states.active;
|
|
134
|
-
const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
|
|
135
|
-
const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
|
|
136
|
-
if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
|
|
137
|
-
return "left";
|
|
138
|
-
} else if (index === 0 && isLastItemActive || isPrevItemActive) {
|
|
139
|
-
return "right";
|
|
140
|
-
}
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
function handleMouseEnter() {
|
|
144
|
-
hover.value = true;
|
|
145
|
-
if (props.pauseOnHover) {
|
|
146
|
-
pauseTimer();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function handleMouseLeave() {
|
|
150
|
-
hover.value = false;
|
|
151
|
-
startTimer();
|
|
152
|
-
}
|
|
153
|
-
function handleButtonEnter(arrow) {
|
|
154
|
-
if (vue.unref(isVertical))
|
|
155
|
-
return;
|
|
156
|
-
items.value.forEach((item, index) => {
|
|
157
|
-
if (arrow === itemInStage(item, index)) {
|
|
158
|
-
item.states.hover = true;
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
function handleButtonLeave() {
|
|
163
|
-
if (vue.unref(isVertical))
|
|
164
|
-
return;
|
|
165
|
-
items.value.forEach((item) => {
|
|
166
|
-
item.states.hover = false;
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
function handleIndicatorClick(index) {
|
|
170
|
-
activeIndex.value = index;
|
|
171
|
-
}
|
|
172
|
-
function handleIndicatorHover(index) {
|
|
173
|
-
if (props.trigger === "hover" && index !== activeIndex.value) {
|
|
174
|
-
activeIndex.value = index;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
function prev() {
|
|
178
|
-
setActiveItem(activeIndex.value - 1);
|
|
179
|
-
}
|
|
180
|
-
function next() {
|
|
181
|
-
setActiveItem(activeIndex.value + 1);
|
|
182
|
-
}
|
|
183
|
-
function resetTimer() {
|
|
184
|
-
pauseTimer();
|
|
185
|
-
startTimer();
|
|
186
|
-
}
|
|
187
|
-
vue.watch(() => activeIndex.value, (current, prev2) => {
|
|
188
|
-
resetItemPosition(prev2);
|
|
189
|
-
if (prev2 > -1) {
|
|
190
|
-
emit("change", current, prev2);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
vue.watch(() => props.autoplay, (autoplay) => {
|
|
194
|
-
autoplay ? startTimer() : pauseTimer();
|
|
195
|
-
});
|
|
196
|
-
vue.watch(() => props.loop, () => {
|
|
197
|
-
setActiveItem(activeIndex.value);
|
|
198
|
-
});
|
|
199
|
-
vue.watch(() => props.interval, () => {
|
|
200
|
-
resetTimer();
|
|
201
|
-
});
|
|
202
|
-
vue.watch(() => items.value, () => {
|
|
203
|
-
if (items.value.length > 0)
|
|
204
|
-
setActiveItem(props.initialIndex);
|
|
205
|
-
});
|
|
206
|
-
const resizeObserver = vue.shallowRef();
|
|
207
|
-
vue.onMounted(() => {
|
|
208
|
-
resizeObserver.value = core.useResizeObserver(root.value, () => {
|
|
209
|
-
resetItemPosition();
|
|
210
|
-
});
|
|
211
|
-
startTimer();
|
|
212
|
-
});
|
|
213
|
-
vue.onBeforeUnmount(() => {
|
|
214
|
-
pauseTimer();
|
|
215
|
-
if (root.value && resizeObserver.value)
|
|
216
|
-
resizeObserver.value.stop();
|
|
217
|
-
});
|
|
218
|
-
vue.provide(carousel$1.carouselContextKey, {
|
|
219
|
-
root,
|
|
220
|
-
isCardType,
|
|
221
|
-
isVertical,
|
|
222
|
-
items,
|
|
223
|
-
loop: props.loop,
|
|
224
|
-
addItem,
|
|
225
|
-
removeItem,
|
|
226
|
-
setActiveItem
|
|
227
|
-
});
|
|
228
63
|
expose({
|
|
229
64
|
setActiveItem,
|
|
230
65
|
prev,
|
|
@@ -235,8 +70,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
235
70
|
ref_key: "root",
|
|
236
71
|
ref: root,
|
|
237
72
|
class: vue.normalizeClass(vue.unref(carouselClasses)),
|
|
238
|
-
onMouseenter: vue.withModifiers(handleMouseEnter, ["stop"]),
|
|
239
|
-
onMouseleave: vue.withModifiers(handleMouseLeave, ["stop"])
|
|
73
|
+
onMouseenter: _cache[6] || (_cache[6] = vue.withModifiers((...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args), ["stop"])),
|
|
74
|
+
onMouseleave: _cache[7] || (_cache[7] = vue.withModifiers((...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args), ["stop"]))
|
|
240
75
|
}, [
|
|
241
76
|
vue.createElementVNode("div", {
|
|
242
77
|
class: vue.normalizeClass(vue.unref(ns).e("container")),
|
|
@@ -251,11 +86,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
251
86
|
vue.withDirectives(vue.createElementVNode("button", {
|
|
252
87
|
type: "button",
|
|
253
88
|
class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
|
|
254
|
-
onMouseenter: _cache[0] || (_cache[0] = ($event) => handleButtonEnter("left")),
|
|
255
|
-
onMouseleave: handleButtonLeave,
|
|
256
|
-
onClick: _cache[
|
|
89
|
+
onMouseenter: _cache[0] || (_cache[0] = ($event) => vue.unref(handleButtonEnter)("left")),
|
|
90
|
+
onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
|
|
91
|
+
onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"]))
|
|
257
92
|
}, [
|
|
258
|
-
vue.createVNode(vue.unref(index$
|
|
93
|
+
vue.createVNode(vue.unref(index$1.ElIcon), null, {
|
|
259
94
|
default: vue.withCtx(() => [
|
|
260
95
|
vue.createVNode(vue.unref(iconsVue.ArrowLeft))
|
|
261
96
|
]),
|
|
@@ -264,7 +99,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
264
99
|
], 34), [
|
|
265
100
|
[
|
|
266
101
|
vue.vShow,
|
|
267
|
-
(_ctx.arrow === "always" || hover
|
|
102
|
+
(_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0)
|
|
268
103
|
]
|
|
269
104
|
])
|
|
270
105
|
]),
|
|
@@ -279,11 +114,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
279
114
|
vue.withDirectives(vue.createElementVNode("button", {
|
|
280
115
|
type: "button",
|
|
281
116
|
class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
|
|
282
|
-
onMouseenter: _cache[
|
|
283
|
-
onMouseleave: handleButtonLeave,
|
|
284
|
-
onClick: _cache[
|
|
117
|
+
onMouseenter: _cache[3] || (_cache[3] = ($event) => vue.unref(handleButtonEnter)("right")),
|
|
118
|
+
onMouseleave: _cache[4] || (_cache[4] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
|
|
119
|
+
onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"]))
|
|
285
120
|
}, [
|
|
286
|
-
vue.createVNode(vue.unref(index$
|
|
121
|
+
vue.createVNode(vue.unref(index$1.ElIcon), null, {
|
|
287
122
|
default: vue.withCtx(() => [
|
|
288
123
|
vue.createVNode(vue.unref(iconsVue.ArrowRight))
|
|
289
124
|
]),
|
|
@@ -292,7 +127,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
292
127
|
], 34), [
|
|
293
128
|
[
|
|
294
129
|
vue.vShow,
|
|
295
|
-
(_ctx.arrow === "always" || hover
|
|
130
|
+
(_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
|
|
296
131
|
]
|
|
297
132
|
])
|
|
298
133
|
]),
|
|
@@ -310,20 +145,20 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
310
145
|
class: vue.normalizeClass([
|
|
311
146
|
vue.unref(ns).e("indicator"),
|
|
312
147
|
vue.unref(ns).em("indicator", _ctx.direction),
|
|
313
|
-
vue.unref(ns).is("active", index === activeIndex
|
|
148
|
+
vue.unref(ns).is("active", index === vue.unref(activeIndex))
|
|
314
149
|
]),
|
|
315
150
|
onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
|
|
316
|
-
onClick: vue.withModifiers(($event) => handleIndicatorClick(index), ["stop"])
|
|
151
|
+
onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
|
|
317
152
|
}, [
|
|
318
153
|
vue.createElementVNode("button", {
|
|
319
154
|
class: vue.normalizeClass(vue.unref(ns).e("button"))
|
|
320
155
|
}, [
|
|
321
|
-
vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span",
|
|
156
|
+
vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
|
|
322
157
|
], 2)
|
|
323
|
-
], 42,
|
|
158
|
+
], 42, _hoisted_1);
|
|
324
159
|
}), 128))
|
|
325
160
|
], 2)) : vue.createCommentVNode("v-if", true)
|
|
326
|
-
],
|
|
161
|
+
], 34);
|
|
327
162
|
};
|
|
328
163
|
}
|
|
329
164
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel2.js","sources":["../../../../../../packages/components/carousel/src/carousel.vue"],"sourcesContent":["<template>\n <div\n ref=\"root\"\n :class=\"carouselClasses\"\n @mouseenter.stop=\"handleMouseEnter\"\n @mouseleave.stop=\"handleMouseLeave\"\n >\n <div :class=\"ns.e('container')\" :style=\"{ height: height }\">\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-left\">\n <button\n v-show=\"\n (arrow === 'always' || hover) && (props.loop || activeIndex > 0)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'left')]\"\n @mouseenter=\"handleButtonEnter('left')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex - 1)\"\n >\n <ElIcon>\n <ArrowLeft />\n </ElIcon>\n </button>\n </transition>\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-right\">\n <button\n v-show=\"\n (arrow === 'always' || hover) &&\n (props.loop || activeIndex < items.length - 1)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'right')]\"\n @mouseenter=\"handleButtonEnter('right')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex + 1)\"\n >\n <ElIcon>\n <ArrowRight />\n </ElIcon>\n </button>\n </transition>\n <slot />\n </div>\n <ul v-if=\"indicatorPosition !== 'none'\" :class=\"indicatorsClasses\">\n <li\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"[\n ns.e('indicator'),\n ns.em('indicator', direction),\n ns.is('active', index === activeIndex),\n ]\"\n @mouseenter=\"throttledIndicatorHover(index)\"\n @click.stop=\"handleIndicatorClick(index)\"\n >\n <button :class=\"ns.e('button')\">\n <span v-if=\"hasLabel\">{{ item.props.label }}</span>\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n getCurrentInstance,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n unref,\n watch,\n} from 'vue'\nimport { throttle } from 'lodash-unified'\nimport { useResizeObserver } from '@vueuse/core'\nimport { debugWarn, isString } from '@element-plus/utils'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'\nimport { useNamespace, useOrderedChildren } from '@element-plus/hooks'\nimport { carouselContextKey } from '@element-plus/tokens'\nimport { carouselEmits, carouselProps } from './carousel'\nimport type { CarouselItemContext } from '@element-plus/tokens'\n\ndefineOptions({\n name: 'ElCarousel',\n})\n\nconst props = defineProps(carouselProps)\nconst emit = defineEmits(carouselEmits)\nconst ns = useNamespace('carousel')\nconst COMPONENT_NAME = 'ElCarousel'\nconst THROTTLE_TIME = 300\n\nconst {\n children: items,\n addChild: addItem,\n removeChild: removeItem,\n} = useOrderedChildren<CarouselItemContext>(\n getCurrentInstance()!,\n 'ElCarouselItem'\n)\n\n// refs\nconst activeIndex = ref(-1)\nconst timer = ref<ReturnType<typeof setInterval> | null>(null)\nconst hover = ref(false)\nconst root = ref<HTMLDivElement>()\n\n// computed\nconst arrowDisplay = computed(\n () => props.arrow !== 'never' && !unref(isVertical)\n)\n\nconst hasLabel = computed(() => {\n return items.value.some((item) => item.props.label.toString().length > 0)\n})\n\nconst 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\nconst indicatorsClasses = computed(() => {\n const classes = [ns.e('indicators'), ns.em('indicators', props.direction)]\n if (hasLabel.value) {\n classes.push(ns.em('indicators', 'labels'))\n }\n if (props.indicatorPosition === 'outside' || unref(isCardType)) {\n classes.push(ns.em('indicators', 'outside'))\n }\n return classes\n})\n\nconst isCardType = computed(() => props.type === 'card')\nconst isVertical = computed(() => props.direction === 'vertical')\n\n// methods\nconst throttledArrowClick = throttle(\n (index: number) => {\n setActiveItem(index)\n },\n THROTTLE_TIME,\n { trailing: true }\n)\n\nconst throttledIndicatorHover = throttle((index: number) => {\n handleIndicatorHover(index)\n}, THROTTLE_TIME)\n\nfunction pauseTimer() {\n if (timer.value) {\n clearInterval(timer.value)\n timer.value = null\n }\n}\n\nfunction startTimer() {\n if (props.interval <= 0 || !props.autoplay || timer.value) return\n timer.value = setInterval(() => playSlides(), props.interval)\n}\n\nconst playSlides = () => {\n if (activeIndex.value < items.value.length - 1) {\n activeIndex.value = activeIndex.value + 1\n } else if (props.loop) {\n activeIndex.value = 0\n }\n}\n\nfunction setActiveItem(index: number | string) {\n if (isString(index)) {\n const filteredItems = items.value.filter(\n (item) => item.props.name === index\n )\n if (filteredItems.length > 0) {\n index = items.value.indexOf(filteredItems[0])\n }\n }\n index = Number(index)\n if (Number.isNaN(index) || index !== Math.floor(index)) {\n debugWarn(COMPONENT_NAME, 'index must be integer.')\n return\n }\n const itemCount = items.value.length\n const oldIndex = activeIndex.value\n if (index < 0) {\n activeIndex.value = props.loop ? itemCount - 1 : 0\n } else if (index >= itemCount) {\n activeIndex.value = props.loop ? 0 : itemCount - 1\n } else {\n activeIndex.value = index\n }\n if (oldIndex === activeIndex.value) {\n resetItemPosition(oldIndex)\n }\n resetTimer()\n}\n\nfunction resetItemPosition(oldIndex?: number) {\n items.value.forEach((item, index) => {\n item.translateItem(index, activeIndex.value, oldIndex)\n })\n}\n\nfunction itemInStage(item: CarouselItemContext, index: number) {\n const _items = unref(items)\n const itemCount = _items.length\n if (itemCount === 0 || !item.states.inStage) return false\n const nextItemIndex = index + 1\n const prevItemIndex = index - 1\n const lastItemIndex = itemCount - 1\n const isLastItemActive = _items[lastItemIndex].states.active\n const isFirstItemActive = _items[0].states.active\n const isNextItemActive = _items[nextItemIndex]?.states?.active\n const isPrevItemActive = _items[prevItemIndex]?.states?.active\n\n if ((index === lastItemIndex && isFirstItemActive) || isNextItemActive) {\n return 'left'\n } else if ((index === 0 && isLastItemActive) || isPrevItemActive) {\n return 'right'\n }\n return false\n}\n\nfunction handleMouseEnter() {\n hover.value = true\n if (props.pauseOnHover) {\n pauseTimer()\n }\n}\n\nfunction handleMouseLeave() {\n hover.value = false\n startTimer()\n}\n\nfunction handleButtonEnter(arrow: 'left' | 'right') {\n if (unref(isVertical)) return\n items.value.forEach((item, index) => {\n if (arrow === itemInStage(item, index)) {\n item.states.hover = true\n }\n })\n}\n\nfunction handleButtonLeave() {\n if (unref(isVertical)) return\n items.value.forEach((item) => {\n item.states.hover = false\n })\n}\n\nfunction handleIndicatorClick(index: number) {\n activeIndex.value = index\n}\n\nfunction handleIndicatorHover(index: number) {\n if (props.trigger === 'hover' && index !== activeIndex.value) {\n activeIndex.value = index\n }\n}\n\nfunction prev() {\n setActiveItem(activeIndex.value - 1)\n}\n\nfunction next() {\n setActiveItem(activeIndex.value + 1)\n}\n\nfunction resetTimer() {\n pauseTimer()\n startTimer()\n}\n\n// watch\nwatch(\n () => activeIndex.value,\n (current, prev) => {\n resetItemPosition(prev)\n if (prev > -1) {\n emit('change', current, prev)\n }\n }\n)\nwatch(\n () => props.autoplay,\n (autoplay) => {\n autoplay ? startTimer() : pauseTimer()\n }\n)\nwatch(\n () => props.loop,\n () => {\n setActiveItem(activeIndex.value)\n }\n)\n\nwatch(\n () => props.interval,\n () => {\n resetTimer()\n }\n)\n\nwatch(\n () => items.value,\n () => {\n if (items.value.length > 0) setActiveItem(props.initialIndex)\n }\n)\n\nconst resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n// lifecycle\nonMounted(() => {\n resizeObserver.value = useResizeObserver(root.value, () => {\n resetItemPosition()\n })\n startTimer()\n})\n\nonBeforeUnmount(() => {\n pauseTimer()\n if (root.value && resizeObserver.value) resizeObserver.value.stop()\n})\n\n// provide\nprovide(carouselContextKey, {\n root,\n isCardType,\n isVertical,\n items,\n loop: props.loop,\n addItem,\n removeItem,\n setActiveItem,\n})\n\ndefineExpose({\n /** @description manually switch slide */\n setActiveItem,\n /** @description switch to the previous slide */\n prev,\n /** @description switch to the next slide */\n next,\n})\n</script>\n"],"names":["useNamespace","useOrderedChildren","getCurrentInstance","ref","computed","unref","throttle","isString","debugWarn","watch","shallowRef","onMounted","useResizeObserver","onBeforeUnmount","provide","carouselContextKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;uCAqFc,CAAA;AA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AA4B,IAC1BC,WAAA,CAAAC,6BAAA,EAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA;AAAY,MACZ,IAAA,EAAA,KAAA,CAAA,IAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACD,aAAA;AAED,KAAa,CAAA,CAAA;AAAA,IAEX,MAAA,CAAA;AAAA,MAEA,aAAA;AAAA,MAEA,IAAA;AAAA,MACD,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"carousel2.js","sources":["../../../../../../packages/components/carousel/src/carousel.vue"],"sourcesContent":["<template>\n <div\n ref=\"root\"\n :class=\"carouselClasses\"\n @mouseenter.stop=\"handleMouseEnter\"\n @mouseleave.stop=\"handleMouseLeave\"\n >\n <div :class=\"ns.e('container')\" :style=\"{ height: height }\">\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-left\">\n <button\n v-show=\"\n (arrow === 'always' || hover) && (props.loop || activeIndex > 0)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'left')]\"\n @mouseenter=\"handleButtonEnter('left')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex - 1)\"\n >\n <ElIcon>\n <ArrowLeft />\n </ElIcon>\n </button>\n </transition>\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-right\">\n <button\n v-show=\"\n (arrow === 'always' || hover) &&\n (props.loop || activeIndex < items.length - 1)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'right')]\"\n @mouseenter=\"handleButtonEnter('right')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex + 1)\"\n >\n <ElIcon>\n <ArrowRight />\n </ElIcon>\n </button>\n </transition>\n <slot />\n </div>\n <ul v-if=\"indicatorPosition !== 'none'\" :class=\"indicatorsClasses\">\n <li\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"[\n ns.e('indicator'),\n ns.em('indicator', direction),\n ns.is('active', index === activeIndex),\n ]\"\n @mouseenter=\"throttledIndicatorHover(index)\"\n @click.stop=\"handleIndicatorClick(index)\"\n >\n <button :class=\"ns.e('button')\">\n <span v-if=\"hasLabel\">{{ item.props.label }}</span>\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, unref } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { carouselEmits, carouselProps } from './carousel'\nimport { useCarousel } from './use-carousel'\n\nconst COMPONENT_NAME = 'ElCarousel'\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = defineProps(carouselProps)\nconst emit = defineEmits(carouselEmits)\nconst {\n root,\n activeIndex,\n arrowDisplay,\n hasLabel,\n hover,\n isCardType,\n items,\n handleButtonEnter,\n handleButtonLeave,\n handleIndicatorClick,\n handleMouseEnter,\n handleMouseLeave,\n setActiveItem,\n prev,\n next,\n throttledArrowClick,\n throttledIndicatorHover,\n} = useCarousel(props, emit, COMPONENT_NAME)\nconst ns = useNamespace('carousel')\n\nconst 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\nconst 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' || unref(isCardType)) {\n classes.push(ns.em('indicators', 'outside'))\n }\n return classes\n})\n\ndefineExpose({\n /** @description manually switch slide */\n setActiveItem,\n /** @description switch to the previous slide */\n prev,\n /** @description switch to the next slide */\n next,\n})\n</script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,YAAA,EAAc,QAAQ,CAAC,CAAA,CAAA;AAAA,OAC5C;AACA,MAAA,IAAI,KAAM,CAAA,iBAAA,KAAsB,SAAa,IAAAA,SAAA,CAAM,UAAU,CAAG,EAAA;AAC9D,QAAA,OAAA,CAAQ,IAAK,CAAA,EAAA,CAAG,EAAG,CAAA,YAAA,EAAc,SAAS,CAAC,CAAA,CAAA;AAAA,OAC7C;AACA,MAAO,OAAA,OAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAa,MAAA,CAAA;AAAA,MAEX,aAAA;AAAA,MAEA,IAAA;AAAA,MAEA,IAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CarouselItemProps } from './carousel-item';
|
|
2
|
+
export declare const useCarouselItem: (props: CarouselItemProps, componentName: string) => {
|
|
3
|
+
active: import("vue").Ref<boolean>;
|
|
4
|
+
animating: import("vue").Ref<boolean>;
|
|
5
|
+
hover: import("vue").Ref<boolean>;
|
|
6
|
+
inStage: import("vue").Ref<boolean>;
|
|
7
|
+
isVertical: import("vue").Ref<boolean>;
|
|
8
|
+
translate: import("vue").Ref<number>;
|
|
9
|
+
isCardType: import("vue").Ref<boolean>;
|
|
10
|
+
scale: import("vue").Ref<number>;
|
|
11
|
+
ready: import("vue").Ref<boolean>;
|
|
12
|
+
handleItemClick: () => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
require('../../../utils/index.js');
|
|
7
|
+
require('../../../tokens/index.js');
|
|
8
|
+
var carousel = require('../../../tokens/carousel.js');
|
|
9
|
+
var error = require('../../../utils/error.js');
|
|
10
|
+
var types = require('../../../utils/types.js');
|
|
11
|
+
|
|
12
|
+
const useCarouselItem = (props, componentName) => {
|
|
13
|
+
const carouselContext = vue.inject(carousel.carouselContextKey);
|
|
14
|
+
const instance = vue.getCurrentInstance();
|
|
15
|
+
if (!carouselContext) {
|
|
16
|
+
error.debugWarn(componentName, "usage: <el-carousel></el-carousel-item></el-carousel>");
|
|
17
|
+
}
|
|
18
|
+
if (!instance) {
|
|
19
|
+
error.debugWarn(componentName, "compositional hook can only be invoked inside setups");
|
|
20
|
+
}
|
|
21
|
+
const CARD_SCALE = 0.83;
|
|
22
|
+
const hover = vue.ref(false);
|
|
23
|
+
const translate = vue.ref(0);
|
|
24
|
+
const scale = vue.ref(1);
|
|
25
|
+
const active = vue.ref(false);
|
|
26
|
+
const ready = vue.ref(false);
|
|
27
|
+
const inStage = vue.ref(false);
|
|
28
|
+
const animating = vue.ref(false);
|
|
29
|
+
const { isCardType, isVertical } = carouselContext;
|
|
30
|
+
function processIndex(index, activeIndex, length) {
|
|
31
|
+
const lastItemIndex = length - 1;
|
|
32
|
+
const prevItemIndex = activeIndex - 1;
|
|
33
|
+
const nextItemIndex = activeIndex + 1;
|
|
34
|
+
const halfItemIndex = length / 2;
|
|
35
|
+
if (activeIndex === 0 && index === lastItemIndex) {
|
|
36
|
+
return -1;
|
|
37
|
+
} else if (activeIndex === lastItemIndex && index === 0) {
|
|
38
|
+
return length;
|
|
39
|
+
} else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
|
|
40
|
+
return length + 1;
|
|
41
|
+
} else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
|
|
42
|
+
return -2;
|
|
43
|
+
}
|
|
44
|
+
return index;
|
|
45
|
+
}
|
|
46
|
+
function calcCardTranslate(index, activeIndex) {
|
|
47
|
+
var _a;
|
|
48
|
+
const parentWidth = ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetWidth) || 0;
|
|
49
|
+
if (inStage.value) {
|
|
50
|
+
return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
|
|
51
|
+
} else if (index < activeIndex) {
|
|
52
|
+
return -(1 + CARD_SCALE) * parentWidth / 4;
|
|
53
|
+
} else {
|
|
54
|
+
return (3 + CARD_SCALE) * parentWidth / 4;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function calcTranslate(index, activeIndex, isVertical2) {
|
|
58
|
+
const rootEl = carouselContext.root.value;
|
|
59
|
+
if (!rootEl)
|
|
60
|
+
return 0;
|
|
61
|
+
const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
|
|
62
|
+
return distance * (index - activeIndex);
|
|
63
|
+
}
|
|
64
|
+
const translateItem = (index, activeIndex, oldIndex) => {
|
|
65
|
+
var _a;
|
|
66
|
+
const _isCardType = vue.unref(isCardType);
|
|
67
|
+
const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
|
|
68
|
+
const isActive = index === activeIndex;
|
|
69
|
+
if (!_isCardType && !types.isUndefined(oldIndex)) {
|
|
70
|
+
animating.value = isActive || index === oldIndex;
|
|
71
|
+
}
|
|
72
|
+
if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
|
|
73
|
+
index = processIndex(index, activeIndex, carouselItemLength);
|
|
74
|
+
}
|
|
75
|
+
const _isVertical = vue.unref(isVertical);
|
|
76
|
+
active.value = isActive;
|
|
77
|
+
if (_isCardType) {
|
|
78
|
+
if (_isVertical) {
|
|
79
|
+
error.debugWarn("Carousel", "vertical direction is not supported for card mode");
|
|
80
|
+
}
|
|
81
|
+
inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
|
|
82
|
+
translate.value = calcCardTranslate(index, activeIndex);
|
|
83
|
+
scale.value = vue.unref(active) ? 1 : CARD_SCALE;
|
|
84
|
+
} else {
|
|
85
|
+
translate.value = calcTranslate(index, activeIndex, _isVertical);
|
|
86
|
+
}
|
|
87
|
+
ready.value = true;
|
|
88
|
+
};
|
|
89
|
+
function handleItemClick() {
|
|
90
|
+
if (carouselContext && vue.unref(isCardType)) {
|
|
91
|
+
const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
|
|
92
|
+
carouselContext.setActiveItem(index);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
vue.onMounted(() => {
|
|
96
|
+
carouselContext.addItem({
|
|
97
|
+
props,
|
|
98
|
+
states: vue.reactive({
|
|
99
|
+
hover,
|
|
100
|
+
translate,
|
|
101
|
+
scale,
|
|
102
|
+
active,
|
|
103
|
+
ready,
|
|
104
|
+
inStage,
|
|
105
|
+
animating
|
|
106
|
+
}),
|
|
107
|
+
uid: instance.uid,
|
|
108
|
+
translateItem
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
vue.onUnmounted(() => {
|
|
112
|
+
carouselContext.removeItem(instance.uid);
|
|
113
|
+
});
|
|
114
|
+
return {
|
|
115
|
+
active,
|
|
116
|
+
animating,
|
|
117
|
+
hover,
|
|
118
|
+
inStage,
|
|
119
|
+
isVertical,
|
|
120
|
+
translate,
|
|
121
|
+
isCardType,
|
|
122
|
+
scale,
|
|
123
|
+
ready,
|
|
124
|
+
handleItemClick
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
exports.useCarouselItem = useCarouselItem;
|
|
129
|
+
//# sourceMappingURL=use-carousel-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-carousel-item.js","sources":["../../../../../../packages/components/carousel/src/use-carousel-item.ts"],"sourcesContent":["import {\n getCurrentInstance,\n inject,\n onMounted,\n onUnmounted,\n reactive,\n ref,\n unref,\n} from 'vue'\nimport { debugWarn, isUndefined } from '@element-plus/utils'\nimport { carouselContextKey } from '@element-plus/tokens'\n\nimport type { CarouselItemProps } from './carousel-item'\n\nexport const useCarouselItem = (\n props: CarouselItemProps,\n componentName: string\n) => {\n const carouselContext = inject(carouselContextKey)!\n // instance\n const instance = getCurrentInstance()!\n if (!carouselContext) {\n debugWarn(\n componentName,\n 'usage: <el-carousel></el-carousel-item></el-carousel>'\n )\n }\n\n if (!instance) {\n debugWarn(\n componentName,\n 'compositional hook can only be invoked inside setups'\n )\n }\n\n const CARD_SCALE = 0.83\n\n const hover = ref(false)\n const translate = ref(0)\n const scale = ref(1)\n const active = ref(false)\n const ready = ref(false)\n const inStage = ref(false)\n const animating = ref(false)\n\n // computed\n const { isCardType, isVertical } = carouselContext\n\n // methods\n\n function processIndex(index: number, activeIndex: number, length: number) {\n const lastItemIndex = length - 1\n const prevItemIndex = activeIndex - 1\n const nextItemIndex = activeIndex + 1\n const halfItemIndex = length / 2\n\n if (activeIndex === 0 && index === lastItemIndex) {\n return -1\n } else if (activeIndex === lastItemIndex && index === 0) {\n return length\n } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {\n return length + 1\n } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {\n return -2\n }\n return index\n }\n\n function calcCardTranslate(index: number, activeIndex: number) {\n const parentWidth = carouselContext.root.value?.offsetWidth || 0\n if (inStage.value) {\n return (parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1)) / 4\n } else if (index < activeIndex) {\n return (-(1 + CARD_SCALE) * parentWidth) / 4\n } else {\n return ((3 + CARD_SCALE) * parentWidth) / 4\n }\n }\n\n function calcTranslate(\n index: number,\n activeIndex: number,\n isVertical: boolean\n ) {\n const rootEl = carouselContext.root.value\n if (!rootEl) return 0\n\n const distance =\n (isVertical ? rootEl.offsetHeight : rootEl.offsetWidth) || 0\n return distance * (index - activeIndex)\n }\n\n const translateItem = (\n index: number,\n activeIndex: number,\n oldIndex?: number\n ) => {\n const _isCardType = unref(isCardType)\n const carouselItemLength = carouselContext.items.value.length ?? Number.NaN\n\n const isActive = index === activeIndex\n if (!_isCardType && !isUndefined(oldIndex)) {\n animating.value = isActive || index === oldIndex\n }\n\n if (!isActive && carouselItemLength > 2 && carouselContext.loop) {\n index = processIndex(index, activeIndex, carouselItemLength)\n }\n\n const _isVertical = unref(isVertical)\n active.value = isActive\n\n if (_isCardType) {\n if (_isVertical) {\n debugWarn(\n 'Carousel',\n 'vertical direction is not supported for card mode'\n )\n }\n inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1\n translate.value = calcCardTranslate(index, activeIndex)\n scale.value = unref(active) ? 1 : CARD_SCALE\n } else {\n translate.value = calcTranslate(index, activeIndex, _isVertical)\n }\n\n ready.value = true\n }\n\n function handleItemClick() {\n if (carouselContext && unref(isCardType)) {\n const index = carouselContext.items.value.findIndex(\n ({ uid }) => uid === instance.uid\n )\n carouselContext.setActiveItem(index)\n }\n }\n\n // lifecycle\n onMounted(() => {\n carouselContext.addItem({\n props,\n states: reactive({\n hover,\n translate,\n scale,\n active,\n ready,\n inStage,\n animating,\n }),\n uid: instance.uid,\n translateItem,\n })\n })\n\n onUnmounted(() => {\n carouselContext.removeItem(instance.uid)\n })\n\n return {\n active,\n animating,\n hover,\n inStage,\n isVertical,\n translate,\n isCardType,\n scale,\n ready,\n handleItemClick,\n }\n}\n"],"names":["inject","carouselContextKey","getCurrentInstance","debugWarn","ref","unref","isUndefined","onMounted","reactive","onUnmounted"],"mappings":";;;;;;;;;;;AAWY,MAAC,eAAe,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK;AACzD,EAAE,MAAM,eAAe,GAAGA,UAAM,CAACC,2BAAkB,CAAC,CAAC;AACrD,EAAE,MAAM,QAAQ,GAAGC,sBAAkB,EAAE,CAAC;AACxC,EAAE,IAAI,CAAC,eAAe,EAAE;AACxB,IAAIC,eAAS,CAAC,aAAa,EAAE,uDAAuD,CAAC,CAAC;AACtF,GAAG;AACH,EAAE,IAAI,CAAC,QAAQ,EAAE;AACjB,IAAIA,eAAS,CAAC,aAAa,EAAE,sDAAsD,CAAC,CAAC;AACrF,GAAG;AACH,EAAE,MAA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3
|
+
import type { CarouselEmits, CarouselProps } from './carousel';
|
|
4
|
+
export declare const useCarousel: (props: CarouselProps, emit: SetupContext<CarouselEmits>['emit'], componentName: string) => {
|
|
5
|
+
root: import("vue").Ref<HTMLDivElement | undefined>;
|
|
6
|
+
activeIndex: import("vue").Ref<number>;
|
|
7
|
+
arrowDisplay: import("vue").ComputedRef<boolean>;
|
|
8
|
+
hasLabel: import("vue").ComputedRef<boolean>;
|
|
9
|
+
hover: import("vue").Ref<boolean>;
|
|
10
|
+
isCardType: import("vue").ComputedRef<boolean>;
|
|
11
|
+
items: import("vue").ShallowRef<CarouselItemContext[]>;
|
|
12
|
+
handleButtonEnter: (arrow: 'left' | 'right') => void;
|
|
13
|
+
handleButtonLeave: () => void;
|
|
14
|
+
handleIndicatorClick: (index: number) => void;
|
|
15
|
+
handleMouseEnter: () => void;
|
|
16
|
+
handleMouseLeave: () => void;
|
|
17
|
+
setActiveItem: (index: number | string) => void;
|
|
18
|
+
prev: () => void;
|
|
19
|
+
next: () => void;
|
|
20
|
+
throttledArrowClick: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
21
|
+
throttledIndicatorHover: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
22
|
+
};
|