@element-plus/nightly 0.0.20241228 → 0.0.20241229
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.full.js +5 -3
- 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 +5 -3
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/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/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/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 +118 -25
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/anchor/index.mjs +1 -1
- package/es/components/anchor/src/anchor-link.mjs +5 -81
- package/es/components/anchor/src/anchor-link.mjs.map +1 -1
- package/es/components/anchor/src/anchor-link2.mjs +81 -5
- package/es/components/anchor/src/anchor-link2.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete.mjs +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/card/index.mjs +2 -2
- package/es/components/card/src/card.mjs +42 -20
- package/es/components/card/src/card.mjs.map +1 -1
- package/es/components/card/src/card2.mjs +20 -42
- package/es/components/card/src/card2.mjs.map +1 -1
- package/es/components/carousel/index.mjs +2 -2
- package/es/components/carousel/src/carousel-item.mjs +7 -69
- package/es/components/carousel/src/carousel-item.mjs.map +1 -1
- package/es/components/carousel/src/carousel-item2.mjs +69 -7
- package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
- package/es/components/cascader/src/cascader.mjs +1 -1
- package/es/components/check-tag/index.mjs +2 -2
- package/es/components/check-tag/src/check-tag.mjs +14 -38
- package/es/components/check-tag/src/check-tag.mjs.map +1 -1
- package/es/components/check-tag/src/check-tag2.mjs +38 -14
- package/es/components/check-tag/src/check-tag2.mjs.map +1 -1
- package/es/components/checkbox/index.mjs +2 -2
- package/es/components/checkbox/src/checkbox-group.mjs +71 -29
- package/es/components/checkbox/src/checkbox-group.mjs.map +1 -1
- package/es/components/checkbox/src/checkbox-group2.mjs +29 -71
- package/es/components/checkbox/src/checkbox-group2.mjs.map +1 -1
- package/es/components/collapse/index.mjs +2 -2
- package/es/components/collapse/src/collapse-item.mjs +90 -18
- package/es/components/collapse/src/collapse-item.mjs.map +1 -1
- package/es/components/collapse/src/collapse-item2.mjs +18 -90
- package/es/components/collapse/src/collapse-item2.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/index.mjs +2 -2
- package/es/components/color-picker/src/color-picker.mjs +402 -40
- package/es/components/color-picker/src/color-picker.mjs.map +1 -1
- package/es/components/color-picker/src/color-picker2.mjs +40 -402
- package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
- package/es/components/color-picker/src/components/predefine.mjs +1 -1
- package/es/components/drawer/index.mjs +2 -2
- package/es/components/drawer/src/drawer.mjs +178 -26
- package/es/components/drawer/src/drawer.mjs.map +1 -1
- package/es/components/drawer/src/drawer2.mjs +26 -178
- package/es/components/drawer/src/drawer2.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown-item-impl.mjs +2 -2
- package/es/components/dropdown/src/dropdown-menu.mjs +1 -1
- package/es/components/dropdown/src/dropdown.mjs +2 -2
- package/es/components/dropdown/src/dropdown2.mjs +1 -1
- package/es/components/index.mjs +23 -23
- package/es/components/input-tag/index.mjs +2 -2
- package/es/components/input-tag/src/input-tag.mjs +215 -65
- package/es/components/input-tag/src/input-tag.mjs.map +1 -1
- package/es/components/input-tag/src/input-tag2.mjs +65 -215
- package/es/components/input-tag/src/input-tag2.mjs.map +1 -1
- package/es/components/link/index.mjs +2 -2
- package/es/components/link/src/link.mjs +24 -49
- package/es/components/link/src/link.mjs.map +1 -1
- package/es/components/link/src/link2.mjs +49 -24
- package/es/components/link/src/link2.mjs.map +1 -1
- package/es/components/menu/index.mjs +4 -4
- package/es/components/menu/src/menu-item-group.mjs +34 -4
- package/es/components/menu/src/menu-item-group.mjs.map +1 -1
- package/es/components/menu/src/menu-item-group2.mjs +4 -34
- package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
- package/es/components/menu/src/menu-item.mjs +96 -14
- package/es/components/menu/src/menu-item.mjs.map +1 -1
- package/es/components/menu/src/menu-item2.mjs +14 -96
- package/es/components/menu/src/menu-item2.mjs.map +1 -1
- package/es/components/pagination/src/components/jumper.mjs +7 -58
- package/es/components/pagination/src/components/jumper.mjs.map +1 -1
- package/es/components/pagination/src/components/jumper2.mjs +58 -7
- package/es/components/pagination/src/components/jumper2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +1 -1
- package/es/components/popconfirm/src/popconfirm.mjs +1 -1
- package/es/components/popover/src/popover.mjs +1 -1
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/arrow.mjs +7 -36
- package/es/components/popper/src/arrow.mjs.map +1 -1
- package/es/components/popper/src/arrow2.mjs +36 -7
- package/es/components/popper/src/arrow2.mjs.map +1 -1
- package/es/components/roving-focus-group/index.mjs +3 -3
- package/es/components/roving-focus-group/src/roving-focus-group-impl.mjs +1 -1
- package/es/components/roving-focus-group/src/roving-focus-group.mjs +27 -27
- package/es/components/roving-focus-group/src/roving-focus-group.mjs.map +1 -1
- package/es/components/roving-focus-group/src/roving-focus-group2.mjs +27 -27
- package/es/components/roving-focus-group/src/roving-focus-group2.mjs.map +1 -1
- package/es/components/roving-focus-group/src/roving-focus-item.mjs +1 -1
- package/es/components/scrollbar/index.mjs +3 -3
- package/es/components/scrollbar/src/bar2.mjs +1 -1
- package/es/components/scrollbar/src/scrollbar.mjs +55 -170
- package/es/components/scrollbar/src/scrollbar.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar2.mjs +170 -55
- package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
- package/es/components/scrollbar/src/thumb.mjs +129 -11
- package/es/components/scrollbar/src/thumb.mjs.map +1 -1
- package/es/components/scrollbar/src/thumb2.mjs +11 -129
- package/es/components/scrollbar/src/thumb2.mjs.map +1 -1
- package/es/components/select/src/select.mjs +1 -1
- package/es/components/select-v2/src/defaults.mjs +1 -1
- package/es/components/skeleton/index.mjs +2 -2
- package/es/components/skeleton/src/skeleton-item.mjs +17 -22
- package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton-item2.mjs +22 -17
- package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton2.mjs +1 -1
- package/es/components/slider/index.mjs +2 -2
- package/es/components/slider/src/slider.mjs +238 -88
- package/es/components/slider/src/slider.mjs.map +1 -1
- package/es/components/slider/src/slider2.mjs +88 -238
- package/es/components/slider/src/slider2.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-body/events-helper.mjs +4 -2
- package/es/components/table/src/table-body/events-helper.mjs.map +1 -1
- package/es/components/tooltip/index.mjs +1 -1
- package/es/components/tooltip/src/content.mjs +192 -28
- package/es/components/tooltip/src/content.mjs.map +1 -1
- package/es/components/tooltip/src/content2.mjs +28 -192
- package/es/components/tooltip/src/content2.mjs.map +1 -1
- package/es/components/tooltip/src/tooltip.mjs +2 -2
- package/es/components/tooltip/src/tooltip2.mjs +2 -2
- package/es/components/tooltip-v2/index.mjs +3 -3
- package/es/components/tooltip-v2/src/content.mjs +48 -110
- package/es/components/tooltip-v2/src/content.mjs.map +1 -1
- package/es/components/tooltip-v2/src/content2.mjs +110 -48
- package/es/components/tooltip-v2/src/content2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip.mjs +77 -19
- package/es/components/tooltip-v2/src/tooltip.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip2.mjs +19 -77
- package/es/components/tooltip-v2/src/tooltip2.mjs.map +1 -1
- package/es/components/tour/index.mjs +2 -2
- package/es/components/tour/src/tour.mjs +153 -68
- package/es/components/tour/src/tour.mjs.map +1 -1
- package/es/components/tour/src/tour2.mjs +68 -153
- package/es/components/tour/src/tour2.mjs.map +1 -1
- package/es/components/upload/index.mjs +2 -2
- package/es/components/upload/src/upload-content.mjs +33 -196
- package/es/components/upload/src/upload-content.mjs.map +1 -1
- package/es/components/upload/src/upload-content2.mjs +196 -33
- package/es/components/upload/src/upload-content2.mjs.map +1 -1
- package/es/components/upload/src/upload-list.mjs +28 -173
- package/es/components/upload/src/upload-list.mjs.map +1 -1
- package/es/components/upload/src/upload-list2.mjs +173 -28
- package/es/components/upload/src/upload-list2.mjs.map +1 -1
- package/es/components/upload/src/upload2.mjs +2 -2
- package/es/directives/click-outside/index.mjs +1 -1
- package/es/hooks/use-focus-controller/index.mjs +1 -1
- package/es/hooks/use-lockscreen/index.mjs +1 -1
- package/es/index.mjs +23 -23
- 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 +118 -26
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/anchor/index.js +1 -1
- package/lib/components/anchor/src/anchor-link.js +5 -81
- package/lib/components/anchor/src/anchor-link.js.map +1 -1
- package/lib/components/anchor/src/anchor-link2.js +81 -5
- package/lib/components/anchor/src/anchor-link2.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete.js +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/card/index.js +2 -2
- package/lib/components/card/src/card.js +42 -20
- package/lib/components/card/src/card.js.map +1 -1
- package/lib/components/card/src/card2.js +20 -42
- package/lib/components/card/src/card2.js.map +1 -1
- package/lib/components/carousel/index.js +2 -2
- package/lib/components/carousel/src/carousel-item.js +7 -69
- package/lib/components/carousel/src/carousel-item.js.map +1 -1
- package/lib/components/carousel/src/carousel-item2.js +69 -7
- package/lib/components/carousel/src/carousel-item2.js.map +1 -1
- package/lib/components/cascader/src/cascader.js +1 -1
- package/lib/components/check-tag/index.js +2 -2
- package/lib/components/check-tag/src/check-tag.js +15 -38
- package/lib/components/check-tag/src/check-tag.js.map +1 -1
- package/lib/components/check-tag/src/check-tag2.js +38 -15
- package/lib/components/check-tag/src/check-tag2.js.map +1 -1
- package/lib/components/checkbox/index.js +2 -2
- package/lib/components/checkbox/src/checkbox-group.js +71 -30
- package/lib/components/checkbox/src/checkbox-group.js.map +1 -1
- package/lib/components/checkbox/src/checkbox-group2.js +30 -71
- package/lib/components/checkbox/src/checkbox-group2.js.map +1 -1
- package/lib/components/collapse/index.js +2 -2
- package/lib/components/collapse/src/collapse-item.js +90 -18
- package/lib/components/collapse/src/collapse-item.js.map +1 -1
- package/lib/components/collapse/src/collapse-item2.js +18 -90
- package/lib/components/collapse/src/collapse-item2.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/index.js +2 -2
- package/lib/components/color-picker/src/color-picker.js +400 -40
- package/lib/components/color-picker/src/color-picker.js.map +1 -1
- package/lib/components/color-picker/src/color-picker2.js +40 -400
- package/lib/components/color-picker/src/color-picker2.js.map +1 -1
- package/lib/components/color-picker/src/components/predefine.js +1 -1
- package/lib/components/drawer/index.js +2 -2
- package/lib/components/drawer/src/drawer.js +178 -27
- package/lib/components/drawer/src/drawer.js.map +1 -1
- package/lib/components/drawer/src/drawer2.js +27 -178
- package/lib/components/drawer/src/drawer2.js.map +1 -1
- package/lib/components/dropdown/src/dropdown-item-impl.js +2 -2
- package/lib/components/dropdown/src/dropdown-menu.js +1 -1
- package/lib/components/dropdown/src/dropdown.js +2 -2
- package/lib/components/dropdown/src/dropdown2.js +1 -1
- package/lib/components/index.js +23 -23
- package/lib/components/input-tag/index.js +2 -2
- package/lib/components/input-tag/src/input-tag.js +214 -65
- package/lib/components/input-tag/src/input-tag.js.map +1 -1
- package/lib/components/input-tag/src/input-tag2.js +65 -214
- package/lib/components/input-tag/src/input-tag2.js.map +1 -1
- package/lib/components/link/index.js +2 -2
- package/lib/components/link/src/link.js +25 -49
- package/lib/components/link/src/link.js.map +1 -1
- package/lib/components/link/src/link2.js +49 -25
- package/lib/components/link/src/link2.js.map +1 -1
- package/lib/components/menu/index.js +4 -4
- package/lib/components/menu/src/menu-item-group.js +34 -4
- package/lib/components/menu/src/menu-item-group.js.map +1 -1
- package/lib/components/menu/src/menu-item-group2.js +4 -34
- package/lib/components/menu/src/menu-item-group2.js.map +1 -1
- package/lib/components/menu/src/menu-item.js +96 -15
- package/lib/components/menu/src/menu-item.js.map +1 -1
- package/lib/components/menu/src/menu-item2.js +15 -96
- package/lib/components/menu/src/menu-item2.js.map +1 -1
- package/lib/components/pagination/src/components/jumper.js +7 -58
- package/lib/components/pagination/src/components/jumper.js.map +1 -1
- package/lib/components/pagination/src/components/jumper2.js +58 -7
- package/lib/components/pagination/src/components/jumper2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +1 -1
- package/lib/components/popconfirm/src/popconfirm.js +1 -1
- package/lib/components/popover/src/popover.js +1 -1
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/arrow.js +8 -36
- package/lib/components/popper/src/arrow.js.map +1 -1
- package/lib/components/popper/src/arrow2.js +36 -8
- package/lib/components/popper/src/arrow2.js.map +1 -1
- package/lib/components/roving-focus-group/index.js +2 -2
- package/lib/components/roving-focus-group/src/roving-focus-group-impl.js +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-group.js +27 -31
- package/lib/components/roving-focus-group/src/roving-focus-group.js.map +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-group2.js +31 -27
- package/lib/components/roving-focus-group/src/roving-focus-group2.js.map +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-item.js +1 -1
- package/lib/components/scrollbar/index.js +3 -3
- package/lib/components/scrollbar/src/bar2.js +1 -1
- package/lib/components/scrollbar/src/scrollbar.js +56 -170
- package/lib/components/scrollbar/src/scrollbar.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar2.js +170 -56
- package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
- package/lib/components/scrollbar/src/thumb.js +129 -11
- package/lib/components/scrollbar/src/thumb.js.map +1 -1
- package/lib/components/scrollbar/src/thumb2.js +11 -129
- package/lib/components/scrollbar/src/thumb2.js.map +1 -1
- package/lib/components/select/src/select.js +1 -1
- package/lib/components/select-v2/src/defaults.js +1 -1
- package/lib/components/skeleton/index.js +2 -2
- package/lib/components/skeleton/src/skeleton-item.js +17 -22
- package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
- package/lib/components/skeleton/src/skeleton-item2.js +22 -17
- package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
- package/lib/components/skeleton/src/skeleton2.js +1 -1
- package/lib/components/slider/index.js +2 -2
- package/lib/components/slider/src/slider.js +238 -89
- package/lib/components/slider/src/slider.js.map +1 -1
- package/lib/components/slider/src/slider2.js +89 -238
- package/lib/components/slider/src/slider2.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-body/events-helper.js +3 -1
- package/lib/components/table/src/table-body/events-helper.js.map +1 -1
- package/lib/components/tooltip/index.js +1 -1
- package/lib/components/tooltip/src/content.js +192 -28
- package/lib/components/tooltip/src/content.js.map +1 -1
- package/lib/components/tooltip/src/content2.js +28 -192
- package/lib/components/tooltip/src/content2.js.map +1 -1
- package/lib/components/tooltip/src/tooltip.js +2 -2
- package/lib/components/tooltip/src/tooltip2.js +2 -2
- package/lib/components/tooltip-v2/index.js +3 -3
- package/lib/components/tooltip-v2/src/content.js +48 -110
- package/lib/components/tooltip-v2/src/content.js.map +1 -1
- package/lib/components/tooltip-v2/src/content2.js +110 -48
- package/lib/components/tooltip-v2/src/content2.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip.js +77 -19
- package/lib/components/tooltip-v2/src/tooltip.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip2.js +19 -77
- package/lib/components/tooltip-v2/src/tooltip2.js.map +1 -1
- package/lib/components/tour/index.js +2 -2
- package/lib/components/tour/src/tour.js +152 -68
- package/lib/components/tour/src/tour.js.map +1 -1
- package/lib/components/tour/src/tour2.js +68 -152
- package/lib/components/tour/src/tour2.js.map +1 -1
- package/lib/components/upload/index.js +2 -2
- package/lib/components/upload/src/upload-content.js +31 -194
- package/lib/components/upload/src/upload-content.js.map +1 -1
- package/lib/components/upload/src/upload-content2.js +194 -31
- package/lib/components/upload/src/upload-content2.js.map +1 -1
- package/lib/components/upload/src/upload-list.js +29 -173
- package/lib/components/upload/src/upload-list.js.map +1 -1
- package/lib/components/upload/src/upload-list2.js +173 -29
- package/lib/components/upload/src/upload-list2.js.map +1 -1
- package/lib/components/upload/src/upload2.js +2 -2
- package/lib/directives/click-outside/index.js +1 -1
- package/lib/hooks/use-focus-controller/index.js +1 -1
- package/lib/hooks/use-lockscreen/index.js +1 -1
- package/lib/index.js +23 -23
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
@@ -1,201 +1,38 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import { uploadContentProps } from './upload-content2.mjs';
|
5
|
-
import { genFileId } from './upload.mjs';
|
6
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
7
|
-
import { entriesOf } from '../../../utils/objects.mjs';
|
8
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
9
|
-
import { useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
|
10
|
-
import { isPlainObject, isFunction } from '@vue/shared';
|
1
|
+
import { uploadBaseProps } from './upload.mjs';
|
2
|
+
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
3
|
+
import { NOOP } from '@vue/shared';
|
11
4
|
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
upload(rawFile);
|
42
|
-
}
|
43
|
-
};
|
44
|
-
const upload = async (rawFile) => {
|
45
|
-
inputRef.value.value = "";
|
46
|
-
if (!props.beforeUpload) {
|
47
|
-
return doUpload(rawFile);
|
48
|
-
}
|
49
|
-
let hookResult;
|
50
|
-
let beforeData = {};
|
51
|
-
try {
|
52
|
-
const originData = props.data;
|
53
|
-
const beforeUploadPromise = props.beforeUpload(rawFile);
|
54
|
-
beforeData = isPlainObject(props.data) ? cloneDeep(props.data) : props.data;
|
55
|
-
hookResult = await beforeUploadPromise;
|
56
|
-
if (isPlainObject(props.data) && isEqual(originData, beforeData)) {
|
57
|
-
beforeData = cloneDeep(props.data);
|
58
|
-
}
|
59
|
-
} catch (e) {
|
60
|
-
hookResult = false;
|
61
|
-
}
|
62
|
-
if (hookResult === false) {
|
63
|
-
props.onRemove(rawFile);
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
let file = rawFile;
|
67
|
-
if (hookResult instanceof Blob) {
|
68
|
-
if (hookResult instanceof File) {
|
69
|
-
file = hookResult;
|
70
|
-
} else {
|
71
|
-
file = new File([hookResult], rawFile.name, {
|
72
|
-
type: rawFile.type
|
73
|
-
});
|
74
|
-
}
|
75
|
-
}
|
76
|
-
doUpload(Object.assign(file, {
|
77
|
-
uid: rawFile.uid
|
78
|
-
}), beforeData);
|
79
|
-
};
|
80
|
-
const resolveData = async (data, rawFile) => {
|
81
|
-
if (isFunction(data)) {
|
82
|
-
return data(rawFile);
|
83
|
-
}
|
84
|
-
return data;
|
85
|
-
};
|
86
|
-
const doUpload = async (rawFile, beforeData) => {
|
87
|
-
const {
|
88
|
-
headers,
|
89
|
-
data,
|
90
|
-
method,
|
91
|
-
withCredentials,
|
92
|
-
name: filename,
|
93
|
-
action,
|
94
|
-
onProgress,
|
95
|
-
onSuccess,
|
96
|
-
onError,
|
97
|
-
httpRequest
|
98
|
-
} = props;
|
99
|
-
try {
|
100
|
-
beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
|
101
|
-
} catch (e) {
|
102
|
-
props.onRemove(rawFile);
|
103
|
-
return;
|
104
|
-
}
|
105
|
-
const { uid } = rawFile;
|
106
|
-
const options = {
|
107
|
-
headers: headers || {},
|
108
|
-
withCredentials,
|
109
|
-
file: rawFile,
|
110
|
-
data: beforeData,
|
111
|
-
method,
|
112
|
-
filename,
|
113
|
-
action,
|
114
|
-
onProgress: (evt) => {
|
115
|
-
onProgress(evt, rawFile);
|
116
|
-
},
|
117
|
-
onSuccess: (res) => {
|
118
|
-
onSuccess(res, rawFile);
|
119
|
-
delete requests.value[uid];
|
120
|
-
},
|
121
|
-
onError: (err) => {
|
122
|
-
onError(err, rawFile);
|
123
|
-
delete requests.value[uid];
|
124
|
-
}
|
125
|
-
};
|
126
|
-
const request = httpRequest(options);
|
127
|
-
requests.value[uid] = request;
|
128
|
-
if (request instanceof Promise) {
|
129
|
-
request.then(options.onSuccess, options.onError);
|
130
|
-
}
|
131
|
-
};
|
132
|
-
const handleChange = (e) => {
|
133
|
-
const files = e.target.files;
|
134
|
-
if (!files)
|
135
|
-
return;
|
136
|
-
uploadFiles(Array.from(files));
|
137
|
-
};
|
138
|
-
const handleClick = () => {
|
139
|
-
if (!disabled.value) {
|
140
|
-
inputRef.value.value = "";
|
141
|
-
inputRef.value.click();
|
142
|
-
}
|
143
|
-
};
|
144
|
-
const handleKeydown = () => {
|
145
|
-
handleClick();
|
146
|
-
};
|
147
|
-
const abort = (file) => {
|
148
|
-
const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
|
149
|
-
_reqs.forEach(([uid, req]) => {
|
150
|
-
if (req instanceof XMLHttpRequest)
|
151
|
-
req.abort();
|
152
|
-
delete requests.value[uid];
|
153
|
-
});
|
154
|
-
};
|
155
|
-
expose({
|
156
|
-
abort,
|
157
|
-
upload
|
158
|
-
});
|
159
|
-
return (_ctx, _cache) => {
|
160
|
-
return openBlock(), createElementBlock("div", {
|
161
|
-
class: normalizeClass([
|
162
|
-
unref(ns).b(),
|
163
|
-
unref(ns).m(_ctx.listType),
|
164
|
-
unref(ns).is("drag", _ctx.drag),
|
165
|
-
unref(ns).is("disabled", unref(disabled))
|
166
|
-
]),
|
167
|
-
tabindex: unref(disabled) ? "-1" : "0",
|
168
|
-
onClick: handleClick,
|
169
|
-
onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
|
170
|
-
}, [
|
171
|
-
_ctx.drag ? (openBlock(), createBlock(UploadDragger, {
|
172
|
-
key: 0,
|
173
|
-
disabled: unref(disabled),
|
174
|
-
onFile: uploadFiles
|
175
|
-
}, {
|
176
|
-
default: withCtx(() => [
|
177
|
-
renderSlot(_ctx.$slots, "default")
|
178
|
-
]),
|
179
|
-
_: 3
|
180
|
-
}, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
|
181
|
-
createElementVNode("input", {
|
182
|
-
ref_key: "inputRef",
|
183
|
-
ref: inputRef,
|
184
|
-
class: normalizeClass(unref(ns).e("input")),
|
185
|
-
name: _ctx.name,
|
186
|
-
disabled: unref(disabled),
|
187
|
-
multiple: _ctx.multiple,
|
188
|
-
accept: _ctx.accept,
|
189
|
-
type: "file",
|
190
|
-
onChange: handleChange,
|
191
|
-
onClick: withModifiers(() => {
|
192
|
-
}, ["stop"])
|
193
|
-
}, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
|
194
|
-
], 42, ["tabindex", "onKeydown"]);
|
195
|
-
};
|
5
|
+
const uploadContentProps = buildProps({
|
6
|
+
...uploadBaseProps,
|
7
|
+
beforeUpload: {
|
8
|
+
type: definePropType(Function),
|
9
|
+
default: NOOP
|
10
|
+
},
|
11
|
+
onRemove: {
|
12
|
+
type: definePropType(Function),
|
13
|
+
default: NOOP
|
14
|
+
},
|
15
|
+
onStart: {
|
16
|
+
type: definePropType(Function),
|
17
|
+
default: NOOP
|
18
|
+
},
|
19
|
+
onSuccess: {
|
20
|
+
type: definePropType(Function),
|
21
|
+
default: NOOP
|
22
|
+
},
|
23
|
+
onProgress: {
|
24
|
+
type: definePropType(Function),
|
25
|
+
default: NOOP
|
26
|
+
},
|
27
|
+
onError: {
|
28
|
+
type: definePropType(Function),
|
29
|
+
default: NOOP
|
30
|
+
},
|
31
|
+
onExceed: {
|
32
|
+
type: definePropType(Function),
|
33
|
+
default: NOOP
|
196
34
|
}
|
197
35
|
});
|
198
|
-
var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "upload-content.vue"]]);
|
199
36
|
|
200
|
-
export {
|
37
|
+
export { uploadContentProps };
|
201
38
|
//# sourceMappingURL=upload-content.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"upload-content.mjs","sources":["../../../../../../packages/components/upload/src/upload-content.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n ns.b(),\n ns.m(listType),\n ns.is('drag', drag),\n ns.is('disabled', disabled),\n ]\"\n :tabindex=\"disabled ? '-1' : '0'\"\n @click=\"handleClick\"\n @keydown.self.enter.space=\"handleKeydown\"\n >\n <template v-if=\"drag\">\n <upload-dragger :disabled=\"disabled\" @file=\"uploadFiles\">\n <slot />\n </upload-dragger>\n </template>\n <template v-else>\n <slot />\n </template>\n <input\n ref=\"inputRef\"\n :class=\"ns.e('input')\"\n :name=\"name\"\n :disabled=\"disabled\"\n :multiple=\"multiple\"\n :accept=\"accept\"\n type=\"file\"\n @change=\"handleChange\"\n @click.stop\n />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { shallowRef } from 'vue'\nimport { cloneDeep, isEqual } from 'lodash-unified'\nimport { entriesOf, isFunction, isPlainObject } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useFormDisabled } from '@element-plus/components/form'\nimport UploadDragger from './upload-dragger.vue'\nimport { uploadContentProps } from './upload-content'\nimport { genFileId } from './upload'\nimport type { UploadContentProps } from './upload-content'\n\nimport type {\n UploadFile,\n UploadHooks,\n UploadRawFile,\n UploadRequestOptions,\n} from './upload'\n\ndefineOptions({\n name: 'ElUploadContent',\n inheritAttrs: false,\n})\n\nconst props = defineProps(uploadContentProps)\nconst ns = useNamespace('upload')\nconst disabled = useFormDisabled()\n\nconst requests = shallowRef<Record<string, XMLHttpRequest | Promise<unknown>>>(\n {}\n)\nconst inputRef = shallowRef<HTMLInputElement>()\n\nconst uploadFiles = (files: File[]) => {\n if (files.length === 0) return\n\n const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props\n\n if (limit && fileList.length + files.length > limit) {\n onExceed(files, fileList)\n return\n }\n\n if (!multiple) {\n files = files.slice(0, 1)\n }\n\n for (const file of files) {\n const rawFile = file as UploadRawFile\n rawFile.uid = genFileId()\n onStart(rawFile)\n if (autoUpload) upload(rawFile)\n }\n}\n\nconst upload = async (rawFile: UploadRawFile): Promise<void> => {\n inputRef.value!.value = ''\n\n if (!props.beforeUpload) {\n return doUpload(rawFile)\n }\n\n let hookResult: Exclude<ReturnType<UploadHooks['beforeUpload']>, Promise<any>>\n let beforeData: UploadContentProps['data'] = {}\n\n try {\n // origin data: Handle data changes after synchronization tasks are executed\n const originData = props.data\n const beforeUploadPromise = props.beforeUpload(rawFile)\n beforeData = isPlainObject(props.data) ? cloneDeep(props.data) : props.data\n hookResult = await beforeUploadPromise\n if (isPlainObject(props.data) && isEqual(originData, beforeData)) {\n beforeData = cloneDeep(props.data)\n }\n } catch {\n hookResult = false\n }\n\n if (hookResult === false) {\n props.onRemove(rawFile)\n return\n }\n\n let file: File = rawFile\n if (hookResult instanceof Blob) {\n if (hookResult instanceof File) {\n file = hookResult\n } else {\n file = new File([hookResult], rawFile.name, {\n type: rawFile.type,\n })\n }\n }\n\n doUpload(\n Object.assign(file, {\n uid: rawFile.uid,\n }),\n beforeData\n )\n}\n\nconst resolveData = async (\n data: UploadContentProps['data'],\n rawFile: UploadRawFile\n): Promise<Record<string, any>> => {\n if (isFunction(data)) {\n return data(rawFile)\n }\n\n return data\n}\n\nconst doUpload = async (\n rawFile: UploadRawFile,\n beforeData?: UploadContentProps['data']\n) => {\n const {\n headers,\n data,\n method,\n withCredentials,\n name: filename,\n action,\n onProgress,\n onSuccess,\n onError,\n httpRequest,\n } = props\n\n try {\n beforeData = await resolveData(beforeData ?? data, rawFile)\n } catch {\n props.onRemove(rawFile)\n return\n }\n\n const { uid } = rawFile\n const options: UploadRequestOptions = {\n headers: headers || {},\n withCredentials,\n file: rawFile,\n data: beforeData,\n method,\n filename,\n action,\n onProgress: (evt) => {\n onProgress(evt, rawFile)\n },\n onSuccess: (res) => {\n onSuccess(res, rawFile)\n delete requests.value[uid]\n },\n onError: (err) => {\n onError(err, rawFile)\n delete requests.value[uid]\n },\n }\n const request = httpRequest(options)\n requests.value[uid] = request\n if (request instanceof Promise) {\n request.then(options.onSuccess, options.onError)\n }\n}\n\nconst handleChange = (e: Event) => {\n const files = (e.target as HTMLInputElement).files\n if (!files) return\n uploadFiles(Array.from(files))\n}\n\nconst handleClick = () => {\n if (!disabled.value) {\n inputRef.value!.value = ''\n inputRef.value!.click()\n }\n}\n\nconst handleKeydown = () => {\n handleClick()\n}\n\nconst abort = (file?: UploadFile) => {\n const _reqs = entriesOf(requests.value).filter(\n file ? ([uid]) => String(file.uid) === uid : () => true\n )\n _reqs.forEach(([uid, req]) => {\n if (req instanceof XMLHttpRequest) req.abort()\n delete requests.value[uid]\n })\n}\n\ndefineExpose({\n abort,\n upload,\n})\n</script>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass"],"mappings":";;;;;;;;;;;mCAoDc,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAChB,CAAA,CAAA,CAAA;;;;;;AAGA,IAAM,MAAA,EAAA,GAAK,aAAa,QAAQ,CAAA,CAAA;AAChC,IAAA,MAAM,WAAW,eAAgB,EAAA,CAAA;AAEjC,IAAA,MAAM,QAAW,GAAA,UAAA,CAAA,EAAA,CAAA,CAAA;AAAA,IAAA,MACd,QAAA,GAAA,UAAA,EAAA,CAAA;AAAA,IACH,MAAA,WAAA,GAAA,CAAA,KAAA,KAAA;AACA,MAAA,IAAM,YAAwC,KAAA,CAAA;AAE9C,QAAM,OAAA;AACJ,MAAI,MAAA,EAAA,iBAAoB,EAAA,QAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,GAAA,KAAA,CAAA;AAExB,MAAA,IAAA,KAAoB,IAAA,QAAA,CAAA,eAAiB,MAAU,GAAA,KAAA,EAAA;AAE/C,QAAA,QAAa,CAAA,KAAA,EAAA,QAAkB,CAAA,CAAA;AAC7B,QAAA,OA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CAAA,IAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AAC7C,KAAA,CAAA;AACA,IAAY,MAAA,WAAA,GAAM,MAAK;AAAM,MAC/B,IAAA,CAAA,QAAA,CAAA,KAAA,EAAA;AAEA,QAAA,oBAA0B,GAAA,EAAA,CAAA;AACxB,QAAI,cAAiB,CAAA,KAAA,EAAA,CAAA;AACnB,OAAA;AACA,KAAA,CAAA;AAAsB,IACxB,MAAA,aAAA,GAAA,MAAA;AAAA,MACF,WAAA,EAAA,CAAA;AAEA,KAAA,CAAA;AACE,IAAY,MAAA,KAAA,GAAA,CAAA,IAAA,KAAA;AAAA,MACd,MAAA,KAAA,GAAA,SAAA,CAAA,QAAA,CAAA,KAAA,CAAA,CAAA,MAAA,CAAA,IAAA,GAAA,CAAA,CAAA,GAAA,CAAA,KAAA,MAAA,CAAA,IAAA,CAAA,GAAA,CAAA,KAAA,GAAA,GAAA,MAAA,IAAA,CAAA,CAAA;AAEA,MAAM,KAAA,CAAA,OAAS,CAAsB,CAAA,CAAA,GAAA,EAAA,GAAA,CAAA,KAAA;AACnC,QAAA,IAAM,GAAQ,YAAA,cAAmB;AAAO,UACtC,GAAA,CAAA,KAAY,EAAA,CAAA;AAAuC,QACrD,OAAA,QAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA;AACA,OAAA,CAAA,CAAA;AACE,KAAI,CAAA;AACJ,IAAO,MAAA,CAAA;AAAkB,MAC3B,KAAC;AAAA,MACH,MAAA;AAEA,KAAa,CAAA,CAAA;AAAA,IACX,OAAA,CAAA,IAAA,EAAA,MAAA,KAAA;AAAA,MACA,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA;AAAA,QACD,KAAA,EAAAC,cAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"upload-content.mjs","sources":["../../../../../../packages/components/upload/src/upload-content.ts"],"sourcesContent":["import { NOOP, buildProps, definePropType } from '@element-plus/utils'\nimport { uploadBaseProps } from './upload'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type {\n UploadFile,\n UploadHooks,\n UploadProgressEvent,\n UploadRawFile,\n} from './upload'\nimport type UploadContent from './upload-content.vue'\nimport type { UploadAjaxError } from './ajax'\n\nexport const uploadContentProps = buildProps({\n ...uploadBaseProps,\n\n beforeUpload: {\n type: definePropType<UploadHooks['beforeUpload']>(Function),\n default: NOOP,\n },\n onRemove: {\n type: definePropType<\n (file: UploadFile | UploadRawFile, rawFile?: UploadRawFile) => void\n >(Function),\n default: NOOP,\n },\n onStart: {\n type: definePropType<(rawFile: UploadRawFile) => void>(Function),\n default: NOOP,\n },\n onSuccess: {\n type: definePropType<(response: any, rawFile: UploadRawFile) => unknown>(\n Function\n ),\n default: NOOP,\n },\n onProgress: {\n type: definePropType<\n (evt: UploadProgressEvent, rawFile: UploadRawFile) => void\n >(Function),\n default: NOOP,\n },\n onError: {\n type: definePropType<\n (err: UploadAjaxError, rawFile: UploadRawFile) => void\n >(Function),\n default: NOOP,\n },\n onExceed: {\n type: definePropType<UploadHooks['onExceed']>(Function),\n default: NOOP,\n },\n} as const)\n\nexport type UploadContentProps = ExtractPropTypes<typeof uploadContentProps>\n\nexport type UploadContentInstance = InstanceType<typeof UploadContent>\n"],"names":[],"mappings":";;;;AAEY,MAAC,kBAAkB,GAAG,UAAU,CAAC;AAC7C,EAAE,GAAG,eAAe;AACpB,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC;;;;"}
|
@@ -1,38 +1,201 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import
|
1
|
+
import { defineComponent, shallowRef, openBlock, createElementBlock, normalizeClass, unref, withKeys, withModifiers, createBlock, withCtx, renderSlot, createElementVNode } from 'vue';
|
2
|
+
import { cloneDeep, isEqual } from 'lodash-unified';
|
3
|
+
import UploadDragger from './upload-dragger2.mjs';
|
4
|
+
import { uploadContentProps } from './upload-content.mjs';
|
5
|
+
import { genFileId } from './upload.mjs';
|
6
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
7
|
+
import { entriesOf } from '../../../utils/objects.mjs';
|
8
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
9
|
+
import { useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
|
10
|
+
import { isPlainObject, isFunction } from '@vue/shared';
|
4
11
|
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
12
|
+
const __default__ = defineComponent({
|
13
|
+
name: "ElUploadContent",
|
14
|
+
inheritAttrs: false
|
15
|
+
});
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
17
|
+
...__default__,
|
18
|
+
props: uploadContentProps,
|
19
|
+
setup(__props, { expose }) {
|
20
|
+
const props = __props;
|
21
|
+
const ns = useNamespace("upload");
|
22
|
+
const disabled = useFormDisabled();
|
23
|
+
const requests = shallowRef({});
|
24
|
+
const inputRef = shallowRef();
|
25
|
+
const uploadFiles = (files) => {
|
26
|
+
if (files.length === 0)
|
27
|
+
return;
|
28
|
+
const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
|
29
|
+
if (limit && fileList.length + files.length > limit) {
|
30
|
+
onExceed(files, fileList);
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
if (!multiple) {
|
34
|
+
files = files.slice(0, 1);
|
35
|
+
}
|
36
|
+
for (const file of files) {
|
37
|
+
const rawFile = file;
|
38
|
+
rawFile.uid = genFileId();
|
39
|
+
onStart(rawFile);
|
40
|
+
if (autoUpload)
|
41
|
+
upload(rawFile);
|
42
|
+
}
|
43
|
+
};
|
44
|
+
const upload = async (rawFile) => {
|
45
|
+
inputRef.value.value = "";
|
46
|
+
if (!props.beforeUpload) {
|
47
|
+
return doUpload(rawFile);
|
48
|
+
}
|
49
|
+
let hookResult;
|
50
|
+
let beforeData = {};
|
51
|
+
try {
|
52
|
+
const originData = props.data;
|
53
|
+
const beforeUploadPromise = props.beforeUpload(rawFile);
|
54
|
+
beforeData = isPlainObject(props.data) ? cloneDeep(props.data) : props.data;
|
55
|
+
hookResult = await beforeUploadPromise;
|
56
|
+
if (isPlainObject(props.data) && isEqual(originData, beforeData)) {
|
57
|
+
beforeData = cloneDeep(props.data);
|
58
|
+
}
|
59
|
+
} catch (e) {
|
60
|
+
hookResult = false;
|
61
|
+
}
|
62
|
+
if (hookResult === false) {
|
63
|
+
props.onRemove(rawFile);
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
let file = rawFile;
|
67
|
+
if (hookResult instanceof Blob) {
|
68
|
+
if (hookResult instanceof File) {
|
69
|
+
file = hookResult;
|
70
|
+
} else {
|
71
|
+
file = new File([hookResult], rawFile.name, {
|
72
|
+
type: rawFile.type
|
73
|
+
});
|
74
|
+
}
|
75
|
+
}
|
76
|
+
doUpload(Object.assign(file, {
|
77
|
+
uid: rawFile.uid
|
78
|
+
}), beforeData);
|
79
|
+
};
|
80
|
+
const resolveData = async (data, rawFile) => {
|
81
|
+
if (isFunction(data)) {
|
82
|
+
return data(rawFile);
|
83
|
+
}
|
84
|
+
return data;
|
85
|
+
};
|
86
|
+
const doUpload = async (rawFile, beforeData) => {
|
87
|
+
const {
|
88
|
+
headers,
|
89
|
+
data,
|
90
|
+
method,
|
91
|
+
withCredentials,
|
92
|
+
name: filename,
|
93
|
+
action,
|
94
|
+
onProgress,
|
95
|
+
onSuccess,
|
96
|
+
onError,
|
97
|
+
httpRequest
|
98
|
+
} = props;
|
99
|
+
try {
|
100
|
+
beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
|
101
|
+
} catch (e) {
|
102
|
+
props.onRemove(rawFile);
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
const { uid } = rawFile;
|
106
|
+
const options = {
|
107
|
+
headers: headers || {},
|
108
|
+
withCredentials,
|
109
|
+
file: rawFile,
|
110
|
+
data: beforeData,
|
111
|
+
method,
|
112
|
+
filename,
|
113
|
+
action,
|
114
|
+
onProgress: (evt) => {
|
115
|
+
onProgress(evt, rawFile);
|
116
|
+
},
|
117
|
+
onSuccess: (res) => {
|
118
|
+
onSuccess(res, rawFile);
|
119
|
+
delete requests.value[uid];
|
120
|
+
},
|
121
|
+
onError: (err) => {
|
122
|
+
onError(err, rawFile);
|
123
|
+
delete requests.value[uid];
|
124
|
+
}
|
125
|
+
};
|
126
|
+
const request = httpRequest(options);
|
127
|
+
requests.value[uid] = request;
|
128
|
+
if (request instanceof Promise) {
|
129
|
+
request.then(options.onSuccess, options.onError);
|
130
|
+
}
|
131
|
+
};
|
132
|
+
const handleChange = (e) => {
|
133
|
+
const files = e.target.files;
|
134
|
+
if (!files)
|
135
|
+
return;
|
136
|
+
uploadFiles(Array.from(files));
|
137
|
+
};
|
138
|
+
const handleClick = () => {
|
139
|
+
if (!disabled.value) {
|
140
|
+
inputRef.value.value = "";
|
141
|
+
inputRef.value.click();
|
142
|
+
}
|
143
|
+
};
|
144
|
+
const handleKeydown = () => {
|
145
|
+
handleClick();
|
146
|
+
};
|
147
|
+
const abort = (file) => {
|
148
|
+
const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
|
149
|
+
_reqs.forEach(([uid, req]) => {
|
150
|
+
if (req instanceof XMLHttpRequest)
|
151
|
+
req.abort();
|
152
|
+
delete requests.value[uid];
|
153
|
+
});
|
154
|
+
};
|
155
|
+
expose({
|
156
|
+
abort,
|
157
|
+
upload
|
158
|
+
});
|
159
|
+
return (_ctx, _cache) => {
|
160
|
+
return openBlock(), createElementBlock("div", {
|
161
|
+
class: normalizeClass([
|
162
|
+
unref(ns).b(),
|
163
|
+
unref(ns).m(_ctx.listType),
|
164
|
+
unref(ns).is("drag", _ctx.drag),
|
165
|
+
unref(ns).is("disabled", unref(disabled))
|
166
|
+
]),
|
167
|
+
tabindex: unref(disabled) ? "-1" : "0",
|
168
|
+
onClick: handleClick,
|
169
|
+
onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
|
170
|
+
}, [
|
171
|
+
_ctx.drag ? (openBlock(), createBlock(UploadDragger, {
|
172
|
+
key: 0,
|
173
|
+
disabled: unref(disabled),
|
174
|
+
onFile: uploadFiles
|
175
|
+
}, {
|
176
|
+
default: withCtx(() => [
|
177
|
+
renderSlot(_ctx.$slots, "default")
|
178
|
+
]),
|
179
|
+
_: 3
|
180
|
+
}, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
|
181
|
+
createElementVNode("input", {
|
182
|
+
ref_key: "inputRef",
|
183
|
+
ref: inputRef,
|
184
|
+
class: normalizeClass(unref(ns).e("input")),
|
185
|
+
name: _ctx.name,
|
186
|
+
disabled: unref(disabled),
|
187
|
+
multiple: _ctx.multiple,
|
188
|
+
accept: _ctx.accept,
|
189
|
+
type: "file",
|
190
|
+
onChange: handleChange,
|
191
|
+
onClick: withModifiers(() => {
|
192
|
+
}, ["stop"])
|
193
|
+
}, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
|
194
|
+
], 42, ["tabindex", "onKeydown"]);
|
195
|
+
};
|
34
196
|
}
|
35
197
|
});
|
198
|
+
var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "upload-content.vue"]]);
|
36
199
|
|
37
|
-
export {
|
200
|
+
export { UploadContent as default };
|
38
201
|
//# sourceMappingURL=upload-content2.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"upload-content2.mjs","sources":["../../../../../../packages/components/upload/src/upload-content.ts"],"sourcesContent":["import { NOOP, buildProps, definePropType } from '@element-plus/utils'\nimport { uploadBaseProps } from './upload'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type {\n UploadFile,\n UploadHooks,\n UploadProgressEvent,\n UploadRawFile,\n} from './upload'\nimport type UploadContent from './upload-content.vue'\nimport type { UploadAjaxError } from './ajax'\n\nexport const uploadContentProps = buildProps({\n ...uploadBaseProps,\n\n beforeUpload: {\n type: definePropType<UploadHooks['beforeUpload']>(Function),\n default: NOOP,\n },\n onRemove: {\n type: definePropType<\n (file: UploadFile | UploadRawFile, rawFile?: UploadRawFile) => void\n >(Function),\n default: NOOP,\n },\n onStart: {\n type: definePropType<(rawFile: UploadRawFile) => void>(Function),\n default: NOOP,\n },\n onSuccess: {\n type: definePropType<(response: any, rawFile: UploadRawFile) => unknown>(\n Function\n ),\n default: NOOP,\n },\n onProgress: {\n type: definePropType<\n (evt: UploadProgressEvent, rawFile: UploadRawFile) => void\n >(Function),\n default: NOOP,\n },\n onError: {\n type: definePropType<\n (err: UploadAjaxError, rawFile: UploadRawFile) => void\n >(Function),\n default: NOOP,\n },\n onExceed: {\n type: definePropType<UploadHooks['onExceed']>(Function),\n default: NOOP,\n },\n} as const)\n\nexport type UploadContentProps = ExtractPropTypes<typeof uploadContentProps>\n\nexport type UploadContentInstance = InstanceType<typeof UploadContent>\n"],"names":[],"mappings":";;;;AAEY,MAAC,kBAAkB,GAAG,UAAU,CAAC;AAC7C,EAAE,GAAG,eAAe;AACpB,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"upload-content2.mjs","sources":["../../../../../../packages/components/upload/src/upload-content.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n ns.b(),\n ns.m(listType),\n ns.is('drag', drag),\n ns.is('disabled', disabled),\n ]\"\n :tabindex=\"disabled ? '-1' : '0'\"\n @click=\"handleClick\"\n @keydown.self.enter.space=\"handleKeydown\"\n >\n <template v-if=\"drag\">\n <upload-dragger :disabled=\"disabled\" @file=\"uploadFiles\">\n <slot />\n </upload-dragger>\n </template>\n <template v-else>\n <slot />\n </template>\n <input\n ref=\"inputRef\"\n :class=\"ns.e('input')\"\n :name=\"name\"\n :disabled=\"disabled\"\n :multiple=\"multiple\"\n :accept=\"accept\"\n type=\"file\"\n @change=\"handleChange\"\n @click.stop\n />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { shallowRef } from 'vue'\nimport { cloneDeep, isEqual } from 'lodash-unified'\nimport { entriesOf, isFunction, isPlainObject } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useFormDisabled } from '@element-plus/components/form'\nimport UploadDragger from './upload-dragger.vue'\nimport { uploadContentProps } from './upload-content'\nimport { genFileId } from './upload'\nimport type { UploadContentProps } from './upload-content'\n\nimport type {\n UploadFile,\n UploadHooks,\n UploadRawFile,\n UploadRequestOptions,\n} from './upload'\n\ndefineOptions({\n name: 'ElUploadContent',\n inheritAttrs: false,\n})\n\nconst props = defineProps(uploadContentProps)\nconst ns = useNamespace('upload')\nconst disabled = useFormDisabled()\n\nconst requests = shallowRef<Record<string, XMLHttpRequest | Promise<unknown>>>(\n {}\n)\nconst inputRef = shallowRef<HTMLInputElement>()\n\nconst uploadFiles = (files: File[]) => {\n if (files.length === 0) return\n\n const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props\n\n if (limit && fileList.length + files.length > limit) {\n onExceed(files, fileList)\n return\n }\n\n if (!multiple) {\n files = files.slice(0, 1)\n }\n\n for (const file of files) {\n const rawFile = file as UploadRawFile\n rawFile.uid = genFileId()\n onStart(rawFile)\n if (autoUpload) upload(rawFile)\n }\n}\n\nconst upload = async (rawFile: UploadRawFile): Promise<void> => {\n inputRef.value!.value = ''\n\n if (!props.beforeUpload) {\n return doUpload(rawFile)\n }\n\n let hookResult: Exclude<ReturnType<UploadHooks['beforeUpload']>, Promise<any>>\n let beforeData: UploadContentProps['data'] = {}\n\n try {\n // origin data: Handle data changes after synchronization tasks are executed\n const originData = props.data\n const beforeUploadPromise = props.beforeUpload(rawFile)\n beforeData = isPlainObject(props.data) ? cloneDeep(props.data) : props.data\n hookResult = await beforeUploadPromise\n if (isPlainObject(props.data) && isEqual(originData, beforeData)) {\n beforeData = cloneDeep(props.data)\n }\n } catch {\n hookResult = false\n }\n\n if (hookResult === false) {\n props.onRemove(rawFile)\n return\n }\n\n let file: File = rawFile\n if (hookResult instanceof Blob) {\n if (hookResult instanceof File) {\n file = hookResult\n } else {\n file = new File([hookResult], rawFile.name, {\n type: rawFile.type,\n })\n }\n }\n\n doUpload(\n Object.assign(file, {\n uid: rawFile.uid,\n }),\n beforeData\n )\n}\n\nconst resolveData = async (\n data: UploadContentProps['data'],\n rawFile: UploadRawFile\n): Promise<Record<string, any>> => {\n if (isFunction(data)) {\n return data(rawFile)\n }\n\n return data\n}\n\nconst doUpload = async (\n rawFile: UploadRawFile,\n beforeData?: UploadContentProps['data']\n) => {\n const {\n headers,\n data,\n method,\n withCredentials,\n name: filename,\n action,\n onProgress,\n onSuccess,\n onError,\n httpRequest,\n } = props\n\n try {\n beforeData = await resolveData(beforeData ?? data, rawFile)\n } catch {\n props.onRemove(rawFile)\n return\n }\n\n const { uid } = rawFile\n const options: UploadRequestOptions = {\n headers: headers || {},\n withCredentials,\n file: rawFile,\n data: beforeData,\n method,\n filename,\n action,\n onProgress: (evt) => {\n onProgress(evt, rawFile)\n },\n onSuccess: (res) => {\n onSuccess(res, rawFile)\n delete requests.value[uid]\n },\n onError: (err) => {\n onError(err, rawFile)\n delete requests.value[uid]\n },\n }\n const request = httpRequest(options)\n requests.value[uid] = request\n if (request instanceof Promise) {\n request.then(options.onSuccess, options.onError)\n }\n}\n\nconst handleChange = (e: Event) => {\n const files = (e.target as HTMLInputElement).files\n if (!files) return\n uploadFiles(Array.from(files))\n}\n\nconst handleClick = () => {\n if (!disabled.value) {\n inputRef.value!.value = ''\n inputRef.value!.click()\n }\n}\n\nconst handleKeydown = () => {\n handleClick()\n}\n\nconst abort = (file?: UploadFile) => {\n const _reqs = entriesOf(requests.value).filter(\n file ? ([uid]) => String(file.uid) === uid : () => true\n )\n _reqs.forEach(([uid, req]) => {\n if (req instanceof XMLHttpRequest) req.abort()\n delete requests.value[uid]\n })\n}\n\ndefineExpose({\n abort,\n upload,\n})\n</script>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass"],"mappings":";;;;;;;;;;;mCAoDc,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAChB,CAAA,CAAA,CAAA;;;;;;AAGA,IAAM,MAAA,EAAA,GAAK,aAAa,QAAQ,CAAA,CAAA;AAChC,IAAA,MAAM,WAAW,eAAgB,EAAA,CAAA;AAEjC,IAAA,MAAM,QAAW,GAAA,UAAA,CAAA,EAAA,CAAA,CAAA;AAAA,IAAA,MACd,QAAA,GAAA,UAAA,EAAA,CAAA;AAAA,IACH,MAAA,WAAA,GAAA,CAAA,KAAA,KAAA;AACA,MAAA,IAAM,YAAwC,KAAA,CAAA;AAE9C,QAAM,OAAA;AACJ,MAAI,MAAA,EAAA,iBAAoB,EAAA,QAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,GAAA,KAAA,CAAA;AAExB,MAAA,IAAA,KAAoB,IAAA,QAAA,CAAA,eAAiB,MAAU,GAAA,KAAA,EAAA;AAE/C,QAAA,QAAa,CAAA,KAAA,EAAA,QAAkB,CAAA,CAAA;AAC7B,QAAA,OAAA;AACA,OAAA;AAAA,MACF,IAAA,CAAA,QAAA,EAAA;AAEA,QAAA,KAAe,GAAA,KAAA,CAAA,KAAA,CAAA,CAAA,EAAA,CA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