element-plus 1.3.0-beta.9 → 2.0.0
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 +1014 -748
- package/dist/index.full.min.js +11 -11
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +11 -11
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +1012 -749
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/autocomplete/index.d.ts +12 -4
- package/es/components/autocomplete/src/index.mjs +11 -4
- package/es/components/autocomplete/src/index.mjs.map +1 -1
- package/es/components/autocomplete/src/index.vue.d.ts +6 -2
- package/es/components/avatar/index.d.ts +1 -1
- package/es/components/avatar/src/avatar.vue.d.ts +1 -1
- package/es/components/avatar/src/avatar2.mjs +3 -3
- package/es/components/avatar/src/avatar2.mjs.map +1 -1
- package/es/components/cascader/index.d.ts +60 -4
- package/es/components/cascader/src/index.mjs +13 -12
- package/es/components/cascader/src/index.mjs.map +1 -1
- package/es/components/cascader/src/index.vue.d.ts +30 -2
- package/es/components/dialog/index.d.ts +4 -0
- package/es/components/dialog/src/dialog.d.ts +1 -0
- package/es/components/dialog/src/dialog.mjs +4 -0
- package/es/components/dialog/src/dialog.mjs.map +1 -1
- package/es/components/dialog/src/dialog.vue.d.ts +4 -0
- package/es/components/dialog/src/dialog2.mjs +12 -3
- package/es/components/dialog/src/dialog2.mjs.map +1 -1
- package/es/components/drawer/index.d.ts +14 -0
- package/es/components/drawer/src/drawer.d.ts +1 -0
- package/es/components/drawer/src/drawer.vue.d.ts +14 -0
- package/es/components/drawer/src/drawer2.mjs +33 -29
- package/es/components/drawer/src/drawer2.mjs.map +1 -1
- package/es/components/empty/src/img-empty.mjs +13 -13
- package/es/components/empty/src/img-empty.mjs.map +1 -1
- package/es/components/image/src/image2.mjs +3 -4
- package/es/components/image/src/image2.mjs.map +1 -1
- package/es/components/image-viewer/index.d.ts +1 -1
- package/es/components/image-viewer/src/image-viewer.vue.d.ts +1 -1
- package/es/components/image-viewer/src/image-viewer2.mjs +34 -23
- package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
- package/es/components/index.mjs +2 -1
- package/es/components/index.mjs.map +1 -1
- package/es/components/message-box/src/index.mjs +133 -113
- package/es/components/message-box/src/index.mjs.map +1 -1
- package/es/components/message-box/src/index.vue.d.ts +14 -4
- package/es/components/message-box/src/message-box.type.d.ts +2 -0
- package/es/components/pagination/src/components/jumper.mjs +6 -3
- package/es/components/pagination/src/components/jumper.mjs.map +1 -1
- package/es/components/pagination/src/components/sizes.mjs +7 -3
- package/es/components/pagination/src/components/sizes.mjs.map +1 -1
- package/es/components/pagination/src/components/sizes.vue.d.ts +3 -0
- package/es/components/pagination/src/components/total.mjs +10 -4
- package/es/components/pagination/src/components/total.mjs.map +1 -1
- package/es/components/pagination/src/components/total.vue.d.ts +1 -0
- package/es/components/pagination/src/pagination.mjs +12 -1
- package/es/components/pagination/src/pagination.mjs.map +1 -1
- package/es/components/popconfirm/index.d.ts +26 -22
- package/es/components/popconfirm/src/popconfirm.d.ts +12 -11
- package/es/components/popconfirm/src/popconfirm.mjs +48 -43
- package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
- package/es/components/popconfirm/src/popconfirm.vue.d.ts +26 -22
- package/es/components/popconfirm/src/popconfirm2.mjs +8 -3
- package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
- package/es/components/popover/index.d.ts +30 -0
- package/es/components/popover/src/index.mjs +21 -6
- package/es/components/popover/src/index.mjs.map +1 -1
- package/es/components/popover/src/index.vue.d.ts +41 -26
- package/es/components/popover/src/popover.d.ts +5 -0
- package/es/components/popover/src/popover.mjs +2 -0
- package/es/components/popover/src/popover.mjs.map +1 -1
- package/es/components/popper/index.d.ts +1 -0
- package/es/components/popper/index.mjs +1 -0
- package/es/components/popper/index.mjs.map +1 -1
- package/es/components/popper/src/deprecation.d.ts +3 -0
- package/es/components/popper/src/deprecation.mjs +24 -0
- package/es/components/popper/src/deprecation.mjs.map +1 -0
- package/es/components/rate/index.d.ts +8 -8
- package/es/components/rate/src/rate.d.ts +4 -4
- package/es/components/rate/src/rate.mjs +8 -4
- package/es/components/rate/src/rate.mjs.map +1 -1
- package/es/components/rate/src/rate.vue.d.ts +8 -8
- package/es/components/scrollbar/index.d.ts +13 -1
- package/es/components/scrollbar/index.mjs +1 -1
- package/es/components/scrollbar/index.mjs.map +1 -1
- package/es/components/scrollbar/src/bar.d.ts +5 -5
- package/es/components/scrollbar/src/bar.mjs +18 -6
- package/es/components/scrollbar/src/bar.mjs.map +1 -1
- package/es/components/scrollbar/src/bar.vue.d.ts +18 -37
- package/es/components/scrollbar/src/bar2.mjs +34 -118
- package/es/components/scrollbar/src/bar2.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar.vue.d.ts +12 -0
- package/es/components/scrollbar/src/scrollbar2.mjs +26 -29
- package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
- package/es/components/scrollbar/src/thumb.d.ts +9 -0
- package/es/components/scrollbar/src/thumb.mjs +15 -0
- package/es/components/scrollbar/src/thumb.mjs.map +1 -0
- package/es/components/scrollbar/src/thumb.vue.d.ts +54 -0
- package/es/components/scrollbar/src/thumb2.mjs +141 -0
- package/es/components/scrollbar/src/thumb2.mjs.map +1 -0
- package/es/components/select/index.d.ts +6 -2
- package/es/components/select/src/select.mjs +16 -6
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/select/src/select.vue.d.ts +30 -26
- package/es/components/select-v2/index.d.ts +12 -12
- package/es/components/select-v2/src/defaults.d.ts +2 -1
- package/es/components/select-v2/src/defaults.mjs +4 -1
- package/es/components/select-v2/src/defaults.mjs.map +1 -1
- package/es/components/select-v2/src/select.mjs +2 -2
- package/es/components/select-v2/src/select.mjs.map +1 -1
- package/es/components/select-v2/src/select.vue.d.ts +6 -6
- package/es/components/select-v2/src/useSelect.d.ts +1 -4
- package/es/components/select-v2/src/useSelect.mjs +4 -2
- package/es/components/select-v2/src/useSelect.mjs.map +1 -1
- package/es/components/skeleton/index.d.ts +37 -2
- package/es/components/skeleton/src/skeleton-item.vue.d.ts +13 -1
- package/es/components/skeleton/src/skeleton-item2.mjs +10 -2
- package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.vue.d.ts +11 -0
- package/es/components/skeleton/src/skeleton2.mjs +11 -8
- package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
- package/es/components/table/src/table/style-helper.mjs +2 -0
- package/es/components/table/src/table/style-helper.mjs.map +1 -1
- package/es/components/table/src/table-body/index.mjs +1 -1
- package/es/components/table/src/table-body/index.mjs.map +1 -1
- package/es/components/table/src/table.mjs +3 -2
- package/es/components/table/src/table.mjs.map +1 -1
- package/es/components/tag/index.d.ts +12 -1
- package/es/components/tag/src/tag.vue.d.ts +12 -1
- package/es/components/tag/src/tag2.mjs +23 -18
- package/es/components/tag/src/tag2.mjs.map +1 -1
- package/es/components/tree/index.d.ts +8 -8
- package/es/components/tree/src/tree.mjs +0 -1
- package/es/components/tree/src/tree.mjs.map +1 -1
- package/es/components/tree/src/tree.vue.d.ts +4 -4
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.mjs +2 -0
- package/es/hooks/index.mjs.map +1 -1
- package/es/hooks/use-deprecated/index.d.ts +10 -0
- package/es/hooks/use-deprecated/index.mjs +17 -0
- package/es/hooks/use-deprecated/index.mjs.map +1 -0
- package/es/hooks/use-draggable/index.d.ts +2 -0
- package/es/hooks/use-draggable/index.mjs +65 -0
- package/es/hooks/use-draggable/index.mjs.map +1 -0
- package/es/index.mjs +4 -1
- package/es/index.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/autocomplete/index.d.ts +12 -4
- package/lib/components/autocomplete/src/index.js +11 -4
- package/lib/components/autocomplete/src/index.js.map +1 -1
- package/lib/components/autocomplete/src/index.vue.d.ts +6 -2
- package/lib/components/avatar/index.d.ts +1 -1
- package/lib/components/avatar/src/avatar.vue.d.ts +1 -1
- package/lib/components/avatar/src/avatar2.js +3 -3
- package/lib/components/avatar/src/avatar2.js.map +1 -1
- package/lib/components/cascader/index.d.ts +60 -4
- package/lib/components/cascader/src/index.js +13 -12
- package/lib/components/cascader/src/index.js.map +1 -1
- package/lib/components/cascader/src/index.vue.d.ts +30 -2
- package/lib/components/dialog/index.d.ts +4 -0
- package/lib/components/dialog/src/dialog.d.ts +1 -0
- package/lib/components/dialog/src/dialog.js +4 -0
- package/lib/components/dialog/src/dialog.js.map +1 -1
- package/lib/components/dialog/src/dialog.vue.d.ts +4 -0
- package/lib/components/dialog/src/dialog2.js +11 -2
- package/lib/components/dialog/src/dialog2.js.map +1 -1
- package/lib/components/drawer/index.d.ts +14 -0
- package/lib/components/drawer/src/drawer.d.ts +1 -0
- package/lib/components/drawer/src/drawer.vue.d.ts +14 -0
- package/lib/components/drawer/src/drawer2.js +33 -29
- package/lib/components/drawer/src/drawer2.js.map +1 -1
- package/lib/components/empty/src/img-empty.js +13 -13
- package/lib/components/empty/src/img-empty.js.map +1 -1
- package/lib/components/image/src/image2.js +3 -4
- package/lib/components/image/src/image2.js.map +1 -1
- package/lib/components/image-viewer/index.d.ts +1 -1
- package/lib/components/image-viewer/src/image-viewer.vue.d.ts +1 -1
- package/lib/components/image-viewer/src/image-viewer2.js +34 -23
- package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
- package/lib/components/index.js +4 -2
- package/lib/components/index.js.map +1 -1
- package/lib/components/message-box/src/index.js +140 -120
- package/lib/components/message-box/src/index.js.map +1 -1
- package/lib/components/message-box/src/index.vue.d.ts +14 -4
- package/lib/components/message-box/src/message-box.type.d.ts +2 -0
- package/lib/components/pagination/src/components/jumper.js +6 -3
- package/lib/components/pagination/src/components/jumper.js.map +1 -1
- package/lib/components/pagination/src/components/sizes.js +7 -3
- package/lib/components/pagination/src/components/sizes.js.map +1 -1
- package/lib/components/pagination/src/components/sizes.vue.d.ts +3 -0
- package/lib/components/pagination/src/components/total.js +10 -4
- package/lib/components/pagination/src/components/total.js.map +1 -1
- package/lib/components/pagination/src/components/total.vue.d.ts +1 -0
- package/lib/components/pagination/src/pagination.js +12 -1
- package/lib/components/pagination/src/pagination.js.map +1 -1
- package/lib/components/popconfirm/index.d.ts +26 -22
- package/lib/components/popconfirm/src/popconfirm.d.ts +12 -11
- package/lib/components/popconfirm/src/popconfirm.js +48 -43
- package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
- package/lib/components/popconfirm/src/popconfirm.vue.d.ts +26 -22
- package/lib/components/popconfirm/src/popconfirm2.js +8 -3
- package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
- package/lib/components/popover/index.d.ts +30 -0
- package/lib/components/popover/src/index.js +21 -6
- package/lib/components/popover/src/index.js.map +1 -1
- package/lib/components/popover/src/index.vue.d.ts +41 -26
- package/lib/components/popover/src/popover.d.ts +5 -0
- package/lib/components/popover/src/popover.js +2 -0
- package/lib/components/popover/src/popover.js.map +1 -1
- package/lib/components/popper/index.d.ts +1 -0
- package/lib/components/popper/index.js +2 -0
- package/lib/components/popper/index.js.map +1 -1
- package/lib/components/popper/src/deprecation.d.ts +3 -0
- package/lib/components/popper/src/deprecation.js +28 -0
- package/lib/components/popper/src/deprecation.js.map +1 -0
- package/lib/components/rate/index.d.ts +8 -8
- package/lib/components/rate/src/rate.d.ts +4 -4
- package/lib/components/rate/src/rate.js +8 -4
- package/lib/components/rate/src/rate.js.map +1 -1
- package/lib/components/rate/src/rate.vue.d.ts +8 -8
- package/lib/components/scrollbar/index.d.ts +13 -1
- package/lib/components/scrollbar/index.js +2 -2
- package/lib/components/scrollbar/index.js.map +1 -1
- package/lib/components/scrollbar/src/bar.d.ts +5 -5
- package/lib/components/scrollbar/src/bar.js +18 -6
- package/lib/components/scrollbar/src/bar.js.map +1 -1
- package/lib/components/scrollbar/src/bar.vue.d.ts +18 -37
- package/lib/components/scrollbar/src/bar2.js +33 -117
- package/lib/components/scrollbar/src/bar2.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar.vue.d.ts +12 -0
- package/lib/components/scrollbar/src/scrollbar2.js +25 -28
- package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
- package/lib/components/scrollbar/src/thumb.d.ts +9 -0
- package/lib/components/scrollbar/src/thumb.js +19 -0
- package/lib/components/scrollbar/src/thumb.js.map +1 -0
- package/lib/components/scrollbar/src/thumb.vue.d.ts +54 -0
- package/lib/components/scrollbar/src/thumb2.js +145 -0
- package/lib/components/scrollbar/src/thumb2.js.map +1 -0
- package/lib/components/select/index.d.ts +6 -2
- package/lib/components/select/src/select.js +16 -6
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/components/select/src/select.vue.d.ts +30 -26
- package/lib/components/select-v2/index.d.ts +12 -12
- package/lib/components/select-v2/src/defaults.d.ts +2 -1
- package/lib/components/select-v2/src/defaults.js +4 -1
- package/lib/components/select-v2/src/defaults.js.map +1 -1
- package/lib/components/select-v2/src/select.js +2 -2
- package/lib/components/select-v2/src/select.js.map +1 -1
- package/lib/components/select-v2/src/select.vue.d.ts +6 -6
- package/lib/components/select-v2/src/useSelect.d.ts +1 -4
- package/lib/components/select-v2/src/useSelect.js +11 -9
- package/lib/components/select-v2/src/useSelect.js.map +1 -1
- package/lib/components/skeleton/index.d.ts +37 -2
- package/lib/components/skeleton/src/skeleton-item.vue.d.ts +13 -1
- package/lib/components/skeleton/src/skeleton-item2.js +10 -2
- package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.vue.d.ts +11 -0
- package/lib/components/skeleton/src/skeleton2.js +12 -9
- package/lib/components/skeleton/src/skeleton2.js.map +1 -1
- package/lib/components/table/src/table/style-helper.js +2 -0
- package/lib/components/table/src/table/style-helper.js.map +1 -1
- package/lib/components/table/src/table-body/index.js +1 -1
- package/lib/components/table/src/table-body/index.js.map +1 -1
- package/lib/components/table/src/table.js +3 -2
- package/lib/components/table/src/table.js.map +1 -1
- package/lib/components/tag/index.d.ts +12 -1
- package/lib/components/tag/src/tag.vue.d.ts +12 -1
- package/lib/components/tag/src/tag2.js +23 -18
- package/lib/components/tag/src/tag2.js.map +1 -1
- package/lib/components/tree/index.d.ts +8 -8
- package/lib/components/tree/src/tree.js +0 -1
- package/lib/components/tree/src/tree.js.map +1 -1
- package/lib/components/tree/src/tree.vue.d.ts +4 -4
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +62 -58
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/use-deprecated/index.d.ts +10 -0
- package/lib/hooks/use-deprecated/index.js +21 -0
- package/lib/hooks/use-deprecated/index.js.map +1 -0
- package/lib/hooks/use-draggable/index.d.ts +2 -0
- package/lib/hooks/use-draggable/index.js +69 -0
- package/lib/hooks/use-draggable/index.js.map +1 -0
- package/lib/index.js +66 -60
- package/lib/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +3 -3
- package/tags.json +1 -1
- package/theme-chalk/el-breadcrumb.css +1 -1
- package/theme-chalk/el-dialog.css +1 -1
- package/theme-chalk/el-empty.css +1 -1
- package/theme-chalk/el-image-viewer.css +1 -1
- package/theme-chalk/el-message-box.css +1 -1
- package/theme-chalk/el-pagination.css +1 -1
- package/theme-chalk/el-popper.css +1 -1
- package/theme-chalk/el-rate.css +1 -1
- package/theme-chalk/el-select.css +1 -1
- package/theme-chalk/el-table.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/breadcrumb.scss +2 -0
- package/theme-chalk/src/common/var.scss +18 -4
- package/theme-chalk/src/dialog.scss +7 -0
- package/theme-chalk/src/image-viewer.scss +1 -0
- package/theme-chalk/src/message-box.scss +26 -15
- package/theme-chalk/src/pagination.scss +73 -56
- package/theme-chalk/src/popper.scss +6 -6
- package/theme-chalk/src/select.scss +3 -3
- package/theme-chalk/src/table.scss +0 -12
- package/web-types.json +1 -1
|
@@ -3,135 +3,51 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var vue = require('vue');
|
|
6
|
-
var
|
|
7
|
-
require('../../../tokens/index.js');
|
|
8
|
-
var error = require('../../../utils/error.js');
|
|
9
|
-
var util = require('./util.js');
|
|
6
|
+
var thumb = require('./thumb2.js');
|
|
10
7
|
var bar = require('./bar.js');
|
|
11
8
|
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
12
|
-
var scrollbar = require('../../../tokens/scrollbar.js');
|
|
13
9
|
|
|
14
|
-
const COMPONENT_NAME = "Bar";
|
|
15
10
|
const _sfc_main = vue.defineComponent({
|
|
16
|
-
|
|
11
|
+
components: {
|
|
12
|
+
Thumb: thumb["default"]
|
|
13
|
+
},
|
|
17
14
|
props: bar.barProps,
|
|
18
15
|
setup(props) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const bar = vue.computed(() => util.BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
|
|
30
|
-
const thumbStyle = vue.computed(() => util.renderThumbStyle({
|
|
31
|
-
size: props.size,
|
|
32
|
-
move: props.move,
|
|
33
|
-
bar: bar.value
|
|
34
|
-
}));
|
|
35
|
-
const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar$1.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
|
|
36
|
-
const clickThumbHandler = (e) => {
|
|
37
|
-
var _a;
|
|
38
|
-
e.stopPropagation();
|
|
39
|
-
if (e.ctrlKey || [1, 2].includes(e.button))
|
|
40
|
-
return;
|
|
41
|
-
(_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
|
|
42
|
-
startDrag(e);
|
|
43
|
-
const el = e.currentTarget;
|
|
44
|
-
if (!el)
|
|
45
|
-
return;
|
|
46
|
-
barStore.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
|
|
16
|
+
const moveX = vue.ref(0);
|
|
17
|
+
const moveY = vue.ref(0);
|
|
18
|
+
const GAP = 4;
|
|
19
|
+
const handleScroll = (wrap) => {
|
|
20
|
+
if (wrap) {
|
|
21
|
+
const offsetHeight = wrap.offsetHeight - GAP;
|
|
22
|
+
const offsetWidth = wrap.offsetWidth - GAP;
|
|
23
|
+
moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
|
|
24
|
+
moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
|
|
25
|
+
}
|
|
47
26
|
};
|
|
48
|
-
const clickTrackHandler = (e) => {
|
|
49
|
-
if (!thumb.value || !instance.value || !scrollbar$1.wrapElement)
|
|
50
|
-
return;
|
|
51
|
-
const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
|
|
52
|
-
const thumbHalf = thumb.value[bar.value.offset] / 2;
|
|
53
|
-
const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
|
|
54
|
-
scrollbar$1.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar$1.wrapElement[bar.value.scrollSize] / 100;
|
|
55
|
-
};
|
|
56
|
-
const startDrag = (e) => {
|
|
57
|
-
e.stopImmediatePropagation();
|
|
58
|
-
cursorDown = true;
|
|
59
|
-
document.addEventListener("mousemove", mouseMoveDocumentHandler);
|
|
60
|
-
document.addEventListener("mouseup", mouseUpDocumentHandler);
|
|
61
|
-
onselectstartStore = document.onselectstart;
|
|
62
|
-
document.onselectstart = () => false;
|
|
63
|
-
};
|
|
64
|
-
const mouseMoveDocumentHandler = (e) => {
|
|
65
|
-
if (!instance.value || !thumb.value)
|
|
66
|
-
return;
|
|
67
|
-
if (cursorDown === false)
|
|
68
|
-
return;
|
|
69
|
-
const prevPage = barStore.value[bar.value.axis];
|
|
70
|
-
if (!prevPage)
|
|
71
|
-
return;
|
|
72
|
-
const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
|
|
73
|
-
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
|
|
74
|
-
const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
|
|
75
|
-
scrollbar$1.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar$1.wrapElement[bar.value.scrollSize] / 100;
|
|
76
|
-
};
|
|
77
|
-
const mouseUpDocumentHandler = () => {
|
|
78
|
-
cursorDown = false;
|
|
79
|
-
barStore.value[bar.value.axis] = 0;
|
|
80
|
-
document.removeEventListener("mousemove", mouseMoveDocumentHandler);
|
|
81
|
-
document.removeEventListener("mouseup", mouseUpDocumentHandler);
|
|
82
|
-
restoreOnselectstart();
|
|
83
|
-
if (cursorLeave)
|
|
84
|
-
visible.value = false;
|
|
85
|
-
};
|
|
86
|
-
const mouseMoveScrollbarHandler = () => {
|
|
87
|
-
cursorLeave = false;
|
|
88
|
-
visible.value = !!props.size;
|
|
89
|
-
};
|
|
90
|
-
const mouseLeaveScrollbarHandler = () => {
|
|
91
|
-
cursorLeave = true;
|
|
92
|
-
visible.value = cursorDown;
|
|
93
|
-
};
|
|
94
|
-
vue.onBeforeUnmount(() => {
|
|
95
|
-
restoreOnselectstart();
|
|
96
|
-
document.removeEventListener("mouseup", mouseUpDocumentHandler);
|
|
97
|
-
});
|
|
98
|
-
const restoreOnselectstart = () => {
|
|
99
|
-
if (document.onselectstart !== onselectstartStore)
|
|
100
|
-
document.onselectstart = onselectstartStore;
|
|
101
|
-
};
|
|
102
|
-
core.useEventListener(vue.toRef(scrollbar$1, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
|
|
103
|
-
core.useEventListener(vue.toRef(scrollbar$1, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
|
|
104
27
|
return {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
thumbStyle,
|
|
109
|
-
visible,
|
|
110
|
-
clickTrackHandler,
|
|
111
|
-
clickThumbHandler
|
|
28
|
+
handleScroll,
|
|
29
|
+
moveX,
|
|
30
|
+
moveY
|
|
112
31
|
};
|
|
113
32
|
}
|
|
114
33
|
});
|
|
115
34
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
]),
|
|
133
|
-
_: 1
|
|
134
|
-
});
|
|
35
|
+
const _component_thumb = vue.resolveComponent("thumb");
|
|
36
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
37
|
+
vue.createVNode(_component_thumb, {
|
|
38
|
+
move: _ctx.moveX,
|
|
39
|
+
ratio: _ctx.ratioX,
|
|
40
|
+
size: _ctx.width,
|
|
41
|
+
always: _ctx.always
|
|
42
|
+
}, null, 8, ["move", "ratio", "size", "always"]),
|
|
43
|
+
vue.createVNode(_component_thumb, {
|
|
44
|
+
move: _ctx.moveY,
|
|
45
|
+
ratio: _ctx.ratioY,
|
|
46
|
+
size: _ctx.height,
|
|
47
|
+
vertical: "",
|
|
48
|
+
always: _ctx.always
|
|
49
|
+
}, null, 8, ["move", "ratio", "size", "always"])
|
|
50
|
+
], 64);
|
|
135
51
|
}
|
|
136
52
|
var Bar = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
|
|
137
53
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar2.js","sources":["../../../../../../packages/components/scrollbar/src/bar.vue"],"sourcesContent":["<template>\n <
|
|
1
|
+
{"version":3,"file":"bar2.js","sources":["../../../../../../packages/components/scrollbar/src/bar.vue"],"sourcesContent":["<template>\n <thumb :move=\"moveX\" :ratio=\"ratioX\" :size=\"width\" :always=\"always\" />\n <thumb\n :move=\"moveY\"\n :ratio=\"ratioY\"\n :size=\"height\"\n vertical\n :always=\"always\"\n />\n</template>\n<script lang=\"ts\">\nimport { defineComponent, ref } from 'vue'\nimport Thumb from './thumb.vue'\nimport { barProps } from './bar'\n\nexport default defineComponent({\n components: {\n Thumb,\n },\n props: barProps,\n setup(props) {\n const moveX = ref(0)\n const moveY = ref(0)\n const GAP = 4 // top 2 + bottom 2 of bar instance\n\n const handleScroll = (wrap: HTMLDivElement) => {\n if (wrap) {\n const offsetHeight = wrap.offsetHeight - GAP\n const offsetWidth = wrap.offsetWidth - GAP\n\n moveY.value = ((wrap.scrollTop * 100) / offsetHeight) * props.ratioY\n moveX.value = ((wrap.scrollLeft * 100) / offsetWidth) * props.ratioX\n }\n }\n\n return {\n handleScroll,\n moveX,\n moveY,\n }\n },\n})\n</script>\n"],"names":["defineComponent","Thumb","barProps","ref","_openBlock","_createElementBlock"],"mappings":";;;;;;;;;AAeA,MAAK,YAAaA,oBAAa;AAAA,EAC7B,YAAY;AAAA,WACVC;AAAA;AAAA,EAEF,OAAOC;AAAA,EACP,MAAM,OAAO;AACX,UAAM,QAAQC,QAAI;AAClB,UAAM,QAAQA,QAAI;AAClB,UAAM,MAAM;AAEZ,UAAM,eAAe,CAAC,SAAyB;AAC7C,UAAI,MAAM;AACR,cAAM,eAAe,KAAK,eAAe;AACzC,cAAM,cAAc,KAAK,cAAc;AAEvC,cAAM,QAAU,KAAK,YAAY,MAAO,eAAgB,MAAM;AAC9D,cAAM,QAAU,KAAK,aAAa,MAAO,cAAe,MAAM;AAAA;AAAA;AAIlE,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;SArCJC,iBAAsEC;AAAA,oBAAxD,kBAAK;AAAA,MAAG,MAAK,KAAE;AAAA,MAAS,OAAM;AAAA,MAAQ,MAAM,KAAE;AAAA;OAC5D,SAME;AAAA,oBALO,kBAAK;AAAA,MACX,MAAK,KAAE;AAAA,MACP,OAAM;AAAA,MACP;AAAA,MACC,UAAQ;AAAA;;;;;;;;"}
|
|
@@ -12,9 +12,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
12
12
|
readonly always: import("../../../utils/props").BuildPropReturn<BooleanConstructor, false, unknown, unknown, unknown>;
|
|
13
13
|
readonly minSize: import("../../../utils/props").BuildPropReturn<NumberConstructor, 20, unknown, unknown, unknown>;
|
|
14
14
|
}, {
|
|
15
|
+
ns: {
|
|
16
|
+
namespace: import("vue").ComputedRef<string>;
|
|
17
|
+
b: (blockSuffix?: string) => string;
|
|
18
|
+
e: (element?: string | undefined) => string;
|
|
19
|
+
m: (modifier?: string | undefined) => string;
|
|
20
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
21
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
22
|
+
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
23
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
24
|
+
is: (name: string, state?: boolean) => string;
|
|
25
|
+
};
|
|
15
26
|
scrollbar$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
16
27
|
wrap$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
17
28
|
resize$: import("vue").Ref<HTMLElement | undefined>;
|
|
29
|
+
barRef: import("vue").Ref<any>;
|
|
18
30
|
moveX: import("vue").Ref<number>;
|
|
19
31
|
moveY: import("vue").Ref<number>;
|
|
20
32
|
ratioX: import("vue").Ref<number>;
|
|
@@ -7,9 +7,11 @@ var core = require('@vueuse/core');
|
|
|
7
7
|
var util = require('../../../utils/util.js');
|
|
8
8
|
var error = require('../../../utils/error.js');
|
|
9
9
|
require('../../../tokens/index.js');
|
|
10
|
+
require('../../../hooks/index.js');
|
|
10
11
|
var bar = require('./bar2.js');
|
|
11
12
|
var scrollbar = require('./scrollbar.js');
|
|
12
13
|
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
14
|
+
var index = require('../../../hooks/use-namespace/index.js');
|
|
13
15
|
var scrollbar$1 = require('../../../tokens/scrollbar.js');
|
|
14
16
|
|
|
15
17
|
const _sfc_main = vue.defineComponent({
|
|
@@ -20,6 +22,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
20
22
|
props: scrollbar.scrollbarProps,
|
|
21
23
|
emits: scrollbar.scrollbarEmits,
|
|
22
24
|
setup(props, { emit }) {
|
|
25
|
+
const ns = index.useNamespace("scrollbar");
|
|
23
26
|
let stopResizeObserver = void 0;
|
|
24
27
|
let stopResizeListener = void 0;
|
|
25
28
|
const scrollbar$ = vue.ref();
|
|
@@ -27,6 +30,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
27
30
|
const resize$ = vue.ref();
|
|
28
31
|
const sizeWidth = vue.ref("0");
|
|
29
32
|
const sizeHeight = vue.ref("0");
|
|
33
|
+
const barRef = vue.ref();
|
|
30
34
|
const moveX = vue.ref(0);
|
|
31
35
|
const moveY = vue.ref(0);
|
|
32
36
|
const ratioY = vue.ref(1);
|
|
@@ -42,11 +46,9 @@ const _sfc_main = vue.defineComponent({
|
|
|
42
46
|
return [props.wrapStyle, style2];
|
|
43
47
|
});
|
|
44
48
|
const handleScroll = () => {
|
|
49
|
+
var _a;
|
|
45
50
|
if (wrap$.value) {
|
|
46
|
-
|
|
47
|
-
const offsetWidth = wrap$.value.offsetWidth - GAP;
|
|
48
|
-
moveY.value = wrap$.value.scrollTop * 100 / offsetHeight * ratioY.value;
|
|
49
|
-
moveX.value = wrap$.value.scrollLeft * 100 / offsetWidth * ratioX.value;
|
|
51
|
+
(_a = barRef.value) == null ? void 0 : _a.handleScroll(wrap$.value);
|
|
50
52
|
emit("scroll", {
|
|
51
53
|
scrollTop: wrap$.value.scrollTop,
|
|
52
54
|
scrollLeft: wrap$.value.scrollLeft
|
|
@@ -100,9 +102,11 @@ const _sfc_main = vue.defineComponent({
|
|
|
100
102
|
vue.nextTick(() => update());
|
|
101
103
|
});
|
|
102
104
|
return {
|
|
105
|
+
ns,
|
|
103
106
|
scrollbar$,
|
|
104
107
|
wrap$,
|
|
105
108
|
resize$,
|
|
109
|
+
barRef,
|
|
106
110
|
moveX,
|
|
107
111
|
moveY,
|
|
108
112
|
ratioX,
|
|
@@ -117,26 +121,25 @@ const _sfc_main = vue.defineComponent({
|
|
|
117
121
|
};
|
|
118
122
|
}
|
|
119
123
|
});
|
|
120
|
-
const _hoisted_1 = {
|
|
121
|
-
ref: "scrollbar$",
|
|
122
|
-
class: "el-scrollbar"
|
|
123
|
-
};
|
|
124
124
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
125
125
|
const _component_bar = vue.resolveComponent("bar");
|
|
126
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
126
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
127
|
+
ref: "scrollbar$",
|
|
128
|
+
class: vue.normalizeClass(_ctx.ns.b())
|
|
129
|
+
}, [
|
|
127
130
|
vue.createElementVNode("div", {
|
|
128
131
|
ref: "wrap$",
|
|
129
132
|
class: vue.normalizeClass([
|
|
130
133
|
_ctx.wrapClass,
|
|
131
|
-
"
|
|
132
|
-
_ctx.
|
|
134
|
+
_ctx.ns.e("wrap"),
|
|
135
|
+
{ [_ctx.ns.em("wrap", "hidden-default")]: !_ctx.native }
|
|
133
136
|
]),
|
|
134
137
|
style: vue.normalizeStyle(_ctx.style),
|
|
135
138
|
onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
|
|
136
139
|
}, [
|
|
137
140
|
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
|
|
138
141
|
ref: "resize$",
|
|
139
|
-
class: vue.normalizeClass(["
|
|
142
|
+
class: vue.normalizeClass([_ctx.ns.e("view"), _ctx.viewClass]),
|
|
140
143
|
style: vue.normalizeStyle(_ctx.viewStyle)
|
|
141
144
|
}, {
|
|
142
145
|
default: vue.withCtx(() => [
|
|
@@ -145,22 +148,16 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
145
148
|
_: 3
|
|
146
149
|
}, 8, ["class", "style"]))
|
|
147
150
|
], 38),
|
|
148
|
-
!_ctx.native ? (vue.openBlock(), vue.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
size: _ctx.sizeHeight,
|
|
159
|
-
vertical: "",
|
|
160
|
-
always: _ctx.always
|
|
161
|
-
}, null, 8, ["move", "ratio", "size", "always"])
|
|
162
|
-
], 64)) : vue.createCommentVNode("v-if", true)
|
|
163
|
-
], 512);
|
|
151
|
+
!_ctx.native ? (vue.openBlock(), vue.createBlock(_component_bar, {
|
|
152
|
+
key: 0,
|
|
153
|
+
ref: "barRef",
|
|
154
|
+
height: _ctx.sizeHeight,
|
|
155
|
+
width: _ctx.sizeWidth,
|
|
156
|
+
always: _ctx.always,
|
|
157
|
+
"ratio-x": _ctx.ratioX,
|
|
158
|
+
"ratio-y": _ctx.ratioY
|
|
159
|
+
}, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : vue.createCommentVNode("v-if", true)
|
|
160
|
+
], 2);
|
|
164
161
|
}
|
|
165
162
|
var Scrollbar = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
|
|
166
163
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollbar2.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.vue"],"sourcesContent":["<template>\n <div ref=\"scrollbar$\" class=\"
|
|
1
|
+
{"version":3,"file":"scrollbar2.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.vue"],"sourcesContent":["<template>\n <div ref=\"scrollbar$\" :class=\"ns.b()\">\n <div\n ref=\"wrap$\"\n :class=\"[\n wrapClass,\n ns.e('wrap'),\n { [ns.em('wrap', 'hidden-default')]: !native },\n ]\"\n :style=\"style\"\n @scroll=\"handleScroll\"\n >\n <component\n :is=\"tag\"\n ref=\"resize$\"\n :class=\"[ns.e('view'), viewClass]\"\n :style=\"viewStyle\"\n >\n <slot />\n </component>\n </div>\n <template v-if=\"!native\">\n <bar\n ref=\"barRef\"\n :height=\"sizeHeight\"\n :width=\"sizeWidth\"\n :always=\"always\"\n :ratio-x=\"ratioX\"\n :ratio-y=\"ratioY\"\n ></bar>\n </template>\n </div>\n</template>\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n nextTick,\n onMounted,\n provide,\n ref,\n watch,\n reactive,\n} from 'vue'\nimport { useResizeObserver, useEventListener } from '@vueuse/core'\nimport { addUnit, isNumber } from '@element-plus/utils/util'\nimport { debugWarn } from '@element-plus/utils/error'\nimport { scrollbarContextKey } from '@element-plus/tokens'\nimport { useNamespace } from '@element-plus/hooks'\nimport Bar from './bar.vue'\n\nimport { scrollbarProps, scrollbarEmits } from './scrollbar'\nimport type { StyleValue, CSSProperties } from 'vue'\n\nexport default defineComponent({\n name: 'ElScrollbar',\n components: {\n Bar,\n },\n props: scrollbarProps,\n emits: scrollbarEmits,\n\n setup(props, { emit }) {\n const ns = useNamespace('scrollbar')\n\n let stopResizeObserver: (() => void) | undefined = undefined\n let stopResizeListener: (() => void) | undefined = undefined\n\n const scrollbar$ = ref<HTMLDivElement>()\n const wrap$ = ref<HTMLDivElement>()\n const resize$ = ref<HTMLElement>()\n\n const sizeWidth = ref('0')\n const sizeHeight = ref('0')\n const barRef = ref()\n const moveX = ref(0)\n const moveY = ref(0)\n const ratioY = ref(1)\n const ratioX = ref(1)\n const SCOPE = 'ElScrollbar'\n const GAP = 4 // top 2 + bottom 2 of bar instance\n\n const style = computed<StyleValue>(() => {\n const style: CSSProperties = {}\n if (props.height) style.height = addUnit(props.height)\n if (props.maxHeight) style.maxHeight = addUnit(props.maxHeight)\n return [props.wrapStyle, style]\n })\n\n const handleScroll = () => {\n if (wrap$.value) {\n barRef.value?.handleScroll(wrap$.value)\n\n emit('scroll', {\n scrollTop: wrap$.value.scrollTop,\n scrollLeft: wrap$.value.scrollLeft,\n })\n }\n }\n\n const setScrollTop = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(SCOPE, 'value must be a number')\n return\n }\n wrap$.value!.scrollTop = value\n }\n\n const setScrollLeft = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(SCOPE, 'value must be a number')\n return\n }\n wrap$.value!.scrollLeft = value\n }\n\n const update = () => {\n if (!wrap$.value) return\n\n const offsetHeight = wrap$.value.offsetHeight - GAP\n const offsetWidth = wrap$.value.offsetWidth - GAP\n\n const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight\n const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth\n const height = Math.max(originalHeight, props.minSize)\n const width = Math.max(originalWidth, props.minSize)\n\n ratioY.value =\n originalHeight /\n (offsetHeight - originalHeight) /\n (height / (offsetHeight - height))\n ratioX.value =\n originalWidth /\n (offsetWidth - originalWidth) /\n (width / (offsetWidth - width))\n\n sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : ''\n sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : ''\n }\n\n watch(\n () => props.noresize,\n (noresize) => {\n if (noresize) {\n stopResizeObserver?.()\n stopResizeListener?.()\n } else {\n ;({ stop: stopResizeObserver } = useResizeObserver(resize$, update))\n stopResizeListener = useEventListener('resize', update)\n }\n },\n { immediate: true }\n )\n\n provide(\n scrollbarContextKey,\n reactive({\n scrollbarElement: scrollbar$,\n wrapElement: wrap$,\n })\n )\n\n onMounted(() => {\n if (!props.native) nextTick(() => update())\n })\n\n return {\n ns,\n scrollbar$,\n wrap$,\n resize$,\n barRef,\n moveX,\n moveY,\n ratioX,\n ratioY,\n sizeWidth,\n sizeHeight,\n style,\n update,\n handleScroll,\n setScrollTop,\n setScrollLeft,\n }\n },\n})\n</script>\n"],"names":["defineComponent","Bar","scrollbarProps","scrollbarEmits","useNamespace","ref","computed","addUnit","_openBlock"],"mappings":";;;;;;;;;;;;;;;;AAsDA,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,SACVC;AAAA;AAAA,EAEF,OAAOC;AAAA,EACP,OAAOC;AAAA,EAEP,MAAM,OAAO,EAAE,QAAQ;AACrB,UAAM,KAAKC,mBAAa;AAExB,QAAI,qBAA+C;AACnD,QAAI,qBAA+C;AAEnD,UAAM,aAAaC;AACnB,UAAM,QAAQA;AACd,UAAM,UAAUA;AAEhB,UAAM,YAAYA,QAAI;AACtB,UAAM,aAAaA,QAAI;AACvB,UAAM,SAASA;AACf,UAAM,QAAQA,QAAI;AAClB,UAAM,QAAQA,QAAI;AAClB,UAAM,SAASA,QAAI;AACnB,UAAM,SAASA,QAAI;AACnB,UAAM,QAAQ;AACd,UAAM,MAAM;AAEZ,UAAM,QAAQC,aAAqB,MAAM;AACvC,YAAM,SAAuB;AAC7B,UAAI,MAAM;AAAQ,eAAM,SAASC,aAAQ,MAAM;AAC/C,UAAI,MAAM;AAAW,eAAM,YAAYA,aAAQ,MAAM;AACrD,aAAO,CAAC,MAAM,WAAW;AAAA;AAG3B,UAAM,eAAe,MAAM;AACzB,UAAI;AACF,eAAO;AAEP;AAAe,qBACF;AAAY,UACvB;AAAwB;AAAA;AAAA;AAK9B;AACE,UAAI;AACF,8BAAiB;AACjB;AAAA;AAEF;AAAyB;AAG3B;AACE,UAAI;AACF,8BAAiB;AACjB;AAAA;AAEF;AAA0B;AAG5B;AACE,UAAI;AAAc;AAElB;AACA,YAAM,oBAAoB,MAAM;AAEhC,YAAM,qCAAqC,MAAM;AACjD,YAAM;AACN,YAAM,wCAAwC;AAC9C,YAAM,aAAa,IAAI,eAAe;AAEtC;AAIA,aAAO,QACL,gDAEC;AAEH,kCAA4B;AAC5B,gBAAU,oCAAoC,GAAG,YAAY;AAAA;AAG/D;AAGI,cAAI;AACF;AACA;AAAA;AAEA;AAAC,QAAC;AACF;AAAgD;AAAA,OAGpD;AAGF;AAEW;AACW,MAClB;AAAa;AAIjB;AACE;AAAmB,iBAAS,MAAM;AAAA;AAGpC;AAAO;AACL,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;;AArLiB,SAAOC;AAAA;;AAC1B;AACa;AACL;AAAqB;AAAU,aAAyB;AAAE;;;AAMzD;;;AAIQ;AACP,QACL;AAAgB;;;AAET;;;;OAGK;AAAA;;AAET,MACH;AAAA,MACA;AAAO,MACP,YAAQ;AAAA,MACR;AAAS,MACT;AAAS;;;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue';
|
|
2
|
+
export declare const thumbProps: {
|
|
3
|
+
readonly vertical: BooleanConstructor;
|
|
4
|
+
readonly size: StringConstructor;
|
|
5
|
+
readonly move: NumberConstructor;
|
|
6
|
+
readonly ratio: import("element-plus/es/utils/props").BuildPropReturn<NumberConstructor, unknown, true, unknown, unknown>;
|
|
7
|
+
readonly always: BooleanConstructor;
|
|
8
|
+
};
|
|
9
|
+
export declare type ThumbProps = ExtractPropTypes<typeof thumbProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var props = require('../../../utils/props.js');
|
|
6
|
+
|
|
7
|
+
const thumbProps = props.buildProps({
|
|
8
|
+
vertical: Boolean,
|
|
9
|
+
size: String,
|
|
10
|
+
move: Number,
|
|
11
|
+
ratio: {
|
|
12
|
+
type: Number,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
always: Boolean
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
exports.thumbProps = thumbProps;
|
|
19
|
+
//# sourceMappingURL=thumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumb.js","sources":["../../../../../../packages/components/scrollbar/src/thumb.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils/props'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const thumbProps = buildProps({\n vertical: Boolean,\n size: String,\n move: Number,\n ratio: {\n type: Number,\n required: true,\n },\n always: Boolean,\n} as const)\nexport type ThumbProps = ExtractPropTypes<typeof thumbProps>\n"],"names":["buildProps"],"mappings":";;;;;;AACY,MAAC,UAAU,GAAGA,gBAAU,CAAC;AACrC,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,CAAC;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
readonly vertical: BooleanConstructor;
|
|
3
|
+
readonly size: StringConstructor;
|
|
4
|
+
readonly move: NumberConstructor;
|
|
5
|
+
readonly ratio: import("../../../utils/props").BuildPropReturn<NumberConstructor, unknown, true, unknown, unknown>;
|
|
6
|
+
readonly always: BooleanConstructor;
|
|
7
|
+
}, {
|
|
8
|
+
ns: {
|
|
9
|
+
namespace: import("vue").ComputedRef<string>;
|
|
10
|
+
b: (blockSuffix?: string) => string;
|
|
11
|
+
e: (element?: string | undefined) => string;
|
|
12
|
+
m: (modifier?: string | undefined) => string;
|
|
13
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
14
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
15
|
+
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
16
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
17
|
+
is: (name: string, state?: boolean) => string;
|
|
18
|
+
};
|
|
19
|
+
instance: import("vue").Ref<HTMLDivElement | undefined>;
|
|
20
|
+
thumb: import("vue").Ref<HTMLDivElement | undefined>;
|
|
21
|
+
bar: import("vue").ComputedRef<{
|
|
22
|
+
offset: string;
|
|
23
|
+
scroll: string;
|
|
24
|
+
scrollSize: string;
|
|
25
|
+
size: string;
|
|
26
|
+
key: string;
|
|
27
|
+
axis: string;
|
|
28
|
+
client: string;
|
|
29
|
+
direction: string;
|
|
30
|
+
} | {
|
|
31
|
+
offset: string;
|
|
32
|
+
scroll: string;
|
|
33
|
+
scrollSize: string;
|
|
34
|
+
size: string;
|
|
35
|
+
key: string;
|
|
36
|
+
axis: string;
|
|
37
|
+
client: string;
|
|
38
|
+
direction: string;
|
|
39
|
+
}>;
|
|
40
|
+
thumbStyle: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
41
|
+
visible: import("vue").Ref<boolean>;
|
|
42
|
+
clickTrackHandler: (e: MouseEvent) => void;
|
|
43
|
+
clickThumbHandler: (e: MouseEvent) => void;
|
|
44
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
+
readonly vertical: BooleanConstructor;
|
|
46
|
+
readonly size: StringConstructor;
|
|
47
|
+
readonly move: NumberConstructor;
|
|
48
|
+
readonly ratio: import("../../../utils/props").BuildPropReturn<NumberConstructor, unknown, true, unknown, unknown>;
|
|
49
|
+
readonly always: BooleanConstructor;
|
|
50
|
+
}>>, {
|
|
51
|
+
always: boolean;
|
|
52
|
+
vertical: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
export default _default;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var core = require('@vueuse/core');
|
|
7
|
+
require('../../../tokens/index.js');
|
|
8
|
+
var error = require('../../../utils/error.js');
|
|
9
|
+
require('../../../hooks/index.js');
|
|
10
|
+
var util = require('./util.js');
|
|
11
|
+
var thumb = require('./thumb.js');
|
|
12
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
13
|
+
var scrollbar = require('../../../tokens/scrollbar.js');
|
|
14
|
+
var index = require('../../../hooks/use-namespace/index.js');
|
|
15
|
+
|
|
16
|
+
const COMPONENT_NAME = "Thumb";
|
|
17
|
+
const _sfc_main = vue.defineComponent({
|
|
18
|
+
name: COMPONENT_NAME,
|
|
19
|
+
props: thumb.thumbProps,
|
|
20
|
+
setup(props) {
|
|
21
|
+
const scrollbar$1 = vue.inject(scrollbar.scrollbarContextKey);
|
|
22
|
+
const ns = index.useNamespace("scrollbar");
|
|
23
|
+
if (!scrollbar$1)
|
|
24
|
+
error.throwError(COMPONENT_NAME, "can not inject scrollbar context");
|
|
25
|
+
const instance = vue.ref();
|
|
26
|
+
const thumb = vue.ref();
|
|
27
|
+
const thumbState = vue.ref({});
|
|
28
|
+
const visible = vue.ref(false);
|
|
29
|
+
let cursorDown = false;
|
|
30
|
+
let cursorLeave = false;
|
|
31
|
+
let originalOnSelectStart = core.isClient ? document.onselectstart : null;
|
|
32
|
+
const bar = vue.computed(() => util.BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
|
|
33
|
+
const thumbStyle = vue.computed(() => util.renderThumbStyle({
|
|
34
|
+
size: props.size,
|
|
35
|
+
move: props.move,
|
|
36
|
+
bar: bar.value
|
|
37
|
+
}));
|
|
38
|
+
const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar$1.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
|
|
39
|
+
const clickThumbHandler = (e) => {
|
|
40
|
+
var _a;
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
if (e.ctrlKey || [1, 2].includes(e.button))
|
|
43
|
+
return;
|
|
44
|
+
(_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
|
|
45
|
+
startDrag(e);
|
|
46
|
+
const el = e.currentTarget;
|
|
47
|
+
if (!el)
|
|
48
|
+
return;
|
|
49
|
+
thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
|
|
50
|
+
};
|
|
51
|
+
const clickTrackHandler = (e) => {
|
|
52
|
+
if (!thumb.value || !instance.value || !scrollbar$1.wrapElement)
|
|
53
|
+
return;
|
|
54
|
+
const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
|
|
55
|
+
const thumbHalf = thumb.value[bar.value.offset] / 2;
|
|
56
|
+
const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
|
|
57
|
+
scrollbar$1.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar$1.wrapElement[bar.value.scrollSize] / 100;
|
|
58
|
+
};
|
|
59
|
+
const startDrag = (e) => {
|
|
60
|
+
e.stopImmediatePropagation();
|
|
61
|
+
cursorDown = true;
|
|
62
|
+
document.addEventListener("mousemove", mouseMoveDocumentHandler);
|
|
63
|
+
document.addEventListener("mouseup", mouseUpDocumentHandler);
|
|
64
|
+
originalOnSelectStart = document.onselectstart;
|
|
65
|
+
document.onselectstart = () => false;
|
|
66
|
+
};
|
|
67
|
+
const mouseMoveDocumentHandler = (e) => {
|
|
68
|
+
if (!instance.value || !thumb.value)
|
|
69
|
+
return;
|
|
70
|
+
if (cursorDown === false)
|
|
71
|
+
return;
|
|
72
|
+
const prevPage = thumbState.value[bar.value.axis];
|
|
73
|
+
if (!prevPage)
|
|
74
|
+
return;
|
|
75
|
+
const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
|
|
76
|
+
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
|
|
77
|
+
const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
|
|
78
|
+
scrollbar$1.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar$1.wrapElement[bar.value.scrollSize] / 100;
|
|
79
|
+
};
|
|
80
|
+
const mouseUpDocumentHandler = () => {
|
|
81
|
+
cursorDown = false;
|
|
82
|
+
thumbState.value[bar.value.axis] = 0;
|
|
83
|
+
document.removeEventListener("mousemove", mouseMoveDocumentHandler);
|
|
84
|
+
document.removeEventListener("mouseup", mouseUpDocumentHandler);
|
|
85
|
+
restoreOnselectstart();
|
|
86
|
+
if (cursorLeave)
|
|
87
|
+
visible.value = false;
|
|
88
|
+
};
|
|
89
|
+
const mouseMoveScrollbarHandler = () => {
|
|
90
|
+
cursorLeave = false;
|
|
91
|
+
visible.value = !!props.size;
|
|
92
|
+
};
|
|
93
|
+
const mouseLeaveScrollbarHandler = () => {
|
|
94
|
+
cursorLeave = true;
|
|
95
|
+
visible.value = cursorDown;
|
|
96
|
+
};
|
|
97
|
+
vue.onBeforeUnmount(() => {
|
|
98
|
+
restoreOnselectstart();
|
|
99
|
+
document.removeEventListener("mouseup", mouseUpDocumentHandler);
|
|
100
|
+
});
|
|
101
|
+
const restoreOnselectstart = () => {
|
|
102
|
+
if (document.onselectstart !== originalOnSelectStart)
|
|
103
|
+
document.onselectstart = originalOnSelectStart;
|
|
104
|
+
};
|
|
105
|
+
core.useEventListener(vue.toRef(scrollbar$1, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
|
|
106
|
+
core.useEventListener(vue.toRef(scrollbar$1, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
|
|
107
|
+
return {
|
|
108
|
+
ns,
|
|
109
|
+
instance,
|
|
110
|
+
thumb,
|
|
111
|
+
bar,
|
|
112
|
+
thumbStyle,
|
|
113
|
+
visible,
|
|
114
|
+
clickTrackHandler,
|
|
115
|
+
clickThumbHandler
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
120
|
+
return vue.openBlock(), vue.createBlock(vue.Transition, {
|
|
121
|
+
name: _ctx.ns.b("fade")
|
|
122
|
+
}, {
|
|
123
|
+
default: vue.withCtx(() => [
|
|
124
|
+
vue.withDirectives(vue.createElementVNode("div", {
|
|
125
|
+
ref: "instance",
|
|
126
|
+
class: vue.normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)]),
|
|
127
|
+
onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
|
|
128
|
+
}, [
|
|
129
|
+
vue.createElementVNode("div", {
|
|
130
|
+
ref: "thumb",
|
|
131
|
+
class: vue.normalizeClass(_ctx.ns.e("thumb")),
|
|
132
|
+
style: vue.normalizeStyle(_ctx.thumbStyle),
|
|
133
|
+
onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
|
|
134
|
+
}, null, 38)
|
|
135
|
+
], 34), [
|
|
136
|
+
[vue.vShow, _ctx.always || _ctx.visible]
|
|
137
|
+
])
|
|
138
|
+
]),
|
|
139
|
+
_: 1
|
|
140
|
+
}, 8, ["name"]);
|
|
141
|
+
}
|
|
142
|
+
var Thumb = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
|
|
143
|
+
|
|
144
|
+
exports["default"] = Thumb;
|
|
145
|
+
//# sourceMappingURL=thumb2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumb2.js","sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n ></div>\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n inject,\n onBeforeUnmount,\n ref,\n toRef,\n} from 'vue'\nimport { useEventListener, isClient } from '@vueuse/core'\nimport { scrollbarContextKey } from '@element-plus/tokens'\nimport { throwError } from '@element-plus/utils/error'\nimport { useNamespace } from '@element-plus/hooks'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport { thumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nexport default defineComponent({\n name: COMPONENT_NAME,\n props: thumbProps,\n\n setup(props) {\n const scrollbar = inject(scrollbarContextKey)\n const ns = useNamespace('scrollbar')\n\n if (!scrollbar)\n throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\n const instance = ref<HTMLDivElement>()\n const thumb = ref<HTMLDivElement>()\n\n const thumbState = ref({})\n const visible = ref(false)\n\n let cursorDown = false\n let cursorLeave = false\n let originalOnSelectStart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = isClient ? document.onselectstart : null\n\n const bar = computed(\n () => BAR_MAP[props.vertical ? 'vertical' : 'horizontal']\n )\n\n const thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n )\n\n const offsetRatio = computed(\n () =>\n // offsetRatioX = original width of thumb / current width of thumb / ratioX\n // offsetRatioY = original height of thumb / current height of thumb / ratioY\n // instance height = wrap height - GAP\n instance.value![bar.value.offset] ** 2 /\n scrollbar.wrapElement![bar.value.scrollSize] /\n props.ratio /\n thumb.value![bar.value.offset]\n )\n\n const clickThumbHandler = (e: MouseEvent) => {\n // prevent click event of middle and right button\n e.stopPropagation()\n if (e.ctrlKey || [1, 2].includes(e.button)) return\n\n window.getSelection()?.removeAllRanges()\n startDrag(e)\n\n const el = e.currentTarget as HTMLDivElement\n if (!el) return\n thumbState.value[bar.value.axis] =\n el[bar.value.offset] -\n (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction])\n }\n\n const clickTrackHandler = (e: MouseEvent) => {\n if (!thumb.value || !instance.value || !scrollbar.wrapElement) return\n\n const offset = Math.abs(\n (e.target as HTMLElement).getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]\n )\n const thumbHalf = thumb.value[bar.value.offset] / 2\n const thumbPositionPercentage =\n ((offset - thumbHalf) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage *\n scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n }\n\n const startDrag = (e: MouseEvent) => {\n e.stopImmediatePropagation()\n cursorDown = true\n document.addEventListener('mousemove', mouseMoveDocumentHandler)\n document.addEventListener('mouseup', mouseUpDocumentHandler)\n originalOnSelectStart = document.onselectstart\n document.onselectstart = () => false\n }\n\n const mouseMoveDocumentHandler = (e: MouseEvent) => {\n if (!instance.value || !thumb.value) return\n if (cursorDown === false) return\n\n const prevPage = thumbState.value[bar.value.axis]\n if (!prevPage) return\n\n const offset =\n (instance.value.getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]) *\n -1\n const thumbClickPosition = thumb.value[bar.value.offset] - prevPage\n const thumbPositionPercentage =\n ((offset - thumbClickPosition) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage *\n scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n }\n\n const mouseUpDocumentHandler = () => {\n cursorDown = false\n thumbState.value[bar.value.axis] = 0\n document.removeEventListener('mousemove', mouseMoveDocumentHandler)\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n restoreOnselectstart()\n if (cursorLeave) visible.value = false\n }\n\n const mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n }\n\n const mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n }\n\n onBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n })\n\n const restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n }\n\n useEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n )\n useEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n )\n\n return {\n ns,\n instance,\n thumb,\n bar,\n thumbStyle,\n visible,\n clickTrackHandler,\n clickThumbHandler,\n }\n },\n})\n</script>\n"],"names":["defineComponent","thumbProps","scrollbar","inject","scrollbarContextKey","useNamespace","ref","isClient","computed","BAR_MAP","renderThumbStyle","toRef"],"mappings":";;;;;;;;;;;;;;;AAmCA,MAAM,iBAAiB;AACvB,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,OAAOC;AAAA,EAEP,MAAM,OAAO;AACX,UAAMC,cAAYC,WAAOC;AACzB,UAAM,KAAKC,mBAAa;AAExB,QAAI,CAACH;AACH,uBAAW,gBAAgB;AAE7B,UAAM,WAAWI;AACjB,UAAM,QAAQA;AAEd,UAAM,aAAaA,QAAI;AACvB,UAAM,UAAUA,QAAI;AAEpB,QAAI,aAAa;AACjB,QAAI,cAAc;AAClB,QAAI,wBAEOC,gBAAW,SAAS,gBAAgB;AAE/C,UAAM,MAAMC,aACV,MAAMC,aAAQ,MAAM,WAAW,aAAa;AAG9C,UAAM,aAAaD,aAAS,MAC1BE,sBAAiB;AAAA,MACf,MAAM,MAAM;AAAA,MACZ,MAAM,MAAM;AAAA,MACZ,KAAK,IAAI;AAAA;AAIb,UAAM,cAAcF,aAClB,MAIE,SAAS,MAAO,IAAI,MAAM,WAAW,IACrCN,YAAU,YAAa,IAAI,MAAM,cACjC,MAAM,QACN,MAAM,MAAO,IAAI,MAAM;AAG3B,UAAM,oBAAoB,CAAC,MAAkB;AAE3C;AACA,uBAAiB;AAA2B;AAE5C;AACA;AAEA,iBAAW,EAAE;AACb;AAAS;AACT;AAE8D;AAGhE;AACE,UAAI,iBAAiB;AAA0C;AAE/D;AAIA,YAAM,kBAAkB;AACxB,YAAM;AAIN,sCAAgC,UAC7B,oCACW,YAAY,UAAU,cAClC;AAAA;AAGJ;AACE;AACA;AACA;AACA,eAAS,iBAAiB,WAAW;AACrC;AACA;AAA+B;AAGjC;AACE,UAAI;AAAiC;AACrC;AAA0B;AAE1B;AACA;AAAe;AAEf;AAIA,YAAM,qDAAqD;AAC3D,YAAM,0BACF,UAAS;AAEb,sCAAgC,UAC7B,gDACuB,wBACxB;AAAA;AAGJ;AACE;AACA;AACA;AACA,eAAS,oBAAoB,WAAW;AACxC;AACA;AAAiB;AAAgB;AAGnC;AACE;AACA;AAAwB;AAG1B;AACE;AACA;AAAgB;AAGlB;AACE;AACA;AAAwC;AAG1C;AACE,UAAI;AACF;AAAyB;AAG7B;AAKA,0BACES,UAAMT,aAAW,qBACjB;AAIF;AAAO;AACL,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;SAhMe;AAAI;;;AACrB,yBAEM;AAAU;AACR,QACL;AAAW;;AAEZ;AACa;AACL,UACL;AAAO,UACP,0BAAS;AAAA;;;AATM;;;;;;;;;;;"}
|