@element-plus/nightly 0.0.20251227 → 0.0.20251228
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/dist/index.full.js +10 -13
- 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 +10 -13
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hi.js +1 -1
- package/dist/locale/hi.min.js +1 -1
- package/dist/locale/hi.min.mjs +1 -1
- package/dist/locale/hi.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lo.js +1 -1
- package/dist/locale/lo.min.js +1 -1
- package/dist/locale/lo.min.mjs +1 -1
- package/dist/locale/lo.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/ms.js +1 -1
- package/dist/locale/ms.min.js +1 -1
- package/dist/locale/ms.min.mjs +1 -1
- package/dist/locale/ms.mjs +1 -1
- package/dist/locale/my.js +1 -1
- package/dist/locale/my.min.js +1 -1
- package/dist/locale/my.min.mjs +1 -1
- package/dist/locale/my.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/no.js +1 -1
- package/dist/locale/no.min.js +1 -1
- package/dist/locale/no.min.mjs +1 -1
- package/dist/locale/no.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/te.js +1 -1
- package/dist/locale/te.min.js +1 -1
- package/dist/locale/te.min.mjs +1 -1
- package/dist/locale/te.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-hk.js +1 -1
- package/dist/locale/zh-hk.min.js +1 -1
- package/dist/locale/zh-hk.min.mjs +1 -1
- package/dist/locale/zh-hk.mjs +1 -1
- package/dist/locale/zh-mo.js +1 -1
- package/dist/locale/zh-mo.min.js +1 -1
- package/dist/locale/zh-mo.min.mjs +1 -1
- package/dist/locale/zh-mo.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/affix/index.mjs +2 -2
- package/es/components/affix/src/affix.mjs +153 -29
- package/es/components/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +29 -153
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/autocomplete/index.mjs +2 -2
- package/es/components/autocomplete/src/autocomplete.mjs +60 -486
- package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete2.mjs +486 -60
- package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
- package/es/components/badge/index.mjs +2 -2
- package/es/components/badge/src/badge.mjs +83 -31
- package/es/components/badge/src/badge.mjs.map +1 -1
- package/es/components/badge/src/badge2.mjs +31 -83
- package/es/components/badge/src/badge2.mjs.map +1 -1
- package/es/components/calendar/src/calendar2.mjs +1 -1
- package/es/components/calendar/src/select-controller.mjs +12 -95
- package/es/components/calendar/src/select-controller.mjs.map +1 -1
- package/es/components/calendar/src/select-controller2.mjs +95 -12
- package/es/components/calendar/src/select-controller2.mjs.map +1 -1
- package/es/components/carousel/index.mjs +4 -4
- package/es/components/carousel/src/carousel-item.mjs +79 -7
- package/es/components/carousel/src/carousel-item.mjs.map +1 -1
- package/es/components/carousel/src/carousel-item2.mjs +7 -79
- package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
- package/es/components/carousel/src/carousel.mjs +254 -60
- package/es/components/carousel/src/carousel.mjs.map +1 -1
- package/es/components/carousel/src/carousel2.mjs +60 -254
- package/es/components/carousel/src/carousel2.mjs.map +1 -1
- package/es/components/cascader/index.mjs +2 -2
- package/es/components/cascader/src/cascader.mjs +103 -822
- package/es/components/cascader/src/cascader.mjs.map +1 -1
- package/es/components/cascader/src/cascader2.mjs +822 -103
- package/es/components/cascader/src/cascader2.mjs.map +1 -1
- package/es/components/cascader-panel/src/index.mjs +1 -1
- package/es/components/cascader-panel/src/menu.mjs +1 -1
- package/es/components/cascader-panel/src/node.mjs +192 -116
- package/es/components/cascader-panel/src/node.mjs.map +1 -1
- package/es/components/cascader-panel/src/node2.mjs +116 -192
- package/es/components/cascader-panel/src/node2.mjs.map +1 -1
- package/es/components/cascader-panel/src/store.mjs +1 -1
- package/es/components/check-tag/index.mjs +2 -2
- package/es/components/check-tag/src/check-tag.mjs +14 -43
- package/es/components/check-tag/src/check-tag.mjs.map +1 -1
- package/es/components/check-tag/src/check-tag2.mjs +43 -14
- package/es/components/check-tag/src/check-tag2.mjs.map +1 -1
- package/es/components/collapse/index.mjs +2 -2
- package/es/components/collapse/src/collapse-item.mjs +118 -17
- package/es/components/collapse/src/collapse-item.mjs.map +1 -1
- package/es/components/collapse/src/collapse-item2.mjs +17 -118
- package/es/components/collapse/src/collapse-item2.mjs.map +1 -1
- package/es/components/color-picker/index.mjs +2 -2
- package/es/components/color-picker/src/color-picker.mjs +391 -53
- package/es/components/color-picker/src/color-picker.mjs.map +1 -1
- package/es/components/color-picker/src/color-picker2.mjs +53 -391
- package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
- package/es/components/dropdown/index.mjs +2 -2
- package/es/components/dropdown/src/dropdown-item-impl.mjs +1 -1
- package/es/components/dropdown/src/dropdown-item.mjs +1 -1
- package/es/components/dropdown/src/dropdown-menu.mjs +1 -1
- package/es/components/dropdown/src/dropdown.mjs +264 -112
- package/es/components/dropdown/src/dropdown.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown2.mjs +112 -264
- package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
- package/es/components/index.mjs +23 -23
- package/es/components/input/index.mjs +2 -2
- package/es/components/input/src/input.mjs +586 -124
- package/es/components/input/src/input.mjs.map +1 -1
- package/es/components/input/src/input2.mjs +124 -586
- package/es/components/input/src/input2.mjs.map +1 -1
- package/es/components/mention/src/mention-dropdown.mjs +205 -14
- package/es/components/mention/src/mention-dropdown.mjs.map +1 -1
- package/es/components/mention/src/mention-dropdown2.mjs +14 -205
- package/es/components/mention/src/mention-dropdown2.mjs.map +1 -1
- package/es/components/mention/src/mention.mjs +1 -1
- package/es/components/mention/src/mention2.mjs +2 -2
- package/es/components/pagination/src/components/sizes.mjs +25 -88
- package/es/components/pagination/src/components/sizes.mjs.map +1 -1
- package/es/components/pagination/src/components/sizes2.mjs +88 -25
- package/es/components/pagination/src/components/sizes2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +1 -1
- package/es/components/popover/src/popover.mjs +1 -1
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/trigger.mjs +156 -30
- package/es/components/popper/src/trigger.mjs.map +1 -1
- package/es/components/popper/src/trigger2.mjs +30 -156
- package/es/components/popper/src/trigger2.mjs.map +1 -1
- package/es/components/radio/index.mjs +2 -2
- package/es/components/radio/src/radio-button.mjs +79 -5
- package/es/components/radio/src/radio-button.mjs.map +1 -1
- package/es/components/radio/src/radio-button2.mjs +5 -79
- package/es/components/radio/src/radio-button2.mjs.map +1 -1
- package/es/components/radio/src/radio-group2.mjs +1 -1
- package/es/components/rate/index.mjs +2 -2
- package/es/components/rate/src/rate.mjs +295 -85
- package/es/components/rate/src/rate.mjs.map +1 -1
- package/es/components/rate/src/rate2.mjs +85 -295
- package/es/components/rate/src/rate2.mjs.map +1 -1
- package/es/components/result/index.mjs +2 -2
- package/es/components/result/src/result.mjs +96 -29
- package/es/components/result/src/result.mjs.map +1 -1
- package/es/components/result/src/result2.mjs +29 -96
- package/es/components/result/src/result2.mjs.map +1 -1
- package/es/components/select/index.mjs +2 -2
- package/es/components/select/src/option2.mjs +1 -3
- package/es/components/select/src/option2.mjs.map +1 -1
- package/es/components/select/src/select.mjs +727 -152
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/select/src/select2.mjs +152 -727
- package/es/components/select/src/select2.mjs.map +1 -1
- package/es/components/select-v2/src/option-item.mjs +1 -3
- package/es/components/select-v2/src/option-item.mjs.map +1 -1
- package/es/components/skeleton/index.mjs +4 -4
- package/es/components/skeleton/src/skeleton-item.mjs +27 -17
- package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton-item2.mjs +17 -27
- package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.mjs +67 -17
- package/es/components/skeleton/src/skeleton.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton2.mjs +17 -67
- package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
- package/es/components/steps/index.mjs +2 -2
- package/es/components/steps/src/item.mjs +257 -18
- package/es/components/steps/src/item.mjs.map +1 -1
- package/es/components/steps/src/item2.mjs +18 -257
- package/es/components/steps/src/item2.mjs.map +1 -1
- package/es/components/tabs/index.mjs +2 -2
- package/es/components/tabs/src/tab-pane.mjs +88 -15
- package/es/components/tabs/src/tab-pane.mjs.map +1 -1
- package/es/components/tabs/src/tab-pane2.mjs +15 -88
- package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
- package/es/components/tooltip/src/trigger.mjs +1 -1
- package/es/components/tooltip/src/trigger2.mjs +1 -1
- package/es/components/tour/index.mjs +1 -1
- package/es/components/tour/src/content.mjs +42 -85
- package/es/components/tour/src/content.mjs.map +1 -1
- package/es/components/tour/src/content2.mjs +85 -42
- package/es/components/tour/src/content2.mjs.map +1 -1
- package/es/components/tour/src/step.mjs +1 -1
- package/es/components/tour/src/tour.mjs +1 -1
- package/es/components/tour/src/tour2.mjs +1 -1
- package/es/components/tree-select/src/tree-select.mjs +1 -1
- package/es/components/virtual-list/src/hooks/use-wheel.mjs +7 -6
- package/es/components/virtual-list/src/hooks/use-wheel.mjs.map +1 -1
- package/es/components/watermark/index.mjs +2 -2
- package/es/components/watermark/src/watermark.mjs +26 -247
- package/es/components/watermark/src/watermark.mjs.map +1 -1
- package/es/components/watermark/src/watermark2.mjs +247 -26
- package/es/components/watermark/src/watermark2.mjs.map +1 -1
- package/es/index.mjs +23 -23
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/affix/index.js +2 -2
- package/lib/components/affix/src/affix.js +153 -30
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +30 -153
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/autocomplete/index.js +2 -2
- package/lib/components/autocomplete/src/autocomplete.js +59 -484
- package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete2.js +484 -59
- package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
- package/lib/components/badge/index.js +2 -2
- package/lib/components/badge/src/badge.js +83 -31
- package/lib/components/badge/src/badge.js.map +1 -1
- package/lib/components/badge/src/badge2.js +31 -83
- package/lib/components/badge/src/badge2.js.map +1 -1
- package/lib/components/calendar/src/calendar2.js +1 -1
- package/lib/components/calendar/src/select-controller.js +12 -98
- package/lib/components/calendar/src/select-controller.js.map +1 -1
- package/lib/components/calendar/src/select-controller2.js +98 -12
- package/lib/components/calendar/src/select-controller2.js.map +1 -1
- package/lib/components/carousel/index.js +4 -4
- package/lib/components/carousel/src/carousel-item.js +79 -7
- package/lib/components/carousel/src/carousel-item.js.map +1 -1
- package/lib/components/carousel/src/carousel-item2.js +7 -79
- package/lib/components/carousel/src/carousel-item2.js.map +1 -1
- package/lib/components/carousel/src/carousel.js +254 -61
- package/lib/components/carousel/src/carousel.js.map +1 -1
- package/lib/components/carousel/src/carousel2.js +61 -254
- package/lib/components/carousel/src/carousel2.js.map +1 -1
- package/lib/components/cascader/index.js +2 -2
- package/lib/components/cascader/src/cascader.js +103 -821
- package/lib/components/cascader/src/cascader.js.map +1 -1
- package/lib/components/cascader/src/cascader2.js +821 -103
- package/lib/components/cascader/src/cascader2.js.map +1 -1
- package/lib/components/cascader-panel/src/index.js +1 -1
- package/lib/components/cascader-panel/src/menu.js +1 -1
- package/lib/components/cascader-panel/src/node.js +192 -116
- package/lib/components/cascader-panel/src/node.js.map +1 -1
- package/lib/components/cascader-panel/src/node2.js +116 -192
- package/lib/components/cascader-panel/src/node2.js.map +1 -1
- package/lib/components/cascader-panel/src/store.js +1 -1
- package/lib/components/check-tag/index.js +2 -2
- package/lib/components/check-tag/src/check-tag.js +15 -43
- package/lib/components/check-tag/src/check-tag.js.map +1 -1
- package/lib/components/check-tag/src/check-tag2.js +43 -15
- package/lib/components/check-tag/src/check-tag2.js.map +1 -1
- package/lib/components/collapse/index.js +2 -2
- package/lib/components/collapse/src/collapse-item.js +118 -17
- package/lib/components/collapse/src/collapse-item.js.map +1 -1
- package/lib/components/collapse/src/collapse-item2.js +17 -118
- package/lib/components/collapse/src/collapse-item2.js.map +1 -1
- package/lib/components/color-picker/index.js +2 -2
- package/lib/components/color-picker/src/color-picker.js +390 -53
- package/lib/components/color-picker/src/color-picker.js.map +1 -1
- package/lib/components/color-picker/src/color-picker2.js +53 -390
- package/lib/components/color-picker/src/color-picker2.js.map +1 -1
- package/lib/components/dropdown/index.js +2 -2
- package/lib/components/dropdown/src/dropdown-item-impl.js +1 -1
- package/lib/components/dropdown/src/dropdown-item.js +1 -1
- package/lib/components/dropdown/src/dropdown-menu.js +1 -1
- package/lib/components/dropdown/src/dropdown.js +264 -117
- package/lib/components/dropdown/src/dropdown.js.map +1 -1
- package/lib/components/dropdown/src/dropdown2.js +117 -264
- package/lib/components/dropdown/src/dropdown2.js.map +1 -1
- package/lib/components/index.js +23 -23
- package/lib/components/input/index.js +2 -2
- package/lib/components/input/src/input.js +582 -121
- package/lib/components/input/src/input.js.map +1 -1
- package/lib/components/input/src/input2.js +121 -582
- package/lib/components/input/src/input2.js.map +1 -1
- package/lib/components/mention/src/mention-dropdown.js +205 -15
- package/lib/components/mention/src/mention-dropdown.js.map +1 -1
- package/lib/components/mention/src/mention-dropdown2.js +15 -205
- package/lib/components/mention/src/mention-dropdown2.js.map +1 -1
- package/lib/components/mention/src/mention.js +1 -1
- package/lib/components/mention/src/mention2.js +2 -2
- package/lib/components/pagination/src/components/sizes.js +25 -88
- package/lib/components/pagination/src/components/sizes.js.map +1 -1
- package/lib/components/pagination/src/components/sizes2.js +88 -25
- package/lib/components/pagination/src/components/sizes2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +1 -1
- package/lib/components/popover/src/popover.js +1 -1
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/trigger.js +156 -31
- package/lib/components/popper/src/trigger.js.map +1 -1
- package/lib/components/popper/src/trigger2.js +31 -156
- package/lib/components/popper/src/trigger2.js.map +1 -1
- package/lib/components/radio/index.js +2 -2
- package/lib/components/radio/src/radio-button.js +79 -5
- package/lib/components/radio/src/radio-button.js.map +1 -1
- package/lib/components/radio/src/radio-button2.js +5 -79
- package/lib/components/radio/src/radio-button2.js.map +1 -1
- package/lib/components/radio/src/radio-group2.js +1 -1
- package/lib/components/rate/index.js +2 -2
- package/lib/components/rate/src/rate.js +294 -85
- package/lib/components/rate/src/rate.js.map +1 -1
- package/lib/components/rate/src/rate2.js +85 -294
- package/lib/components/rate/src/rate2.js.map +1 -1
- package/lib/components/result/index.js +2 -2
- package/lib/components/result/src/result.js +96 -31
- package/lib/components/result/src/result.js.map +1 -1
- package/lib/components/result/src/result2.js +31 -96
- package/lib/components/result/src/result2.js.map +1 -1
- package/lib/components/select/index.js +2 -2
- package/lib/components/select/src/option2.js +1 -3
- package/lib/components/select/src/option2.js.map +1 -1
- package/lib/components/select/src/select.js +726 -152
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/components/select/src/select2.js +152 -726
- package/lib/components/select/src/select2.js.map +1 -1
- package/lib/components/select-v2/src/option-item.js +1 -3
- package/lib/components/select-v2/src/option-item.js.map +1 -1
- package/lib/components/skeleton/index.js +4 -4
- package/lib/components/skeleton/src/skeleton-item.js +27 -17
- package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
- package/lib/components/skeleton/src/skeleton-item2.js +17 -27
- package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.js +67 -17
- package/lib/components/skeleton/src/skeleton.js.map +1 -1
- package/lib/components/skeleton/src/skeleton2.js +17 -67
- package/lib/components/skeleton/src/skeleton2.js.map +1 -1
- package/lib/components/steps/index.js +2 -2
- package/lib/components/steps/src/item.js +257 -18
- package/lib/components/steps/src/item.js.map +1 -1
- package/lib/components/steps/src/item2.js +18 -257
- package/lib/components/steps/src/item2.js.map +1 -1
- package/lib/components/tabs/index.js +2 -2
- package/lib/components/tabs/src/tab-pane.js +88 -15
- package/lib/components/tabs/src/tab-pane.js.map +1 -1
- package/lib/components/tabs/src/tab-pane2.js +15 -88
- package/lib/components/tabs/src/tab-pane2.js.map +1 -1
- package/lib/components/tooltip/src/trigger.js +1 -1
- package/lib/components/tooltip/src/trigger2.js +1 -1
- package/lib/components/tour/index.js +1 -1
- package/lib/components/tour/src/content.js +45 -85
- package/lib/components/tour/src/content.js.map +1 -1
- package/lib/components/tour/src/content2.js +85 -45
- package/lib/components/tour/src/content2.js.map +1 -1
- package/lib/components/tour/src/step.js +1 -1
- package/lib/components/tour/src/tour.js +1 -1
- package/lib/components/tour/src/tour2.js +1 -1
- package/lib/components/tree-select/src/tree-select.js +1 -1
- package/lib/components/virtual-list/src/hooks/use-wheel.js +6 -5
- package/lib/components/virtual-list/src/hooks/use-wheel.js.map +1 -1
- package/lib/components/watermark/index.js +2 -2
- package/lib/components/watermark/src/watermark.js +26 -247
- package/lib/components/watermark/src/watermark.js.map +1 -1
- package/lib/components/watermark/src/watermark2.js +247 -26
- package/lib/components/watermark/src/watermark2.js.map +1 -1
- package/lib/index.js +23 -23
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
|
@@ -2,7 +2,7 @@ import { defineComponent, ref, computed, toRef, watch, useSlots, provide, openBl
|
|
|
2
2
|
import { useVModel } from '@vueuse/core';
|
|
3
3
|
import { ElTeleport } from '../../teleport/index.mjs';
|
|
4
4
|
import ElTourMask from './mask2.mjs';
|
|
5
|
-
import ElTourContent from './
|
|
5
|
+
import ElTourContent from './content2.mjs';
|
|
6
6
|
import ElTourSteps from './steps.mjs';
|
|
7
7
|
import { tourProps, tourEmits } from './tour.mjs';
|
|
8
8
|
import { useTarget, tourKey } from './helper.mjs';
|
|
@@ -6,7 +6,7 @@ import { useSelect } from './select.mjs';
|
|
|
6
6
|
import { useTree } from './tree.mjs';
|
|
7
7
|
import CacheOptions from './cache-options.mjs';
|
|
8
8
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
9
|
-
import { selectProps } from '../../select/src/
|
|
9
|
+
import { selectProps } from '../../select/src/select2.mjs';
|
|
10
10
|
import { treeProps } from '../../tree/src/tree.mjs';
|
|
11
11
|
|
|
12
12
|
const _sfc_main = defineComponent({
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { HORIZONTAL
|
|
1
|
+
import { HORIZONTAL } from '../defaults.mjs';
|
|
2
2
|
import { cAF, rAF } from '../../../../utils/raf.mjs';
|
|
3
3
|
import { isFirefox } from '../../../../utils/browser.mjs';
|
|
4
4
|
|
|
5
|
-
const LayoutKeys = {
|
|
6
|
-
[HORIZONTAL]: "deltaX",
|
|
7
|
-
[VERTICAL]: "deltaY"
|
|
8
|
-
};
|
|
9
5
|
const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
|
|
10
6
|
let frameHandle;
|
|
11
7
|
let offset = 0;
|
|
@@ -15,7 +11,12 @@ const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
|
|
|
15
11
|
};
|
|
16
12
|
const onWheel = (e) => {
|
|
17
13
|
cAF(frameHandle);
|
|
18
|
-
|
|
14
|
+
let { deltaX, deltaY } = e;
|
|
15
|
+
if (e.shiftKey && deltaY !== 0) {
|
|
16
|
+
deltaX = deltaY;
|
|
17
|
+
deltaY = 0;
|
|
18
|
+
}
|
|
19
|
+
const newOffset = layout.value === HORIZONTAL ? deltaX : deltaY;
|
|
19
20
|
if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
|
|
20
21
|
return;
|
|
21
22
|
offset += newOffset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-wheel.mjs","sources":["../../../../../../../packages/components/virtual-list/src/hooks/use-wheel.ts"],"sourcesContent":["import { cAF, isFirefox, rAF } from '@element-plus/utils'\nimport { HORIZONTAL
|
|
1
|
+
{"version":3,"file":"use-wheel.mjs","sources":["../../../../../../../packages/components/virtual-list/src/hooks/use-wheel.ts"],"sourcesContent":["import { cAF, isFirefox, rAF } from '@element-plus/utils'\nimport { HORIZONTAL } from '../defaults'\n\nimport type { ComputedRef } from 'vue'\nimport type { LayoutDirection } from '../types'\n\ninterface ListWheelState {\n atStartEdge: ComputedRef<boolean> // exclusive to reachEnd\n atEndEdge: ComputedRef<boolean>\n layout: ComputedRef<LayoutDirection>\n}\n\ntype ListWheelHandler = (offset: number) => void\n\nconst useWheel = (\n { atEndEdge, atStartEdge, layout }: ListWheelState,\n onWheelDelta: ListWheelHandler\n) => {\n let frameHandle: number\n let offset = 0\n\n const hasReachedEdge = (offset: number) => {\n const edgeReached =\n (offset < 0 && atStartEdge.value) || (offset > 0 && atEndEdge.value)\n\n return edgeReached\n }\n\n const onWheel = (e: WheelEvent) => {\n cAF(frameHandle)\n\n let { deltaX, deltaY } = e\n // Special case for windows machine with shift key + wheel scrolling\n if (e.shiftKey && deltaY !== 0) {\n deltaX = deltaY\n deltaY = 0\n }\n\n const newOffset = layout.value === HORIZONTAL ? deltaX : deltaY\n\n if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset)) return\n\n offset += newOffset\n\n if (!isFirefox()) {\n e.preventDefault()\n }\n\n frameHandle = rAF(() => {\n onWheelDelta(offset)\n offset = 0\n })\n }\n\n return {\n hasReachedEdge,\n onWheel,\n }\n}\n\nexport default useWheel\n"],"names":["offset"],"mappings":";;;;AAcA,MAAM,WAAW,CACf,EAAE,WAAW,WAAa,EAAA,MAAA,IAC1B,YACG,KAAA;AACH,EAAI,IAAA,WAAA,CAAA;AACJ,EAAA,IAAI,MAAS,GAAA,CAAA,CAAA;AAEb,EAAM,MAAA,cAAA,GAAiB,CAACA,OAAmB,KAAA;AACzC,IAAA,MAAM,cACHA,OAAS,GAAA,CAAA,IAAK,YAAY,KAAWA,IAAAA,OAAAA,GAAS,KAAK,SAAU,CAAA,KAAA,CAAA;AAEhE,IAAO,OAAA,WAAA,CAAA;AAAA,GACT,CAAA;AAEA,EAAM,MAAA,OAAA,GAAU,CAAC,CAAkB,KAAA;AACjC,IAAA,GAAA,CAAI,WAAW,CAAA,CAAA;AAEf,IAAI,IAAA,EAAE,MAAQ,EAAA,MAAA,EAAW,GAAA,CAAA,CAAA;AAEzB,IAAI,IAAA,CAAA,CAAE,QAAY,IAAA,MAAA,KAAW,CAAG,EAAA;AAC9B,MAAS,MAAA,GAAA,MAAA,CAAA;AACT,MAAS,MAAA,GAAA,CAAA,CAAA;AAAA,KACX;AAEA,IAAA,MAAM,SAAY,GAAA,MAAA,CAAO,KAAU,KAAA,UAAA,GAAa,MAAS,GAAA,MAAA,CAAA;AAEzD,IAAA,IAAI,cAAe,CAAA,MAAM,CAAK,IAAA,cAAA,CAAe,SAAS,SAAS,CAAA;AAAG,MAAA,OAAA;AAElE,IAAU,MAAA,IAAA,SAAA,CAAA;AAEV,IAAI,IAAA,CAAC,WAAa,EAAA;AAChB,MAAA,CAAA,CAAE,cAAe,EAAA,CAAA;AAAA,KACnB;AAEA,IAAA,WAAA,GAAc,IAAI,MAAM;AACtB,MAAA,YAAA,CAAa,MAAM,CAAA,CAAA;AACnB,MAAS,MAAA,GAAA,CAAA,CAAA;AAAA,KACV,CAAA,CAAA;AAAA,GACH,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,cAAA;AAAA,IACA,OAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Watermark from './src/
|
|
2
|
-
export { watermarkProps } from './src/
|
|
1
|
+
import Watermark from './src/watermark2.mjs';
|
|
2
|
+
export { watermarkProps } from './src/watermark.mjs';
|
|
3
3
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
4
4
|
|
|
5
5
|
const ElWatermark = withInstall(Watermark);
|
|
@@ -1,253 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMutationObserver } from '@vueuse/core';
|
|
3
|
-
import { watermarkProps } from './watermark2.mjs';
|
|
4
|
-
import { reRendering, getStyleStr, getPixelRatio } from './utils.mjs';
|
|
5
|
-
import useClips from './useClips.mjs';
|
|
6
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
7
|
-
import { isArray } from '@vue/shared';
|
|
8
|
-
import { isUndefined } from '../../../utils/types.mjs';
|
|
1
|
+
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
9
2
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
const watermarkProps = buildProps({
|
|
4
|
+
zIndex: {
|
|
5
|
+
type: Number,
|
|
6
|
+
default: 9
|
|
13
7
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var _a, _b;
|
|
35
|
-
return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
|
|
36
|
-
});
|
|
37
|
-
const fontStyle = computed(() => {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
|
|
40
|
-
});
|
|
41
|
-
const fontFamily = computed(() => {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
|
|
44
|
-
});
|
|
45
|
-
const textAlign = computed(() => {
|
|
46
|
-
var _a, _b;
|
|
47
|
-
return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
|
|
48
|
-
});
|
|
49
|
-
const textBaseline = computed(() => {
|
|
50
|
-
var _a, _b;
|
|
51
|
-
return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
|
|
52
|
-
});
|
|
53
|
-
const gapX = computed(() => props.gap[0]);
|
|
54
|
-
const gapY = computed(() => props.gap[1]);
|
|
55
|
-
const gapXCenter = computed(() => gapX.value / 2);
|
|
56
|
-
const gapYCenter = computed(() => gapY.value / 2);
|
|
57
|
-
const offsetLeft = computed(() => {
|
|
58
|
-
var _a, _b;
|
|
59
|
-
return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
|
|
60
|
-
});
|
|
61
|
-
const offsetTop = computed(() => {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
|
|
64
|
-
});
|
|
65
|
-
const getMarkStyle = () => {
|
|
66
|
-
const markStyle = {
|
|
67
|
-
zIndex: props.zIndex,
|
|
68
|
-
position: "absolute",
|
|
69
|
-
left: 0,
|
|
70
|
-
top: 0,
|
|
71
|
-
width: "100%",
|
|
72
|
-
height: "100%",
|
|
73
|
-
pointerEvents: "none",
|
|
74
|
-
backgroundRepeat: "repeat"
|
|
75
|
-
};
|
|
76
|
-
let positionLeft = offsetLeft.value - gapXCenter.value;
|
|
77
|
-
let positionTop = offsetTop.value - gapYCenter.value;
|
|
78
|
-
if (positionLeft > 0) {
|
|
79
|
-
markStyle.left = `${positionLeft}px`;
|
|
80
|
-
markStyle.width = `calc(100% - ${positionLeft}px)`;
|
|
81
|
-
positionLeft = 0;
|
|
82
|
-
}
|
|
83
|
-
if (positionTop > 0) {
|
|
84
|
-
markStyle.top = `${positionTop}px`;
|
|
85
|
-
markStyle.height = `calc(100% - ${positionTop}px)`;
|
|
86
|
-
positionTop = 0;
|
|
87
|
-
}
|
|
88
|
-
markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
|
|
89
|
-
return markStyle;
|
|
90
|
-
};
|
|
91
|
-
const containerRef = shallowRef(null);
|
|
92
|
-
const watermarkRef = shallowRef();
|
|
93
|
-
const stopObservation = ref(false);
|
|
94
|
-
const destroyWatermark = () => {
|
|
95
|
-
if (watermarkRef.value) {
|
|
96
|
-
watermarkRef.value.remove();
|
|
97
|
-
watermarkRef.value = void 0;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
const appendWatermark = (base64Url, markWidth) => {
|
|
101
|
-
var _a;
|
|
102
|
-
if (containerRef.value && watermarkRef.value) {
|
|
103
|
-
stopObservation.value = true;
|
|
104
|
-
watermarkRef.value.setAttribute(
|
|
105
|
-
"style",
|
|
106
|
-
getStyleStr({
|
|
107
|
-
...getMarkStyle(),
|
|
108
|
-
backgroundImage: `url('${base64Url}')`,
|
|
109
|
-
backgroundSize: `${Math.floor(markWidth)}px`
|
|
110
|
-
})
|
|
111
|
-
);
|
|
112
|
-
(_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
|
|
113
|
-
setTimeout(() => {
|
|
114
|
-
stopObservation.value = false;
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const getMarkSize = (ctx) => {
|
|
119
|
-
let defaultWidth = 120;
|
|
120
|
-
let defaultHeight = 64;
|
|
121
|
-
let space = 0;
|
|
122
|
-
const { image, content, width, height, rotate } = props;
|
|
123
|
-
if (!image && ctx.measureText) {
|
|
124
|
-
ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
|
|
125
|
-
const contents = isArray(content) ? content : [content];
|
|
126
|
-
let maxWidth = 0;
|
|
127
|
-
let maxHeight = 0;
|
|
128
|
-
contents.forEach((item) => {
|
|
129
|
-
const {
|
|
130
|
-
width: width2,
|
|
131
|
-
fontBoundingBoxAscent,
|
|
132
|
-
fontBoundingBoxDescent,
|
|
133
|
-
actualBoundingBoxAscent,
|
|
134
|
-
actualBoundingBoxDescent
|
|
135
|
-
} = ctx.measureText(item);
|
|
136
|
-
const height2 = isUndefined(fontBoundingBoxAscent) ? actualBoundingBoxAscent + actualBoundingBoxDescent : fontBoundingBoxAscent + fontBoundingBoxDescent;
|
|
137
|
-
if (width2 > maxWidth)
|
|
138
|
-
maxWidth = Math.ceil(width2);
|
|
139
|
-
if (height2 > maxHeight)
|
|
140
|
-
maxHeight = Math.ceil(height2);
|
|
141
|
-
});
|
|
142
|
-
defaultWidth = maxWidth;
|
|
143
|
-
defaultHeight = maxHeight * contents.length + (contents.length - 1) * fontGap.value;
|
|
144
|
-
const angle = Math.PI / 180 * Number(rotate);
|
|
145
|
-
space = Math.ceil(Math.abs(Math.sin(angle) * defaultHeight) / 2);
|
|
146
|
-
defaultWidth += space;
|
|
147
|
-
}
|
|
148
|
-
return [width != null ? width : defaultWidth, height != null ? height : defaultHeight, space];
|
|
149
|
-
};
|
|
150
|
-
const getClips = useClips();
|
|
151
|
-
const renderWatermark = () => {
|
|
152
|
-
const canvas = document.createElement("canvas");
|
|
153
|
-
const ctx = canvas.getContext("2d");
|
|
154
|
-
const image = props.image;
|
|
155
|
-
const content = props.content;
|
|
156
|
-
const rotate = props.rotate;
|
|
157
|
-
if (ctx) {
|
|
158
|
-
if (!watermarkRef.value) {
|
|
159
|
-
watermarkRef.value = document.createElement("div");
|
|
160
|
-
}
|
|
161
|
-
const ratio = getPixelRatio();
|
|
162
|
-
const [markWidth, markHeight, space] = getMarkSize(ctx);
|
|
163
|
-
const drawCanvas = (drawContent) => {
|
|
164
|
-
const [textClips, clipWidth] = getClips(
|
|
165
|
-
drawContent || "",
|
|
166
|
-
rotate,
|
|
167
|
-
ratio,
|
|
168
|
-
markWidth,
|
|
169
|
-
markHeight,
|
|
170
|
-
{
|
|
171
|
-
color: color.value,
|
|
172
|
-
fontSize: fontSize.value,
|
|
173
|
-
fontStyle: fontStyle.value,
|
|
174
|
-
fontWeight: fontWeight.value,
|
|
175
|
-
fontFamily: fontFamily.value,
|
|
176
|
-
fontGap: fontGap.value,
|
|
177
|
-
textAlign: textAlign.value,
|
|
178
|
-
textBaseline: textBaseline.value
|
|
179
|
-
},
|
|
180
|
-
gapX.value,
|
|
181
|
-
gapY.value,
|
|
182
|
-
space
|
|
183
|
-
);
|
|
184
|
-
appendWatermark(textClips, clipWidth);
|
|
185
|
-
};
|
|
186
|
-
if (image) {
|
|
187
|
-
const img = new Image();
|
|
188
|
-
img.onload = () => {
|
|
189
|
-
drawCanvas(img);
|
|
190
|
-
};
|
|
191
|
-
img.onerror = () => {
|
|
192
|
-
drawCanvas(content);
|
|
193
|
-
};
|
|
194
|
-
img.crossOrigin = "anonymous";
|
|
195
|
-
img.referrerPolicy = "no-referrer";
|
|
196
|
-
img.src = image;
|
|
197
|
-
} else {
|
|
198
|
-
drawCanvas(content);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
onMounted(() => {
|
|
203
|
-
renderWatermark();
|
|
204
|
-
});
|
|
205
|
-
watch(
|
|
206
|
-
() => props,
|
|
207
|
-
() => {
|
|
208
|
-
renderWatermark();
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
deep: true,
|
|
212
|
-
flush: "post"
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
onBeforeUnmount(() => {
|
|
216
|
-
destroyWatermark();
|
|
217
|
-
});
|
|
218
|
-
const onMutate = (mutations) => {
|
|
219
|
-
if (stopObservation.value) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
mutations.forEach((mutation) => {
|
|
223
|
-
if (reRendering(mutation, watermarkRef.value)) {
|
|
224
|
-
destroyWatermark();
|
|
225
|
-
renderWatermark();
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
useMutationObserver(containerRef, onMutate, {
|
|
230
|
-
attributes: true,
|
|
231
|
-
subtree: true,
|
|
232
|
-
childList: true
|
|
233
|
-
});
|
|
234
|
-
return (_ctx, _cache) => {
|
|
235
|
-
return openBlock(), createElementBlock(
|
|
236
|
-
"div",
|
|
237
|
-
{
|
|
238
|
-
ref_key: "containerRef",
|
|
239
|
-
ref: containerRef,
|
|
240
|
-
style: normalizeStyle([style])
|
|
241
|
-
},
|
|
242
|
-
[
|
|
243
|
-
renderSlot(_ctx.$slots, "default")
|
|
244
|
-
],
|
|
245
|
-
4
|
|
246
|
-
);
|
|
247
|
-
};
|
|
8
|
+
rotate: {
|
|
9
|
+
type: Number,
|
|
10
|
+
default: -22
|
|
11
|
+
},
|
|
12
|
+
width: Number,
|
|
13
|
+
height: Number,
|
|
14
|
+
image: String,
|
|
15
|
+
content: {
|
|
16
|
+
type: definePropType([String, Array]),
|
|
17
|
+
default: "Element Plus"
|
|
18
|
+
},
|
|
19
|
+
font: {
|
|
20
|
+
type: definePropType(Object)
|
|
21
|
+
},
|
|
22
|
+
gap: {
|
|
23
|
+
type: definePropType(Array),
|
|
24
|
+
default: () => [100, 100]
|
|
25
|
+
},
|
|
26
|
+
offset: {
|
|
27
|
+
type: definePropType(Array)
|
|
248
28
|
}
|
|
249
29
|
});
|
|
250
|
-
var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/watermark/src/watermark.vue"]]);
|
|
251
30
|
|
|
252
|
-
export {
|
|
31
|
+
export { watermarkProps };
|
|
253
32
|
//# sourceMappingURL=watermark.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watermark.mjs","sources":["../../../../../../packages/components/watermark/src/watermark.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" :style=\"[style]\">\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n ref,\n shallowRef,\n watch,\n} from 'vue'\nimport { useMutationObserver } from '@vueuse/core'\nimport { isArray, isUndefined } from '@element-plus/utils'\nimport { watermarkProps } from './watermark'\nimport { getPixelRatio, getStyleStr, reRendering } from './utils'\nimport useClips from './useClips'\n\nimport type { WatermarkProps } from './watermark'\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElWatermark',\n})\n\nconst style: CSSProperties = {\n position: 'relative',\n}\n\nconst props = defineProps(watermarkProps)\nconst fontGap = computed(() => props.font?.fontGap ?? 3)\nconst color = computed(() => props.font?.color ?? 'rgba(0,0,0,.15)')\nconst fontSize = computed(() => props.font?.fontSize ?? 16)\nconst fontWeight = computed(() => props.font?.fontWeight ?? 'normal')\nconst fontStyle = computed(() => props.font?.fontStyle ?? 'normal')\nconst fontFamily = computed(() => props.font?.fontFamily ?? 'sans-serif')\nconst textAlign = computed(() => props.font?.textAlign ?? 'center')\nconst textBaseline = computed(() => props.font?.textBaseline ?? 'hanging')\n\nconst gapX = computed(() => props.gap[0])\nconst gapY = computed(() => props.gap[1])\nconst gapXCenter = computed(() => gapX.value / 2)\nconst gapYCenter = computed(() => gapY.value / 2)\nconst offsetLeft = computed(() => props.offset?.[0] ?? gapXCenter.value)\nconst offsetTop = computed(() => props.offset?.[1] ?? gapYCenter.value)\n\nconst getMarkStyle = () => {\n const markStyle: CSSProperties = {\n zIndex: props.zIndex,\n position: 'absolute',\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n backgroundRepeat: 'repeat',\n }\n\n /** Calculate the style of the offset */\n let positionLeft = offsetLeft.value - gapXCenter.value\n let positionTop = offsetTop.value - gapYCenter.value\n if (positionLeft > 0) {\n markStyle.left = `${positionLeft}px`\n markStyle.width = `calc(100% - ${positionLeft}px)`\n positionLeft = 0\n }\n if (positionTop > 0) {\n markStyle.top = `${positionTop}px`\n markStyle.height = `calc(100% - ${positionTop}px)`\n positionTop = 0\n }\n markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`\n\n return markStyle\n}\n\nconst containerRef = shallowRef<HTMLDivElement | null>(null)\nconst watermarkRef = shallowRef<HTMLDivElement>()\nconst stopObservation = ref(false)\n\nconst destroyWatermark = () => {\n if (watermarkRef.value) {\n watermarkRef.value.remove()\n watermarkRef.value = undefined\n }\n}\nconst appendWatermark = (base64Url: string, markWidth: number) => {\n if (containerRef.value && watermarkRef.value) {\n stopObservation.value = true\n watermarkRef.value.setAttribute(\n 'style',\n getStyleStr({\n ...getMarkStyle(),\n backgroundImage: `url('${base64Url}')`,\n backgroundSize: `${Math.floor(markWidth)}px`,\n })\n )\n containerRef.value?.append(watermarkRef.value)\n // Delayed execution\n setTimeout(() => {\n stopObservation.value = false\n })\n }\n}\n\n/**\n * Get the width and height of the watermark. The default values are as follows\n * Image: [120, 64]; Content: It's calculated by content;\n */\nconst getMarkSize = (ctx: CanvasRenderingContext2D) => {\n let defaultWidth = 120\n let defaultHeight = 64\n let space = 0\n\n const { image, content, width, height, rotate } = props\n\n if (!image && ctx.measureText) {\n ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`\n\n const contents = isArray(content) ? content : [content]\n let maxWidth = 0\n let maxHeight = 0\n\n contents.forEach((item) => {\n const {\n width,\n fontBoundingBoxAscent,\n fontBoundingBoxDescent,\n actualBoundingBoxAscent,\n actualBoundingBoxDescent,\n } = ctx.measureText(item!)\n // Using `actualBoundingBoxAscent` to be compatible with lower version browsers (eg: Firefox < 116)\n const height = isUndefined(fontBoundingBoxAscent)\n ? actualBoundingBoxAscent + actualBoundingBoxDescent\n : fontBoundingBoxAscent + fontBoundingBoxDescent\n\n if (width > maxWidth) maxWidth = Math.ceil(width)\n if (height > maxHeight) maxHeight = Math.ceil(height)\n })\n\n defaultWidth = maxWidth\n defaultHeight =\n maxHeight * contents.length + (contents.length - 1) * fontGap.value\n\n const angle = (Math.PI / 180) * Number(rotate)\n space = Math.ceil(Math.abs(Math.sin(angle) * defaultHeight) / 2)\n\n defaultWidth += space\n }\n\n return [width ?? defaultWidth, height ?? defaultHeight, space] as const\n}\n\nconst getClips = useClips()\n\nconst renderWatermark = () => {\n const canvas = document.createElement('canvas')\n const ctx = canvas.getContext('2d')\n const image = props.image\n const content = props.content\n const rotate = props.rotate\n\n if (ctx) {\n if (!watermarkRef.value) {\n watermarkRef.value = document.createElement('div')\n }\n\n const ratio = getPixelRatio()\n const [markWidth, markHeight, space] = getMarkSize(ctx)\n\n const drawCanvas = (\n drawContent?: NonNullable<WatermarkProps['content']> | HTMLImageElement\n ) => {\n const [textClips, clipWidth] = getClips(\n drawContent || '',\n rotate,\n ratio,\n markWidth,\n markHeight,\n {\n color: color.value,\n fontSize: fontSize.value,\n fontStyle: fontStyle.value,\n fontWeight: fontWeight.value,\n fontFamily: fontFamily.value,\n fontGap: fontGap.value,\n textAlign: textAlign.value,\n textBaseline: textBaseline.value,\n },\n gapX.value,\n gapY.value,\n space\n )\n\n appendWatermark(textClips, clipWidth)\n }\n\n if (image) {\n const img = new Image()\n img.onload = () => {\n drawCanvas(img)\n }\n img.onerror = () => {\n drawCanvas(content)\n }\n img.crossOrigin = 'anonymous'\n img.referrerPolicy = 'no-referrer'\n img.src = image\n } else {\n drawCanvas(content)\n }\n }\n}\n\nonMounted(() => {\n renderWatermark()\n})\n\nwatch(\n () => props,\n () => {\n renderWatermark()\n },\n {\n deep: true,\n flush: 'post',\n }\n)\n\nonBeforeUnmount(() => {\n destroyWatermark()\n})\n\nconst onMutate = (mutations: MutationRecord[]) => {\n if (stopObservation.value) {\n return\n }\n mutations.forEach((mutation) => {\n if (reRendering(mutation, watermarkRef.value)) {\n destroyWatermark()\n renderWatermark()\n }\n })\n}\n\nuseMutationObserver(containerRef, onMutate, {\n attributes: true,\n subtree: true,\n childList: true,\n})\n</script>\n"],"names":["width","height","_openBlock","_createElementBlock","_normalizeStyle","_renderSlot"],"mappings":";;;;;;;;;;;;;;;;AA4BA,IAAA,MAAM,KAAuB,GAAA;AAAA,MAC3B,QAAU,EAAA,UAAA;AAAA,KACZ,CAAA;AAEA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAM,MAAA,OAAA,GAAU,SAAS,MAAA;;AAAM,MAAM,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,KAAA,CAAA,IAAA,KAAN,IAAY,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAA,KAAZ,IAAuB,GAAA,EAAA,GAAA,CAAA,CAAA;AAAA,KAAC,CAAA,CAAA;AACvD,IAAM,MAAA,KAAA,GAAQ,SAAS,MAAA;;AAAM,MAAM,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAA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EAAA,CAAA;AAAA,KAClB,CAAA,CAAA;AAEK,IAAA,MAAA,QAAA,GAAW,CAAC,SAAgC,KAAA;AAChD,MAAA,IAAI,gBAAgB,KAAO,EAAA;AACzB,QAAA,OAAA;AAAA,OACF;AACU,MAAA,SAAA,CAAA,OAAA,CAAQ,CAAC,QAAa,KAAA;AAC9B,QAAA,IAAI,WAAY,CAAA,QAAA,EAAU,YAAa,CAAA,KAAK,CAAG,EAAA;AAC5B,UAAA,gBAAA,EAAA,CAAA;AACD,UAAA,eAAA,EAAA,CAAA;AAAA,SAClB;AAAA,OACD,CAAA,CAAA;AAAA,KACH,CAAA;AAEA,IAAA,mBAAA,CAAoB,cAAc,QAAU,EAAA;AAAA,MAC1C,UAAY,EAAA,IAAA;AAAA,MACZ,OAAS,EAAA,IAAA;AAAA,MACT,SAAW,EAAA,IAAA;AAAA,KACZ,CAAA,CAAA;;AA3PC,MAAA,OAAAC,WAAA,EAAAC,kBAAA;AAAA,QAEM,KAAA;AAAA,QAAA;AAAA,UAFG,OAAA,EAAA,cAAA;AAAA,UAAJ,GAAI,EAAA,YAAA;AAAA,UAAgB,KAAK,EAAAC,cAAA,EAAG,KAAK,CAAA,CAAA;AAAA,SAAA;AAAA;UACpCC,UAAA,CAAQ,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA,SAAA;AAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"watermark.mjs","sources":["../../../../../../packages/components/watermark/src/watermark.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, ExtractPublicPropTypes } from 'vue'\nimport type Watermark from './watermark.vue'\n\nexport interface WatermarkFontType {\n color?: string\n fontSize?: number | string\n fontWeight?: 'normal' | 'light' | 'weight' | number\n fontStyle?: 'none' | 'normal' | 'italic' | 'oblique'\n fontFamily?: string\n fontGap?: number\n textAlign?: 'start' | 'end' | 'left' | 'right' | 'center'\n textBaseline?:\n | 'top'\n | 'hanging'\n | 'middle'\n | 'alphabetic'\n | 'ideographic'\n | 'bottom'\n}\n\nexport const watermarkProps = buildProps({\n /**\n * @description The z-index of the appended watermark element\n */\n zIndex: {\n type: Number,\n default: 9,\n },\n /**\n * @description The rotation angle of the watermark\n */\n rotate: {\n type: Number,\n default: -22,\n },\n /**\n * @description The width of the watermark\n */\n width: Number,\n /**\n * @description The height of the watermark\n */\n height: Number,\n /**\n * @description Image source, it is recommended to export 2x or 3x image, high priority (support base64 format)\n */\n image: String,\n /**\n * @description Watermark text content\n */\n content: {\n type: definePropType<string | string[]>([String, Array]),\n default: 'Element Plus',\n },\n /**\n * @description Text style\n */\n font: {\n type: definePropType<WatermarkFontType>(Object),\n },\n /**\n * @description The spacing between watermarks\n */\n gap: {\n type: definePropType<[number, number]>(Array),\n default: () => [100, 100],\n },\n /**\n * @description The offset of the watermark from the upper left corner of the container. The default is gap/2\n */\n offset: {\n type: definePropType<[number, number]>(Array),\n },\n} as const)\n\nexport type WatermarkProps = ExtractPropTypes<typeof watermarkProps>\nexport type WatermarkPropsPublic = ExtractPublicPropTypes<typeof watermarkProps>\nexport type WatermarkInstance = InstanceType<typeof Watermark> & unknown\n"],"names":[],"mappings":";;AAsBO,MAAM,iBAAiB,UAAW,CAAA;AAAA,EAIvC,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,CAAA;AAAA,GACX;AAAA,EAIA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,CAAA,EAAA;AAAA,GACX;AAAA,EAIA,KAAO,EAAA,MAAA;AAAA,EAIP,MAAQ,EAAA,MAAA;AAAA,EAIR,KAAO,EAAA,MAAA;AAAA,EAIP,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,cAAA,CAAkC,CAAC,MAAA,EAAQ,KAAK,CAAC,CAAA;AAAA,IACvD,OAAS,EAAA,cAAA;AAAA,GACX;AAAA,EAIA,IAAM,EAAA;AAAA,IACJ,IAAA,EAAM,eAAkC,MAAM,CAAA;AAAA,GAChD;AAAA,EAIA,GAAK,EAAA;AAAA,IACH,IAAA,EAAM,eAAiC,KAAK,CAAA;AAAA,IAC5C,OAAS,EAAA,MAAM,CAAC,GAAA,EAAK,GAAG,CAAA;AAAA,GAC1B;AAAA,EAIA,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,eAAiC,KAAK,CAAA;AAAA,GAC9C;AACF,CAAU;;;;"}
|
|
@@ -1,32 +1,253 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineComponent, computed, shallowRef, ref, onMounted, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeStyle, renderSlot } from 'vue';
|
|
2
|
+
import { useMutationObserver } from '@vueuse/core';
|
|
3
|
+
import { watermarkProps } from './watermark.mjs';
|
|
4
|
+
import { reRendering, getStyleStr, getPixelRatio } from './utils.mjs';
|
|
5
|
+
import useClips from './useClips.mjs';
|
|
6
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
7
|
+
import { isArray } from '@vue/shared';
|
|
8
|
+
import { isUndefined } from '../../../utils/types.mjs';
|
|
2
9
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
default: 9
|
|
10
|
+
const _sfc_main = defineComponent({
|
|
11
|
+
...{
|
|
12
|
+
name: "ElWatermark"
|
|
7
13
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
__name: "watermark",
|
|
15
|
+
props: watermarkProps,
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const style = {
|
|
18
|
+
position: "relative"
|
|
19
|
+
};
|
|
20
|
+
const props = __props;
|
|
21
|
+
const fontGap = computed(() => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.fontGap) != null ? _b : 3;
|
|
24
|
+
});
|
|
25
|
+
const color = computed(() => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
|
|
28
|
+
});
|
|
29
|
+
const fontSize = computed(() => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
|
|
32
|
+
});
|
|
33
|
+
const fontWeight = computed(() => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
|
|
36
|
+
});
|
|
37
|
+
const fontStyle = computed(() => {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
|
|
40
|
+
});
|
|
41
|
+
const fontFamily = computed(() => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
|
|
44
|
+
});
|
|
45
|
+
const textAlign = computed(() => {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
|
|
48
|
+
});
|
|
49
|
+
const textBaseline = computed(() => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
|
|
52
|
+
});
|
|
53
|
+
const gapX = computed(() => props.gap[0]);
|
|
54
|
+
const gapY = computed(() => props.gap[1]);
|
|
55
|
+
const gapXCenter = computed(() => gapX.value / 2);
|
|
56
|
+
const gapYCenter = computed(() => gapY.value / 2);
|
|
57
|
+
const offsetLeft = computed(() => {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
|
|
60
|
+
});
|
|
61
|
+
const offsetTop = computed(() => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
|
|
64
|
+
});
|
|
65
|
+
const getMarkStyle = () => {
|
|
66
|
+
const markStyle = {
|
|
67
|
+
zIndex: props.zIndex,
|
|
68
|
+
position: "absolute",
|
|
69
|
+
left: 0,
|
|
70
|
+
top: 0,
|
|
71
|
+
width: "100%",
|
|
72
|
+
height: "100%",
|
|
73
|
+
pointerEvents: "none",
|
|
74
|
+
backgroundRepeat: "repeat"
|
|
75
|
+
};
|
|
76
|
+
let positionLeft = offsetLeft.value - gapXCenter.value;
|
|
77
|
+
let positionTop = offsetTop.value - gapYCenter.value;
|
|
78
|
+
if (positionLeft > 0) {
|
|
79
|
+
markStyle.left = `${positionLeft}px`;
|
|
80
|
+
markStyle.width = `calc(100% - ${positionLeft}px)`;
|
|
81
|
+
positionLeft = 0;
|
|
82
|
+
}
|
|
83
|
+
if (positionTop > 0) {
|
|
84
|
+
markStyle.top = `${positionTop}px`;
|
|
85
|
+
markStyle.height = `calc(100% - ${positionTop}px)`;
|
|
86
|
+
positionTop = 0;
|
|
87
|
+
}
|
|
88
|
+
markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
|
|
89
|
+
return markStyle;
|
|
90
|
+
};
|
|
91
|
+
const containerRef = shallowRef(null);
|
|
92
|
+
const watermarkRef = shallowRef();
|
|
93
|
+
const stopObservation = ref(false);
|
|
94
|
+
const destroyWatermark = () => {
|
|
95
|
+
if (watermarkRef.value) {
|
|
96
|
+
watermarkRef.value.remove();
|
|
97
|
+
watermarkRef.value = void 0;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const appendWatermark = (base64Url, markWidth) => {
|
|
101
|
+
var _a;
|
|
102
|
+
if (containerRef.value && watermarkRef.value) {
|
|
103
|
+
stopObservation.value = true;
|
|
104
|
+
watermarkRef.value.setAttribute(
|
|
105
|
+
"style",
|
|
106
|
+
getStyleStr({
|
|
107
|
+
...getMarkStyle(),
|
|
108
|
+
backgroundImage: `url('${base64Url}')`,
|
|
109
|
+
backgroundSize: `${Math.floor(markWidth)}px`
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
(_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
stopObservation.value = false;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const getMarkSize = (ctx) => {
|
|
119
|
+
let defaultWidth = 120;
|
|
120
|
+
let defaultHeight = 64;
|
|
121
|
+
let space = 0;
|
|
122
|
+
const { image, content, width, height, rotate } = props;
|
|
123
|
+
if (!image && ctx.measureText) {
|
|
124
|
+
ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
|
|
125
|
+
const contents = isArray(content) ? content : [content];
|
|
126
|
+
let maxWidth = 0;
|
|
127
|
+
let maxHeight = 0;
|
|
128
|
+
contents.forEach((item) => {
|
|
129
|
+
const {
|
|
130
|
+
width: width2,
|
|
131
|
+
fontBoundingBoxAscent,
|
|
132
|
+
fontBoundingBoxDescent,
|
|
133
|
+
actualBoundingBoxAscent,
|
|
134
|
+
actualBoundingBoxDescent
|
|
135
|
+
} = ctx.measureText(item);
|
|
136
|
+
const height2 = isUndefined(fontBoundingBoxAscent) ? actualBoundingBoxAscent + actualBoundingBoxDescent : fontBoundingBoxAscent + fontBoundingBoxDescent;
|
|
137
|
+
if (width2 > maxWidth)
|
|
138
|
+
maxWidth = Math.ceil(width2);
|
|
139
|
+
if (height2 > maxHeight)
|
|
140
|
+
maxHeight = Math.ceil(height2);
|
|
141
|
+
});
|
|
142
|
+
defaultWidth = maxWidth;
|
|
143
|
+
defaultHeight = maxHeight * contents.length + (contents.length - 1) * fontGap.value;
|
|
144
|
+
const angle = Math.PI / 180 * Number(rotate);
|
|
145
|
+
space = Math.ceil(Math.abs(Math.sin(angle) * defaultHeight) / 2);
|
|
146
|
+
defaultWidth += space;
|
|
147
|
+
}
|
|
148
|
+
return [width != null ? width : defaultWidth, height != null ? height : defaultHeight, space];
|
|
149
|
+
};
|
|
150
|
+
const getClips = useClips();
|
|
151
|
+
const renderWatermark = () => {
|
|
152
|
+
const canvas = document.createElement("canvas");
|
|
153
|
+
const ctx = canvas.getContext("2d");
|
|
154
|
+
const image = props.image;
|
|
155
|
+
const content = props.content;
|
|
156
|
+
const rotate = props.rotate;
|
|
157
|
+
if (ctx) {
|
|
158
|
+
if (!watermarkRef.value) {
|
|
159
|
+
watermarkRef.value = document.createElement("div");
|
|
160
|
+
}
|
|
161
|
+
const ratio = getPixelRatio();
|
|
162
|
+
const [markWidth, markHeight, space] = getMarkSize(ctx);
|
|
163
|
+
const drawCanvas = (drawContent) => {
|
|
164
|
+
const [textClips, clipWidth] = getClips(
|
|
165
|
+
drawContent || "",
|
|
166
|
+
rotate,
|
|
167
|
+
ratio,
|
|
168
|
+
markWidth,
|
|
169
|
+
markHeight,
|
|
170
|
+
{
|
|
171
|
+
color: color.value,
|
|
172
|
+
fontSize: fontSize.value,
|
|
173
|
+
fontStyle: fontStyle.value,
|
|
174
|
+
fontWeight: fontWeight.value,
|
|
175
|
+
fontFamily: fontFamily.value,
|
|
176
|
+
fontGap: fontGap.value,
|
|
177
|
+
textAlign: textAlign.value,
|
|
178
|
+
textBaseline: textBaseline.value
|
|
179
|
+
},
|
|
180
|
+
gapX.value,
|
|
181
|
+
gapY.value,
|
|
182
|
+
space
|
|
183
|
+
);
|
|
184
|
+
appendWatermark(textClips, clipWidth);
|
|
185
|
+
};
|
|
186
|
+
if (image) {
|
|
187
|
+
const img = new Image();
|
|
188
|
+
img.onload = () => {
|
|
189
|
+
drawCanvas(img);
|
|
190
|
+
};
|
|
191
|
+
img.onerror = () => {
|
|
192
|
+
drawCanvas(content);
|
|
193
|
+
};
|
|
194
|
+
img.crossOrigin = "anonymous";
|
|
195
|
+
img.referrerPolicy = "no-referrer";
|
|
196
|
+
img.src = image;
|
|
197
|
+
} else {
|
|
198
|
+
drawCanvas(content);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
onMounted(() => {
|
|
203
|
+
renderWatermark();
|
|
204
|
+
});
|
|
205
|
+
watch(
|
|
206
|
+
() => props,
|
|
207
|
+
() => {
|
|
208
|
+
renderWatermark();
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
deep: true,
|
|
212
|
+
flush: "post"
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
onBeforeUnmount(() => {
|
|
216
|
+
destroyWatermark();
|
|
217
|
+
});
|
|
218
|
+
const onMutate = (mutations) => {
|
|
219
|
+
if (stopObservation.value) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
mutations.forEach((mutation) => {
|
|
223
|
+
if (reRendering(mutation, watermarkRef.value)) {
|
|
224
|
+
destroyWatermark();
|
|
225
|
+
renderWatermark();
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
useMutationObserver(containerRef, onMutate, {
|
|
230
|
+
attributes: true,
|
|
231
|
+
subtree: true,
|
|
232
|
+
childList: true
|
|
233
|
+
});
|
|
234
|
+
return (_ctx, _cache) => {
|
|
235
|
+
return openBlock(), createElementBlock(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
ref_key: "containerRef",
|
|
239
|
+
ref: containerRef,
|
|
240
|
+
style: normalizeStyle([style])
|
|
241
|
+
},
|
|
242
|
+
[
|
|
243
|
+
renderSlot(_ctx.$slots, "default")
|
|
244
|
+
],
|
|
245
|
+
4
|
|
246
|
+
);
|
|
247
|
+
};
|
|
28
248
|
}
|
|
29
249
|
});
|
|
250
|
+
var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/watermark/src/watermark.vue"]]);
|
|
30
251
|
|
|
31
|
-
export {
|
|
252
|
+
export { Watermark as default };
|
|
32
253
|
//# sourceMappingURL=watermark2.mjs.map
|