@element-plus/nightly 0.0.20241119 → 0.0.20241120
Sign up to get free protection for your applications and to get access to all the features.
- package/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +150 -124
- package/dist/index.full.min.js +13 -13
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +12 -12
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +150 -124
- 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/anchor/index.mjs +2 -2
- package/es/components/anchor/src/anchor.mjs +193 -38
- package/es/components/anchor/src/anchor.mjs.map +1 -1
- package/es/components/anchor/src/anchor2.mjs +38 -193
- package/es/components/anchor/src/anchor2.mjs.map +1 -1
- package/es/components/badge/index.mjs +2 -2
- package/es/components/badge/src/badge.mjs +69 -32
- package/es/components/badge/src/badge.mjs.map +1 -1
- package/es/components/badge/src/badge2.mjs +32 -69
- package/es/components/badge/src/badge2.mjs.map +1 -1
- package/es/components/image-viewer/index.mjs +2 -2
- package/es/components/image-viewer/src/image-viewer.mjs +45 -392
- package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
- package/es/components/image-viewer/src/image-viewer2.mjs +415 -45
- package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
- package/es/components/index.mjs +13 -13
- package/es/components/link/index.mjs +2 -2
- package/es/components/link/src/link.mjs +25 -50
- package/es/components/link/src/link.mjs.map +1 -1
- package/es/components/link/src/link2.mjs +50 -25
- package/es/components/link/src/link2.mjs.map +1 -1
- package/es/components/mention/src/mention-dropdown.mjs +167 -15
- package/es/components/mention/src/mention-dropdown.mjs.map +1 -1
- package/es/components/mention/src/mention-dropdown2.mjs +15 -167
- package/es/components/mention/src/mention-dropdown2.mjs.map +1 -1
- package/es/components/mention/src/mention2.mjs +1 -1
- package/es/components/menu/index.mjs +2 -2
- package/es/components/menu/src/menu-item-group.mjs +35 -4
- package/es/components/menu/src/menu-item-group.mjs.map +1 -1
- package/es/components/menu/src/menu-item-group2.mjs +4 -35
- package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
- package/es/components/page-header/index.mjs +2 -2
- package/es/components/page-header/src/page-header.mjs +17 -102
- package/es/components/page-header/src/page-header.mjs.map +1 -1
- package/es/components/page-header/src/page-header2.mjs +102 -17
- package/es/components/page-header/src/page-header2.mjs.map +1 -1
- package/es/components/popconfirm/index.mjs +2 -2
- package/es/components/popconfirm/src/popconfirm.mjs +115 -47
- package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
- package/es/components/popconfirm/src/popconfirm2.mjs +47 -115
- package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/content.mjs +137 -93
- package/es/components/popper/src/content.mjs.map +1 -1
- package/es/components/popper/src/content2.mjs +93 -137
- package/es/components/popper/src/content2.mjs.map +1 -1
- package/es/components/result/index.mjs +2 -2
- package/es/components/result/src/result.mjs +29 -63
- package/es/components/result/src/result.mjs.map +1 -1
- package/es/components/result/src/result2.mjs +63 -29
- package/es/components/result/src/result2.mjs.map +1 -1
- package/es/components/scrollbar/index.mjs +1 -1
- package/es/components/scrollbar/src/bar2.mjs +1 -1
- package/es/components/scrollbar/src/thumb.mjs +11 -130
- package/es/components/scrollbar/src/thumb.mjs.map +1 -1
- package/es/components/scrollbar/src/thumb2.mjs +130 -11
- package/es/components/scrollbar/src/thumb2.mjs.map +1 -1
- package/es/components/slider/src/button.mjs +21 -91
- package/es/components/slider/src/button.mjs.map +1 -1
- package/es/components/slider/src/button2.mjs +91 -21
- package/es/components/slider/src/button2.mjs.map +1 -1
- package/es/components/slider/src/slider2.mjs +1 -1
- package/es/components/statistic/index.mjs +2 -2
- package/es/components/statistic/src/statistic.mjs +70 -25
- package/es/components/statistic/src/statistic.mjs.map +1 -1
- package/es/components/statistic/src/statistic2.mjs +25 -70
- package/es/components/statistic/src/statistic2.mjs.map +1 -1
- package/es/components/table/src/table.mjs +5 -3
- package/es/components/table/src/table.mjs.map +1 -1
- package/es/components/table/src/table.vue.d.ts +2 -1
- package/es/components/tag/src/tag2.mjs +4 -1
- package/es/components/tag/src/tag2.mjs.map +1 -1
- package/es/components/tooltip/src/content.mjs +1 -1
- package/es/components/tooltip/src/content2.mjs +1 -1
- package/es/components/upload/index.mjs +2 -2
- package/es/components/upload/src/upload-content.mjs +1 -1
- package/es/components/upload/src/upload-content2.mjs +1 -1
- package/es/components/upload/src/upload-list.mjs +1 -1
- package/es/components/upload/src/upload.mjs +98 -126
- package/es/components/upload/src/upload.mjs.map +1 -1
- package/es/components/upload/src/upload2.mjs +126 -98
- package/es/components/upload/src/upload2.mjs.map +1 -1
- package/es/components/upload/src/use-handlers.mjs +1 -1
- package/es/index.mjs +13 -13
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/global.d.ts +2 -0
- package/lib/components/anchor/index.js +2 -2
- package/lib/components/anchor/src/anchor.js +192 -38
- package/lib/components/anchor/src/anchor.js.map +1 -1
- package/lib/components/anchor/src/anchor2.js +38 -192
- package/lib/components/anchor/src/anchor2.js.map +1 -1
- package/lib/components/badge/index.js +2 -2
- package/lib/components/badge/src/badge.js +69 -32
- package/lib/components/badge/src/badge.js.map +1 -1
- package/lib/components/badge/src/badge2.js +32 -69
- package/lib/components/badge/src/badge2.js.map +1 -1
- package/lib/components/image-viewer/index.js +2 -2
- package/lib/components/image-viewer/src/image-viewer.js +46 -392
- package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
- package/lib/components/image-viewer/src/image-viewer2.js +415 -46
- package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
- package/lib/components/index.js +13 -13
- package/lib/components/link/index.js +2 -2
- package/lib/components/link/src/link.js +26 -50
- package/lib/components/link/src/link.js.map +1 -1
- package/lib/components/link/src/link2.js +50 -26
- package/lib/components/link/src/link2.js.map +1 -1
- package/lib/components/mention/src/mention-dropdown.js +167 -16
- package/lib/components/mention/src/mention-dropdown.js.map +1 -1
- package/lib/components/mention/src/mention-dropdown2.js +16 -167
- package/lib/components/mention/src/mention-dropdown2.js.map +1 -1
- package/lib/components/mention/src/mention2.js +1 -1
- package/lib/components/menu/index.js +2 -2
- package/lib/components/menu/src/menu-item-group.js +35 -4
- package/lib/components/menu/src/menu-item-group.js.map +1 -1
- package/lib/components/menu/src/menu-item-group2.js +4 -35
- package/lib/components/menu/src/menu-item-group2.js.map +1 -1
- package/lib/components/page-header/index.js +2 -2
- package/lib/components/page-header/src/page-header.js +18 -102
- package/lib/components/page-header/src/page-header.js.map +1 -1
- package/lib/components/page-header/src/page-header2.js +102 -18
- package/lib/components/page-header/src/page-header2.js.map +1 -1
- package/lib/components/popconfirm/index.js +2 -2
- package/lib/components/popconfirm/src/popconfirm.js +115 -48
- package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
- package/lib/components/popconfirm/src/popconfirm2.js +48 -115
- package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/content.js +137 -98
- package/lib/components/popper/src/content.js.map +1 -1
- package/lib/components/popper/src/content2.js +98 -137
- package/lib/components/popper/src/content2.js.map +1 -1
- package/lib/components/result/index.js +2 -2
- package/lib/components/result/src/result.js +31 -63
- package/lib/components/result/src/result.js.map +1 -1
- package/lib/components/result/src/result2.js +63 -31
- package/lib/components/result/src/result2.js.map +1 -1
- package/lib/components/scrollbar/index.js +1 -1
- package/lib/components/scrollbar/src/bar2.js +1 -1
- package/lib/components/scrollbar/src/thumb.js +11 -130
- package/lib/components/scrollbar/src/thumb.js.map +1 -1
- package/lib/components/scrollbar/src/thumb2.js +130 -11
- package/lib/components/scrollbar/src/thumb2.js.map +1 -1
- package/lib/components/slider/src/button.js +22 -91
- package/lib/components/slider/src/button.js.map +1 -1
- package/lib/components/slider/src/button2.js +91 -22
- package/lib/components/slider/src/button2.js.map +1 -1
- package/lib/components/slider/src/slider2.js +1 -1
- package/lib/components/statistic/index.js +2 -2
- package/lib/components/statistic/src/statistic.js +70 -25
- package/lib/components/statistic/src/statistic.js.map +1 -1
- package/lib/components/statistic/src/statistic2.js +25 -70
- package/lib/components/statistic/src/statistic2.js.map +1 -1
- package/lib/components/table/src/table.js +5 -3
- package/lib/components/table/src/table.js.map +1 -1
- package/lib/components/table/src/table.vue.d.ts +2 -1
- package/lib/components/tag/src/tag2.js +4 -1
- package/lib/components/tag/src/tag2.js.map +1 -1
- package/lib/components/tooltip/src/content.js +1 -1
- package/lib/components/tooltip/src/content2.js +1 -1
- package/lib/components/upload/index.js +2 -2
- package/lib/components/upload/src/upload-content.js +1 -1
- package/lib/components/upload/src/upload-content2.js +1 -1
- package/lib/components/upload/src/upload-list.js +1 -1
- package/lib/components/upload/src/upload.js +101 -126
- package/lib/components/upload/src/upload.js.map +1 -1
- package/lib/components/upload/src/upload2.js +126 -101
- package/lib/components/upload/src/upload2.js.map +1 -1
- package/lib/components/upload/src/use-handlers.js +1 -1
- package/lib/index.js +13 -13
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/tags.json +1 -1
- package/theme-chalk/el-image-viewer.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/image-viewer.scss +4 -0
- package/web-types.json +1 -1
@@ -1,68 +1,34 @@
|
|
1
|
-
import
|
2
|
-
import '
|
3
|
-
import {
|
4
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
5
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
1
|
+
import '../../../utils/index.mjs';
|
2
|
+
import { CircleCheckFilled, WarningFilled, CircleCloseFilled, InfoFilled } from '@element-plus/icons-vue';
|
3
|
+
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
6
4
|
|
7
|
-
const
|
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
|
-
renderSlot(_ctx.$slots, "icon", {}, () => [
|
33
|
-
unref(resultIcon).component ? (openBlock(), createBlock(resolveDynamicComponent(unref(resultIcon).component), {
|
34
|
-
key: 0,
|
35
|
-
class: normalizeClass(unref(resultIcon).class)
|
36
|
-
}, null, 8, ["class"])) : createCommentVNode("v-if", true)
|
37
|
-
])
|
38
|
-
], 2),
|
39
|
-
_ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
|
40
|
-
key: 0,
|
41
|
-
class: normalizeClass(unref(ns).e("title"))
|
42
|
-
}, [
|
43
|
-
renderSlot(_ctx.$slots, "title", {}, () => [
|
44
|
-
createElementVNode("p", null, toDisplayString(_ctx.title), 1)
|
45
|
-
])
|
46
|
-
], 2)) : createCommentVNode("v-if", true),
|
47
|
-
_ctx.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
|
48
|
-
key: 1,
|
49
|
-
class: normalizeClass(unref(ns).e("subtitle"))
|
50
|
-
}, [
|
51
|
-
renderSlot(_ctx.$slots, "sub-title", {}, () => [
|
52
|
-
createElementVNode("p", null, toDisplayString(_ctx.subTitle), 1)
|
53
|
-
])
|
54
|
-
], 2)) : createCommentVNode("v-if", true),
|
55
|
-
_ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
|
56
|
-
key: 2,
|
57
|
-
class: normalizeClass(unref(ns).e("extra"))
|
58
|
-
}, [
|
59
|
-
renderSlot(_ctx.$slots, "extra")
|
60
|
-
], 2)) : createCommentVNode("v-if", true)
|
61
|
-
], 2);
|
62
|
-
};
|
5
|
+
const IconMap = {
|
6
|
+
success: "icon-success",
|
7
|
+
warning: "icon-warning",
|
8
|
+
error: "icon-error",
|
9
|
+
info: "icon-info"
|
10
|
+
};
|
11
|
+
const IconComponentMap = {
|
12
|
+
[IconMap.success]: CircleCheckFilled,
|
13
|
+
[IconMap.warning]: WarningFilled,
|
14
|
+
[IconMap.error]: CircleCloseFilled,
|
15
|
+
[IconMap.info]: InfoFilled
|
16
|
+
};
|
17
|
+
const resultProps = buildProps({
|
18
|
+
title: {
|
19
|
+
type: String,
|
20
|
+
default: ""
|
21
|
+
},
|
22
|
+
subTitle: {
|
23
|
+
type: String,
|
24
|
+
default: ""
|
25
|
+
},
|
26
|
+
icon: {
|
27
|
+
type: String,
|
28
|
+
values: ["success", "warning", "info", "error"],
|
29
|
+
default: "info"
|
63
30
|
}
|
64
31
|
});
|
65
|
-
var Result = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "result.vue"]]);
|
66
32
|
|
67
|
-
export {
|
33
|
+
export { IconComponentMap, IconMap, resultProps };
|
68
34
|
//# sourceMappingURL=result.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"result.mjs","sources":["../../../../../../packages/components/result/src/result.
|
1
|
+
{"version":3,"file":"result.mjs","sources":["../../../../../../packages/components/result/src/result.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport {\n CircleCheckFilled,\n CircleCloseFilled,\n InfoFilled,\n WarningFilled,\n} from '@element-plus/icons-vue'\nimport type { Component, ExtractPropTypes } from 'vue'\nimport type Result from './result.vue'\n\nexport const IconMap = {\n success: 'icon-success',\n warning: 'icon-warning',\n error: 'icon-error',\n info: 'icon-info',\n} as const\n\nexport const IconComponentMap: Record<\n typeof IconMap[keyof typeof IconMap],\n Component\n> = {\n [IconMap.success]: CircleCheckFilled,\n [IconMap.warning]: WarningFilled,\n [IconMap.error]: CircleCloseFilled,\n [IconMap.info]: InfoFilled,\n}\n\nexport const resultProps = buildProps({\n /**\n * @description title of result\n */\n title: {\n type: String,\n default: '',\n },\n /**\n * @description sub title of result\n */\n subTitle: {\n type: String,\n default: '',\n },\n /**\n * @description icon type of result\n */\n icon: {\n type: String,\n values: ['success', 'warning', 'info', 'error'],\n default: 'info',\n },\n} as const)\n\nexport type ResultProps = ExtractPropTypes<typeof resultProps>\n\nexport type ResultInstance = InstanceType<typeof Result>\n"],"names":[],"mappings":";;;;AAOY,MAAC,OAAO,GAAG;AACvB,EAAE,OAAO,EAAE,cAAc;AACzB,EAAE,OAAO,EAAE,cAAc;AACzB,EAAE,KAAK,EAAE,YAAY;AACrB,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE;AACU,MAAC,gBAAgB,GAAG;AAChC,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,iBAAiB;AACtC,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,aAAa;AAClC,EAAE,CAAC,OAAO,CAAC,KAAK,GAAG,iBAAiB;AACpC,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,UAAU;AAC5B,EAAE;AACU,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;AACnD,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,CAAC;;;;"}
|
@@ -1,34 +1,68 @@
|
|
1
|
-
import '
|
2
|
-
import
|
3
|
-
import {
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode, toDisplayString } from 'vue';
|
2
|
+
import '../../../hooks/index.mjs';
|
3
|
+
import { resultProps, IconMap, IconComponentMap } from './result.mjs';
|
4
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
5
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
4
6
|
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
7
|
+
const __default__ = defineComponent({
|
8
|
+
name: "ElResult"
|
9
|
+
});
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
11
|
+
...__default__,
|
12
|
+
props: resultProps,
|
13
|
+
setup(__props) {
|
14
|
+
const props = __props;
|
15
|
+
const ns = useNamespace("result");
|
16
|
+
const resultIcon = computed(() => {
|
17
|
+
const icon = props.icon;
|
18
|
+
const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
|
19
|
+
const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
|
20
|
+
return {
|
21
|
+
class: iconClass,
|
22
|
+
component: iconComponent
|
23
|
+
};
|
24
|
+
});
|
25
|
+
return (_ctx, _cache) => {
|
26
|
+
return openBlock(), createElementBlock("div", {
|
27
|
+
class: normalizeClass(unref(ns).b())
|
28
|
+
}, [
|
29
|
+
createElementVNode("div", {
|
30
|
+
class: normalizeClass(unref(ns).e("icon"))
|
31
|
+
}, [
|
32
|
+
renderSlot(_ctx.$slots, "icon", {}, () => [
|
33
|
+
unref(resultIcon).component ? (openBlock(), createBlock(resolveDynamicComponent(unref(resultIcon).component), {
|
34
|
+
key: 0,
|
35
|
+
class: normalizeClass(unref(resultIcon).class)
|
36
|
+
}, null, 8, ["class"])) : createCommentVNode("v-if", true)
|
37
|
+
])
|
38
|
+
], 2),
|
39
|
+
_ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
|
40
|
+
key: 0,
|
41
|
+
class: normalizeClass(unref(ns).e("title"))
|
42
|
+
}, [
|
43
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
44
|
+
createElementVNode("p", null, toDisplayString(_ctx.title), 1)
|
45
|
+
])
|
46
|
+
], 2)) : createCommentVNode("v-if", true),
|
47
|
+
_ctx.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
|
48
|
+
key: 1,
|
49
|
+
class: normalizeClass(unref(ns).e("subtitle"))
|
50
|
+
}, [
|
51
|
+
renderSlot(_ctx.$slots, "sub-title", {}, () => [
|
52
|
+
createElementVNode("p", null, toDisplayString(_ctx.subTitle), 1)
|
53
|
+
])
|
54
|
+
], 2)) : createCommentVNode("v-if", true),
|
55
|
+
_ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
|
56
|
+
key: 2,
|
57
|
+
class: normalizeClass(unref(ns).e("extra"))
|
58
|
+
}, [
|
59
|
+
renderSlot(_ctx.$slots, "extra")
|
60
|
+
], 2)) : createCommentVNode("v-if", true)
|
61
|
+
], 2);
|
62
|
+
};
|
30
63
|
}
|
31
64
|
});
|
65
|
+
var Result = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "result.vue"]]);
|
32
66
|
|
33
|
-
export {
|
67
|
+
export { Result as default };
|
34
68
|
//# sourceMappingURL=result2.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"result2.mjs","sources":["../../../../../../packages/components/result/src/result.
|
1
|
+
{"version":3,"file":"result2.mjs","sources":["../../../../../../packages/components/result/src/result.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <div :class=\"ns.e('icon')\">\n <slot name=\"icon\">\n <component\n :is=\"resultIcon.component\"\n v-if=\"resultIcon.component\"\n :class=\"resultIcon.class\"\n />\n </slot>\n </div>\n <div v-if=\"title || $slots.title\" :class=\"ns.e('title')\">\n <slot name=\"title\">\n <p>{{ title }}</p>\n </slot>\n </div>\n <div v-if=\"subTitle || $slots['sub-title']\" :class=\"ns.e('subtitle')\">\n <slot name=\"sub-title\">\n <p>{{ subTitle }}</p>\n </slot>\n </div>\n <div v-if=\"$slots.extra\" :class=\"ns.e('extra')\">\n <slot name=\"extra\" />\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { IconComponentMap, IconMap, resultProps } from './result'\n\ndefineOptions({\n name: 'ElResult',\n})\n\nconst props = defineProps(resultProps)\n\nconst ns = useNamespace('result')\n\nconst resultIcon = computed(() => {\n const icon = props.icon\n const iconClass = icon && IconMap[icon] ? IconMap[icon] : 'icon-info'\n const iconComponent =\n IconComponentMap[iconClass] || IconComponentMap['icon-info']\n\n return {\n class: iconClass,\n component: iconComponent,\n }\n})\n</script>\n"],"names":[],"mappings":";;;;;;mCA+Bc,CAAA;AAAA,EACZ,IAAM,EAAA,UAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAIA,IAAM,MAAA,EAAA,GAAK,aAAa,QAAQ,CAAA,CAAA;AAEhC,IAAM,MAAA,UAAA,GAAa,SAAS,MAAM;AAChC,MAAA,MAAM,OAAO,KAAM,CAAA,IAAA,CAAA;AACnB,MAAA,MAAM,YAAY,IAAQ,IAAA,OAAA,CAAQ,IAAI,CAAI,GAAA,OAAA,CAAQ,IAAI,CAAI,GAAA,WAAA,CAAA;AAC1D,MAAA,MAAM,aACJ,GAAA,gBAAA,CAAiB,SAAS,CAAA,IAAK,iBAAiB,WAAW,CAAA,CAAA;AAE7D,MAAO,OAAA;AAAA,QACL,KAAO,EAAA,SAAA;AAAA,QACP,SAAW,EAAA,aAAA;AAAA,OACb,CAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -2,7 +2,7 @@ import '../../utils/index.mjs';
|
|
2
2
|
import Scrollbar from './src/scrollbar2.mjs';
|
3
3
|
export { BAR_MAP, GAP, renderThumbStyle } from './src/util.mjs';
|
4
4
|
export { scrollbarEmits, scrollbarProps } from './src/scrollbar.mjs';
|
5
|
-
export { thumbProps } from './src/
|
5
|
+
export { thumbProps } from './src/thumb.mjs';
|
6
6
|
export { scrollbarContextKey } from './src/constants.mjs';
|
7
7
|
import { withInstall } from '../../utils/vue/install.mjs';
|
8
8
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { defineComponent, inject, ref, openBlock, createElementBlock, Fragment, createVNode } from 'vue';
|
2
2
|
import { GAP } from './util.mjs';
|
3
|
-
import Thumb from './
|
3
|
+
import Thumb from './thumb2.mjs';
|
4
4
|
import { barProps } from './bar.mjs';
|
5
5
|
import { scrollbarContextKey } from './constants.mjs';
|
6
6
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
@@ -1,135 +1,16 @@
|
|
1
|
-
import { defineComponent, inject, ref, computed, onBeforeUnmount, toRef, openBlock, createBlock, Transition, unref, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, vShow } from 'vue';
|
2
|
-
import { isClient, useEventListener } from '@vueuse/core';
|
3
1
|
import '../../../utils/index.mjs';
|
4
|
-
import '../../../
|
5
|
-
import { scrollbarContextKey } from './constants.mjs';
|
6
|
-
import { BAR_MAP, renderThumbStyle } from './util.mjs';
|
7
|
-
import { thumbProps } from './thumb2.mjs';
|
8
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
9
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
10
|
-
import { throwError } from '../../../utils/error.mjs';
|
2
|
+
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
11
3
|
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
throwError(COMPONENT_NAME, "can not inject scrollbar context");
|
22
|
-
const instance = ref();
|
23
|
-
const thumb = ref();
|
24
|
-
const thumbState = ref({});
|
25
|
-
const visible = ref(false);
|
26
|
-
let cursorDown = false;
|
27
|
-
let cursorLeave = false;
|
28
|
-
let originalOnSelectStart = isClient ? document.onselectstart : null;
|
29
|
-
const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
|
30
|
-
const thumbStyle = computed(() => renderThumbStyle({
|
31
|
-
size: props.size,
|
32
|
-
move: props.move,
|
33
|
-
bar: bar.value
|
34
|
-
}));
|
35
|
-
const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.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
|
-
thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
|
47
|
-
};
|
48
|
-
const clickTrackHandler = (e) => {
|
49
|
-
if (!thumb.value || !instance.value || !scrollbar.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.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.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
|
-
originalOnSelectStart = 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 = thumbState.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.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
|
76
|
-
};
|
77
|
-
const mouseUpDocumentHandler = () => {
|
78
|
-
cursorDown = false;
|
79
|
-
thumbState.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
|
-
onBeforeUnmount(() => {
|
95
|
-
restoreOnselectstart();
|
96
|
-
document.removeEventListener("mouseup", mouseUpDocumentHandler);
|
97
|
-
});
|
98
|
-
const restoreOnselectstart = () => {
|
99
|
-
if (document.onselectstart !== originalOnSelectStart)
|
100
|
-
document.onselectstart = originalOnSelectStart;
|
101
|
-
};
|
102
|
-
useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
|
103
|
-
useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
|
104
|
-
return (_ctx, _cache) => {
|
105
|
-
return openBlock(), createBlock(Transition, {
|
106
|
-
name: unref(ns).b("fade"),
|
107
|
-
persisted: ""
|
108
|
-
}, {
|
109
|
-
default: withCtx(() => [
|
110
|
-
withDirectives(createElementVNode("div", {
|
111
|
-
ref_key: "instance",
|
112
|
-
ref: instance,
|
113
|
-
class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
|
114
|
-
onMousedown: clickTrackHandler
|
115
|
-
}, [
|
116
|
-
createElementVNode("div", {
|
117
|
-
ref_key: "thumb",
|
118
|
-
ref: thumb,
|
119
|
-
class: normalizeClass(unref(ns).e("thumb")),
|
120
|
-
style: normalizeStyle(unref(thumbStyle)),
|
121
|
-
onMousedown: clickThumbHandler
|
122
|
-
}, null, 38)
|
123
|
-
], 34), [
|
124
|
-
[vShow, _ctx.always || visible.value]
|
125
|
-
])
|
126
|
-
]),
|
127
|
-
_: 1
|
128
|
-
}, 8, ["name"]);
|
129
|
-
};
|
130
|
-
}
|
4
|
+
const thumbProps = buildProps({
|
5
|
+
vertical: Boolean,
|
6
|
+
size: String,
|
7
|
+
move: Number,
|
8
|
+
ratio: {
|
9
|
+
type: Number,
|
10
|
+
required: true
|
11
|
+
},
|
12
|
+
always: Boolean
|
131
13
|
});
|
132
|
-
var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "thumb.vue"]]);
|
133
14
|
|
134
|
-
export {
|
15
|
+
export { thumbProps };
|
135
16
|
//# sourceMappingURL=thumb.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"thumb.mjs","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 />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\nimport { thumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps(thumbProps)\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet originalOnSelectStart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = isClient ? document.onselectstart : null\n\nconst bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal'])\n\nconst thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n)\n\nconst 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\nconst 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\nconst 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 * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst 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\nconst 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 * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst 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\nconst mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n}\n\nconst mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n}\n\nonBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n})\n\nconst restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n}\n\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n)\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n)\n</script>\n"],"names":["_createBlock","_Transition","_unref","_withCtx","_withDirectives","_createElementVNode","_normalizeClass"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,IAAM,MAAA,SAAA,GAAY,OAAO,mBAAmB,CAAA,CAAA;AAC5C,IAAM,MAAA,EAAA,GAAK,aAAa,WAAW,CAAA,CAAA;AAEnC,IAAA,IAAI,CAAC,SAAA;AAEL,MAAA,yBAAqC,EAAA,kCAAA,CAAA,CAAA;AACrC,IAAA,MAAM,QAAQ,GAAoB,GAAA,EAAA,CAAA;AAElC,IAAM,MAAA,KAAA,GAAA,GAAA,EAAa,CAAwC;AAC3D,IAAM,MAAA,UAAU,MAAS,CAAA,EAAA,CAAA,CAAA;AAEzB,IAAA,MAAiB,OAAA,GAAA,GAAA,CAAA,KAAA,CAAA,CAAA;AACjB,IAAA,IAAI,UAAc,GAAA,KAAA,CAAA;AAClB,IAAI,IAAA,WAAA,GAAA,KAAA,CAAA;AAIJ,IAAM,IAAA,qBAAqB,GAAA,mBAAyB,CAAA,aAAA,GAAA;AAEpD,IAAA,MAAM,GAAa,GAAA,QAAA,CAAA,MAAA,OAAA,CAAA,KAAA,CAAA,QAAA,GAAA,UAAA,GAAA,YAAA,CAAA,CAAA,CAAA;AAAA,IAAA,gBACA,GAAA,QAAA,CAAA,MAAA,gBAAA,CAAA;AAAA,MAAA,WACH,CAAA,IAAA;AAAA,MAAA,WACA,CAAA,IAAA;AAAA,MAAA,QACH,CAAA,KAAA;AAAA,KAAA,CACX,CAAC,CAAA;AAAA,IACH,MAAA,WAAA,GAAA,QAAA,CAAA,MAAA,QAAA,CAAA,KAAA,CAAA,GAAA,CAAA,KAAA,CAAA,MAAA,CAAA,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AAqB,CAAA,CAAA;AACrB,IAAS,MAAA,oBAAA,GAAA;AAAqD,MAC/D,IAAA,QAAA,CAAA,aAAA,KAAA,qBAAA;AAED,QAAA,yBAA6B,qBAAM,CAAA;AACjC,KAAA,CAAA;AACE,IAAA,gBAAyB,CAAA,KAAA,CAAA,SAAA,EAAA,kBAAA,CAAA,EAAA,WAAA,EAAA,yBAAA,CAAA,CAAA;AAAA,IAC7B,gBAAA,CAAA,KAAA,CAAA,SAAA,EAAA,kBAAA,CAAA,EAAA,YAAA,EAAA,0BAAA,CAAA,CAAA;AAEA,IAAA,OAAA,CAAA,IAAA,EAAA,MAAA,KAAA;AAAA,MACE,gBAAiB,EAAkB,EAAAA,WAAA,CAAAC,UAAA,EAAA;AAAA,QACnC,IAAA,EAAAC,KAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA;AAAA,QACA,SAAA,EAAA,EAAA;AAAA,OACF,EAAA;AACA,QAAA,OAAA,EAAAC,OAAA,CAAA,MAAA;AAAA,UACEC,cAAmC,CAAAC,kBAAA,CAAA,KAAA,EAAA;AAAA,YACnC,OAAA,EAAA,UAAA;AAAA,YACA,GAAA,EAAA,QAAA;AAAA,YACF,KAAA,EAAAC,cAAA,CAAA,CAAAJ,KAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,KAAA,CAAA,EAAAA,KAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"thumb.mjs","sources":["../../../../../../packages/components/scrollbar/src/thumb.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type Thumb from './thumb.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\nexport type ThumbInstance = InstanceType<typeof Thumb>\n"],"names":[],"mappings":";;;AACY,MAAC,UAAU,GAAG,UAAU,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;;;;"}
|
@@ -1,16 +1,135 @@
|
|
1
|
+
import { defineComponent, inject, ref, computed, onBeforeUnmount, toRef, openBlock, createBlock, Transition, unref, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, vShow } from 'vue';
|
2
|
+
import { isClient, useEventListener } from '@vueuse/core';
|
1
3
|
import '../../../utils/index.mjs';
|
2
|
-
import
|
4
|
+
import '../../../hooks/index.mjs';
|
5
|
+
import { scrollbarContextKey } from './constants.mjs';
|
6
|
+
import { BAR_MAP, renderThumbStyle } from './util.mjs';
|
7
|
+
import { thumbProps } from './thumb.mjs';
|
8
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
9
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
10
|
+
import { throwError } from '../../../utils/error.mjs';
|
3
11
|
|
4
|
-
const
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
const COMPONENT_NAME = "Thumb";
|
13
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
14
|
+
__name: "thumb",
|
15
|
+
props: thumbProps,
|
16
|
+
setup(__props) {
|
17
|
+
const props = __props;
|
18
|
+
const scrollbar = inject(scrollbarContextKey);
|
19
|
+
const ns = useNamespace("scrollbar");
|
20
|
+
if (!scrollbar)
|
21
|
+
throwError(COMPONENT_NAME, "can not inject scrollbar context");
|
22
|
+
const instance = ref();
|
23
|
+
const thumb = ref();
|
24
|
+
const thumbState = ref({});
|
25
|
+
const visible = ref(false);
|
26
|
+
let cursorDown = false;
|
27
|
+
let cursorLeave = false;
|
28
|
+
let originalOnSelectStart = isClient ? document.onselectstart : null;
|
29
|
+
const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
|
30
|
+
const thumbStyle = computed(() => renderThumbStyle({
|
31
|
+
size: props.size,
|
32
|
+
move: props.move,
|
33
|
+
bar: bar.value
|
34
|
+
}));
|
35
|
+
const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.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
|
+
thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
|
47
|
+
};
|
48
|
+
const clickTrackHandler = (e) => {
|
49
|
+
if (!thumb.value || !instance.value || !scrollbar.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.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.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
|
+
originalOnSelectStart = 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 = thumbState.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.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
|
76
|
+
};
|
77
|
+
const mouseUpDocumentHandler = () => {
|
78
|
+
cursorDown = false;
|
79
|
+
thumbState.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
|
+
onBeforeUnmount(() => {
|
95
|
+
restoreOnselectstart();
|
96
|
+
document.removeEventListener("mouseup", mouseUpDocumentHandler);
|
97
|
+
});
|
98
|
+
const restoreOnselectstart = () => {
|
99
|
+
if (document.onselectstart !== originalOnSelectStart)
|
100
|
+
document.onselectstart = originalOnSelectStart;
|
101
|
+
};
|
102
|
+
useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
|
103
|
+
useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
|
104
|
+
return (_ctx, _cache) => {
|
105
|
+
return openBlock(), createBlock(Transition, {
|
106
|
+
name: unref(ns).b("fade"),
|
107
|
+
persisted: ""
|
108
|
+
}, {
|
109
|
+
default: withCtx(() => [
|
110
|
+
withDirectives(createElementVNode("div", {
|
111
|
+
ref_key: "instance",
|
112
|
+
ref: instance,
|
113
|
+
class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
|
114
|
+
onMousedown: clickTrackHandler
|
115
|
+
}, [
|
116
|
+
createElementVNode("div", {
|
117
|
+
ref_key: "thumb",
|
118
|
+
ref: thumb,
|
119
|
+
class: normalizeClass(unref(ns).e("thumb")),
|
120
|
+
style: normalizeStyle(unref(thumbStyle)),
|
121
|
+
onMousedown: clickThumbHandler
|
122
|
+
}, null, 38)
|
123
|
+
], 34), [
|
124
|
+
[vShow, _ctx.always || visible.value]
|
125
|
+
])
|
126
|
+
]),
|
127
|
+
_: 1
|
128
|
+
}, 8, ["name"]);
|
129
|
+
};
|
130
|
+
}
|
13
131
|
});
|
132
|
+
var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "thumb.vue"]]);
|
14
133
|
|
15
|
-
export {
|
134
|
+
export { Thumb as default };
|
16
135
|
//# sourceMappingURL=thumb2.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"thumb2.mjs","sources":["../../../../../../packages/components/scrollbar/src/thumb.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type Thumb from './thumb.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\nexport type ThumbInstance = InstanceType<typeof Thumb>\n"],"names":[],"mappings":";;;AACY,MAAC,UAAU,GAAG,UAAU,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;;;;"}
|
1
|
+
{"version":3,"file":"thumb2.mjs","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 />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\nimport { thumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps(thumbProps)\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet originalOnSelectStart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = isClient ? document.onselectstart : null\n\nconst bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal'])\n\nconst thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n)\n\nconst 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\nconst 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\nconst 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 * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst 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\nconst 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 * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst 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\nconst mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n}\n\nconst mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n}\n\nonBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n})\n\nconst restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n}\n\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n)\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n)\n</script>\n"],"names":["_createBlock","_Transition","_unref","_withCtx","_withDirectives","_createElementVNode","_normalizeClass"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,IAAM,MAAA,SAAA,GAAY,OAAO,mBAAmB,CAAA,CAAA;AAC5C,IAAM,MAAA,EAAA,GAAK,aAAa,WAAW,CAAA,CAAA;AAEnC,IAAA,IAAI,CAAC,SAAA;AAEL,MAAA,yBAAqC,EAAA,kCAAA,CAAA,CAAA;AACrC,IAAA,MAAM,QAAQ,GAAoB,GAAA,EAAA,CAAA;AAElC,IAAM,MAAA,KAAA,GAAA,GAAA,EAAa,CAAwC;AAC3D,IAAM,MAAA,UAAU,MAAS,CAAA,EAAA,CAAA,CA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