@element-plus/nightly 0.0.20250701 → 0.0.20250704
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.json +1 -1
- package/dist/index.full.js +150 -108
- package/dist/index.full.min.js +16 -16
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +17 -17
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +150 -108
- 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/autocomplete/src/autocomplete.d.ts +83 -3
- package/es/components/autocomplete/src/autocomplete.mjs +3 -12
- package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete.vue.d.ts +183 -8
- package/es/components/autocomplete/src/autocomplete2.mjs +8 -11
- package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
- package/es/components/calendar/src/calendar2.mjs +1 -1
- package/es/components/calendar/src/date-table.mjs +31 -89
- package/es/components/calendar/src/date-table.mjs.map +1 -1
- package/es/components/calendar/src/date-table2.mjs +89 -31
- package/es/components/calendar/src/date-table2.mjs.map +1 -1
- package/es/components/calendar/src/use-date-table.mjs +1 -1
- package/es/components/carousel/src/constants.d.ts +2 -1
- package/es/components/carousel/src/constants.mjs.map +1 -1
- package/es/components/carousel/src/use-carousel-item.mjs +1 -0
- package/es/components/carousel/src/use-carousel-item.mjs.map +1 -1
- package/es/components/collapse/index.mjs +2 -2
- package/es/components/collapse/src/collapse.mjs +23 -28
- package/es/components/collapse/src/collapse.mjs.map +1 -1
- package/es/components/collapse/src/collapse2.mjs +28 -23
- package/es/components/collapse/src/collapse2.mjs.map +1 -1
- package/es/components/collection/index.mjs +1 -1
- package/es/components/collection/src/collection.mjs +10 -62
- package/es/components/collection/src/collection.mjs.map +1 -1
- package/es/components/collection/src/collection2.mjs +62 -10
- package/es/components/collection/src/collection2.mjs.map +1 -1
- package/es/components/drawer/index.mjs +2 -2
- package/es/components/drawer/src/drawer.mjs +26 -178
- package/es/components/drawer/src/drawer.mjs.map +1 -1
- package/es/components/drawer/src/drawer2.mjs +178 -26
- package/es/components/drawer/src/drawer2.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown-item-impl.mjs +2 -2
- package/es/components/dropdown/src/dropdown-menu.mjs +1 -1
- package/es/components/dropdown/src/dropdown.mjs +2 -2
- package/es/components/dropdown/src/dropdown2.mjs +1 -1
- package/es/components/empty/index.mjs +2 -2
- package/es/components/empty/src/empty.mjs +11 -52
- package/es/components/empty/src/empty.mjs.map +1 -1
- package/es/components/empty/src/empty2.mjs +52 -11
- package/es/components/empty/src/empty2.mjs.map +1 -1
- package/es/components/index.mjs +13 -13
- package/es/components/input/src/input.d.ts +1 -0
- package/es/components/input/src/input.mjs +2 -1
- package/es/components/input/src/input.mjs.map +1 -1
- package/es/components/input/src/input.vue.d.ts +2 -0
- package/es/components/input/src/input2.mjs +2 -1
- package/es/components/input/src/input2.mjs.map +1 -1
- package/es/components/mention/src/mention.d.ts +1 -0
- package/es/components/mention/src/mention.mjs +1 -1
- package/es/components/mention/src/mention.vue.d.ts +2 -0
- package/es/components/pagination/src/components/prev.mjs +35 -17
- package/es/components/pagination/src/components/prev.mjs.map +1 -1
- package/es/components/pagination/src/components/prev2.mjs +17 -35
- package/es/components/pagination/src/components/prev2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +1 -1
- package/es/components/popper/index.mjs +6 -6
- package/es/components/popper/src/arrow.mjs +30 -7
- package/es/components/popper/src/arrow.mjs.map +1 -1
- package/es/components/popper/src/arrow2.mjs +7 -30
- package/es/components/popper/src/arrow2.mjs.map +1 -1
- package/es/components/popper/src/content.mjs +130 -94
- package/es/components/popper/src/content.mjs.map +1 -1
- package/es/components/popper/src/content2.mjs +94 -130
- package/es/components/popper/src/content2.mjs.map +1 -1
- package/es/components/popper/src/popper.mjs +22 -32
- package/es/components/popper/src/popper.mjs.map +1 -1
- package/es/components/popper/src/popper2.mjs +32 -22
- package/es/components/popper/src/popper2.mjs.map +1 -1
- package/es/components/rate/index.mjs +2 -2
- package/es/components/rate/src/rate.mjs +83 -258
- package/es/components/rate/src/rate.mjs.map +1 -1
- package/es/components/rate/src/rate2.mjs +258 -83
- 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 +30 -62
- package/es/components/result/src/result.mjs.map +1 -1
- package/es/components/result/src/result2.mjs +62 -30
- package/es/components/result/src/result2.mjs.map +1 -1
- package/es/components/roving-focus-group/index.mjs +3 -3
- package/es/components/roving-focus-group/src/roving-focus-group-impl.mjs +1 -1
- package/es/components/roving-focus-group/src/roving-focus-group.mjs +27 -27
- package/es/components/roving-focus-group/src/roving-focus-group.mjs.map +1 -1
- package/es/components/roving-focus-group/src/roving-focus-group2.mjs +27 -27
- package/es/components/roving-focus-group/src/roving-focus-group2.mjs.map +1 -1
- package/es/components/roving-focus-group/src/roving-focus-item.mjs +1 -1
- package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
- package/es/components/select/index.mjs +1 -1
- package/es/components/select/src/option.mjs +89 -13
- package/es/components/select/src/option.mjs.map +1 -1
- package/es/components/select/src/option2.mjs +13 -89
- package/es/components/select/src/option2.mjs.map +1 -1
- package/es/components/select/src/select2.mjs +3 -2
- package/es/components/select/src/select2.mjs.map +1 -1
- package/es/components/select/src/useOption.mjs +1 -1
- package/es/components/select-v2/src/select.mjs +2 -1
- package/es/components/select-v2/src/select.mjs.map +1 -1
- package/es/components/skeleton/index.mjs +4 -4
- package/es/components/skeleton/src/skeleton-item.mjs +17 -22
- package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton-item2.mjs +22 -17
- package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.mjs +21 -48
- package/es/components/skeleton/src/skeleton.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton2.mjs +48 -21
- package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
- package/es/components/slider/src/button.mjs +19 -91
- package/es/components/slider/src/button.mjs.map +1 -1
- package/es/components/slider/src/button2.mjs +91 -19
- package/es/components/slider/src/button2.mjs.map +1 -1
- package/es/components/slider/src/slider2.mjs +1 -1
- package/es/components/splitter/src/split-panel2.mjs +1 -0
- package/es/components/splitter/src/split-panel2.mjs.map +1 -1
- package/es/components/splitter/src/type.d.ts +2 -1
- package/es/components/splitter/src/type.mjs.map +1 -1
- package/es/components/steps/src/item.vue.d.ts +2 -1
- package/es/components/steps/src/item2.mjs +1 -0
- package/es/components/steps/src/item2.mjs.map +1 -1
- package/es/components/switch/index.mjs +2 -2
- package/es/components/switch/src/switch.mjs +228 -72
- package/es/components/switch/src/switch.mjs.map +1 -1
- package/es/components/switch/src/switch2.mjs +72 -228
- package/es/components/switch/src/switch2.mjs.map +1 -1
- package/es/components/table/src/table/defaults.d.ts +2 -2
- package/es/components/table/src/table/defaults.mjs.map +1 -1
- package/es/components/table/src/table/style-helper.d.ts +2 -2
- package/es/components/table/src/table/style-helper.mjs.map +1 -1
- package/es/components/table/src/table-body/events-helper.d.ts +3 -2
- package/es/components/table/src/table-body/events-helper.mjs +24 -14
- package/es/components/table/src/table-body/events-helper.mjs.map +1 -1
- package/es/components/table/src/table-body/index.mjs +13 -12
- package/es/components/table/src/table-body/index.mjs.map +1 -1
- package/es/components/table/src/table-body/render-helper.d.ts +2 -1
- package/es/components/table/src/table-body/render-helper.mjs +14 -10
- package/es/components/table/src/table-body/render-helper.mjs.map +1 -1
- package/es/components/table/src/table-body/styles-helper.d.ts +2 -1
- package/es/components/table/src/table-body/styles-helper.mjs +2 -1
- package/es/components/table/src/table-body/styles-helper.mjs.map +1 -1
- package/es/components/table/src/table-column/defaults.d.ts +1 -1
- package/es/components/table/src/table-column/defaults.mjs.map +1 -1
- package/es/components/table/src/table-column/index.mjs +5 -5
- package/es/components/table/src/table-column/index.mjs.map +1 -1
- package/es/components/table/src/table-column/render-helper.d.ts +9 -8
- package/es/components/table/src/table-column/render-helper.mjs +2 -2
- package/es/components/table/src/table-column/render-helper.mjs.map +1 -1
- package/es/components/table/src/table-column/watcher-helper.d.ts +2 -1
- package/es/components/table/src/table-column/watcher-helper.mjs.map +1 -1
- package/es/components/table/src/table-footer/index.d.ts +12 -12
- package/es/components/table/src/table-footer/index.mjs.map +1 -1
- package/es/components/table/src/table-footer/mapState-helper.d.ts +1 -1
- package/es/components/table/src/table-footer/mapState-helper.mjs +14 -12
- package/es/components/table/src/table-footer/mapState-helper.mjs.map +1 -1
- package/es/components/table/src/table-footer/style-helper.d.ts +1 -1
- package/es/components/table/src/table-header/event-helper.d.ts +4 -2
- package/es/components/table/src/table-header/event-helper.mjs +5 -4
- package/es/components/table/src/table-header/event-helper.mjs.map +1 -1
- package/es/components/table/src/table-header/index.d.ts +18 -17
- package/es/components/table/src/table-header/index.mjs +3 -2
- package/es/components/table/src/table-header/index.mjs.map +1 -1
- package/es/components/table/src/table-header/utils-helper.d.ts +4 -3
- package/es/components/table/src/table-header/utils-helper.mjs.map +1 -1
- package/es/components/table/src/table.vue.d.ts +7 -7
- package/es/components/tabs/src/constants.d.ts +4 -1
- package/es/components/tabs/src/constants.mjs.map +1 -1
- package/es/components/tabs/src/tab-bar.d.ts +4 -0
- package/es/components/tabs/src/tab-bar.vue.d.ts +9 -0
- package/es/components/tabs/src/tab-nav.d.ts +16 -0
- package/es/components/tabs/src/tab-nav.mjs +5 -2
- package/es/components/tabs/src/tab-nav.mjs.map +1 -1
- package/es/components/tabs/src/tab-pane2.mjs +6 -1
- package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
- package/es/components/tabs/src/tabs.d.ts +2 -1
- package/es/components/tabs/src/tabs.mjs +16 -17
- package/es/components/tabs/src/tabs.mjs.map +1 -1
- package/es/components/time-picker/src/common/picker.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/tooltip/src/tooltip.mjs +2 -2
- package/es/components/tooltip/src/tooltip2.mjs +1 -1
- package/es/hooks/use-ordered-children/index.d.ts +5 -2
- package/es/hooks/use-ordered-children/index.mjs +22 -1
- package/es/hooks/use-ordered-children/index.mjs.map +1 -1
- package/es/index.d.ts +350 -25
- 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/lib/components/autocomplete/src/autocomplete.d.ts +83 -3
- package/lib/components/autocomplete/src/autocomplete.js +3 -12
- package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete.vue.d.ts +183 -8
- package/lib/components/autocomplete/src/autocomplete2.js +17 -20
- package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
- package/lib/components/calendar/src/calendar2.js +1 -1
- package/lib/components/calendar/src/date-table.js +35 -89
- package/lib/components/calendar/src/date-table.js.map +1 -1
- package/lib/components/calendar/src/date-table2.js +89 -35
- package/lib/components/calendar/src/date-table2.js.map +1 -1
- package/lib/components/calendar/src/use-date-table.js +1 -1
- package/lib/components/carousel/src/constants.d.ts +2 -1
- package/lib/components/carousel/src/constants.js.map +1 -1
- package/lib/components/carousel/src/use-carousel-item.js +1 -0
- package/lib/components/carousel/src/use-carousel-item.js.map +1 -1
- package/lib/components/collapse/index.js +2 -2
- package/lib/components/collapse/src/collapse.js +25 -28
- package/lib/components/collapse/src/collapse.js.map +1 -1
- package/lib/components/collapse/src/collapse2.js +28 -25
- package/lib/components/collapse/src/collapse2.js.map +1 -1
- package/lib/components/collection/index.js +1 -1
- package/lib/components/collection/src/collection.js +9 -62
- package/lib/components/collection/src/collection.js.map +1 -1
- package/lib/components/collection/src/collection2.js +62 -9
- package/lib/components/collection/src/collection2.js.map +1 -1
- package/lib/components/drawer/index.js +2 -2
- package/lib/components/drawer/src/drawer.js +27 -178
- package/lib/components/drawer/src/drawer.js.map +1 -1
- package/lib/components/drawer/src/drawer2.js +178 -27
- package/lib/components/drawer/src/drawer2.js.map +1 -1
- package/lib/components/dropdown/src/dropdown-item-impl.js +2 -2
- package/lib/components/dropdown/src/dropdown-menu.js +1 -1
- package/lib/components/dropdown/src/dropdown.js +2 -2
- package/lib/components/dropdown/src/dropdown2.js +1 -1
- package/lib/components/empty/index.js +2 -2
- package/lib/components/empty/src/empty.js +11 -52
- package/lib/components/empty/src/empty.js.map +1 -1
- package/lib/components/empty/src/empty2.js +52 -11
- package/lib/components/empty/src/empty2.js.map +1 -1
- package/lib/components/index.js +13 -13
- package/lib/components/input/src/input.d.ts +1 -0
- package/lib/components/input/src/input.js +2 -1
- package/lib/components/input/src/input.js.map +1 -1
- package/lib/components/input/src/input.vue.d.ts +2 -0
- package/lib/components/input/src/input2.js +2 -1
- package/lib/components/input/src/input2.js.map +1 -1
- package/lib/components/mention/src/mention.d.ts +1 -0
- package/lib/components/mention/src/mention.js +1 -1
- package/lib/components/mention/src/mention.vue.d.ts +2 -0
- package/lib/components/pagination/src/components/prev.js +35 -18
- package/lib/components/pagination/src/components/prev.js.map +1 -1
- package/lib/components/pagination/src/components/prev2.js +18 -35
- package/lib/components/pagination/src/components/prev2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +1 -1
- package/lib/components/popper/index.js +6 -6
- package/lib/components/popper/src/arrow.js +30 -8
- package/lib/components/popper/src/arrow.js.map +1 -1
- package/lib/components/popper/src/arrow2.js +8 -30
- package/lib/components/popper/src/arrow2.js.map +1 -1
- package/lib/components/popper/src/content.js +130 -99
- package/lib/components/popper/src/content.js.map +1 -1
- package/lib/components/popper/src/content2.js +99 -130
- package/lib/components/popper/src/content2.js.map +1 -1
- package/lib/components/popper/src/popper.js +25 -32
- package/lib/components/popper/src/popper.js.map +1 -1
- package/lib/components/popper/src/popper2.js +32 -25
- package/lib/components/popper/src/popper2.js.map +1 -1
- package/lib/components/rate/index.js +2 -2
- package/lib/components/rate/src/rate.js +83 -257
- package/lib/components/rate/src/rate.js.map +1 -1
- package/lib/components/rate/src/rate2.js +257 -83
- 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 +32 -62
- package/lib/components/result/src/result.js.map +1 -1
- package/lib/components/result/src/result2.js +62 -32
- package/lib/components/result/src/result2.js.map +1 -1
- package/lib/components/roving-focus-group/index.js +2 -2
- package/lib/components/roving-focus-group/src/roving-focus-group-impl.js +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-group.js +31 -27
- package/lib/components/roving-focus-group/src/roving-focus-group.js.map +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-group2.js +27 -31
- package/lib/components/roving-focus-group/src/roving-focus-group2.js.map +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-item.js +1 -1
- package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
- package/lib/components/select/index.js +1 -1
- package/lib/components/select/src/option.js +89 -14
- package/lib/components/select/src/option.js.map +1 -1
- package/lib/components/select/src/option2.js +14 -89
- package/lib/components/select/src/option2.js.map +1 -1
- package/lib/components/select/src/select2.js +3 -2
- package/lib/components/select/src/select2.js.map +1 -1
- package/lib/components/select/src/useOption.js +1 -1
- package/lib/components/select-v2/src/select.js +2 -1
- package/lib/components/select-v2/src/select.js.map +1 -1
- package/lib/components/skeleton/index.js +4 -4
- package/lib/components/skeleton/src/skeleton-item.js +17 -22
- package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
- package/lib/components/skeleton/src/skeleton-item2.js +22 -17
- package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.js +21 -48
- package/lib/components/skeleton/src/skeleton.js.map +1 -1
- package/lib/components/skeleton/src/skeleton2.js +48 -21
- package/lib/components/skeleton/src/skeleton2.js.map +1 -1
- package/lib/components/slider/src/button.js +20 -91
- package/lib/components/slider/src/button.js.map +1 -1
- package/lib/components/slider/src/button2.js +91 -20
- package/lib/components/slider/src/button2.js.map +1 -1
- package/lib/components/slider/src/slider2.js +1 -1
- package/lib/components/splitter/src/split-panel2.js +1 -0
- package/lib/components/splitter/src/split-panel2.js.map +1 -1
- package/lib/components/splitter/src/type.d.ts +2 -1
- package/lib/components/splitter/src/type.js.map +1 -1
- package/lib/components/steps/src/item.vue.d.ts +2 -1
- package/lib/components/steps/src/item2.js +1 -0
- package/lib/components/steps/src/item2.js.map +1 -1
- package/lib/components/switch/index.js +2 -2
- package/lib/components/switch/src/switch.js +227 -72
- package/lib/components/switch/src/switch.js.map +1 -1
- package/lib/components/switch/src/switch2.js +72 -227
- package/lib/components/switch/src/switch2.js.map +1 -1
- package/lib/components/table/src/table/defaults.d.ts +2 -2
- package/lib/components/table/src/table/defaults.js.map +1 -1
- package/lib/components/table/src/table/style-helper.d.ts +2 -2
- package/lib/components/table/src/table/style-helper.js.map +1 -1
- package/lib/components/table/src/table-body/events-helper.d.ts +3 -2
- package/lib/components/table/src/table-body/events-helper.js +24 -14
- package/lib/components/table/src/table-body/events-helper.js.map +1 -1
- package/lib/components/table/src/table-body/index.js +13 -12
- package/lib/components/table/src/table-body/index.js.map +1 -1
- package/lib/components/table/src/table-body/render-helper.d.ts +2 -1
- package/lib/components/table/src/table-body/render-helper.js +14 -10
- package/lib/components/table/src/table-body/render-helper.js.map +1 -1
- package/lib/components/table/src/table-body/styles-helper.d.ts +2 -1
- package/lib/components/table/src/table-body/styles-helper.js +2 -1
- package/lib/components/table/src/table-body/styles-helper.js.map +1 -1
- package/lib/components/table/src/table-column/defaults.d.ts +1 -1
- package/lib/components/table/src/table-column/defaults.js.map +1 -1
- package/lib/components/table/src/table-column/index.js +5 -5
- package/lib/components/table/src/table-column/index.js.map +1 -1
- package/lib/components/table/src/table-column/render-helper.d.ts +9 -8
- package/lib/components/table/src/table-column/render-helper.js +2 -2
- package/lib/components/table/src/table-column/render-helper.js.map +1 -1
- package/lib/components/table/src/table-column/watcher-helper.d.ts +2 -1
- package/lib/components/table/src/table-column/watcher-helper.js.map +1 -1
- package/lib/components/table/src/table-footer/index.d.ts +12 -12
- package/lib/components/table/src/table-footer/index.js.map +1 -1
- package/lib/components/table/src/table-footer/mapState-helper.d.ts +1 -1
- package/lib/components/table/src/table-footer/mapState-helper.js +14 -12
- package/lib/components/table/src/table-footer/mapState-helper.js.map +1 -1
- package/lib/components/table/src/table-footer/style-helper.d.ts +1 -1
- package/lib/components/table/src/table-header/event-helper.d.ts +4 -2
- package/lib/components/table/src/table-header/event-helper.js +5 -4
- package/lib/components/table/src/table-header/event-helper.js.map +1 -1
- package/lib/components/table/src/table-header/index.d.ts +18 -17
- package/lib/components/table/src/table-header/index.js +3 -2
- package/lib/components/table/src/table-header/index.js.map +1 -1
- package/lib/components/table/src/table-header/utils-helper.d.ts +4 -3
- package/lib/components/table/src/table-header/utils-helper.js.map +1 -1
- package/lib/components/table/src/table.vue.d.ts +7 -7
- package/lib/components/tabs/src/constants.d.ts +4 -1
- package/lib/components/tabs/src/constants.js.map +1 -1
- package/lib/components/tabs/src/tab-bar.d.ts +4 -0
- package/lib/components/tabs/src/tab-bar.vue.d.ts +9 -0
- package/lib/components/tabs/src/tab-nav.d.ts +16 -0
- package/lib/components/tabs/src/tab-nav.js +4 -1
- package/lib/components/tabs/src/tab-nav.js.map +1 -1
- package/lib/components/tabs/src/tab-pane2.js +5 -0
- package/lib/components/tabs/src/tab-pane2.js.map +1 -1
- package/lib/components/tabs/src/tabs.d.ts +2 -1
- package/lib/components/tabs/src/tabs.js +16 -17
- package/lib/components/tabs/src/tabs.js.map +1 -1
- package/lib/components/time-picker/src/common/picker.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/tooltip/src/tooltip.js +2 -2
- package/lib/components/tooltip/src/tooltip2.js +1 -1
- package/lib/hooks/use-ordered-children/index.d.ts +5 -2
- package/lib/hooks/use-ordered-children/index.js +21 -0
- package/lib/hooks/use-ordered-children/index.js.map +1 -1
- package/lib/index.d.ts +350 -25
- 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/web-types.json +1 -1
@@ -16,14 +16,14 @@ function useEvents(props) {
|
|
16
16
|
const tooltipContent = vue.ref("");
|
17
17
|
const tooltipTrigger = vue.ref(vue.h("div"));
|
18
18
|
const handleEvent = (event, row, name) => {
|
19
|
-
var _a;
|
19
|
+
var _a, _b, _c;
|
20
20
|
const table = parent;
|
21
21
|
const cell = util.getCell(event);
|
22
|
-
let column;
|
22
|
+
let column = null;
|
23
23
|
const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
|
24
24
|
if (cell) {
|
25
25
|
column = util.getColumnByCell({
|
26
|
-
columns: props.store.states.columns.value
|
26
|
+
columns: (_c = (_b = props.store) == null ? void 0 : _b.states.columns.value) != null ? _c : []
|
27
27
|
}, cell, namespace);
|
28
28
|
if (column) {
|
29
29
|
table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
|
@@ -35,17 +35,20 @@ function useEvents(props) {
|
|
35
35
|
handleEvent(event, row, "dblclick");
|
36
36
|
};
|
37
37
|
const handleClick = (event, row) => {
|
38
|
-
|
38
|
+
var _a;
|
39
|
+
(_a = props.store) == null ? void 0 : _a.commit("setCurrentRow", row);
|
39
40
|
handleEvent(event, row, "click");
|
40
41
|
};
|
41
42
|
const handleContextMenu = (event, row) => {
|
42
43
|
handleEvent(event, row, "contextmenu");
|
43
44
|
};
|
44
45
|
const handleMouseEnter = lodashUnified.debounce((index) => {
|
45
|
-
|
46
|
+
var _a;
|
47
|
+
(_a = props.store) == null ? void 0 : _a.commit("setHoverRow", index);
|
46
48
|
}, 30);
|
47
49
|
const handleMouseLeave = lodashUnified.debounce(() => {
|
48
|
-
|
50
|
+
var _a;
|
51
|
+
(_a = props.store) == null ? void 0 : _a.commit("setHoverRow", null);
|
49
52
|
}, 30);
|
50
53
|
const getPadding = (el) => {
|
51
54
|
const style = window.getComputedStyle(el, null);
|
@@ -61,7 +64,8 @@ function useEvents(props) {
|
|
61
64
|
};
|
62
65
|
};
|
63
66
|
const toggleRowClassByCell = (rowSpan, event, toggle) => {
|
64
|
-
|
67
|
+
var _a;
|
68
|
+
let node = (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.parentNode;
|
65
69
|
while (rowSpan > 1) {
|
66
70
|
node = node == null ? void 0 : node.nextSibling;
|
67
71
|
if (!node || node.nodeName !== "TR")
|
@@ -71,14 +75,16 @@ function useEvents(props) {
|
|
71
75
|
}
|
72
76
|
};
|
73
77
|
const handleCellMouseEnter = (event, row, tooltipOptions) => {
|
74
|
-
var _a, _b, _c;
|
78
|
+
var _a, _b, _c, _d, _e, _f;
|
79
|
+
if (!parent)
|
80
|
+
return;
|
75
81
|
const table = parent;
|
76
82
|
const cell = util.getCell(event);
|
77
83
|
const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
|
78
|
-
let column;
|
84
|
+
let column = null;
|
79
85
|
if (cell) {
|
80
86
|
column = util.getColumnByCell({
|
81
|
-
columns: props.store.states.columns.value
|
87
|
+
columns: (_c = (_b = props.store) == null ? void 0 : _b.states.columns.value) != null ? _c : []
|
82
88
|
}, cell, namespace);
|
83
89
|
if (!column) {
|
84
90
|
return;
|
@@ -86,7 +92,11 @@ function useEvents(props) {
|
|
86
92
|
if (cell.rowSpan > 1) {
|
87
93
|
toggleRowClassByCell(cell.rowSpan, event, style.addClass);
|
88
94
|
}
|
89
|
-
const hoverState = table.hoverState = {
|
95
|
+
const hoverState = table.hoverState = {
|
96
|
+
cell,
|
97
|
+
column,
|
98
|
+
row
|
99
|
+
};
|
90
100
|
table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
|
91
101
|
}
|
92
102
|
if (!tooltipOptions) {
|
@@ -105,9 +115,9 @@ function useEvents(props) {
|
|
105
115
|
const horizontalPadding = left + right;
|
106
116
|
const verticalPadding = top + bottom;
|
107
117
|
if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
|
108
|
-
util.createTablePopper(tooltipOptions, cell.innerText || cell.textContent, row, column, cell, table);
|
109
|
-
} else if (((
|
110
|
-
(
|
118
|
+
util.createTablePopper(tooltipOptions, (_d = (cell == null ? void 0 : cell.innerText) || (cell == null ? void 0 : cell.textContent)) != null ? _d : "", row, column, cell, table);
|
119
|
+
} else if (((_e = util.removePopper) == null ? void 0 : _e.trigger) === cell) {
|
120
|
+
(_f = util.removePopper) == null ? void 0 : _f();
|
111
121
|
}
|
112
122
|
};
|
113
123
|
const handleCellMouseLeave = (event) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events-helper.js","sources":["../../../../../../../packages/components/table/src/table-body/events-helper.ts"],"sourcesContent":["// @ts-nocheck\nimport { h, inject, ref } from 'vue'\nimport { debounce } from 'lodash-unified'\nimport { addClass, hasClass, removeClass } from '@element-plus/utils'\nimport {\n createTablePopper,\n getCell,\n getColumnByCell,\n removePopper,\n} from '../util'\nimport { TABLE_INJECTION_KEY } from '../tokens'\n\nimport type { TableColumnCtx } from '../table-column/defaults'\nimport type { TableBodyProps } from './defaults'\nimport type { TableOverflowTooltipOptions } from '../util'\n\nfunction isGreaterThan(a: number, b: number, epsilon = 0.03) {\n return a - b > epsilon\n}\n\nfunction useEvents<T>(props: Partial<TableBodyProps<T>>) {\n const parent = inject(TABLE_INJECTION_KEY)\n const tooltipContent = ref('')\n const tooltipTrigger = ref(h('div'))\n const handleEvent = (event: Event, row: T, name: string) => {\n const table = parent\n const cell = getCell(event)\n let column: TableColumnCtx<T>\n const namespace = table?.vnode.el?.dataset.prefix\n if (cell) {\n column = getColumnByCell(\n {\n columns: props.store.states.columns.value,\n },\n cell,\n namespace\n )\n if (column) {\n table?.emit(`cell-${name}`, row, column, cell, event)\n }\n }\n table?.emit(`row-${name}`, row, column, event)\n }\n const handleDoubleClick = (event: Event, row: T) => {\n handleEvent(event, row, 'dblclick')\n }\n const handleClick = (event: Event, row: T) => {\n props.store.commit('setCurrentRow', row)\n handleEvent(event, row, 'click')\n }\n const handleContextMenu = (event: Event, row: T) => {\n handleEvent(event, row, 'contextmenu')\n }\n const handleMouseEnter = debounce((index: number) => {\n props.store.commit('setHoverRow', index)\n }, 30)\n const handleMouseLeave = debounce(() => {\n props.store.commit('setHoverRow', null)\n }, 30)\n const getPadding = (el: HTMLElement) => {\n const style = window.getComputedStyle(el, null)\n const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0\n const paddingRight = Number.parseInt(style.paddingRight, 10) || 0\n const paddingTop = Number.parseInt(style.paddingTop, 10) || 0\n const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0\n return {\n left: paddingLeft,\n right: paddingRight,\n top: paddingTop,\n bottom: paddingBottom,\n }\n }\n\n const toggleRowClassByCell = (\n rowSpan: number,\n event: MouseEvent,\n toggle: (el: Element, cls: string) => void\n ) => {\n let node = event.target.parentNode\n while (rowSpan > 1) {\n node = node?.nextSibling\n if (!node || node.nodeName !== 'TR') break\n toggle(node, 'hover-row hover-fixed-row')\n rowSpan--\n }\n }\n\n const handleCellMouseEnter = (\n event: MouseEvent,\n row: T,\n tooltipOptions: TableOverflowTooltipOptions\n ) => {\n const table = parent\n const cell = getCell(event)\n const namespace = table?.vnode.el?.dataset.prefix\n let column: TableColumnCtx<T>\n if (cell) {\n column = getColumnByCell(\n {\n columns: props.store.states.columns.value,\n },\n cell,\n namespace\n )\n if (!column) {\n return\n }\n if (cell.rowSpan > 1) {\n toggleRowClassByCell(cell.rowSpan, event, addClass)\n }\n const hoverState = (table.hoverState = { cell, column, row })\n table?.emit(\n 'cell-mouse-enter',\n hoverState.row,\n hoverState.column,\n hoverState.cell,\n event\n )\n }\n\n if (!tooltipOptions) {\n return\n }\n\n // 判断是否text-overflow, 如果是就显示tooltip\n const cellChild = (event.target as HTMLElement).querySelector(\n '.cell'\n ) as HTMLElement\n if (\n !(\n hasClass(cellChild, `${namespace}-tooltip`) &&\n cellChild.childNodes.length\n )\n ) {\n return\n }\n // use range width instead of scrollWidth to determine whether the text is overflowing\n // to address a potential FireFox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1074543#c3\n const range = document.createRange()\n range.setStart(cellChild, 0)\n range.setEnd(cellChild, cellChild.childNodes.length)\n /** detail: https://github.com/element-plus/element-plus/issues/10790\n * What went wrong?\n * UI > Browser > Zoom, In Blink/WebKit, getBoundingClientRect() sometimes returns inexact values, probably due to lost precision during internal calculations. In the example above:\n * - Expected: 188\n * - Actual: 188.00000762939453\n */\n const { width: rangeWidth, height: rangeHeight } =\n range.getBoundingClientRect()\n const { width: cellChildWidth, height: cellChildHeight } =\n cellChild.getBoundingClientRect()\n\n const { top, left, right, bottom } = getPadding(cellChild)\n const horizontalPadding = left + right\n const verticalPadding = top + bottom\n if (\n isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) ||\n isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) ||\n // When using a high-resolution screen, it is possible that a returns cellChild.scrollWidth value of 1921 and\n // cellChildWidth returns a value of 1920.994140625. #16856 #16673\n isGreaterThan(cellChild.scrollWidth, cellChildWidth)\n ) {\n createTablePopper(\n tooltipOptions,\n cell.innerText || cell.textContent,\n row,\n column,\n cell,\n table\n )\n } else if (removePopper?.trigger === cell) {\n removePopper?.()\n }\n }\n const handleCellMouseLeave = (event) => {\n const cell = getCell(event)\n if (!cell) return\n if (cell.rowSpan > 1) {\n toggleRowClassByCell(cell.rowSpan, event, removeClass)\n }\n const oldHoverState = parent?.hoverState\n parent?.emit(\n 'cell-mouse-leave',\n oldHoverState?.row,\n oldHoverState?.column,\n oldHoverState?.cell,\n event\n )\n }\n\n return {\n handleDoubleClick,\n handleClick,\n handleContextMenu,\n handleMouseEnter,\n handleMouseLeave,\n handleCellMouseEnter,\n handleCellMouseLeave,\n tooltipContent,\n tooltipTrigger,\n }\n}\n\nexport default useEvents\n"],"names":["inject","TABLE_INJECTION_KEY","ref","h","getCell","getColumnByCell","debounce","addClass","hasClass","createTablePopper","removePopper","removeClass"],"mappings":";;;;;;;;;;AAUA,SAAS,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE;AAC7C,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;AACzB,CAAC;AACD,SAAS,SAAS,CAAC,KAAK,EAAE;AAC1B,EAAE,MAAM,MAAM,GAAGA,UAAM,CAACC,0BAAmB,CAAC,CAAC;AAC7C,EAAE,MAAM,cAAc,GAAGC,OAAG,CAAC,EAAE,CAAC,CAAC;AACjC,EAAE,MAAM,cAAc,GAAGA,OAAG,CAACC,KAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AACvC,EAAE,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,KAAK;AAC5C,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,MAAM,KAA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AI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,aAAa,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,aAAa,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,aAAa,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACrO,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,iBAAiB;AACrB,IAAI,WAAW;AACf,IAAI,iBAAiB;AACrB,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,IAAI,oBAAoB;AACxB,IAAI,oBAAoB;AACxB,IAAI,cAAc;AAClB,IAAI,cAAc;AAClB,GAAG,CAAC;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"events-helper.js","sources":["../../../../../../../packages/components/table/src/table-body/events-helper.ts"],"sourcesContent":["import { h, inject, ref } from 'vue'\nimport { debounce } from 'lodash-unified'\nimport { addClass, hasClass, removeClass } from '@element-plus/utils'\nimport {\n createTablePopper,\n getCell,\n getColumnByCell,\n removePopper,\n} from '../util'\nimport { TABLE_INJECTION_KEY } from '../tokens'\n\nimport type { TableColumnCtx } from '../table-column/defaults'\nimport type { TableBodyProps } from './defaults'\nimport type { TableOverflowTooltipOptions } from '../util'\nimport type { DefaultRow } from '../table/defaults'\n\nfunction isGreaterThan(a: number, b: number, epsilon = 0.03) {\n return a - b > epsilon\n}\n\nfunction useEvents<T extends DefaultRow>(props: Partial<TableBodyProps<T>>) {\n const parent = inject(TABLE_INJECTION_KEY)\n const tooltipContent = ref('')\n const tooltipTrigger = ref(h('div'))\n const handleEvent = (event: Event, row: T, name: string) => {\n const table = parent\n const cell = getCell(event)\n let column: TableColumnCtx<T> | null = null\n const namespace = table?.vnode.el?.dataset.prefix\n if (cell) {\n column = getColumnByCell(\n {\n columns: props.store?.states.columns.value ?? [],\n },\n cell,\n namespace\n )\n if (column) {\n table?.emit(`cell-${name}`, row, column, cell, event)\n }\n }\n table?.emit(`row-${name}`, row, column, event)\n }\n const handleDoubleClick = (event: Event, row: T) => {\n handleEvent(event, row, 'dblclick')\n }\n const handleClick = (event: Event, row: T) => {\n props.store?.commit('setCurrentRow', row)\n handleEvent(event, row, 'click')\n }\n const handleContextMenu = (event: Event, row: T) => {\n handleEvent(event, row, 'contextmenu')\n }\n const handleMouseEnter = debounce((index: number) => {\n props.store?.commit('setHoverRow', index)\n }, 30)\n const handleMouseLeave = debounce(() => {\n props.store?.commit('setHoverRow', null)\n }, 30)\n const getPadding = (el: HTMLElement) => {\n const style = window.getComputedStyle(el, null)\n const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0\n const paddingRight = Number.parseInt(style.paddingRight, 10) || 0\n const paddingTop = Number.parseInt(style.paddingTop, 10) || 0\n const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0\n return {\n left: paddingLeft,\n right: paddingRight,\n top: paddingTop,\n bottom: paddingBottom,\n }\n }\n\n const toggleRowClassByCell = (\n rowSpan: number,\n event: MouseEvent,\n toggle: (el: Element, cls: string) => void\n ) => {\n let node: Node | null | undefined = (event?.target as Element | null)\n ?.parentNode\n while (rowSpan > 1) {\n node = node?.nextSibling\n if (!node || node.nodeName !== 'TR') break\n toggle(node as Element, 'hover-row hover-fixed-row')\n rowSpan--\n }\n }\n\n const handleCellMouseEnter = (\n event: MouseEvent,\n row: T,\n tooltipOptions: TableOverflowTooltipOptions\n ) => {\n if (!parent) return\n const table = parent\n const cell = getCell(event)\n const namespace = table?.vnode.el?.dataset.prefix\n let column: TableColumnCtx<T> | null = null\n if (cell) {\n column = getColumnByCell(\n {\n columns: props.store?.states.columns.value ?? [],\n },\n cell,\n namespace\n )\n if (!column) {\n return\n }\n if (cell.rowSpan > 1) {\n toggleRowClassByCell(cell.rowSpan, event, addClass)\n }\n const hoverState = (table.hoverState = {\n cell,\n column: column as any,\n row,\n })\n table?.emit(\n 'cell-mouse-enter',\n hoverState.row,\n hoverState.column,\n hoverState.cell,\n event\n )\n }\n\n if (!tooltipOptions) {\n return\n }\n\n // 判断是否text-overflow, 如果是就显示tooltip\n const cellChild = (event.target as HTMLElement).querySelector(\n '.cell'\n ) as HTMLElement\n if (\n !(\n hasClass(cellChild, `${namespace}-tooltip`) &&\n cellChild.childNodes.length\n )\n ) {\n return\n }\n // use range width instead of scrollWidth to determine whether the text is overflowing\n // to address a potential FireFox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1074543#c3\n const range = document.createRange()\n range.setStart(cellChild, 0)\n range.setEnd(cellChild, cellChild.childNodes.length)\n /** detail: https://github.com/element-plus/element-plus/issues/10790\n * What went wrong?\n * UI > Browser > Zoom, In Blink/WebKit, getBoundingClientRect() sometimes returns inexact values, probably due to lost precision during internal calculations. In the example above:\n * - Expected: 188\n * - Actual: 188.00000762939453\n */\n const { width: rangeWidth, height: rangeHeight } =\n range.getBoundingClientRect()\n const { width: cellChildWidth, height: cellChildHeight } =\n cellChild.getBoundingClientRect()\n\n const { top, left, right, bottom } = getPadding(cellChild)\n const horizontalPadding = left + right\n const verticalPadding = top + bottom\n if (\n isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) ||\n isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) ||\n // When using a high-resolution screen, it is possible that a returns cellChild.scrollWidth value of 1921 and\n // cellChildWidth returns a value of 1920.994140625. #16856 #16673\n isGreaterThan(cellChild.scrollWidth, cellChildWidth)\n ) {\n createTablePopper(\n tooltipOptions,\n (cell?.innerText || cell?.textContent) ?? '',\n row,\n column,\n cell,\n table\n )\n } else if (removePopper?.trigger === cell) {\n removePopper?.()\n }\n }\n const handleCellMouseLeave = (event: MouseEvent) => {\n const cell = getCell(event)\n if (!cell) return\n if (cell.rowSpan > 1) {\n toggleRowClassByCell(cell.rowSpan, event, removeClass)\n }\n const oldHoverState = parent?.hoverState\n parent?.emit(\n 'cell-mouse-leave',\n oldHoverState?.row,\n oldHoverState?.column,\n oldHoverState?.cell,\n event\n )\n }\n\n return {\n handleDoubleClick,\n handleClick,\n handleContextMenu,\n handleMouseEnter,\n handleMouseLeave,\n handleCellMouseEnter,\n handleCellMouseLeave,\n tooltipContent,\n tooltipTrigger,\n }\n}\n\nexport default useEvents\n"],"names":["inject","TABLE_INJECTION_KEY","ref","h","getCell","getColumnByCell","debounce","addClass","hasClass","createTablePopper","removePopper","removeClass"],"mappings":";;;;;;;;;;AAUA,SAAS,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE;AAC7C,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;AACzB,CAAC;AACD,SAAS,SAAS,CAAC,KAAK,EAAE;AAC1B,EAAE,MAAM,MAAM,GAAGA,UAAM,CAACC,0BAAmB,CAAC,CAAC;AAC7C,EAAE,MAAM,cAAc,GAAGC,OAAG,CAAC,EAAE,CAAC,CAAC;AACjC,EAAE,MAAM,cAAc,GAAGA,OAAG,CAACC,KAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AACvC,EAAE,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,KAAK;AAC5C,IAAI,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AACnB,IAAI,MAAM,KAAK,GAAG,MAAM,CAAC;AACzB,IAAI,MAAM,IAAI,GAAGC,YAAO,CAAC,KAAK,CAAC,CAAC;AAChC,IAAI,IAAI,MAAM,GAAG,IAAI,CAAC;AACtB,IAAI,MAAM,SAAS,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;AAC1G,IAAI,IAAI,IAAI,EAAE;AACd,MAAM,MAAM,GAAGC,oBAAe,CAAC;AAC/B,QAAQ,OAAO,EAAE,CA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,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;AAClD,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,MAAM,oBAAoB,GAAG,CAAC,KAAK,KAAK;AAC1C,IAAI,MAAM,IAAI,GAAGN,YAAO,CAAC,KAAK,CAAC,CAAC;AAChC,IAAI,IAAI,CAAC,IAAI;AACb,MAAM,OAAO;AACb,IAAI,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE;AAC1B,MAAM,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAEO,iBAAW,CAAC,CAAC;AAC7D,KAAK;AACL,IAAI,MAAM,aAAa,GAAG,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC;AACtE,IAAI,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,aAAa,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,aAAa,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,aAAa,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACrO,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,iBAAiB;AACrB,IAAI,WAAW;AACf,IAAI,iBAAiB;AACrB,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,IAAI,oBAAoB;AACxB,IAAI,oBAAoB;AACxB,IAAI,cAAc;AAClB,IAAI,cAAc;AAClB,GAAG,CAAC;AACJ;;;;"}
|
@@ -17,24 +17,25 @@ var TableBody = vue.defineComponent({
|
|
17
17
|
name: "ElTableBody",
|
18
18
|
props: defaults["default"],
|
19
19
|
setup(props) {
|
20
|
+
var _a;
|
20
21
|
const instance = vue.getCurrentInstance();
|
21
22
|
const parent = vue.inject(tokens.TABLE_INJECTION_KEY);
|
22
23
|
const ns = index.useNamespace("table");
|
23
24
|
const { wrappedRowRender, tooltipContent, tooltipTrigger } = renderHelper["default"](props);
|
24
25
|
const { onColumnsChange, onScrollableChange } = layoutObserver["default"](parent);
|
25
26
|
const hoveredCellList = [];
|
26
|
-
vue.watch(props.store.states.hoverRow, (newVal, oldVal) => {
|
27
|
-
var
|
27
|
+
vue.watch((_a = props.store) == null ? void 0 : _a.states.hoverRow, (newVal, oldVal) => {
|
28
|
+
var _a2, _b;
|
28
29
|
const el = instance == null ? void 0 : instance.vnode.el;
|
29
30
|
const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
|
30
31
|
let rowNum = newVal;
|
31
|
-
const childNodes = (
|
32
|
+
const childNodes = (_a2 = rows[rowNum]) == null ? void 0 : _a2.childNodes;
|
32
33
|
if (childNodes == null ? void 0 : childNodes.length) {
|
33
34
|
let control = 0;
|
34
35
|
const indexes = Array.from(childNodes).reduce((acc, item, index) => {
|
35
|
-
var
|
36
|
-
if (((
|
37
|
-
control = (
|
36
|
+
var _a3, _b2;
|
37
|
+
if (((_a3 = childNodes[index]) == null ? void 0 : _a3.colSpan) > 1) {
|
38
|
+
control = (_b2 = childNodes[index]) == null ? void 0 : _b2.colSpan;
|
38
39
|
}
|
39
40
|
if (item.nodeName !== "TD" && control === 0) {
|
40
41
|
acc.push(index);
|
@@ -43,10 +44,10 @@ var TableBody = vue.defineComponent({
|
|
43
44
|
return acc;
|
44
45
|
}, []);
|
45
46
|
indexes.forEach((rowIndex) => {
|
46
|
-
var
|
47
|
+
var _a3;
|
47
48
|
rowNum = newVal;
|
48
49
|
while (rowNum > 0) {
|
49
|
-
const preChildNodes = (
|
50
|
+
const preChildNodes = (_a3 = rows[rowNum - 1]) == null ? void 0 : _a3.childNodes;
|
50
51
|
if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
|
51
52
|
style.addClass(preChildNodes[rowIndex], "hover-cell");
|
52
53
|
hoveredCellList.push(preChildNodes[rowIndex]);
|
@@ -59,7 +60,7 @@ var TableBody = vue.defineComponent({
|
|
59
60
|
hoveredCellList.forEach((item) => style.removeClass(item, "hover-cell"));
|
60
61
|
hoveredCellList.length = 0;
|
61
62
|
}
|
62
|
-
if (!props.store.states.isComplex.value || !core.isClient)
|
63
|
+
if (!((_b = props.store) == null ? void 0 : _b.states.isComplex.value) || !core.isClient)
|
63
64
|
return;
|
64
65
|
raf.rAF(() => {
|
65
66
|
const oldRow = rows[oldVal];
|
@@ -73,8 +74,8 @@ var TableBody = vue.defineComponent({
|
|
73
74
|
});
|
74
75
|
});
|
75
76
|
vue.onUnmounted(() => {
|
76
|
-
var
|
77
|
-
(
|
77
|
+
var _a2;
|
78
|
+
(_a2 = util.removePopper) == null ? void 0 : _a2();
|
78
79
|
});
|
79
80
|
return {
|
80
81
|
ns,
|
@@ -87,7 +88,7 @@ var TableBody = vue.defineComponent({
|
|
87
88
|
},
|
88
89
|
render() {
|
89
90
|
const { wrappedRowRender, store } = this;
|
90
|
-
const data = store.states.data.value || [];
|
91
|
+
const data = (store == null ? void 0 : store.states.data.value) || [];
|
91
92
|
return vue.h("tbody", { tabIndex: -1 }, [
|
92
93
|
data.reduce((acc, row) => {
|
93
94
|
return acc.concat(wrappedRowRender(row, acc.length));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../packages/components/table/src/table-body/index.ts"],"sourcesContent":["
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../packages/components/table/src/table-body/index.ts"],"sourcesContent":["import {\n defineComponent,\n getCurrentInstance,\n h,\n inject,\n onUnmounted,\n watch,\n} from 'vue'\nimport { addClass, isClient, rAF, removeClass } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport useLayoutObserver from '../layout-observer'\nimport { removePopper } from '../util'\nimport { TABLE_INJECTION_KEY } from '../tokens'\nimport useRender from './render-helper'\nimport defaultProps from './defaults'\n\nimport type { VNode } from 'vue'\n\nexport default defineComponent({\n name: 'ElTableBody',\n props: defaultProps,\n setup(props) {\n const instance = getCurrentInstance()\n const parent = inject(TABLE_INJECTION_KEY)\n const ns = useNamespace('table')\n const { wrappedRowRender, tooltipContent, tooltipTrigger } =\n useRender(props)\n const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent!)\n\n const hoveredCellList: HTMLTableCellElement[] = []\n watch(props.store?.states.hoverRow, (newVal: any, oldVal: any) => {\n const el = instance?.vnode.el as HTMLElement\n const rows = Array.from(el?.children || []).filter((e) =>\n e?.classList.contains(`${ns.e('row')}`)\n )\n\n // hover rowSpan > 1 choose the whole row\n let rowNum = newVal\n const childNodes = rows[rowNum]\n ?.childNodes as NodeListOf<HTMLTableCellElement>\n if (childNodes?.length) {\n let control = 0\n const indexes = Array.from(childNodes).reduce((acc, item, index) => {\n // drop colsSpan\n if (childNodes[index]?.colSpan > 1) {\n control = childNodes[index]?.colSpan\n }\n if (item.nodeName !== 'TD' && control === 0) {\n acc.push(index)\n }\n control > 0 && control--\n return acc\n }, [] as number[])\n\n indexes.forEach((rowIndex) => {\n rowNum = newVal\n while (rowNum > 0) {\n // find from previous\n const preChildNodes = rows[rowNum - 1]\n ?.childNodes as NodeListOf<HTMLTableCellElement>\n\n if (\n preChildNodes[rowIndex] &&\n preChildNodes[rowIndex].nodeName === 'TD' &&\n preChildNodes[rowIndex].rowSpan > 1\n ) {\n addClass(preChildNodes[rowIndex], 'hover-cell')\n hoveredCellList.push(preChildNodes[rowIndex])\n break\n }\n rowNum--\n }\n })\n } else {\n hoveredCellList.forEach((item) => removeClass(item, 'hover-cell'))\n hoveredCellList.length = 0\n }\n if (!props.store?.states.isComplex.value || !isClient) return\n\n rAF(() => {\n // just get first level children; fix #9723\n const oldRow = rows[oldVal]\n const newRow = rows[newVal]\n // when there is fixed row, hover on rowSpan > 1 should not clear the class\n if (oldRow && !oldRow.classList.contains('hover-fixed-row')) {\n removeClass(oldRow, 'hover-row')\n }\n if (newRow) {\n addClass(newRow, 'hover-row')\n }\n })\n })\n\n onUnmounted(() => {\n removePopper?.()\n })\n\n return {\n ns,\n onColumnsChange,\n onScrollableChange,\n wrappedRowRender,\n tooltipContent,\n tooltipTrigger,\n }\n },\n render() {\n const { wrappedRowRender, store } = this\n const data = store?.states.data.value || []\n // Why do we need tabIndex: -1 ?\n // If you set the tabindex attribute on an element ,\n // then its child content cannot be scrolled with the arrow keys,\n // unless you set tabindex on the content too\n // See https://github.com/facebook/react/issues/25462#issuecomment-1274775248 or https://developer.mozilla.org/zh-CN/docs/Web/HTML/Global_attributes/tabindex\n return h('tbody', { tabIndex: -1 }, [\n data.reduce((acc: VNode[], row) => {\n return acc.concat(wrappedRowRender(row, acc.length) as VNode[])\n }, []),\n ])\n },\n})\n"],"names":["defineComponent","defaultProps","getCurrentInstance","inject","TABLE_INJECTION_KEY","useNamespace","useRender","useLayoutObserver","watch","addClass","removeClass","isClient","rAF","onUnmounted","removePopper","h"],"mappings":";;;;;;;;;;;;;;;AAeA,gBAAeA,mBAAe,CAAC;AAC/B,EAAE,IAAI,EAAE,aAAa;AACrB,EAAE,KAAK,EAAEC,mBAAY;AACrB,EAAE,KAAK,CAAC,KAAK,EAAE;AACf,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,MAAM,QAAQ,GAAGC,sBAAkB,EAAE,CAAC;AAC1C,IAAI,MAAM,MAAM,GAAGC,UAAM,CAACC,0BAAmB,CAAC,CAAC;AAC/C,IAAI,MAAM,EAAE,GAAGC,kBAAY,CAAC,OAAO,CAAC,CAAC;AACrC,IAAI,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,GAAGC,uBAAS,CAAC,KAAK,CAAC,CAAC;AAClF,IAAI,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,GAAGC,yBAAiB,CAAC,MAAM,CAAC,CAAC;AAC9E,IAAI,MAAM,eAAe,GAAG,EAAE,CAAC;AAC/B,IAAIC,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AAC,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;AAC1E,IAAI,OAAOC,KAAC,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;AACxC,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK;AAChC,QAAQ,OAAO,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7D,OAAO,EAAE,EAAE,CAAC;AACZ,KAAK,CAAC,CAAC;AACP,GAAG;AACH,CAAC,CAAC;;;;"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { TableBodyProps } from './defaults';
|
2
|
-
|
2
|
+
import type { DefaultRow } from '../table/defaults';
|
3
|
+
declare function useRender<T extends DefaultRow>(props: Partial<TableBodyProps<T>>): {
|
3
4
|
wrappedRowRender: (row: T, $index: number) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
4
5
|
[key: string]: any;
|
5
6
|
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
@@ -35,10 +35,12 @@ function useRender(props) {
|
|
35
35
|
getColspanRealWidth
|
36
36
|
} = stylesHelper["default"](props);
|
37
37
|
const firstDefaultColumnIndex = vue.computed(() => {
|
38
|
-
|
38
|
+
var _a;
|
39
|
+
return (_a = props.store) == null ? void 0 : _a.states.columns.value.findIndex(({ type }) => type === "default");
|
39
40
|
});
|
40
41
|
const getKeyOfRow = (row, index) => {
|
41
|
-
|
42
|
+
var _a;
|
43
|
+
const rowKey = (_a = parent == null ? void 0 : parent.props) == null ? void 0 : _a.rowKey;
|
42
44
|
if (rowKey) {
|
43
45
|
return util.getRowIdentity(row, rowKey);
|
44
46
|
}
|
@@ -51,7 +53,7 @@ function useRender(props) {
|
|
51
53
|
let display = true;
|
52
54
|
if (treeRowData) {
|
53
55
|
rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
|
54
|
-
display = treeRowData.display;
|
56
|
+
display = !!treeRowData.display;
|
55
57
|
}
|
56
58
|
const displayStyle = display ? null : { display: "none" };
|
57
59
|
return vue.h("tr", {
|
@@ -71,7 +73,7 @@ function useRender(props) {
|
|
71
73
|
const columnData = Object.assign({}, column);
|
72
74
|
columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
|
73
75
|
const data = {
|
74
|
-
store
|
76
|
+
store,
|
75
77
|
_self: props.context || parent,
|
76
78
|
column: columnData,
|
77
79
|
row,
|
@@ -81,7 +83,7 @@ function useRender(props) {
|
|
81
83
|
};
|
82
84
|
if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
|
83
85
|
data.treeNode = {
|
84
|
-
indent: treeRowData.level * indent.value,
|
86
|
+
indent: treeRowData.level && treeRowData.level * indent.value,
|
85
87
|
level: treeRowData.level
|
86
88
|
};
|
87
89
|
if (types.isBoolean(treeRowData.expanded)) {
|
@@ -112,7 +114,7 @@ function useRender(props) {
|
|
112
114
|
});
|
113
115
|
}));
|
114
116
|
};
|
115
|
-
const cellChildren = (
|
117
|
+
const cellChildren = (_cellIndex, column, data) => {
|
116
118
|
return column.renderCell(data);
|
117
119
|
};
|
118
120
|
const wrappedRowRender = (row, $index) => {
|
@@ -124,7 +126,7 @@ function useRender(props) {
|
|
124
126
|
if (hasExpandColumn) {
|
125
127
|
const expanded = isRowExpanded(row);
|
126
128
|
const tr = rowRender(row, $index, void 0, expanded);
|
127
|
-
const renderExpanded = parent.renderExpanded;
|
129
|
+
const renderExpanded = parent == null ? void 0 : parent.renderExpanded;
|
128
130
|
if (!renderExpanded) {
|
129
131
|
console.error("[Element Error]renderExpanded is required.");
|
130
132
|
return tr;
|
@@ -151,16 +153,18 @@ function useRender(props) {
|
|
151
153
|
treeRowData = {
|
152
154
|
expanded: cur.expanded,
|
153
155
|
level: cur.level,
|
154
|
-
display: true
|
156
|
+
display: true,
|
157
|
+
noLazyChildren: void 0,
|
158
|
+
loading: void 0
|
155
159
|
};
|
156
160
|
if (types.isBoolean(cur.lazy)) {
|
157
|
-
if (types.isBoolean(cur.loaded) && cur.loaded) {
|
161
|
+
if (treeRowData && types.isBoolean(cur.loaded) && cur.loaded) {
|
158
162
|
treeRowData.noLazyChildren = !(cur.children && cur.children.length);
|
159
163
|
}
|
160
164
|
treeRowData.loading = cur.loading;
|
161
165
|
}
|
162
166
|
}
|
163
|
-
const tmp = [rowRender(row, $index, treeRowData)];
|
167
|
+
const tmp = [rowRender(row, $index, treeRowData != null ? treeRowData : void 0)];
|
164
168
|
if (cur) {
|
165
169
|
let i = 0;
|
166
170
|
const traverse = (children, parent2) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"render-helper.js","sources":["../../../../../../../packages/components/table/src/table-body/render-helper.ts"],"sourcesContent":["// @ts-nocheck\nimport { computed, h, inject } from 'vue'\nimport { merge } from 'lodash-unified'\nimport { useNamespace } from '@element-plus/hooks'\nimport { isBoolean, isPropAbsent } from '@element-plus/utils'\nimport { getRowIdentity } from '../util'\nimport { TABLE_INJECTION_KEY } from '../tokens'\nimport useEvents from './events-helper'\nimport useStyles from './styles-helper'\nimport TdWrapper from './td-wrapper.vue'\n\nimport type { TableBodyProps } from './defaults'\nimport type { RenderRowData, TableProps, TreeNode } from '../table/defaults'\n\nfunction useRender<T>(props: Partial<TableBodyProps<T>>) {\n const parent = inject(TABLE_INJECTION_KEY)\n const ns = useNamespace('table')\n const {\n handleDoubleClick,\n handleClick,\n handleContextMenu,\n handleMouseEnter,\n handleMouseLeave,\n handleCellMouseEnter,\n handleCellMouseLeave,\n tooltipContent,\n tooltipTrigger,\n } = useEvents(props)\n const {\n getRowStyle,\n getRowClass,\n getCellStyle,\n getCellClass,\n getSpan,\n getColspanRealWidth,\n } = useStyles(props)\n const firstDefaultColumnIndex = computed(() => {\n return props.store.states.columns.value.findIndex(\n ({ type }) => type === 'default'\n )\n })\n const getKeyOfRow = (row: T, index: number) => {\n const rowKey = (parent.props as Partial<TableProps<T>>).rowKey\n if (rowKey) {\n return getRowIdentity(row, rowKey)\n }\n return index\n }\n const rowRender = (\n row: T,\n $index: number,\n treeRowData?: TreeNode,\n expanded = false\n ) => {\n const { tooltipEffect, tooltipOptions, store } = props\n const { indent, columns } = store.states\n const rowClasses = getRowClass(row, $index)\n let display = true\n if (treeRowData) {\n rowClasses.push(ns.em('row', `level-${treeRowData.level}`))\n display = treeRowData.display\n }\n const displayStyle = display ? null : { display: 'none' }\n return h(\n 'tr',\n {\n style: [displayStyle, getRowStyle(row, $index)],\n class: rowClasses,\n key: getKeyOfRow(row, $index),\n onDblclick: ($event) => handleDoubleClick($event, row),\n onClick: ($event) => handleClick($event, row),\n onContextmenu: ($event) => handleContextMenu($event, row),\n onMouseenter: () => handleMouseEnter($index),\n onMouseleave: handleMouseLeave,\n },\n columns.value.map((column, cellIndex) => {\n const { rowspan, colspan } = getSpan(row, column, $index, cellIndex)\n if (!rowspan || !colspan) {\n return null\n }\n const columnData = Object.assign({}, column)\n columnData.realWidth = getColspanRealWidth(\n columns.value,\n colspan,\n cellIndex\n )\n const data: RenderRowData<T> = {\n store: props.store,\n _self: props.context || parent,\n column: columnData,\n row,\n $index,\n cellIndex,\n expanded,\n }\n if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {\n data.treeNode = {\n indent: treeRowData.level * indent.value,\n level: treeRowData.level,\n }\n if (isBoolean(treeRowData.expanded)) {\n data.treeNode.expanded = treeRowData.expanded\n // 表明是懒加载\n if ('loading' in treeRowData) {\n data.treeNode.loading = treeRowData.loading\n }\n if ('noLazyChildren' in treeRowData) {\n data.treeNode.noLazyChildren = treeRowData.noLazyChildren\n }\n }\n }\n const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`\n const patchKey = columnData.columnKey || columnData.rawColumnKey || ''\n const mergedTooltipOptions =\n column.showOverflowTooltip &&\n merge(\n {\n effect: tooltipEffect,\n },\n tooltipOptions,\n column.showOverflowTooltip\n )\n return h(\n TdWrapper,\n {\n style: getCellStyle($index, cellIndex, row, column),\n class: getCellClass($index, cellIndex, row, column, colspan - 1),\n key: `${patchKey}${baseKey}`,\n rowspan,\n colspan,\n onMouseenter: ($event) =>\n handleCellMouseEnter($event, row, mergedTooltipOptions),\n onMouseleave: handleCellMouseLeave,\n },\n {\n default: () => cellChildren(cellIndex, column, data),\n }\n )\n })\n )\n }\n const cellChildren = (cellIndex, column, data) => {\n return column.renderCell(data)\n }\n\n const wrappedRowRender = (row: T, $index: number) => {\n const store = props.store\n const { isRowExpanded, assertRowKey } = store\n const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } =\n store.states\n const columns = store.states.columns.value\n const hasExpandColumn = columns.some(({ type }) => type === 'expand')\n if (hasExpandColumn) {\n const expanded = isRowExpanded(row)\n const tr = rowRender(row, $index, undefined, expanded)\n const renderExpanded = parent.renderExpanded\n if (!renderExpanded) {\n console.error('[Element Error]renderExpanded is required.')\n return tr\n }\n\n // 在没设置时候避免 h 执行\n // 非保留模式且未展开时,直接返回\n // 使用二维数组包装,避免修改 $index\n const rows = [[tr]]\n\n // 仅在需要时创建展开行(保留模式或展开状态)\n if (parent.props.preserveExpandedContent || expanded) {\n rows[0].push(\n h(\n 'tr',\n {\n key: `expanded-row__${tr.key as string}`,\n style: { display: expanded ? '' : 'none' },\n },\n [\n h(\n 'td',\n {\n colspan: columns.length,\n class: `${ns.e('cell')} ${ns.e('expanded-cell')}`,\n },\n [renderExpanded({ row, $index, store, expanded })]\n ),\n ]\n )\n )\n }\n\n return rows\n } else if (Object.keys(treeData.value).length) {\n assertRowKey()\n // TreeTable 时,rowKey 必须由用户设定,不使用 getKeyOfRow 计算\n // 在调用 rowRender 函数时,仍然会计算 rowKey,不太好的操作\n const key = getRowIdentity(row, rowKey.value)\n let cur = treeData.value[key]\n let treeRowData = null\n if (cur) {\n treeRowData = {\n expanded: cur.expanded,\n level: cur.level,\n display: true,\n }\n if (isBoolean(cur.lazy)) {\n if (isBoolean(cur.loaded) && cur.loaded) {\n treeRowData.noLazyChildren = !(cur.children && cur.children.length)\n }\n treeRowData.loading = cur.loading\n }\n }\n const tmp = [rowRender(row, $index, treeRowData)]\n // 渲染嵌套数据\n if (cur) {\n // currentRow 记录的是 index,所以还需主动增加 TreeTable 的 index\n let i = 0\n const traverse = (children, parent) => {\n if (!(children && children.length && parent)) return\n children.forEach((node) => {\n // 父节点的 display 状态影响子节点的显示状态\n const innerTreeRowData = {\n display: parent.display && parent.expanded,\n level: parent.level + 1,\n expanded: false,\n noLazyChildren: false,\n loading: false,\n }\n const childKey = getRowIdentity(node, rowKey.value)\n if (isPropAbsent(childKey)) {\n throw new Error('For nested data item, row-key is required.')\n }\n cur = { ...treeData.value[childKey] }\n // 对于当前节点,分成有无子节点两种情况。\n // 如果包含子节点的,设置 expanded 属性。\n // 对于它子节点的 display 属性由它本身的 expanded 与 display 共同决定。\n if (cur) {\n innerTreeRowData.expanded = cur.expanded\n // 懒加载的某些节点,level 未知\n cur.level = cur.level || innerTreeRowData.level\n cur.display = !!(cur.expanded && innerTreeRowData.display)\n if (isBoolean(cur.lazy)) {\n if (isBoolean(cur.loaded) && cur.loaded) {\n innerTreeRowData.noLazyChildren = !(\n cur.children && cur.children.length\n )\n }\n innerTreeRowData.loading = cur.loading\n }\n }\n i++\n tmp.push(rowRender(node, $index + i, innerTreeRowData))\n if (cur) {\n const nodes =\n lazyTreeNodeMap.value[childKey] ||\n node[childrenColumnName.value]\n traverse(nodes, cur)\n }\n })\n }\n // 对于 root 节点,display 一定为 true\n cur.display = true\n const nodes =\n lazyTreeNodeMap.value[key] || row[childrenColumnName.value]\n traverse(nodes, cur)\n }\n return tmp\n } else {\n return rowRender(row, $index, undefined)\n }\n }\n\n return {\n wrappedRowRender,\n tooltipContent,\n tooltipTrigger,\n }\n}\n\nexport default useRender\n"],"names":["inject","TABLE_INJECTION_KEY","useNamespace","useEvents","useStyles","computed","getRowIdentity","h","isBoolean","merge","TdWrapper","isPropAbsent"],"mappings":";;;;;;;;;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gB;AACpB,IAAI,cAAc;AAClB,IAAI,cAAc;AAClB,GAAG,CAAC;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"render-helper.js","sources":["../../../../../../../packages/components/table/src/table-body/render-helper.ts"],"sourcesContent":["import { computed, h, inject } from 'vue'\nimport { merge } from 'lodash-unified'\nimport { useNamespace } from '@element-plus/hooks'\nimport { isBoolean, isPropAbsent } from '@element-plus/utils'\nimport { getRowIdentity } from '../util'\nimport { TABLE_INJECTION_KEY } from '../tokens'\nimport useEvents from './events-helper'\nimport useStyles from './styles-helper'\nimport TdWrapper from './td-wrapper.vue'\n\nimport type { TableBodyProps } from './defaults'\nimport type {\n DefaultRow,\n RenderRowData,\n Table,\n TableColumnCtx,\n TableProps,\n TreeNode,\n} from '../table/defaults'\nimport type { TreeData } from '../store/tree'\nimport type { TableOverflowTooltipOptions } from '../util'\n\nfunction useRender<T extends DefaultRow>(props: Partial<TableBodyProps<T>>) {\n const parent = inject(TABLE_INJECTION_KEY) as Table<T>\n const ns = useNamespace('table')\n const {\n handleDoubleClick,\n handleClick,\n handleContextMenu,\n handleMouseEnter,\n handleMouseLeave,\n handleCellMouseEnter,\n handleCellMouseLeave,\n tooltipContent,\n tooltipTrigger,\n } = useEvents(props)\n const {\n getRowStyle,\n getRowClass,\n getCellStyle,\n getCellClass,\n getSpan,\n getColspanRealWidth,\n } = useStyles(props)\n const firstDefaultColumnIndex = computed(() => {\n return props.store?.states.columns.value.findIndex(\n ({ type }) => type === 'default'\n )\n })\n const getKeyOfRow = (row: T, index: number) => {\n const rowKey = (parent?.props as Partial<TableProps<T>>)?.rowKey\n if (rowKey) {\n return getRowIdentity(row, rowKey)\n }\n return index\n }\n const rowRender = (\n row: T,\n $index: number,\n treeRowData?: TreeNode,\n expanded = false\n ) => {\n const { tooltipEffect, tooltipOptions, store } = props\n const { indent, columns } = store!.states\n const rowClasses = getRowClass(row, $index)\n let display = true\n if (treeRowData) {\n rowClasses.push(ns.em('row', `level-${treeRowData.level}`))\n display = !!treeRowData.display\n }\n const displayStyle = display ? null : { display: 'none' }\n return h(\n 'tr',\n {\n style: [displayStyle, getRowStyle(row, $index)],\n class: rowClasses,\n key: getKeyOfRow(row, $index),\n onDblclick: ($event: Event) => handleDoubleClick($event, row),\n onClick: ($event: Event) => handleClick($event, row),\n onContextmenu: ($event: Event) => handleContextMenu($event, row),\n onMouseenter: () => handleMouseEnter($index),\n onMouseleave: handleMouseLeave,\n },\n columns.value.map((column, cellIndex) => {\n const { rowspan, colspan } = getSpan(row, column, $index, cellIndex)\n if (!rowspan || !colspan) {\n return null\n }\n const columnData = Object.assign({}, column)\n columnData.realWidth = getColspanRealWidth(\n columns.value,\n colspan,\n cellIndex\n )\n const data: RenderRowData<T> = {\n store: store!,\n _self: props.context || parent!,\n column: columnData,\n row,\n $index,\n cellIndex,\n expanded,\n }\n if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {\n data.treeNode = {\n indent: treeRowData.level && treeRowData.level * indent.value,\n level: treeRowData.level,\n }\n if (isBoolean(treeRowData.expanded)) {\n data.treeNode.expanded = treeRowData.expanded\n // 表明是懒加载\n if ('loading' in treeRowData) {\n data.treeNode.loading = treeRowData.loading\n }\n if ('noLazyChildren' in treeRowData) {\n data.treeNode.noLazyChildren = treeRowData.noLazyChildren\n }\n }\n }\n const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`\n const patchKey = columnData.columnKey || columnData.rawColumnKey || ''\n const mergedTooltipOptions =\n column.showOverflowTooltip &&\n merge(\n {\n effect: tooltipEffect,\n },\n tooltipOptions,\n column.showOverflowTooltip\n )\n return h(\n TdWrapper,\n {\n style: getCellStyle($index, cellIndex, row, column),\n class: getCellClass($index, cellIndex, row, column, colspan - 1),\n key: `${patchKey}${baseKey}`,\n rowspan,\n colspan,\n onMouseenter: ($event: MouseEvent) =>\n handleCellMouseEnter(\n $event,\n row,\n mergedTooltipOptions as TableOverflowTooltipOptions\n ),\n onMouseleave: handleCellMouseLeave,\n },\n {\n default: () => cellChildren(cellIndex, column, data),\n }\n )\n })\n )\n }\n const cellChildren = <T extends DefaultRow>(\n _cellIndex: number,\n column: TableColumnCtx<T>,\n data: RenderRowData<T>\n ) => {\n return column.renderCell(data)\n }\n\n const wrappedRowRender = (row: T, $index: number) => {\n const store = props.store!\n const { isRowExpanded, assertRowKey } = store\n const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } =\n store.states\n const columns = store.states.columns.value\n const hasExpandColumn = columns.some(({ type }) => type === 'expand')\n if (hasExpandColumn) {\n const expanded = isRowExpanded(row)\n const tr = rowRender(row, $index, undefined, expanded)\n const renderExpanded = parent?.renderExpanded\n if (!renderExpanded) {\n console.error('[Element Error]renderExpanded is required.')\n return tr\n }\n\n // 在没设置时候避免 h 执行\n // 非保留模式且未展开时,直接返回\n // 使用二维数组包装,避免修改 $index\n const rows = [[tr]]\n\n // 仅在需要时创建展开行(保留模式或展开状态)\n if (parent.props.preserveExpandedContent || expanded) {\n rows[0].push(\n h(\n 'tr',\n {\n key: `expanded-row__${tr.key as string}`,\n style: { display: expanded ? '' : 'none' },\n },\n [\n h(\n 'td',\n {\n colspan: columns.length,\n class: `${ns.e('cell')} ${ns.e('expanded-cell')}`,\n },\n [renderExpanded({ row, $index, store, expanded })]\n ),\n ]\n )\n )\n }\n\n return rows\n } else if (Object.keys(treeData.value).length) {\n assertRowKey()\n // TreeTable 时,rowKey 必须由用户设定,不使用 getKeyOfRow 计算\n // 在调用 rowRender 函数时,仍然会计算 rowKey,不太好的操作\n const key = getRowIdentity(row, rowKey.value)\n let cur = treeData.value[key]\n let treeRowData = null\n if (cur) {\n treeRowData = {\n expanded: cur.expanded,\n level: cur.level,\n display: true,\n noLazyChildren: undefined as boolean | undefined,\n loading: undefined as boolean | undefined,\n }\n if (isBoolean(cur.lazy)) {\n if (treeRowData && isBoolean(cur.loaded) && cur.loaded) {\n treeRowData.noLazyChildren = !(cur.children && cur.children.length)\n }\n treeRowData.loading = cur.loading\n }\n }\n const tmp = [rowRender(row, $index, treeRowData ?? undefined)]\n // 渲染嵌套数据\n if (cur) {\n // currentRow 记录的是 index,所以还需主动增加 TreeTable 的 index\n let i = 0\n const traverse = (children: T[], parent: TreeData) => {\n if (!(children && children.length && parent)) return\n children.forEach((node) => {\n // 父节点的 display 状态影响子节点的显示状态\n const innerTreeRowData: Partial<Record<string, any>> = {\n display: parent.display && parent.expanded,\n level: parent.level! + 1,\n expanded: false,\n noLazyChildren: false,\n loading: false,\n }\n const childKey = getRowIdentity(node, rowKey.value)\n if (isPropAbsent(childKey)) {\n throw new Error('For nested data item, row-key is required.')\n }\n cur = { ...treeData.value[childKey] }\n // 对于当前节点,分成有无子节点两种情况。\n // 如果包含子节点的,设置 expanded 属性。\n // 对于它子节点的 display 属性由它本身的 expanded 与 display 共同决定。\n if (cur) {\n innerTreeRowData.expanded = cur.expanded\n // 懒加载的某些节点,level 未知\n cur.level = cur.level || innerTreeRowData.level\n cur.display = !!(cur.expanded && innerTreeRowData.display)\n if (isBoolean(cur.lazy)) {\n if (isBoolean(cur.loaded) && cur.loaded) {\n innerTreeRowData.noLazyChildren = !(\n cur.children && cur.children.length\n )\n }\n innerTreeRowData.loading = cur.loading\n }\n }\n i++\n tmp.push(rowRender(node, $index + i, innerTreeRowData))\n if (cur) {\n const nodes =\n lazyTreeNodeMap.value[childKey] ||\n node[childrenColumnName.value]\n traverse(nodes, cur)\n }\n })\n }\n // 对于 root 节点,display 一定为 true\n cur.display = true\n const nodes =\n lazyTreeNodeMap.value[key] || row[childrenColumnName.value]\n traverse(nodes, cur)\n }\n return tmp\n } else {\n return rowRender(row, $index, undefined)\n }\n }\n\n return {\n wrappedRowRender,\n tooltipContent,\n tooltipTrigger,\n }\n}\n\nexport default useRender\n"],"names":["inject","TABLE_INJECTION_KEY","useNamespace","useEvents","useStyles","computed","getRowIdentity","h","isBoolean","merge","TdWrapper","isPropAbsent"],"mappings":";;;;;;;;;;;;;;AASA,SAAS,SAAS,CAAC,KAAK,EAAE;AAC1B,EAAE,MAA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AAe,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;AAClF,QAAQ,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC7B,OAAO;AACP,MAAM,OAAO,GAAG,CAAC;AACjB,KAAK,MAAM;AACX,MAAM,OAAO,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5C,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,gBAAgB;AACpB,IAAI,cAAc;AAClB,IAAI,cAAc;AAClB,GAAG,CAAC;AACJ;;;;"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { TableColumnCtx } from '../table-column/defaults';
|
2
2
|
import type { TableBodyProps } from './defaults';
|
3
|
-
|
3
|
+
import type { DefaultRow } from '../table/defaults';
|
4
|
+
declare function useStyles<T extends DefaultRow>(props: Partial<TableBodyProps<T>>): {
|
4
5
|
getRowStyle: (row: T, rowIndex: number) => any;
|
5
6
|
getRowClass: (row: T, rowIndex: number) => string[];
|
6
7
|
getCellStyle: (rowIndex: number, columnIndex: number, row: T, column: TableColumnCtx<T>) => import("vue").CSSProperties;
|
@@ -22,8 +22,9 @@ function useStyles(props) {
|
|
22
22
|
return rowStyle || null;
|
23
23
|
};
|
24
24
|
const getRowClass = (row, rowIndex) => {
|
25
|
+
var _a;
|
25
26
|
const classes = [ns.e("row")];
|
26
|
-
if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
|
27
|
+
if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === ((_a = props.store) == null ? void 0 : _a.states.currentRow.value)) {
|
27
28
|
classes.push("current-row");
|
28
29
|
}
|
29
30
|
if (props.stripe && rowIndex % 2 === 1) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"styles-helper.js","sources":["../../../../../../../packages/components/table/src/table-body/styles-helper.ts"],"sourcesContent":["
|
1
|
+
{"version":3,"file":"styles-helper.js","sources":["../../../../../../../packages/components/table/src/table-body/styles-helper.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { isArray, isFunction, isObject, isString } from '@element-plus/utils'\nimport {\n ensurePosition,\n getFixedColumnOffset,\n getFixedColumnsClass,\n} from '../util'\nimport { TABLE_INJECTION_KEY } from '../tokens'\n\nimport type { TableColumnCtx } from '../table-column/defaults'\nimport type { TableBodyProps } from './defaults'\nimport type { DefaultRow, Table } from '../table/defaults'\n\nfunction useStyles<T extends DefaultRow>(props: Partial<TableBodyProps<T>>) {\n const parent = inject(TABLE_INJECTION_KEY) as Table<T>\n const ns = useNamespace('table')\n\n const getRowStyle = (row: T, rowIndex: number) => {\n const rowStyle = parent?.props.rowStyle\n if (isFunction(rowStyle)) {\n return rowStyle.call(null, {\n row,\n rowIndex,\n })\n }\n return rowStyle || null\n }\n\n const getRowClass = (row: T, rowIndex: number) => {\n const classes = [ns.e('row')]\n if (\n parent?.props.highlightCurrentRow &&\n row === props.store?.states.currentRow.value\n ) {\n classes.push('current-row')\n }\n\n if (props.stripe && rowIndex % 2 === 1) {\n classes.push(ns.em('row', 'striped'))\n }\n const rowClassName = parent?.props.rowClassName\n if (isString(rowClassName)) {\n classes.push(rowClassName)\n } else if (isFunction(rowClassName)) {\n classes.push(\n rowClassName.call(null, {\n row,\n rowIndex,\n })\n )\n }\n return classes\n }\n\n const getCellStyle = (\n rowIndex: number,\n columnIndex: number,\n row: T,\n column: TableColumnCtx<T>\n ) => {\n const cellStyle = parent?.props.cellStyle\n let cellStyles = cellStyle ?? {}\n if (isFunction(cellStyle)) {\n cellStyles = cellStyle.call(null, {\n rowIndex,\n columnIndex,\n row,\n column,\n })\n }\n const fixedStyle = getFixedColumnOffset(\n columnIndex,\n props?.fixed,\n props.store\n )\n ensurePosition(fixedStyle, 'left')\n ensurePosition(fixedStyle, 'right')\n return Object.assign({}, cellStyles, fixedStyle)\n }\n\n const getCellClass = (\n rowIndex: number,\n columnIndex: number,\n row: T,\n column: TableColumnCtx<T>,\n offset: number\n ) => {\n const fixedClasses = getFixedColumnsClass(\n ns.b(),\n columnIndex,\n props?.fixed,\n props.store,\n undefined,\n offset\n )\n const classes = [column.id, column.align, column.className, ...fixedClasses]\n const cellClassName = parent?.props.cellClassName\n if (isString(cellClassName)) {\n classes.push(cellClassName)\n } else if (isFunction(cellClassName)) {\n classes.push(\n cellClassName.call(null, {\n rowIndex,\n columnIndex,\n row,\n column,\n })\n )\n }\n classes.push(ns.e('cell'))\n return classes.filter((className) => Boolean(className)).join(' ')\n }\n const getSpan = (\n row: T,\n column: TableColumnCtx<T>,\n rowIndex: number,\n columnIndex: number\n ) => {\n let rowspan = 1\n let colspan = 1\n const fn = parent?.props.spanMethod\n if (isFunction(fn)) {\n const result = fn({\n row,\n column,\n rowIndex,\n columnIndex,\n })\n if (isArray(result)) {\n rowspan = result[0]\n colspan = result[1]\n } else if (isObject(result)) {\n rowspan = result.rowspan\n colspan = result.colspan\n }\n }\n return { rowspan, colspan }\n }\n const getColspanRealWidth = (\n columns: TableColumnCtx<T>[],\n colspan: number,\n index: number\n ): number => {\n if (colspan < 1) {\n return columns[index].realWidth!\n }\n const widthArr = columns\n .map(({ realWidth, width }) => realWidth || width)\n .slice(index, index + colspan)\n return Number(\n widthArr.reduce((acc, width) => Number(acc) + Number(width), -1)\n )\n }\n\n return {\n getRowStyle,\n getRowClass,\n getCellStyle,\n getCellClass,\n getSpan,\n getColspanRealWidth,\n }\n}\n\nexport default useStyles\n"],"names":["inject","TABLE_INJECTION_KEY","useNamespace","isFunction","isString","getFixedColumnOffset","ensurePosition","getFixedColumnsClass","isArray","isObject"],"mappings":";;;;;;;;;;AASA,SAAS,SAAS,CAAC,KAAK,EAAE;AAC1B,EAAE,MAAM,MAAM,GAAGA,UAAM,CAACC,0BAAmB,CAAC,CAAC;AAC7C,EAAE,MAAM,EAAE,GAAGC,kBAAY,CAAC,OAAO,CA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,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACpF,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,WAAW;AACf,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,YAAY;AAChB,IAAI,OAAO;AACX,IAAI,mBAAmB;AACvB,GAAG,CAAC;AACJ;;;;"}
|
@@ -48,7 +48,7 @@ type TableColumnCtx<T extends DefaultRow = DefaultRow> = {
|
|
48
48
|
filterClassName: string;
|
49
49
|
index: number | ((index: number) => number);
|
50
50
|
sortOrders: (TableSortOrder | null)[];
|
51
|
-
renderCell: (data: any) =>
|
51
|
+
renderCell: (data: any) => VNode | VNode[];
|
52
52
|
colSpan: number;
|
53
53
|
rowSpan: number;
|
54
54
|
children?: TableColumnCtx<T>[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"defaults.js","sources":["../../../../../../../packages/components/table/src/table-column/defaults.ts"],"sourcesContent":["import type { ComponentInternalInstance, PropType, Ref, VNode } from 'vue'\nimport type { DefaultRow, Table, TableSortOrder } from '../table/defaults'\nimport type {\n TableOverflowTooltipFormatter,\n TableOverflowTooltipOptions,\n} from '../util'\nimport type { Store } from '../store'\n\ntype CI<T extends DefaultRow> = {\n column: TableColumnCtx<T>\n $index: number\n store: Store<T>\n _self: any\n}\n\ntype Filters = {\n text: string\n value: string\n}[]\n\ntype FilterMethods<T extends DefaultRow> = (\n value: string,\n row: T,\n column: TableColumnCtx<T>\n) => void\n\ntype ValueOf<T> = T[keyof T]\n\ntype TableColumnCtx<T extends DefaultRow = DefaultRow> = {\n id: string\n realWidth: number | null\n type: string\n label: string\n className: string\n labelClassName: string\n property: string\n prop: string\n width?: string | number\n minWidth: string | number\n renderHeader: (data: CI<T>) => VNode\n sortable: boolean | string\n sortMethod: (a: T, b: T) => number\n sortBy: string | ((row: T, index: number, array?: T[]) => string) | string[]\n resizable: boolean\n columnKey: string\n rawColumnKey: string\n align: string\n headerAlign: string\n showOverflowTooltip?: boolean | TableOverflowTooltipOptions\n tooltipFormatter?: TableOverflowTooltipFormatter<T>\n fixed: boolean | string\n formatter: (\n row: T,\n column: TableColumnCtx<T>,\n cellValue: any,\n index: number\n ) => VNode | string\n selectable: (row: T, index: number) => boolean\n reserveSelection: boolean\n filterMethod: FilterMethods<T>\n filteredValue: string[]\n filters: Filters\n filterPlacement: string\n filterMultiple: boolean\n filterClassName: string\n index: number | ((index: number) => number)\n sortOrders: (TableSortOrder | null)[]\n renderCell: (data: any) => void\n colSpan: number\n rowSpan: number\n children?: TableColumnCtx<T>[]\n level: number\n filterable: boolean | FilterMethods<T> | Filters\n order: TableSortOrder | null\n isColumnGroup: boolean\n isSubColumn: boolean\n columns: TableColumnCtx<T>[]\n getColumnIndex: () => number\n no: number\n filterOpened?: boolean\n renderFilterIcon?: (scope: any) => VNode\n renderExpand?: (scope: any) => VNode\n}\n\ninterface TableColumn<T extends DefaultRow> extends ComponentInternalInstance {\n vnode: {\n vParent: TableColumn<T> | Table<T>\n } & VNode\n vParent: TableColumn<T> | Table<T>\n columnId: string\n columnConfig: Ref<Partial<TableColumnCtx<T>>>\n}\n\nexport type { Filters, FilterMethods, TableColumnCtx, TableColumn, ValueOf }\n\nexport default {\n /**\n * @description type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon\n */\n type: {\n type: String,\n default: 'default',\n },\n /**\n * @description column label\n */\n label: String,\n /**\n * @description class name of cells in the column\n */\n className: String,\n /**\n * @description class name of the label of this column\n */\n labelClassName: String,\n /**\n * @description\n */\n property: String,\n /**\n * @description field name. You can also use its alias: `property`\n */\n prop: String,\n /**\n * @description column width\n */\n width: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description column minimum width. Columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion\n */\n minWidth: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description render function for table header of this column\n */\n renderHeader: Function as PropType<TableColumnCtx<any>['renderHeader']>,\n /**\n * @description whether column can be sorted. Remote sorting can be done by setting this attribute to 'custom' and listening to the `sort-change` event of Table\n */\n sortable: {\n type: [Boolean, String],\n default: false,\n },\n /**\n * @description sorting method, works when `sortable` is `true`. Should return a number, just like Array.sort\n */\n sortMethod: Function as PropType<TableColumnCtx<any>['sortMethod']>,\n /**\n * @description specify which property to sort by, works when `sortable` is `true` and `sort-method` is `undefined`. If set to an Array, the column will sequentially sort by the next property if the previous one is equal\n */\n sortBy: [String, Function, Array] as PropType<TableColumnCtx<any>['sortBy']>,\n /**\n * @description whether column width can be resized, works when `border` of `el-table` is `true`\n */\n resizable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered\n */\n columnKey: String,\n /**\n * @description alignment, the value should be 'left' \\/ 'center' \\/ 'right'\n */\n align: String,\n /**\n * @description alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \\/ 'center' \\/ 'right'\n */\n headerAlign: String,\n /**\n * @description whether to hide extra content and show them in a tooltip when hovering on the cell\n */\n showOverflowTooltip: {\n type: [Boolean, Object] as PropType<\n TableColumnCtx<any>['showOverflowTooltip']\n >,\n default: undefined,\n },\n /**\n * @description function that formats cell tooltip content, works when `show-overflow-tooltip` is `true`\n */\n tooltipFormatter: Function as PropType<\n TableColumnCtx<any>['tooltipFormatter']\n >,\n /**\n * @description whether column is fixed at left / right. Will be fixed at left if `true`\n */\n fixed: [Boolean, String],\n /**\n * @description function that formats cell content\n */\n formatter: Function as PropType<TableColumnCtx<any>['formatter']>,\n /**\n * @description function that determines if a certain row can be selected, works when `type` is 'selection'\n */\n selectable: Function as PropType<TableColumnCtx<any>['selectable']>,\n /**\n * @description whether to reserve selection after data refreshing, works when `type` is 'selection'. Note that `row-key` is required for this to work\n */\n reserveSelection: Boolean,\n /**\n * @description data filtering method. If `filter-multiple` is on, this method will be called multiple times for each row, and a row will display if one of the calls returns `true`\n */\n filterMethod: Function as PropType<TableColumnCtx<any>['filterMethod']>,\n /**\n * @description filter value for selected data, might be useful when table header is rendered with `render-header`\n */\n filteredValue: Array as PropType<TableColumnCtx<any>['filteredValue']>,\n /**\n * @description an array of data filtering options. For each element in this array, `text` and `value` are required\n */\n filters: Array as PropType<TableColumnCtx<any>['filters']>,\n /**\n * @description placement for the filter dropdown\n */\n filterPlacement: String,\n /**\n * @description whether data filtering supports multiple options\n */\n filterMultiple: {\n type: Boolean,\n default: true,\n },\n /**\n * @description className for the filter dropdown\n */\n filterClassName: String,\n /**\n * @description customize indices for each row, works on columns with `type=index`\n */\n index: [Number, Function] as PropType<TableColumnCtx<any>['index']>,\n /**\n * @description the order of the sorting strategies used when sorting the data, works when `sortable` is `true`. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array\n */\n sortOrders: {\n type: Array as PropType<TableColumnCtx<any>['sortOrders']>,\n default: () => {\n return ['ascending', 'descending', null]\n },\n validator: (val: TableColumnCtx<any>['sortOrders']) => {\n return val.every((order: TableSortOrder | null) =>\n ['ascending', 'descending', null].includes(order)\n )\n },\n },\n}\n"],"names":[],"mappings":";;;;AAAA,mBAAe;AACf,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,SAAS,EAAE,MAAM;AACnB,EAAE,cAAc,EAAE,MAAM;AACxB,EAAE,QAAQ,EAAE,MAAM;AAClB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,YAAY,EAAE,QAAQ;AACxB,EAAE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AAG,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACrF,KAAK;AACL,GAAG;AACH,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"defaults.js","sources":["../../../../../../../packages/components/table/src/table-column/defaults.ts"],"sourcesContent":["import type { ComponentInternalInstance, PropType, Ref, VNode } from 'vue'\nimport type { DefaultRow, Table, TableSortOrder } from '../table/defaults'\nimport type {\n TableOverflowTooltipFormatter,\n TableOverflowTooltipOptions,\n} from '../util'\nimport type { Store } from '../store'\n\ntype CI<T extends DefaultRow> = {\n column: TableColumnCtx<T>\n $index: number\n store: Store<T>\n _self: any\n}\n\ntype Filters = {\n text: string\n value: string\n}[]\n\ntype FilterMethods<T extends DefaultRow> = (\n value: string,\n row: T,\n column: TableColumnCtx<T>\n) => void\n\ntype ValueOf<T> = T[keyof T]\n\ntype TableColumnCtx<T extends DefaultRow = DefaultRow> = {\n id: string\n realWidth: number | null\n type: string\n label: string\n className: string\n labelClassName: string\n property: string\n prop: string\n width?: string | number\n minWidth: string | number\n renderHeader: (data: CI<T>) => VNode\n sortable: boolean | string\n sortMethod: (a: T, b: T) => number\n sortBy: string | ((row: T, index: number, array?: T[]) => string) | string[]\n resizable: boolean\n columnKey: string\n rawColumnKey: string\n align: string\n headerAlign: string\n showOverflowTooltip?: boolean | TableOverflowTooltipOptions\n tooltipFormatter?: TableOverflowTooltipFormatter<T>\n fixed: boolean | string\n formatter: (\n row: T,\n column: TableColumnCtx<T>,\n cellValue: any,\n index: number\n ) => VNode | string\n selectable: (row: T, index: number) => boolean\n reserveSelection: boolean\n filterMethod: FilterMethods<T>\n filteredValue: string[]\n filters: Filters\n filterPlacement: string\n filterMultiple: boolean\n filterClassName: string\n index: number | ((index: number) => number)\n sortOrders: (TableSortOrder | null)[]\n renderCell: (data: any) => VNode | VNode[]\n colSpan: number\n rowSpan: number\n children?: TableColumnCtx<T>[]\n level: number\n filterable: boolean | FilterMethods<T> | Filters\n order: TableSortOrder | null\n isColumnGroup: boolean\n isSubColumn: boolean\n columns: TableColumnCtx<T>[]\n getColumnIndex: () => number\n no: number\n filterOpened?: boolean\n renderFilterIcon?: (scope: any) => VNode\n renderExpand?: (scope: any) => VNode\n}\n\ninterface TableColumn<T extends DefaultRow> extends ComponentInternalInstance {\n vnode: {\n vParent: TableColumn<T> | Table<T>\n } & VNode\n vParent: TableColumn<T> | Table<T>\n columnId: string\n columnConfig: Ref<Partial<TableColumnCtx<T>>>\n}\n\nexport type { Filters, FilterMethods, TableColumnCtx, TableColumn, ValueOf }\n\nexport default {\n /**\n * @description type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon\n */\n type: {\n type: String,\n default: 'default',\n },\n /**\n * @description column label\n */\n label: String,\n /**\n * @description class name of cells in the column\n */\n className: String,\n /**\n * @description class name of the label of this column\n */\n labelClassName: String,\n /**\n * @description\n */\n property: String,\n /**\n * @description field name. You can also use its alias: `property`\n */\n prop: String,\n /**\n * @description column width\n */\n width: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description column minimum width. Columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion\n */\n minWidth: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description render function for table header of this column\n */\n renderHeader: Function as PropType<TableColumnCtx<any>['renderHeader']>,\n /**\n * @description whether column can be sorted. Remote sorting can be done by setting this attribute to 'custom' and listening to the `sort-change` event of Table\n */\n sortable: {\n type: [Boolean, String],\n default: false,\n },\n /**\n * @description sorting method, works when `sortable` is `true`. Should return a number, just like Array.sort\n */\n sortMethod: Function as PropType<TableColumnCtx<any>['sortMethod']>,\n /**\n * @description specify which property to sort by, works when `sortable` is `true` and `sort-method` is `undefined`. If set to an Array, the column will sequentially sort by the next property if the previous one is equal\n */\n sortBy: [String, Function, Array] as PropType<TableColumnCtx<any>['sortBy']>,\n /**\n * @description whether column width can be resized, works when `border` of `el-table` is `true`\n */\n resizable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered\n */\n columnKey: String,\n /**\n * @description alignment, the value should be 'left' \\/ 'center' \\/ 'right'\n */\n align: String,\n /**\n * @description alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \\/ 'center' \\/ 'right'\n */\n headerAlign: String,\n /**\n * @description whether to hide extra content and show them in a tooltip when hovering on the cell\n */\n showOverflowTooltip: {\n type: [Boolean, Object] as PropType<\n TableColumnCtx<any>['showOverflowTooltip']\n >,\n default: undefined,\n },\n /**\n * @description function that formats cell tooltip content, works when `show-overflow-tooltip` is `true`\n */\n tooltipFormatter: Function as PropType<\n TableColumnCtx<any>['tooltipFormatter']\n >,\n /**\n * @description whether column is fixed at left / right. Will be fixed at left if `true`\n */\n fixed: [Boolean, String],\n /**\n * @description function that formats cell content\n */\n formatter: Function as PropType<TableColumnCtx<any>['formatter']>,\n /**\n * @description function that determines if a certain row can be selected, works when `type` is 'selection'\n */\n selectable: Function as PropType<TableColumnCtx<any>['selectable']>,\n /**\n * @description whether to reserve selection after data refreshing, works when `type` is 'selection'. Note that `row-key` is required for this to work\n */\n reserveSelection: Boolean,\n /**\n * @description data filtering method. If `filter-multiple` is on, this method will be called multiple times for each row, and a row will display if one of the calls returns `true`\n */\n filterMethod: Function as PropType<TableColumnCtx<any>['filterMethod']>,\n /**\n * @description filter value for selected data, might be useful when table header is rendered with `render-header`\n */\n filteredValue: Array as PropType<TableColumnCtx<any>['filteredValue']>,\n /**\n * @description an array of data filtering options. For each element in this array, `text` and `value` are required\n */\n filters: Array as PropType<TableColumnCtx<any>['filters']>,\n /**\n * @description placement for the filter dropdown\n */\n filterPlacement: String,\n /**\n * @description whether data filtering supports multiple options\n */\n filterMultiple: {\n type: Boolean,\n default: true,\n },\n /**\n * @description className for the filter dropdown\n */\n filterClassName: String,\n /**\n * @description customize indices for each row, works on columns with `type=index`\n */\n index: [Number, Function] as PropType<TableColumnCtx<any>['index']>,\n /**\n * @description the order of the sorting strategies used when sorting the data, works when `sortable` is `true`. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array\n */\n sortOrders: {\n type: Array as PropType<TableColumnCtx<any>['sortOrders']>,\n default: () => {\n return ['ascending', 'descending', null]\n },\n validator: (val: TableColumnCtx<any>['sortOrders']) => {\n return val.every((order: TableSortOrder | null) =>\n ['ascending', 'descending', null].includes(order)\n )\n },\n },\n}\n"],"names":[],"mappings":";;;;AAAA,mBAAe;AACf,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,SAAS,EAAE,MAAM;AACnB,EAAE,cAAc,EAAE,MAAM;AACxB,EAAE,QAAQ,EAAE,MAAM;AAClB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,YAAY,EAAE,QAAQ;AACxB,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;AAC3B,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,UAAU,EAAE,QAAQ;AACtB,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC;AACnC,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,SAAS,EAAE,MAAM;AACnB,EAAE,KAAK,EA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