@element-plus/nightly 0.0.20250311 → 0.0.20250313
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 +60 -61
- package/dist/index.full.min.js +10 -10
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +10 -10
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +60 -61
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hi.js +1 -1
- package/dist/locale/hi.min.js +1 -1
- package/dist/locale/hi.min.mjs +1 -1
- package/dist/locale/hi.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/ms.js +1 -1
- package/dist/locale/ms.min.js +1 -1
- package/dist/locale/ms.min.mjs +1 -1
- package/dist/locale/ms.mjs +1 -1
- package/dist/locale/my.js +1 -1
- package/dist/locale/my.min.js +1 -1
- package/dist/locale/my.min.mjs +1 -1
- package/dist/locale/my.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/no.js +1 -1
- package/dist/locale/no.min.js +1 -1
- package/dist/locale/no.min.mjs +1 -1
- package/dist/locale/no.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/te.js +1 -1
- package/dist/locale/te.min.js +1 -1
- package/dist/locale/te.min.mjs +1 -1
- package/dist/locale/te.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-hk.js +1 -1
- package/dist/locale/zh-hk.min.js +1 -1
- package/dist/locale/zh-hk.min.mjs +1 -1
- package/dist/locale/zh-hk.mjs +1 -1
- package/dist/locale/zh-mo.js +1 -1
- package/dist/locale/zh-mo.min.js +1 -1
- package/dist/locale/zh-mo.min.mjs +1 -1
- package/dist/locale/zh-mo.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/index.mjs +2 -2
- package/es/components/affix/src/affix.mjs +25 -118
- package/es/components/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +119 -24
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/alert/index.mjs +2 -2
- package/es/components/alert/src/alert.mjs +36 -91
- package/es/components/alert/src/alert.mjs.map +1 -1
- package/es/components/alert/src/alert2.mjs +91 -36
- package/es/components/alert/src/alert2.mjs.map +1 -1
- package/es/components/anchor/src/anchor2.mjs +2 -1
- package/es/components/anchor/src/anchor2.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete.mjs +1 -1
- package/es/components/avatar/index.mjs +2 -2
- package/es/components/avatar/src/avatar.mjs +65 -31
- package/es/components/avatar/src/avatar.mjs.map +1 -1
- package/es/components/avatar/src/avatar2.mjs +31 -65
- package/es/components/avatar/src/avatar2.mjs.map +1 -1
- package/es/components/calendar/src/calendar2.mjs +1 -1
- package/es/components/calendar/src/date-table.mjs +89 -31
- package/es/components/calendar/src/date-table.mjs.map +1 -1
- package/es/components/calendar/src/date-table2.mjs +31 -89
- package/es/components/calendar/src/date-table2.mjs.map +1 -1
- package/es/components/calendar/src/use-date-table.mjs +1 -1
- package/es/components/carousel/index.mjs +4 -4
- package/es/components/carousel/src/carousel-item.mjs +69 -7
- package/es/components/carousel/src/carousel-item.mjs.map +1 -1
- package/es/components/carousel/src/carousel-item2.mjs +7 -69
- package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
- package/es/components/carousel/src/carousel.mjs +204 -61
- package/es/components/carousel/src/carousel.mjs.map +1 -1
- package/es/components/carousel/src/carousel2.mjs +61 -204
- package/es/components/carousel/src/carousel2.mjs.map +1 -1
- package/es/components/carousel/src/use-carousel.mjs +2 -1
- package/es/components/carousel/src/use-carousel.mjs.map +1 -1
- package/es/components/checkbox/src/checkbox-group2.mjs +2 -2
- package/es/components/checkbox/src/checkbox-group2.mjs.map +1 -1
- package/es/components/checkbox/src/composables/use-checkbox-event.mjs +3 -2
- package/es/components/checkbox/src/composables/use-checkbox-event.mjs.map +1 -1
- package/es/components/col/index.mjs +2 -2
- package/es/components/col/src/col.mjs +43 -64
- package/es/components/col/src/col.mjs.map +1 -1
- package/es/components/col/src/col2.mjs +64 -43
- package/es/components/col/src/col2.mjs.map +1 -1
- package/es/components/collection/index.mjs +1 -1
- package/es/components/collection/src/collection.mjs +10 -62
- package/es/components/collection/src/collection.mjs.map +1 -1
- package/es/components/collection/src/collection2.mjs +62 -10
- package/es/components/collection/src/collection2.mjs.map +1 -1
- package/es/components/color-picker/src/color-picker2.mjs +3 -3
- package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
- package/es/components/countdown/src/countdown2.mjs +2 -1
- package/es/components/countdown/src/countdown2.mjs.map +1 -1
- package/es/components/date-picker/src/date-picker.mjs +3 -2
- package/es/components/date-picker/src/date-picker.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown-item-impl.mjs +1 -1
- package/es/components/dropdown/src/dropdown.mjs +1 -1
- package/es/components/index.mjs +15 -15
- package/es/components/input/src/input2.mjs +5 -5
- package/es/components/input/src/input2.mjs.map +1 -1
- package/es/components/mention/src/mention2.mjs +2 -2
- package/es/components/mention/src/mention2.mjs.map +1 -1
- package/es/components/pagination/src/components/pager2.mjs +4 -3
- package/es/components/pagination/src/components/pager2.mjs.map +1 -1
- package/es/components/pagination/src/components/prev.mjs +17 -35
- package/es/components/pagination/src/components/prev.mjs.map +1 -1
- package/es/components/pagination/src/components/prev2.mjs +35 -17
- package/es/components/pagination/src/components/prev2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +3 -2
- package/es/components/pagination/src/pagination.mjs.map +1 -1
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/arrow.mjs +36 -7
- package/es/components/popper/src/arrow.mjs.map +1 -1
- package/es/components/popper/src/arrow2.mjs +7 -36
- package/es/components/popper/src/arrow2.mjs.map +1 -1
- package/es/components/radio/src/radio-group2.mjs +2 -2
- package/es/components/radio/src/radio-group2.mjs.map +1 -1
- package/es/components/radio/src/radio2.mjs +2 -1
- package/es/components/radio/src/radio2.mjs.map +1 -1
- package/es/components/rate/src/rate2.mjs +3 -3
- package/es/components/rate/src/rate2.mjs.map +1 -1
- package/es/components/roving-focus-group/src/roving-focus-group.mjs +1 -1
- package/es/components/row/index.mjs +2 -2
- package/es/components/row/src/row.mjs +44 -28
- package/es/components/row/src/row.mjs.map +1 -1
- package/es/components/row/src/row2.mjs +28 -44
- package/es/components/row/src/row2.mjs.map +1 -1
- package/es/components/statistic/index.mjs +2 -2
- package/es/components/statistic/src/statistic.mjs +69 -25
- package/es/components/statistic/src/statistic.mjs.map +1 -1
- package/es/components/statistic/src/statistic2.mjs +25 -69
- package/es/components/statistic/src/statistic2.mjs.map +1 -1
- package/es/components/steps/index.mjs +2 -2
- package/es/components/steps/src/steps.mjs +38 -35
- package/es/components/steps/src/steps.mjs.map +1 -1
- package/es/components/steps/src/steps2.mjs +35 -38
- package/es/components/steps/src/steps2.mjs.map +1 -1
- package/es/components/table/src/table/defaults.d.ts +7 -0
- package/es/components/table/src/table/defaults.mjs +4 -0
- package/es/components/table/src/table/defaults.mjs.map +1 -1
- package/es/components/table/src/table-body/render-helper.mjs +17 -23
- package/es/components/table/src/table-body/render-helper.mjs.map +1 -1
- package/es/components/table/src/table.vue.d.ts +9 -0
- package/es/components/time-picker/src/common/picker.mjs +5 -4
- package/es/components/time-picker/src/common/picker.mjs.map +1 -1
- package/es/components/time-picker/src/time-picker-com/basic-time-spinner.mjs +3 -2
- package/es/components/time-picker/src/time-picker-com/basic-time-spinner.mjs.map +1 -1
- package/es/components/time-picker/src/time-picker.mjs +3 -2
- package/es/components/time-picker/src/time-picker.mjs.map +1 -1
- package/es/components/time-select/index.mjs +2 -2
- package/es/components/time-select/src/time-select.mjs +54 -132
- package/es/components/time-select/src/time-select.mjs.map +1 -1
- package/es/components/time-select/src/time-select2.mjs +132 -54
- package/es/components/time-select/src/time-select2.mjs.map +1 -1
- package/es/components/tooltip/src/tooltip.mjs +1 -1
- package/es/components/tooltip/src/tooltip2.mjs +1 -1
- package/es/components/tooltip-v2/index.mjs +3 -3
- package/es/components/tooltip-v2/src/arrow.mjs +21 -37
- package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
- package/es/components/tooltip-v2/src/arrow2.mjs +37 -21
- package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/content.mjs +110 -48
- package/es/components/tooltip-v2/src/content.mjs.map +1 -1
- package/es/components/tooltip-v2/src/content2.mjs +48 -110
- package/es/components/tooltip-v2/src/content2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip.mjs +3 -3
- package/es/components/tooltip-v2/src/tooltip2.mjs +6 -6
- package/es/components/tooltip-v2/src/trigger.mjs +12 -89
- package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
- package/es/components/tooltip-v2/src/trigger2.mjs +89 -12
- package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
- package/es/components/tour/index.mjs +3 -3
- package/es/components/tour/src/content.mjs +67 -43
- package/es/components/tour/src/content.mjs.map +1 -1
- package/es/components/tour/src/content2.mjs +43 -67
- package/es/components/tour/src/content2.mjs.map +1 -1
- package/es/components/tour/src/step.mjs +1 -1
- package/es/components/tour/src/tour.mjs +68 -153
- package/es/components/tour/src/tour.mjs.map +1 -1
- package/es/components/tour/src/tour2.mjs +154 -68
- package/es/components/tour/src/tour2.mjs.map +1 -1
- package/es/components/watermark/index.mjs +2 -2
- package/es/components/watermark/src/watermark.mjs +210 -27
- package/es/components/watermark/src/watermark.mjs.map +1 -1
- package/es/components/watermark/src/watermark2.mjs +27 -210
- package/es/components/watermark/src/watermark2.mjs.map +1 -1
- package/es/index.mjs +15 -15
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/affix/index.js +2 -2
- package/lib/components/affix/src/affix.js +26 -118
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +119 -25
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/alert/index.js +2 -2
- package/lib/components/alert/src/alert.js +37 -90
- package/lib/components/alert/src/alert.js.map +1 -1
- package/lib/components/alert/src/alert2.js +90 -37
- package/lib/components/alert/src/alert2.js.map +1 -1
- package/lib/components/anchor/src/anchor2.js +2 -1
- package/lib/components/anchor/src/anchor2.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete.js +1 -1
- package/lib/components/avatar/index.js +2 -2
- package/lib/components/avatar/src/avatar.js +65 -32
- package/lib/components/avatar/src/avatar.js.map +1 -1
- package/lib/components/avatar/src/avatar2.js +32 -65
- package/lib/components/avatar/src/avatar2.js.map +1 -1
- package/lib/components/calendar/src/calendar2.js +1 -1
- package/lib/components/calendar/src/date-table.js +89 -35
- package/lib/components/calendar/src/date-table.js.map +1 -1
- package/lib/components/calendar/src/date-table2.js +35 -89
- package/lib/components/calendar/src/date-table2.js.map +1 -1
- package/lib/components/calendar/src/use-date-table.js +1 -1
- package/lib/components/carousel/index.js +4 -4
- package/lib/components/carousel/src/carousel-item.js +69 -7
- package/lib/components/carousel/src/carousel-item.js.map +1 -1
- package/lib/components/carousel/src/carousel-item2.js +7 -69
- package/lib/components/carousel/src/carousel-item2.js.map +1 -1
- package/lib/components/carousel/src/carousel.js +204 -62
- package/lib/components/carousel/src/carousel.js.map +1 -1
- package/lib/components/carousel/src/carousel2.js +62 -204
- package/lib/components/carousel/src/carousel2.js.map +1 -1
- package/lib/components/carousel/src/use-carousel.js +2 -1
- package/lib/components/carousel/src/use-carousel.js.map +1 -1
- package/lib/components/checkbox/src/checkbox-group2.js +1 -1
- package/lib/components/checkbox/src/checkbox-group2.js.map +1 -1
- package/lib/components/checkbox/src/composables/use-checkbox-event.js +3 -2
- package/lib/components/checkbox/src/composables/use-checkbox-event.js.map +1 -1
- package/lib/components/col/index.js +2 -2
- package/lib/components/col/src/col.js +43 -64
- package/lib/components/col/src/col.js.map +1 -1
- package/lib/components/col/src/col2.js +64 -43
- package/lib/components/col/src/col2.js.map +1 -1
- package/lib/components/collection/index.js +1 -1
- package/lib/components/collection/src/collection.js +9 -62
- package/lib/components/collection/src/collection.js.map +1 -1
- package/lib/components/collection/src/collection2.js +62 -9
- package/lib/components/collection/src/collection2.js.map +1 -1
- package/lib/components/color-picker/src/color-picker2.js +2 -2
- package/lib/components/color-picker/src/color-picker2.js.map +1 -1
- package/lib/components/countdown/src/countdown2.js +2 -1
- package/lib/components/countdown/src/countdown2.js.map +1 -1
- package/lib/components/date-picker/src/date-picker.js +3 -2
- package/lib/components/date-picker/src/date-picker.js.map +1 -1
- package/lib/components/dropdown/src/dropdown-item-impl.js +1 -1
- package/lib/components/dropdown/src/dropdown.js +1 -1
- package/lib/components/index.js +15 -15
- package/lib/components/input/src/input2.js +7 -7
- package/lib/components/input/src/input2.js.map +1 -1
- package/lib/components/mention/src/mention2.js +2 -2
- package/lib/components/mention/src/mention2.js.map +1 -1
- package/lib/components/pagination/src/components/pager2.js +6 -5
- package/lib/components/pagination/src/components/pager2.js.map +1 -1
- package/lib/components/pagination/src/components/prev.js +18 -35
- package/lib/components/pagination/src/components/prev.js.map +1 -1
- package/lib/components/pagination/src/components/prev2.js +35 -18
- package/lib/components/pagination/src/components/prev2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +3 -2
- package/lib/components/pagination/src/pagination.js.map +1 -1
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/arrow.js +36 -8
- package/lib/components/popper/src/arrow.js.map +1 -1
- package/lib/components/popper/src/arrow2.js +8 -36
- package/lib/components/popper/src/arrow2.js.map +1 -1
- package/lib/components/radio/src/radio-group2.js +1 -1
- package/lib/components/radio/src/radio-group2.js.map +1 -1
- package/lib/components/radio/src/radio2.js +2 -1
- package/lib/components/radio/src/radio2.js.map +1 -1
- package/lib/components/rate/src/rate2.js +2 -2
- package/lib/components/rate/src/rate2.js.map +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-group.js +1 -1
- package/lib/components/row/index.js +2 -2
- package/lib/components/row/src/row.js +44 -30
- package/lib/components/row/src/row.js.map +1 -1
- package/lib/components/row/src/row2.js +30 -44
- package/lib/components/row/src/row2.js.map +1 -1
- package/lib/components/statistic/index.js +2 -2
- package/lib/components/statistic/src/statistic.js +69 -25
- package/lib/components/statistic/src/statistic.js.map +1 -1
- package/lib/components/statistic/src/statistic2.js +25 -69
- package/lib/components/statistic/src/statistic2.js.map +1 -1
- package/lib/components/steps/index.js +2 -2
- package/lib/components/steps/src/steps.js +38 -36
- package/lib/components/steps/src/steps.js.map +1 -1
- package/lib/components/steps/src/steps2.js +36 -38
- package/lib/components/steps/src/steps2.js.map +1 -1
- package/lib/components/table/src/table/defaults.d.ts +7 -0
- package/lib/components/table/src/table/defaults.js +4 -0
- package/lib/components/table/src/table/defaults.js.map +1 -1
- package/lib/components/table/src/table-body/render-helper.js +17 -23
- package/lib/components/table/src/table-body/render-helper.js.map +1 -1
- package/lib/components/table/src/table.vue.d.ts +9 -0
- package/lib/components/time-picker/src/common/picker.js +5 -4
- package/lib/components/time-picker/src/common/picker.js.map +1 -1
- package/lib/components/time-picker/src/time-picker-com/basic-time-spinner.js +3 -2
- package/lib/components/time-picker/src/time-picker-com/basic-time-spinner.js.map +1 -1
- package/lib/components/time-picker/src/time-picker.js +3 -2
- package/lib/components/time-picker/src/time-picker.js.map +1 -1
- package/lib/components/time-select/index.js +2 -2
- package/lib/components/time-select/src/time-select.js +54 -137
- package/lib/components/time-select/src/time-select.js.map +1 -1
- package/lib/components/time-select/src/time-select2.js +137 -54
- package/lib/components/time-select/src/time-select2.js.map +1 -1
- package/lib/components/tooltip/src/tooltip.js +1 -1
- package/lib/components/tooltip/src/tooltip2.js +1 -1
- package/lib/components/tooltip-v2/index.js +3 -3
- package/lib/components/tooltip-v2/src/arrow.js +22 -37
- package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
- package/lib/components/tooltip-v2/src/arrow2.js +37 -22
- package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
- package/lib/components/tooltip-v2/src/content.js +110 -48
- package/lib/components/tooltip-v2/src/content.js.map +1 -1
- package/lib/components/tooltip-v2/src/content2.js +48 -110
- package/lib/components/tooltip-v2/src/content2.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip.js +3 -3
- package/lib/components/tooltip-v2/src/tooltip2.js +6 -6
- package/lib/components/tooltip-v2/src/trigger.js +12 -89
- package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
- package/lib/components/tooltip-v2/src/trigger2.js +89 -12
- package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
- package/lib/components/tour/index.js +3 -3
- package/lib/components/tour/src/content.js +67 -46
- package/lib/components/tour/src/content.js.map +1 -1
- package/lib/components/tour/src/content2.js +46 -67
- package/lib/components/tour/src/content2.js.map +1 -1
- package/lib/components/tour/src/step.js +1 -1
- package/lib/components/tour/src/tour.js +67 -151
- package/lib/components/tour/src/tour.js.map +1 -1
- package/lib/components/tour/src/tour2.js +152 -67
- package/lib/components/tour/src/tour2.js.map +1 -1
- package/lib/components/watermark/index.js +2 -2
- package/lib/components/watermark/src/watermark.js +210 -27
- package/lib/components/watermark/src/watermark.js.map +1 -1
- package/lib/components/watermark/src/watermark2.js +27 -210
- package/lib/components/watermark/src/watermark2.js.map +1 -1
- package/lib/index.js +15 -15
- 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-date-picker.css +1 -1
- package/theme-chalk/el-select-v2.css +1 -1
- package/theme-chalk/el-select.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/date-picker/picker.scss +2 -2
- package/theme-chalk/src/select.scss +8 -0
- package/web-types.json +1 -1
|
@@ -1,208 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue';
|
|
4
|
-
import { carouselProps, carouselEmits } from './carousel.mjs';
|
|
5
|
-
import { useCarousel } from './use-carousel.mjs';
|
|
6
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
7
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
8
|
-
import { useLocale } from '../../../hooks/use-locale/index.mjs';
|
|
1
|
+
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
|
2
|
+
import { isNumber } from '../../../utils/types.mjs';
|
|
9
3
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
const carouselProps = buildProps({
|
|
5
|
+
initialIndex: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: 0
|
|
8
|
+
},
|
|
9
|
+
height: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ""
|
|
12
|
+
},
|
|
13
|
+
trigger: {
|
|
14
|
+
type: String,
|
|
15
|
+
values: ["hover", "click"],
|
|
16
|
+
default: "hover"
|
|
17
|
+
},
|
|
18
|
+
autoplay: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
interval: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 3e3
|
|
25
|
+
},
|
|
26
|
+
indicatorPosition: {
|
|
27
|
+
type: String,
|
|
28
|
+
values: ["", "none", "outside"],
|
|
29
|
+
default: ""
|
|
30
|
+
},
|
|
31
|
+
arrow: {
|
|
32
|
+
type: String,
|
|
33
|
+
values: ["always", "hover", "never"],
|
|
34
|
+
default: "hover"
|
|
35
|
+
},
|
|
36
|
+
type: {
|
|
37
|
+
type: String,
|
|
38
|
+
values: ["", "card"],
|
|
39
|
+
default: ""
|
|
40
|
+
},
|
|
41
|
+
cardScale: {
|
|
42
|
+
type: Number,
|
|
43
|
+
default: 0.83
|
|
44
|
+
},
|
|
45
|
+
loop: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true
|
|
48
|
+
},
|
|
49
|
+
direction: {
|
|
50
|
+
type: String,
|
|
51
|
+
values: ["horizontal", "vertical"],
|
|
52
|
+
default: "horizontal"
|
|
53
|
+
},
|
|
54
|
+
pauseOnHover: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true
|
|
57
|
+
},
|
|
58
|
+
motionBlur: Boolean
|
|
13
59
|
});
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
emits: carouselEmits,
|
|
18
|
-
setup(__props, { expose, emit }) {
|
|
19
|
-
const props = __props;
|
|
20
|
-
const {
|
|
21
|
-
root,
|
|
22
|
-
activeIndex,
|
|
23
|
-
arrowDisplay,
|
|
24
|
-
hasLabel,
|
|
25
|
-
hover,
|
|
26
|
-
isCardType,
|
|
27
|
-
items,
|
|
28
|
-
isVertical,
|
|
29
|
-
containerStyle,
|
|
30
|
-
handleButtonEnter,
|
|
31
|
-
handleButtonLeave,
|
|
32
|
-
isTransitioning,
|
|
33
|
-
handleIndicatorClick,
|
|
34
|
-
handleMouseEnter,
|
|
35
|
-
handleMouseLeave,
|
|
36
|
-
handleTransitionEnd,
|
|
37
|
-
setActiveItem,
|
|
38
|
-
prev,
|
|
39
|
-
next,
|
|
40
|
-
PlaceholderItem,
|
|
41
|
-
isTwoLengthShow,
|
|
42
|
-
throttledArrowClick,
|
|
43
|
-
throttledIndicatorHover
|
|
44
|
-
} = useCarousel(props, emit, COMPONENT_NAME);
|
|
45
|
-
const ns = useNamespace("carousel");
|
|
46
|
-
const { t } = useLocale();
|
|
47
|
-
const carouselClasses = computed(() => {
|
|
48
|
-
const classes = [ns.b(), ns.m(props.direction)];
|
|
49
|
-
if (unref(isCardType)) {
|
|
50
|
-
classes.push(ns.m("card"));
|
|
51
|
-
}
|
|
52
|
-
return classes;
|
|
53
|
-
});
|
|
54
|
-
const carouselContainer = computed(() => {
|
|
55
|
-
const classes = [ns.e("container")];
|
|
56
|
-
if (props.motionBlur && unref(isTransitioning) && items.value.length > 1) {
|
|
57
|
-
classes.push(unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`);
|
|
58
|
-
}
|
|
59
|
-
return classes;
|
|
60
|
-
});
|
|
61
|
-
const indicatorsClasses = computed(() => {
|
|
62
|
-
const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
|
|
63
|
-
if (unref(hasLabel)) {
|
|
64
|
-
classes.push(ns.em("indicators", "labels"));
|
|
65
|
-
}
|
|
66
|
-
if (props.indicatorPosition === "outside") {
|
|
67
|
-
classes.push(ns.em("indicators", "outside"));
|
|
68
|
-
}
|
|
69
|
-
if (unref(isVertical)) {
|
|
70
|
-
classes.push(ns.em("indicators", "right"));
|
|
71
|
-
}
|
|
72
|
-
return classes;
|
|
73
|
-
});
|
|
74
|
-
expose({
|
|
75
|
-
activeIndex,
|
|
76
|
-
setActiveItem,
|
|
77
|
-
prev,
|
|
78
|
-
next
|
|
79
|
-
});
|
|
80
|
-
return (_ctx, _cache) => {
|
|
81
|
-
return openBlock(), createElementBlock("div", {
|
|
82
|
-
ref_key: "root",
|
|
83
|
-
ref: root,
|
|
84
|
-
class: normalizeClass(unref(carouselClasses)),
|
|
85
|
-
onMouseenter: withModifiers(unref(handleMouseEnter), ["stop"]),
|
|
86
|
-
onMouseleave: withModifiers(unref(handleMouseLeave), ["stop"])
|
|
87
|
-
}, [
|
|
88
|
-
unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
|
|
89
|
-
key: 0,
|
|
90
|
-
name: "carousel-arrow-left",
|
|
91
|
-
persisted: ""
|
|
92
|
-
}, {
|
|
93
|
-
default: withCtx(() => [
|
|
94
|
-
withDirectives(createElementVNode("button", {
|
|
95
|
-
type: "button",
|
|
96
|
-
class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "left")]),
|
|
97
|
-
"aria-label": unref(t)("el.carousel.leftArrow"),
|
|
98
|
-
onMouseenter: ($event) => unref(handleButtonEnter)("left"),
|
|
99
|
-
onMouseleave: unref(handleButtonLeave),
|
|
100
|
-
onClick: withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) - 1), ["stop"])
|
|
101
|
-
}, [
|
|
102
|
-
createVNode(unref(ElIcon), null, {
|
|
103
|
-
default: withCtx(() => [
|
|
104
|
-
createVNode(unref(ArrowLeft))
|
|
105
|
-
]),
|
|
106
|
-
_: 1
|
|
107
|
-
})
|
|
108
|
-
], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
|
|
109
|
-
[
|
|
110
|
-
vShow,
|
|
111
|
-
(_ctx.arrow === "always" || unref(hover)) && (props.loop || unref(activeIndex) > 0)
|
|
112
|
-
]
|
|
113
|
-
])
|
|
114
|
-
]),
|
|
115
|
-
_: 1
|
|
116
|
-
})) : createCommentVNode("v-if", true),
|
|
117
|
-
unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
|
|
118
|
-
key: 1,
|
|
119
|
-
name: "carousel-arrow-right",
|
|
120
|
-
persisted: ""
|
|
121
|
-
}, {
|
|
122
|
-
default: withCtx(() => [
|
|
123
|
-
withDirectives(createElementVNode("button", {
|
|
124
|
-
type: "button",
|
|
125
|
-
class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "right")]),
|
|
126
|
-
"aria-label": unref(t)("el.carousel.rightArrow"),
|
|
127
|
-
onMouseenter: ($event) => unref(handleButtonEnter)("right"),
|
|
128
|
-
onMouseleave: unref(handleButtonLeave),
|
|
129
|
-
onClick: withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) + 1), ["stop"])
|
|
130
|
-
}, [
|
|
131
|
-
createVNode(unref(ElIcon), null, {
|
|
132
|
-
default: withCtx(() => [
|
|
133
|
-
createVNode(unref(ArrowRight))
|
|
134
|
-
]),
|
|
135
|
-
_: 1
|
|
136
|
-
})
|
|
137
|
-
], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
|
|
138
|
-
[
|
|
139
|
-
vShow,
|
|
140
|
-
(_ctx.arrow === "always" || unref(hover)) && (props.loop || unref(activeIndex) < unref(items).length - 1)
|
|
141
|
-
]
|
|
142
|
-
])
|
|
143
|
-
]),
|
|
144
|
-
_: 1
|
|
145
|
-
})) : createCommentVNode("v-if", true),
|
|
146
|
-
createElementVNode("div", {
|
|
147
|
-
class: normalizeClass(unref(carouselContainer)),
|
|
148
|
-
style: normalizeStyle(unref(containerStyle)),
|
|
149
|
-
onTransitionend: unref(handleTransitionEnd)
|
|
150
|
-
}, [
|
|
151
|
-
createVNode(unref(PlaceholderItem)),
|
|
152
|
-
renderSlot(_ctx.$slots, "default")
|
|
153
|
-
], 46, ["onTransitionend"]),
|
|
154
|
-
_ctx.indicatorPosition !== "none" ? (openBlock(), createElementBlock("ul", {
|
|
155
|
-
key: 2,
|
|
156
|
-
class: normalizeClass(unref(indicatorsClasses))
|
|
157
|
-
}, [
|
|
158
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item, index) => {
|
|
159
|
-
return withDirectives((openBlock(), createElementBlock("li", {
|
|
160
|
-
key: index,
|
|
161
|
-
class: normalizeClass([
|
|
162
|
-
unref(ns).e("indicator"),
|
|
163
|
-
unref(ns).em("indicator", _ctx.direction),
|
|
164
|
-
unref(ns).is("active", index === unref(activeIndex))
|
|
165
|
-
]),
|
|
166
|
-
onMouseenter: ($event) => unref(throttledIndicatorHover)(index),
|
|
167
|
-
onClick: withModifiers(($event) => unref(handleIndicatorClick)(index), ["stop"])
|
|
168
|
-
}, [
|
|
169
|
-
createElementVNode("button", {
|
|
170
|
-
class: normalizeClass(unref(ns).e("button")),
|
|
171
|
-
"aria-label": unref(t)("el.carousel.indicator", { index: index + 1 })
|
|
172
|
-
}, [
|
|
173
|
-
unref(hasLabel) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(item.props.label), 1)) : createCommentVNode("v-if", true)
|
|
174
|
-
], 10, ["aria-label"])
|
|
175
|
-
], 42, ["onMouseenter", "onClick"])), [
|
|
176
|
-
[vShow, unref(isTwoLengthShow)(index)]
|
|
177
|
-
]);
|
|
178
|
-
}), 128))
|
|
179
|
-
], 2)) : createCommentVNode("v-if", true),
|
|
180
|
-
props.motionBlur ? (openBlock(), createElementBlock("svg", {
|
|
181
|
-
key: 3,
|
|
182
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
183
|
-
version: "1.1",
|
|
184
|
-
style: { "display": "none" }
|
|
185
|
-
}, [
|
|
186
|
-
createElementVNode("defs", null, [
|
|
187
|
-
createElementVNode("filter", { id: "elCarouselHorizontal" }, [
|
|
188
|
-
createElementVNode("feGaussianBlur", {
|
|
189
|
-
in: "SourceGraphic",
|
|
190
|
-
stdDeviation: "12,0"
|
|
191
|
-
})
|
|
192
|
-
]),
|
|
193
|
-
createElementVNode("filter", { id: "elCarouselVertical" }, [
|
|
194
|
-
createElementVNode("feGaussianBlur", {
|
|
195
|
-
in: "SourceGraphic",
|
|
196
|
-
stdDeviation: "0,10"
|
|
197
|
-
})
|
|
198
|
-
])
|
|
199
|
-
])
|
|
200
|
-
])) : createCommentVNode("v-if", true)
|
|
201
|
-
], 42, ["onMouseenter", "onMouseleave"]);
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "carousel.vue"]]);
|
|
60
|
+
const carouselEmits = {
|
|
61
|
+
change: (current, prev) => [current, prev].every(isNumber)
|
|
62
|
+
};
|
|
206
63
|
|
|
207
|
-
export {
|
|
64
|
+
export { carouselEmits, carouselProps };
|
|
208
65
|
//# sourceMappingURL=carousel2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel2.mjs","sources":["../../../../../../packages/components/carousel/src/carousel.
|
|
1
|
+
{"version":3,"file":"carousel2.mjs","sources":["../../../../../../packages/components/carousel/src/carousel.ts"],"sourcesContent":["import { buildProps, isNumber } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const carouselProps = buildProps({\n /**\n * @description index of the initially active slide (starting from 0)\n */\n initialIndex: {\n type: Number,\n default: 0,\n },\n /**\n * @description height of the carousel\n */\n height: {\n type: String,\n default: '',\n },\n /**\n * @description how indicators are triggered\n */\n trigger: {\n type: String,\n values: ['hover', 'click'],\n default: 'hover',\n },\n /**\n * @description whether automatically loop the slides\n */\n autoplay: {\n type: Boolean,\n default: true,\n },\n /**\n * @description interval of the auto loop, in milliseconds\n */\n interval: {\n type: Number,\n default: 3000,\n },\n /**\n * @description position of the indicators\n */\n indicatorPosition: {\n type: String,\n values: ['', 'none', 'outside'],\n default: '',\n },\n /**\n * @description when arrows are shown\n */\n arrow: {\n type: String,\n values: ['always', 'hover', 'never'],\n default: 'hover',\n },\n /**\n * @description type of the Carousel\n */\n type: {\n type: String,\n values: ['', 'card'],\n default: '',\n },\n /**\n * @description when type is card, scaled size of secondary cards\n */\n cardScale: {\n type: Number,\n default: 0.83,\n },\n /**\n * @description display the items in loop\n */\n loop: {\n type: Boolean,\n default: true,\n },\n /**\n * @description display direction\n */\n direction: {\n type: String,\n values: ['horizontal', 'vertical'],\n default: 'horizontal',\n },\n /**\n * @description pause autoplay when hover\n */\n pauseOnHover: {\n type: Boolean,\n default: true,\n },\n /**\n * @description infuse dynamism and smoothness into the carousel\n */\n motionBlur: Boolean,\n} as const)\n\nexport const carouselEmits = {\n /**\n * @description triggers when the active slide switches\n * @param current index of the new active slide\n * @param prev index of the old active slide\n */\n change: (current: number, prev: number) => [current, prev].every(isNumber),\n}\n\nexport type CarouselProps = ExtractPropTypes<typeof carouselProps>\nexport type CarouselEmits = typeof carouselEmits\n"],"names":[],"mappings":";;;AACY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAC9B,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,iBAAiB,EAAE;AACrB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC;AACnC,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;AACxC,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC;AACxB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC;AACtC,IAAI,OAAO,EAAE,YAAY;AACzB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,UAAU,EAAE,OAAO;AACrB,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;AAC5D;;;;"}
|
|
@@ -6,6 +6,7 @@ import { useOrderedChildren } from '../../../hooks/use-ordered-children/index.mj
|
|
|
6
6
|
import { isString } from '@vue/shared';
|
|
7
7
|
import { debugWarn } from '../../../utils/error.mjs';
|
|
8
8
|
import { flattedChildren } from '../../../utils/vue/vnode.mjs';
|
|
9
|
+
import { CHANGE_EVENT } from '../../../constants/event.mjs';
|
|
9
10
|
|
|
10
11
|
const THROTTLE_TIME = 300;
|
|
11
12
|
const useCarousel = (props, emit, componentName) => {
|
|
@@ -214,7 +215,7 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
214
215
|
prev2 = prev2 % 2;
|
|
215
216
|
}
|
|
216
217
|
if (prev2 > -1) {
|
|
217
|
-
emit(
|
|
218
|
+
emit(CHANGE_EVENT, current, prev2);
|
|
218
219
|
}
|
|
219
220
|
});
|
|
220
221
|
watch(() => props.autoplay, (autoplay) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-carousel.mjs","sources":["../../../../../../packages/components/carousel/src/use-carousel.ts"],"sourcesContent":["import {\n computed,\n getCurrentInstance,\n isVNode,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n unref,\n useSlots,\n watch,\n} from 'vue'\nimport { throttle } from 'lodash-unified'\nimport { useResizeObserver } from '@vueuse/core'\nimport { debugWarn, flattedChildren, isString } from '@element-plus/utils'\nimport { useOrderedChildren } from '@element-plus/hooks'\nimport { CAROUSEL_ITEM_NAME, carouselContextKey } from './constants'\n\nimport type { SetupContext } from 'vue'\nimport type { CarouselItemContext } from './constants'\nimport type { CarouselEmits, CarouselProps } from './carousel'\n\nconst THROTTLE_TIME = 300\n\nexport const useCarousel = (\n props: CarouselProps,\n emit: SetupContext<CarouselEmits>['emit'],\n componentName: string\n) => {\n const {\n children: items,\n addChild: addItem,\n removeChild: removeItem,\n } = useOrderedChildren<CarouselItemContext>(\n getCurrentInstance()!,\n CAROUSEL_ITEM_NAME\n )\n\n const slots = useSlots()\n\n // refs\n const activeIndex = ref(-1)\n const timer = ref<ReturnType<typeof setInterval> | null>(null)\n const hover = ref(false)\n const root = ref<HTMLDivElement>()\n const containerHeight = ref<number>(0)\n const isItemsTwoLength = ref(true)\n const isFirstCall = ref(true)\n const isTransitioning = ref(false)\n\n // computed\n const arrowDisplay = computed(\n () => props.arrow !== 'never' && !unref(isVertical)\n )\n\n const hasLabel = computed(() => {\n return items.value.some((item) => item.props.label.toString().length > 0)\n })\n\n const isCardType = computed(() => props.type === 'card')\n const isVertical = computed(() => props.direction === 'vertical')\n\n const containerStyle = computed(() => {\n if (props.height !== 'auto') {\n return {\n height: props.height,\n }\n }\n return {\n height: `${containerHeight.value}px`,\n overflow: 'hidden',\n }\n })\n\n // methods\n const throttledArrowClick = throttle(\n (index: number) => {\n setActiveItem(index)\n },\n THROTTLE_TIME,\n { trailing: true }\n )\n\n const throttledIndicatorHover = throttle((index: number) => {\n handleIndicatorHover(index)\n }, THROTTLE_TIME)\n\n const isTwoLengthShow = (index: number) => {\n if (!isItemsTwoLength.value) return true\n return activeIndex.value <= 1 ? index <= 1 : index > 1\n }\n\n function pauseTimer() {\n if (timer.value) {\n clearInterval(timer.value)\n timer.value = null\n }\n }\n\n function startTimer() {\n if (props.interval <= 0 || !props.autoplay || timer.value) return\n timer.value = setInterval(() => playSlides(), props.interval)\n }\n\n const playSlides = () => {\n if (!isFirstCall.value) {\n isTransitioning.value = true\n }\n isFirstCall.value = false\n\n if (activeIndex.value < items.value.length - 1) {\n activeIndex.value = activeIndex.value + 1\n } else if (props.loop) {\n activeIndex.value = 0\n } else {\n isTransitioning.value = false\n }\n }\n\n function setActiveItem(index: number | string) {\n if (!isFirstCall.value) {\n isTransitioning.value = true\n }\n isFirstCall.value = false\n\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(componentName, '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\n function resetItemPosition(oldIndex?: number) {\n items.value.forEach((item, index) => {\n item.translateItem(index, activeIndex.value, oldIndex)\n })\n }\n\n function 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\n function handleMouseEnter() {\n hover.value = true\n if (props.pauseOnHover) {\n pauseTimer()\n }\n }\n\n function handleMouseLeave() {\n hover.value = false\n startTimer()\n }\n\n function handleTransitionEnd() {\n isTransitioning.value = false\n }\n\n function 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\n function handleButtonLeave() {\n if (unref(isVertical)) return\n items.value.forEach((item) => {\n item.states.hover = false\n })\n }\n\n function handleIndicatorClick(index: number) {\n if (index !== activeIndex.value) {\n if (!isFirstCall.value) {\n isTransitioning.value = true\n }\n }\n activeIndex.value = index\n }\n\n function handleIndicatorHover(index: number) {\n if (props.trigger === 'hover' && index !== activeIndex.value) {\n activeIndex.value = index\n if (!isFirstCall.value) {\n isTransitioning.value = true\n }\n }\n }\n\n function prev() {\n setActiveItem(activeIndex.value - 1)\n }\n\n function next() {\n setActiveItem(activeIndex.value + 1)\n }\n\n function resetTimer() {\n pauseTimer()\n if (!props.pauseOnHover) startTimer()\n }\n\n function setContainerHeight(height: number) {\n if (props.height !== 'auto') return\n containerHeight.value = height\n }\n\n function PlaceholderItem() {\n // fix: https://github.com/element-plus/element-plus/issues/12139\n const defaultSlots = slots.default?.()\n if (!defaultSlots) return null\n\n const flatSlots = flattedChildren(defaultSlots)\n\n const normalizeSlots = flatSlots.filter((slot) => {\n return isVNode(slot) && (slot.type as any).name === CAROUSEL_ITEM_NAME\n })\n\n if (normalizeSlots?.length === 2 && props.loop && !isCardType.value) {\n isItemsTwoLength.value = true\n return normalizeSlots\n }\n isItemsTwoLength.value = false\n return null\n }\n\n // watch\n watch(\n () => activeIndex.value,\n (current, prev) => {\n resetItemPosition(prev)\n if (isItemsTwoLength.value) {\n current = current % 2\n prev = prev % 2\n }\n if (prev > -1) {\n emit('change', current, prev)\n }\n }\n )\n watch(\n () => props.autoplay,\n (autoplay) => {\n autoplay ? startTimer() : pauseTimer()\n }\n )\n watch(\n () => props.loop,\n () => {\n setActiveItem(activeIndex.value)\n }\n )\n\n watch(\n () => props.interval,\n () => {\n resetTimer()\n }\n )\n\n const resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n // lifecycle\n onMounted(() => {\n watch(\n () => items.value,\n () => {\n if (items.value.length > 0) setActiveItem(props.initialIndex)\n },\n {\n immediate: true,\n }\n )\n\n resizeObserver.value = useResizeObserver(root.value, () => {\n resetItemPosition()\n })\n startTimer()\n })\n\n onBeforeUnmount(() => {\n pauseTimer()\n if (root.value && resizeObserver.value) resizeObserver.value.stop()\n })\n\n // provide\n provide(carouselContextKey, {\n root,\n isCardType,\n isVertical,\n items,\n loop: props.loop,\n cardScale: props.cardScale,\n addItem,\n removeItem,\n setActiveItem,\n setContainerHeight,\n })\n\n return {\n root,\n activeIndex,\n arrowDisplay,\n hasLabel,\n hover,\n isCardType,\n isTransitioning,\n items,\n isVertical,\n containerStyle,\n isItemsTwoLength,\n handleButtonEnter,\n handleTransitionEnd,\n handleButtonLeave,\n handleIndicatorClick,\n handleMouseEnter,\n hand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AAI,UAAU;AACd,IAAI,UAAU;AACd,IAAI,KAAK;AACT,IAAI,IAAI,EAAE,KAAK,CAAC,IAAI;AACpB,IAAI,SAAS,EAAE,KAAK,CAAC,SAAS;AAC9B,IAAI,OAAO;AACX,IAAI,UAAU;AACd,IAAI,aAAa;AACjB,IAAI,kBAAkB;AACtB,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,IAAI;AACR,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,IAAI,KAAK;AACT,IAAI,UAAU;AACd,IAAI,cAAc;AAClB,IAAI,gBAAgB;AACpB,IAAI,iBAAiB;AACrB,IAAI,mBAAmB;AACvB,IAAI,iBAAiB;AACrB,IAAI,oBAAoB;AACxB,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,IAAI,aAAa;AACjB,IAAI,IAAI;AACR,IAAI,IAAI;AACR,IAAI,eAAe;AACnB,IAAI,eAAe;AACnB,IAAI,mBAAmB;AACvB,IAAI,uBAAuB;AAC3B,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"use-carousel.mjs","sources":["../../../../../../packages/components/carousel/src/use-carousel.ts"],"sourcesContent":["import {\n computed,\n getCurrentInstance,\n isVNode,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n unref,\n useSlots,\n watch,\n} from 'vue'\nimport { throttle } from 'lodash-unified'\nimport { useResizeObserver } from '@vueuse/core'\nimport { debugWarn, flattedChildren, isString } from '@element-plus/utils'\nimport { useOrderedChildren } from '@element-plus/hooks'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport { CAROUSEL_ITEM_NAME, carouselContextKey } from './constants'\n\nimport type { SetupContext } from 'vue'\nimport type { CarouselItemContext } from './constants'\nimport type { CarouselEmits, CarouselProps } from './carousel'\n\nconst THROTTLE_TIME = 300\n\nexport const useCarousel = (\n props: CarouselProps,\n emit: SetupContext<CarouselEmits>['emit'],\n componentName: string\n) => {\n const {\n children: items,\n addChild: addItem,\n removeChild: removeItem,\n } = useOrderedChildren<CarouselItemContext>(\n getCurrentInstance()!,\n CAROUSEL_ITEM_NAME\n )\n\n const slots = useSlots()\n\n // refs\n const activeIndex = ref(-1)\n const timer = ref<ReturnType<typeof setInterval> | null>(null)\n const hover = ref(false)\n const root = ref<HTMLDivElement>()\n const containerHeight = ref<number>(0)\n const isItemsTwoLength = ref(true)\n const isFirstCall = ref(true)\n const isTransitioning = ref(false)\n\n // computed\n const arrowDisplay = computed(\n () => props.arrow !== 'never' && !unref(isVertical)\n )\n\n const hasLabel = computed(() => {\n return items.value.some((item) => item.props.label.toString().length > 0)\n })\n\n const isCardType = computed(() => props.type === 'card')\n const isVertical = computed(() => props.direction === 'vertical')\n\n const containerStyle = computed(() => {\n if (props.height !== 'auto') {\n return {\n height: props.height,\n }\n }\n return {\n height: `${containerHeight.value}px`,\n overflow: 'hidden',\n }\n })\n\n // methods\n const throttledArrowClick = throttle(\n (index: number) => {\n setActiveItem(index)\n },\n THROTTLE_TIME,\n { trailing: true }\n )\n\n const throttledIndicatorHover = throttle((index: number) => {\n handleIndicatorHover(index)\n }, THROTTLE_TIME)\n\n const isTwoLengthShow = (index: number) => {\n if (!isItemsTwoLength.value) return true\n return activeIndex.value <= 1 ? index <= 1 : index > 1\n }\n\n function pauseTimer() {\n if (timer.value) {\n clearInterval(timer.value)\n timer.value = null\n }\n }\n\n function startTimer() {\n if (props.interval <= 0 || !props.autoplay || timer.value) return\n timer.value = setInterval(() => playSlides(), props.interval)\n }\n\n const playSlides = () => {\n if (!isFirstCall.value) {\n isTransitioning.value = true\n }\n isFirstCall.value = false\n\n if (activeIndex.value < items.value.length - 1) {\n activeIndex.value = activeIndex.value + 1\n } else if (props.loop) {\n activeIndex.value = 0\n } else {\n isTransitioning.value = false\n }\n }\n\n function setActiveItem(index: number | string) {\n if (!isFirstCall.value) {\n isTransitioning.value = true\n }\n isFirstCall.value = false\n\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(componentName, '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\n function resetItemPosition(oldIndex?: number) {\n items.value.forEach((item, index) => {\n item.translateItem(index, activeIndex.value, oldIndex)\n })\n }\n\n function 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\n function handleMouseEnter() {\n hover.value = true\n if (props.pauseOnHover) {\n pauseTimer()\n }\n }\n\n function handleMouseLeave() {\n hover.value = false\n startTimer()\n }\n\n function handleTransitionEnd() {\n isTransitioning.value = false\n }\n\n function 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\n function handleButtonLeave() {\n if (unref(isVertical)) return\n items.value.forEach((item) => {\n item.states.hover = false\n })\n }\n\n function handleIndicatorClick(index: number) {\n if (index !== activeIndex.value) {\n if (!isFirstCall.value) {\n isTransitioning.value = true\n }\n }\n activeIndex.value = index\n }\n\n function handleIndicatorHover(index: number) {\n if (props.trigger === 'hover' && index !== activeIndex.value) {\n activeIndex.value = index\n if (!isFirstCall.value) {\n isTransitioning.value = true\n }\n }\n }\n\n function prev() {\n setActiveItem(activeIndex.value - 1)\n }\n\n function next() {\n setActiveItem(activeIndex.value + 1)\n }\n\n function resetTimer() {\n pauseTimer()\n if (!props.pauseOnHover) startTimer()\n }\n\n function setContainerHeight(height: number) {\n if (props.height !== 'auto') return\n containerHeight.value = height\n }\n\n function PlaceholderItem() {\n // fix: https://github.com/element-plus/element-plus/issues/12139\n const defaultSlots = slots.default?.()\n if (!defaultSlots) return null\n\n const flatSlots = flattedChildren(defaultSlots)\n\n const normalizeSlots = flatSlots.filter((slot) => {\n return isVNode(slot) && (slot.type as any).name === CAROUSEL_ITEM_NAME\n })\n\n if (normalizeSlots?.length === 2 && props.loop && !isCardType.value) {\n isItemsTwoLength.value = true\n return normalizeSlots\n }\n isItemsTwoLength.value = false\n return null\n }\n\n // watch\n watch(\n () => activeIndex.value,\n (current, prev) => {\n resetItemPosition(prev)\n if (isItemsTwoLength.value) {\n current = current % 2\n prev = prev % 2\n }\n if (prev > -1) {\n emit(CHANGE_EVENT, current, prev)\n }\n }\n )\n watch(\n () => props.autoplay,\n (autoplay) => {\n autoplay ? startTimer() : pauseTimer()\n }\n )\n watch(\n () => props.loop,\n () => {\n setActiveItem(activeIndex.value)\n }\n )\n\n watch(\n () => props.interval,\n () => {\n resetTimer()\n }\n )\n\n const resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n // lifecycle\n onMounted(() => {\n watch(\n () => items.value,\n () => {\n if (items.value.length > 0) setActiveItem(props.initialIndex)\n },\n {\n immediate: true,\n }\n )\n\n resizeObserver.value = useResizeObserver(root.value, () => {\n resetItemPosition()\n })\n startTimer()\n })\n\n onBeforeUnmount(() => {\n pauseTimer()\n if (root.value && resizeObserver.value) resizeObserver.value.stop()\n })\n\n // provide\n provide(carouselContextKey, {\n root,\n isCardType,\n isVertical,\n items,\n loop: props.loop,\n cardScale: props.cardScale,\n addItem,\n removeItem,\n setActiveItem,\n setContainerHeight,\n })\n\n return {\n root,\n activeIndex,\n arrowDisplay,\n hasLabel,\n hover,\n isCardType,\n isTransitioning,\n items,\n isVertical,\n containerStyle,\n isItemsTwoLength,\n handleButtonEnter,\n handleTransitionEnd,\n handleButtonLeave,\n handleIndicatorClick,\n handleMouseEnter,\n handleMouseLeave,\n setActiveItem,\n prev,\n next,\n PlaceholderItem,\n isTwoLengthShow,\n throttledArrowClick,\n throttledIndicatorHover,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAmBA,MAAM,aAAa,GAAG,GAAG,CAAC;AACd,MAAC,WAAW,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,KAAK;AAC3D,EAAE,MAAM;AACR,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,WAAW,EAAE,UAAU;AAC3B,GAAG,GAAG,kBAAkB,CAAC,kBAAkB,EAAE,EAAE,kBAAkB,CAAC,CAAC;AACnE,EAAE,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AAC3B,EAAE,MAAM,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,EAAE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;AAC1B,EAAE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AAC3B,EAAE,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC;AACrB,EAAE,MAAM,eAAe,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACjC,EAAE,MAAM,gBAAgB,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;AACrC,EAAE,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;AAChC,EAAE,MAAM,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AAK,CAAC,CAAC;AACP,IAAI,UAAU,EAAE,CAAC;AACjB,GAAG,CAAC,CAAC;AACL,EAAE,eAAe,CAAC,MAAM;AACxB,IAAI,UAAU,EAAE,CAAC;AACjB,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,cAAc,CAAC,KAAK;AAC1C,MAAM,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;AAClC,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,CAAC,kBAAkB,EAAE;AAC9B,IAAI,IAAI;AACR,IAAI,UAAU;AACd,IAAI,UAAU;AACd,IAAI,KAAK;AACT,IAAI,IAAI,EAAE,KAAK,CAAC,IAAI;AACpB,IAAI,SAAS,EAAE,KAAK,CAAC,SAAS;AAC9B,IAAI,OAAO;AACX,IAAI,UAAU;AACd,IAAI,aAAa;AACjB,IAAI,kBAAkB;AACtB,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,IAAI;AACR,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,IAAI,KAAK;AACT,IAAI,UAAU;AACd,IAAI,cAAc;AAClB,IAAI,gBAAgB;AACpB,IAAI,iBAAiB;AACrB,IAAI,mBAAmB;AACvB,IAAI,iBAAiB;AACrB,IAAI,oBAAoB;AACxB,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,IAAI,aAAa;AACjB,IAAI,IAAI;AACR,IAAI,IAAI;AACR,IAAI,eAAe;AACnB,IAAI,eAAe;AACnB,IAAI,mBAAmB;AACvB,IAAI,uBAAuB;AAC3B,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -6,7 +6,7 @@ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
|
6
6
|
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
7
7
|
import { useFormItem, useFormItemInputId } from '../../form/src/hooks/use-form-item.mjs';
|
|
8
8
|
import { debugWarn } from '../../../utils/error.mjs';
|
|
9
|
-
import { UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';
|
|
9
|
+
import { UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
|
|
10
10
|
|
|
11
11
|
const __default__ = defineComponent({
|
|
12
12
|
name: "ElCheckboxGroup"
|
|
@@ -25,7 +25,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
25
25
|
const changeEvent = async (value) => {
|
|
26
26
|
emit(UPDATE_MODEL_EVENT, value);
|
|
27
27
|
await nextTick();
|
|
28
|
-
emit(
|
|
28
|
+
emit(CHANGE_EVENT, value);
|
|
29
29
|
};
|
|
30
30
|
const modelValue = computed({
|
|
31
31
|
get() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-group2.mjs","sources":["../../../../../../packages/components/checkbox/src/checkbox-group.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n :id=\"groupId\"\n :class=\"ns.b('group')\"\n role=\"group\"\n :aria-label=\"\n !isLabeledByFormItem ? ariaLabel || 'checkbox-group' : undefined\n \"\n :aria-labelledby=\"isLabeledByFormItem ? formItem?.labelId : undefined\"\n >\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, nextTick, provide, toRefs, watch } from 'vue'\nimport { pick } from 'lodash-unified'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { debugWarn } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useFormItem, useFormItemInputId } from '@element-plus/components/form'\nimport { checkboxGroupEmits, checkboxGroupProps } from './checkbox-group'\nimport { checkboxGroupContextKey } from './constants'\n\nimport type { CheckboxGroupValueType } from './checkbox-group'\n\ndefineOptions({\n name: 'ElCheckboxGroup',\n})\n\nconst props = defineProps(checkboxGroupProps)\nconst emit = defineEmits(checkboxGroupEmits)\nconst ns = useNamespace('checkbox')\n\nconst { formItem } = useFormItem()\nconst { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext: formItem,\n})\n\nconst changeEvent = async (value: CheckboxGroupValueType) => {\n emit(UPDATE_MODEL_EVENT, value)\n await nextTick()\n emit(
|
|
1
|
+
{"version":3,"file":"checkbox-group2.mjs","sources":["../../../../../../packages/components/checkbox/src/checkbox-group.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n :id=\"groupId\"\n :class=\"ns.b('group')\"\n role=\"group\"\n :aria-label=\"\n !isLabeledByFormItem ? ariaLabel || 'checkbox-group' : undefined\n \"\n :aria-labelledby=\"isLabeledByFormItem ? formItem?.labelId : undefined\"\n >\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, nextTick, provide, toRefs, watch } from 'vue'\nimport { pick } from 'lodash-unified'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { debugWarn } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useFormItem, useFormItemInputId } from '@element-plus/components/form'\nimport { checkboxGroupEmits, checkboxGroupProps } from './checkbox-group'\nimport { checkboxGroupContextKey } from './constants'\n\nimport type { CheckboxGroupValueType } from './checkbox-group'\n\ndefineOptions({\n name: 'ElCheckboxGroup',\n})\n\nconst props = defineProps(checkboxGroupProps)\nconst emit = defineEmits(checkboxGroupEmits)\nconst ns = useNamespace('checkbox')\n\nconst { formItem } = useFormItem()\nconst { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext: formItem,\n})\n\nconst changeEvent = async (value: CheckboxGroupValueType) => {\n emit(UPDATE_MODEL_EVENT, value)\n await nextTick()\n emit(CHANGE_EVENT, value)\n}\n\nconst modelValue = computed({\n get() {\n return props.modelValue\n },\n set(val: CheckboxGroupValueType) {\n changeEvent(val)\n },\n})\n\nprovide(checkboxGroupContextKey, {\n ...pick(toRefs(props), [\n 'size',\n 'min',\n 'max',\n 'disabled',\n 'validateEvent',\n 'fill',\n 'textColor',\n ]),\n modelValue,\n changeEvent,\n})\n\nwatch(\n () => props.modelValue,\n () => {\n if (props.validateEvent) {\n formItem?.validate('change').catch((err) => debugWarn(err))\n }\n }\n)\n</script>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent"],"mappings":";;;;;;;;;;mCA2Bc,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAIA,IAAM,MAAA,EAAA,GAAK,aAAa,UAAU,CAAA,CAAA;AAElC,IAAM,MAAA,EAAE,QAAS,EAAA,GAAI,WAAY,EAAA,CAAA;AACjC,IAAA,MAAM,EAAE,OAAS,EAAA,OAAA,EAAS,mBAAoB,EAAA,GAAI,mBAAmB,KAAO,EAAA;AAAA,MAC1E,eAAiB,EAAA,QAAA;AAAA,KAClB,CAAA,CAAA;AAED,IAAM,MAAA,WAAA,GAAc,OAAO,KAAkC,KAAA;AAC3D,MAAA,IAAA,CAAK,oBAAoB,KAAK,CAAA,CAAA;AAC9B,MAAA,MAAM,QAAS,EAAA,CAAA;AACf,MAAA,IAAA,CAAK,cAAc,KAAK,CAAA,CAAA;AAAA,KAC1B,CAAA;AAEA,IAAA,MAAM,aAAa,QAAS,CAAA;AAAA,MAC1B,GAAM,GAAA;AACJ,QAAA,OAAO,KAAM,CAAA,UAAA,CAAA;AAAA,OACf;AAAA,MACA,IAAI,GAA6B,EAAA;AAC/B,QAAA,WAAA,CAAY,GAAG,CAAA,CAAA;AAAA,OACjB;AAAA,KACD,CAAA,CAAA;AAED,IAAA,OAAA,CAAQ,uBAAyB,EAAA;AAAA,MAC/B,GAAG,IAAA,CAAK,MAAO,CAAA,KAAK,CAAG,EAAA;AAAA,QACrB,MAAA;AAAA,QACA,KAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAA;AAAA,QACA,eAAA;AAAA,QACA,MAAA;AAAA,QACA,WAAA;AAAA,OACD,CAAA;AAAA,MACD,UAAA;AAAA,MACA,WAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,KAAA,CAAA,MAAA,KAAA,CAAA,UAAA,EAAA,MAAA;AAAA,MACE,SAAY,CAAA,aAAA,EAAA;AAAA,QACN,QAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,QAAA,CAAA,QAAA,CAAA,QAAA,CAAA,CAAA,KAAA,CAAA,CAAA,GAAA,KAAA,SAAA,CAAA,GAAA,CAAA,CAAA,CAAA;AACJ,OAAA;AACE,KAAU,CAAA,CAAA;AAAgD,IAC5D,OAAA,CAAA,IAAA,EAAA,MAAA,KAAA;AAAA,MACF,IAAA,EAAA,CAAA;AAAA,MACF,OAAAA,SAAA,EAAA,EAAAC,WAAA,CAAAC,uBAAA,CAAA,IAAA,CAAA,GAAA,CAAA,EAAA;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,6 +2,7 @@ import { inject, getCurrentInstance, computed, watch, nextTick } from 'vue';
|
|
|
2
2
|
import { checkboxGroupContextKey } from '../constants.mjs';
|
|
3
3
|
import { useFormItem } from '../../../form/src/hooks/use-form-item.mjs';
|
|
4
4
|
import { debugWarn } from '../../../../utils/error.mjs';
|
|
5
|
+
import { CHANGE_EVENT } from '../../../../constants/event.mjs';
|
|
5
6
|
|
|
6
7
|
const useCheckboxEvent = (props, {
|
|
7
8
|
model,
|
|
@@ -18,13 +19,13 @@ const useCheckboxEvent = (props, {
|
|
|
18
19
|
return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
|
|
19
20
|
}
|
|
20
21
|
function emitChangeEvent(checked, e) {
|
|
21
|
-
emit(
|
|
22
|
+
emit(CHANGE_EVENT, getLabeledValue(checked), e);
|
|
22
23
|
}
|
|
23
24
|
function handleChange(e) {
|
|
24
25
|
if (isLimitExceeded.value)
|
|
25
26
|
return;
|
|
26
27
|
const target = e.target;
|
|
27
|
-
emit(
|
|
28
|
+
emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
|
|
28
29
|
}
|
|
29
30
|
async function onClickRoot(e) {
|
|
30
31
|
if (isLimitExceeded.value)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-checkbox-event.mjs","sources":["../../../../../../../packages/components/checkbox/src/composables/use-checkbox-event.ts"],"sourcesContent":["import { computed, getCurrentInstance, inject, nextTick, watch } from 'vue'\nimport { useFormItem } from '@element-plus/components/form'\nimport { debugWarn } from '@element-plus/utils'\nimport { checkboxGroupContextKey } from '../constants'\n\nimport type { useFormItemInputId } from '@element-plus/components/form'\nimport type { CheckboxProps } from '../checkbox'\nimport type {\n CheckboxDisabled,\n CheckboxModel,\n CheckboxStatus,\n} from '../composables'\n\nexport const useCheckboxEvent = (\n props: CheckboxProps,\n {\n model,\n isLimitExceeded,\n hasOwnLabel,\n isDisabled,\n isLabeledByFormItem,\n }: Pick<CheckboxModel, 'model' | 'isLimitExceeded'> &\n Pick<CheckboxStatus, 'hasOwnLabel'> &\n Pick<CheckboxDisabled, 'isDisabled'> &\n Pick<ReturnType<typeof useFormItemInputId>, 'isLabeledByFormItem'>\n) => {\n const checkboxGroup = inject(checkboxGroupContextKey, undefined)\n const { formItem } = useFormItem()\n const { emit } = getCurrentInstance()!\n\n function getLabeledValue(value: string | number | boolean) {\n return [true, props.trueValue, props.trueLabel].includes(value)\n ? props.trueValue ?? props.trueLabel ?? true\n : props.falseValue ?? props.falseLabel ?? false\n }\n\n function emitChangeEvent(\n checked: string | number | boolean,\n e: InputEvent | MouseEvent\n ) {\n emit(
|
|
1
|
+
{"version":3,"file":"use-checkbox-event.mjs","sources":["../../../../../../../packages/components/checkbox/src/composables/use-checkbox-event.ts"],"sourcesContent":["import { computed, getCurrentInstance, inject, nextTick, watch } from 'vue'\nimport { useFormItem } from '@element-plus/components/form'\nimport { debugWarn } from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport { checkboxGroupContextKey } from '../constants'\n\nimport type { useFormItemInputId } from '@element-plus/components/form'\nimport type { CheckboxProps } from '../checkbox'\nimport type {\n CheckboxDisabled,\n CheckboxModel,\n CheckboxStatus,\n} from '../composables'\n\nexport const useCheckboxEvent = (\n props: CheckboxProps,\n {\n model,\n isLimitExceeded,\n hasOwnLabel,\n isDisabled,\n isLabeledByFormItem,\n }: Pick<CheckboxModel, 'model' | 'isLimitExceeded'> &\n Pick<CheckboxStatus, 'hasOwnLabel'> &\n Pick<CheckboxDisabled, 'isDisabled'> &\n Pick<ReturnType<typeof useFormItemInputId>, 'isLabeledByFormItem'>\n) => {\n const checkboxGroup = inject(checkboxGroupContextKey, undefined)\n const { formItem } = useFormItem()\n const { emit } = getCurrentInstance()!\n\n function getLabeledValue(value: string | number | boolean) {\n return [true, props.trueValue, props.trueLabel].includes(value)\n ? props.trueValue ?? props.trueLabel ?? true\n : props.falseValue ?? props.falseLabel ?? false\n }\n\n function emitChangeEvent(\n checked: string | number | boolean,\n e: InputEvent | MouseEvent\n ) {\n emit(CHANGE_EVENT, getLabeledValue(checked), e)\n }\n\n function handleChange(e: Event) {\n if (isLimitExceeded.value) return\n\n const target = e.target as HTMLInputElement\n emit(CHANGE_EVENT, getLabeledValue(target.checked), e)\n }\n\n async function onClickRoot(e: MouseEvent) {\n if (isLimitExceeded.value) return\n\n if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {\n // fix: https://github.com/element-plus/element-plus/issues/9981\n const eventTargets: EventTarget[] = e.composedPath()\n const hasLabel = eventTargets.some(\n (item) => (item as HTMLElement).tagName === 'LABEL'\n )\n if (!hasLabel) {\n model.value = getLabeledValue(\n [false, props.falseValue, props.falseLabel].includes(model.value)\n )\n await nextTick()\n emitChangeEvent(model.value, e)\n }\n }\n }\n\n const validateEvent = computed(\n () => checkboxGroup?.validateEvent || props.validateEvent\n )\n\n watch(\n () => props.modelValue,\n () => {\n if (validateEvent.value) {\n formItem?.validate('change').catch((err) => debugWarn(err))\n }\n }\n )\n\n return {\n handleChange,\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