@element-plus/nightly 0.0.20241112 → 0.0.20241114
Sign up to get free protection for your applications and to get access to all the features.
- package/attributes.json +1 -1
- package/dist/index.full.js +146 -115
- package/dist/index.full.min.js +11 -11
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +11 -11
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +146 -115
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/my.js +1 -1
- package/dist/locale/my.min.js +1 -1
- package/dist/locale/my.min.mjs +1 -1
- package/dist/locale/my.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/cascader/src/cascader2.mjs +2 -0
- package/es/components/cascader/src/cascader2.mjs.map +1 -1
- package/es/components/cascader-panel/src/index.mjs +1 -0
- package/es/components/cascader-panel/src/index.mjs.map +1 -1
- package/es/components/color-picker/src/color-picker2.mjs +1 -0
- package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
- package/es/components/descriptions/src/description-item.d.ts +4 -0
- package/es/components/descriptions/src/description-item.mjs +4 -0
- package/es/components/descriptions/src/description-item.mjs.map +1 -1
- package/es/components/descriptions/src/description.d.ts +1 -0
- package/es/components/descriptions/src/description.mjs +4 -0
- package/es/components/descriptions/src/description.mjs.map +1 -1
- package/es/components/descriptions/src/description.vue.d.ts +3 -0
- package/es/components/descriptions/src/descriptions-cell.mjs +2 -1
- package/es/components/descriptions/src/descriptions-cell.mjs.map +1 -1
- package/es/components/descriptions/src/descriptions.type.d.ts +2 -0
- package/es/components/dropdown/src/dropdown-item-impl.mjs +1 -2
- package/es/components/dropdown/src/dropdown-item-impl.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown2.mjs +6 -1
- package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
- package/es/components/dropdown/src/useDropdown.mjs +1 -1
- package/es/components/dropdown/src/useDropdown.mjs.map +1 -1
- package/es/components/focus-trap/src/focus-trap.mjs +2 -2
- package/es/components/focus-trap/src/focus-trap.mjs.map +1 -1
- package/es/components/mention/src/mention2.mjs +51 -45
- package/es/components/mention/src/mention2.mjs.map +1 -1
- package/es/components/menu/src/utils/menu-item.mjs +1 -0
- package/es/components/menu/src/utils/menu-item.mjs.map +1 -1
- package/es/components/menu/src/utils/submenu.mjs +1 -0
- package/es/components/menu/src/utils/submenu.mjs.map +1 -1
- package/es/components/pagination/src/components/next.mjs +36 -19
- package/es/components/pagination/src/components/next.mjs.map +1 -1
- package/es/components/pagination/src/components/next2.mjs +19 -36
- package/es/components/pagination/src/components/next2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +1 -1
- package/es/components/pagination/style/css.d.ts +1 -0
- package/es/components/pagination/style/css.mjs +1 -0
- package/es/components/pagination/style/css.mjs.map +1 -1
- package/es/components/pagination/style/index.d.ts +1 -0
- package/es/components/pagination/style/index.mjs +1 -0
- package/es/components/pagination/style/index.mjs.map +1 -1
- package/es/components/roving-focus-group/src/roving-focus-item.mjs +2 -2
- package/es/components/roving-focus-group/src/roving-focus-item.mjs.map +1 -1
- package/es/components/roving-focus-group/src/utils.mjs +1 -1
- package/es/components/roving-focus-group/src/utils.mjs.map +1 -1
- package/es/components/select-v2/src/select-dropdown.mjs +7 -9
- package/es/components/select-v2/src/select-dropdown.mjs.map +1 -1
- package/es/components/select-v2/src/useSelect.mjs +2 -1
- package/es/components/select-v2/src/useSelect.mjs.map +1 -1
- package/es/components/slider/src/button.mjs +21 -91
- package/es/components/slider/src/button.mjs.map +1 -1
- package/es/components/slider/src/button2.mjs +91 -21
- package/es/components/slider/src/button2.mjs.map +1 -1
- package/es/components/slider/src/composables/use-slider-button.mjs +24 -15
- package/es/components/slider/src/composables/use-slider-button.mjs.map +1 -1
- package/es/components/slider/src/slider2.mjs +1 -1
- package/es/components/tabs/src/tab-nav.mjs +21 -25
- package/es/components/tabs/src/tab-nav.mjs.map +1 -1
- package/es/components/tabs/src/tabs.mjs +1 -1
- package/es/components/tabs/src/tabs.mjs.map +1 -1
- package/es/components/time-picker/src/time-picker-com/basic-time-spinner.mjs +8 -4
- package/es/components/time-picker/src/time-picker-com/basic-time-spinner.mjs.map +1 -1
- package/es/components/tooltip/src/trigger.mjs +1 -1
- package/es/components/tooltip/src/trigger.mjs.map +1 -1
- package/es/components/tree/src/model/useKeydown.mjs +1 -1
- package/es/components/tree/src/model/useKeydown.mjs.map +1 -1
- package/es/hooks/use-escape-keydown/index.mjs +2 -3
- package/es/hooks/use-escape-keydown/index.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/cascader/src/cascader2.js +2 -0
- package/lib/components/cascader/src/cascader2.js.map +1 -1
- package/lib/components/cascader-panel/src/index.js +1 -0
- package/lib/components/cascader-panel/src/index.js.map +1 -1
- package/lib/components/color-picker/src/color-picker2.js +1 -0
- package/lib/components/color-picker/src/color-picker2.js.map +1 -1
- package/lib/components/descriptions/src/description-item.d.ts +4 -0
- package/lib/components/descriptions/src/description-item.js +4 -0
- package/lib/components/descriptions/src/description-item.js.map +1 -1
- package/lib/components/descriptions/src/description.d.ts +1 -0
- package/lib/components/descriptions/src/description.js +4 -0
- package/lib/components/descriptions/src/description.js.map +1 -1
- package/lib/components/descriptions/src/description.vue.d.ts +3 -0
- package/lib/components/descriptions/src/descriptions-cell.js +2 -1
- package/lib/components/descriptions/src/descriptions-cell.js.map +1 -1
- package/lib/components/descriptions/src/descriptions.type.d.ts +2 -0
- package/lib/components/dropdown/src/dropdown-item-impl.js +1 -2
- package/lib/components/dropdown/src/dropdown-item-impl.js.map +1 -1
- package/lib/components/dropdown/src/dropdown2.js +6 -1
- package/lib/components/dropdown/src/dropdown2.js.map +1 -1
- package/lib/components/dropdown/src/useDropdown.js +1 -1
- package/lib/components/dropdown/src/useDropdown.js.map +1 -1
- package/lib/components/focus-trap/src/focus-trap.js +2 -2
- package/lib/components/focus-trap/src/focus-trap.js.map +1 -1
- package/lib/components/mention/src/mention2.js +51 -45
- package/lib/components/mention/src/mention2.js.map +1 -1
- package/lib/components/menu/src/utils/menu-item.js +1 -0
- package/lib/components/menu/src/utils/menu-item.js.map +1 -1
- package/lib/components/menu/src/utils/submenu.js +1 -0
- package/lib/components/menu/src/utils/submenu.js.map +1 -1
- package/lib/components/pagination/src/components/next.js +36 -19
- package/lib/components/pagination/src/components/next.js.map +1 -1
- package/lib/components/pagination/src/components/next2.js +19 -36
- package/lib/components/pagination/src/components/next2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +1 -1
- package/lib/components/pagination/style/css.d.ts +1 -0
- package/lib/components/pagination/style/css.js +1 -0
- package/lib/components/pagination/style/css.js.map +1 -1
- package/lib/components/pagination/style/index.d.ts +1 -0
- package/lib/components/pagination/style/index.js +1 -0
- package/lib/components/pagination/style/index.js.map +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-item.js +2 -2
- package/lib/components/roving-focus-group/src/roving-focus-item.js.map +1 -1
- package/lib/components/roving-focus-group/src/utils.js +1 -1
- package/lib/components/roving-focus-group/src/utils.js.map +1 -1
- package/lib/components/select-v2/src/select-dropdown.js +7 -9
- package/lib/components/select-v2/src/select-dropdown.js.map +1 -1
- package/lib/components/select-v2/src/useSelect.js +2 -1
- package/lib/components/select-v2/src/useSelect.js.map +1 -1
- package/lib/components/slider/src/button.js +22 -91
- package/lib/components/slider/src/button.js.map +1 -1
- package/lib/components/slider/src/button2.js +91 -22
- package/lib/components/slider/src/button2.js.map +1 -1
- package/lib/components/slider/src/composables/use-slider-button.js +24 -15
- package/lib/components/slider/src/composables/use-slider-button.js.map +1 -1
- package/lib/components/slider/src/slider2.js +1 -1
- package/lib/components/tabs/src/tab-nav.js +21 -25
- package/lib/components/tabs/src/tab-nav.js.map +1 -1
- package/lib/components/tabs/src/tabs.js +1 -1
- package/lib/components/tabs/src/tabs.js.map +1 -1
- package/lib/components/time-picker/src/time-picker-com/basic-time-spinner.js +7 -3
- package/lib/components/time-picker/src/time-picker-com/basic-time-spinner.js.map +1 -1
- package/lib/components/tooltip/src/trigger.js +1 -1
- package/lib/components/tooltip/src/trigger.js.map +1 -1
- package/lib/components/tree/src/model/useKeydown.js +1 -1
- package/lib/components/tree/src/model/useKeydown.js.map +1 -1
- package/lib/hooks/use-escape-keydown/index.js +2 -3
- package/lib/hooks/use-escape-keydown/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/tags.json +1 -1
- package/web-types.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"descriptions-cell.mjs","sources":["../../../../../../packages/components/descriptions/src/descriptions-cell.ts"],"sourcesContent":["import { defineComponent, h, inject, withDirectives } from 'vue'\nimport { isNil } from 'lodash-unified'\nimport { addUnit, getNormalizedProps } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { descriptionsKey } from './token'\nimport type { DirectiveArguments, PropType, VNode } from 'vue'\n\nimport type {\n IDescriptionsInject,\n IDescriptionsItemInject,\n} from './descriptions.type'\nimport type { DescriptionItemVNode } from './description-item'\n\nexport default defineComponent({\n name: 'ElDescriptionsCell',\n props: {\n cell: {\n type: Object as PropType<DescriptionItemVNode>,\n },\n tag: {\n type: String,\n default: 'td',\n },\n type: {\n type: String,\n },\n },\n setup() {\n const descriptions = inject(descriptionsKey, {} as IDescriptionsInject)\n\n return {\n descriptions,\n }\n },\n render() {\n const item = getNormalizedProps(\n this.cell as VNode\n ) as IDescriptionsItemInject\n\n const directives = (this.cell?.dirs || []).map((dire) => {\n const { dir, arg, modifiers, value } = dire\n return [dir, value, arg, modifiers]\n }) as DirectiveArguments\n\n const { border, direction } = this.descriptions\n const isVertical = direction === 'vertical'\n const renderLabel = () => this.cell?.children?.label?.() || item.label\n const renderContent = () => this.cell?.children?.default?.()\n const span = item.span\n const rowspan = item.rowspan\n const align = item.align ? `is-${item.align}` : ''\n const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align\n const className = item.className\n const labelClassName = item.labelClassName\n const style = {\n width: addUnit(
|
1
|
+
{"version":3,"file":"descriptions-cell.mjs","sources":["../../../../../../packages/components/descriptions/src/descriptions-cell.ts"],"sourcesContent":["import { defineComponent, h, inject, withDirectives } from 'vue'\nimport { isNil } from 'lodash-unified'\nimport { addUnit, getNormalizedProps } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { descriptionsKey } from './token'\nimport type { DirectiveArguments, PropType, VNode } from 'vue'\n\nimport type {\n IDescriptionsInject,\n IDescriptionsItemInject,\n} from './descriptions.type'\nimport type { DescriptionItemVNode } from './description-item'\n\nexport default defineComponent({\n name: 'ElDescriptionsCell',\n props: {\n cell: {\n type: Object as PropType<DescriptionItemVNode>,\n },\n tag: {\n type: String,\n default: 'td',\n },\n type: {\n type: String,\n },\n },\n setup() {\n const descriptions = inject(descriptionsKey, {} as IDescriptionsInject)\n\n return {\n descriptions,\n }\n },\n render() {\n const item = getNormalizedProps(\n this.cell as VNode\n ) as IDescriptionsItemInject\n\n const directives = (this.cell?.dirs || []).map((dire) => {\n const { dir, arg, modifiers, value } = dire\n return [dir, value, arg, modifiers]\n }) as DirectiveArguments\n\n const { border, direction } = this.descriptions\n const isVertical = direction === 'vertical'\n const renderLabel = () => this.cell?.children?.label?.() || item.label\n const renderContent = () => this.cell?.children?.default?.()\n const span = item.span\n const rowspan = item.rowspan\n const align = item.align ? `is-${item.align}` : ''\n const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align\n const className = item.className\n const labelClassName = item.labelClassName\n const width =\n this.type === 'label'\n ? item.labelWidth || this.descriptions.labelWidth || item.width\n : item.width\n\n const style = {\n width: addUnit(width),\n minWidth: addUnit(item.minWidth),\n }\n const ns = useNamespace('descriptions')\n\n switch (this.type) {\n case 'label':\n return withDirectives(\n h(\n this.tag,\n {\n style,\n class: [\n ns.e('cell'),\n ns.e('label'),\n ns.is('bordered-label', border),\n ns.is('vertical-label', isVertical),\n labelAlign,\n labelClassName,\n ],\n colSpan: isVertical ? span : 1,\n rowspan: isVertical ? 1 : rowspan,\n },\n renderLabel()\n ),\n directives\n )\n case 'content':\n return withDirectives(\n h(\n this.tag,\n {\n style,\n class: [\n ns.e('cell'),\n ns.e('content'),\n ns.is('bordered-content', border),\n ns.is('vertical-content', isVertical),\n align,\n className,\n ],\n colSpan: isVertical ? span : span * 2 - 1,\n rowspan: isVertical ? rowspan * 2 - 1 : rowspan,\n },\n renderContent()\n ),\n directives\n )\n default: {\n const label = renderLabel()\n\n return withDirectives(\n h(\n 'td',\n {\n style,\n class: [ns.e('cell'), align],\n colSpan: span,\n rowspan,\n },\n [\n !isNil(label)\n ? h(\n 'span',\n {\n class: [ns.e('label'), labelClassName],\n },\n label\n )\n : undefined,\n h(\n 'span',\n {\n class: [ns.e('content'), className],\n },\n renderContent()\n ),\n ]\n ),\n directives\n )\n }\n }\n },\n})\n"],"names":[],"mappings":";;;;;;;;;AAKA,yBAAe,eAAe,CAAC;AAC/B,EAAE,IAAI,EAAE,oBAAoB;AAC5B,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE;AACV,MAAM,IAAI,EAAE,MAAM;AAClB,KAAK;AACL,IAAI,GAAG,EAAE;AACT,MAAM,IAAI,EAAE,MAAM;AAClB,MAAM,OAAO,EAAE,IAAI;AACnB,KAAK;AACL,IAAI,IAAI,EAAE;AACV,MAAM,IAAI,EAAE,MAAM;AAClB,KAAK;AACL,GAAG;AACH,EAAE,KAAK,GAAG;AACV,IAAI,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;AACrD,IAAI,OAAO;AACX,MAAM,YAAY;AAClB,KAAK,CAAC;AACN,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/C,IAAI,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,KAAK,EAAE,EAAE,GAAG,CAAC,CAAC,IAAI,KAAK;AAC3F,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;AAClD,MAAM,OAAO,CAAC,GAAG,EAA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AS,CAAC;AAC/C,WAAW,EAAE,aAAa,EAAE,CAAC;AAC7B,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;AACxB,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAC,CAAC;;;;"}
|
@@ -6,6 +6,7 @@ export interface IDescriptionsInject {
|
|
6
6
|
size: ComponentSize;
|
7
7
|
title: string;
|
8
8
|
extra: string;
|
9
|
+
labelWidth: string | number;
|
9
10
|
}
|
10
11
|
export interface IDescriptionsItemInject {
|
11
12
|
label: string;
|
@@ -13,6 +14,7 @@ export interface IDescriptionsItemInject {
|
|
13
14
|
rowspan: number;
|
14
15
|
width: string | number;
|
15
16
|
minWidth: string | number;
|
17
|
+
labelWidth: string | number;
|
16
18
|
align: string;
|
17
19
|
labelAlign: string;
|
18
20
|
className: string;
|
@@ -45,8 +45,7 @@ const _sfc_main = defineComponent({
|
|
45
45
|
return "button";
|
46
46
|
});
|
47
47
|
const handleKeydown = composeEventHandlers((e) => {
|
48
|
-
|
49
|
-
if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
|
48
|
+
if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(e.code)) {
|
50
49
|
e.preventDefault();
|
51
50
|
e.stopImmediatePropagation();
|
52
51
|
emit("clickimpl", e);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dropdown-item-impl.mjs","sources":["../../../../../../packages/components/dropdown/src/dropdown-item-impl.vue"],"sourcesContent":["<template>\n <li\n v-if=\"divided\"\n role=\"separator\"\n :class=\"ns.bem('menu', 'item', 'divided')\"\n />\n <li\n :ref=\"itemRef\"\n v-bind=\"{ ...dataset, ...$attrs }\"\n :aria-disabled=\"disabled\"\n :class=\"[ns.be('menu', 'item'), ns.is('disabled', disabled)]\"\n :tabindex=\"tabIndex\"\n :role=\"role\"\n @click=\"(e) => $emit('clickimpl', e)\"\n @focus=\"handleFocus\"\n @keydown.self=\"handleKeydown\"\n @mousedown=\"handleMousedown\"\n @pointermove=\"(e) => $emit('pointermove', e)\"\n @pointerleave=\"(e) => $emit('pointerleave', e)\"\n >\n <el-icon v-if=\"icon\">\n <component :is=\"icon\" />\n </el-icon>\n <slot />\n </li>\n</template>\n\n<script lang=\"ts\">\n// @ts-nocheck\nimport { computed, defineComponent, inject } from 'vue'\nimport {\n ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY,\n ROVING_FOCUS_ITEM_COLLECTION_INJECTION_KEY,\n} from '@element-plus/components/roving-focus-group'\nimport { COLLECTION_ITEM_SIGN } from '@element-plus/components/collection'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useNamespace } from '@element-plus/hooks'\nimport { composeEventHandlers, composeRefs } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport {\n DROPDOWN_COLLECTION_ITEM_INJECTION_KEY,\n dropdownItemProps,\n} from './dropdown'\nimport { DROPDOWN_INJECTION_KEY } from './tokens'\n\nexport default defineComponent({\n name: 'DropdownItemImpl',\n components: {\n ElIcon,\n },\n props: dropdownItemProps,\n emits: ['pointermove', 'pointerleave', 'click', 'clickimpl'],\n setup(_, { emit }) {\n const ns = useNamespace('dropdown')\n\n const { role: menuRole } = inject(DROPDOWN_INJECTION_KEY, undefined)!\n\n const { collectionItemRef: dropdownCollectionItemRef } = inject(\n DROPDOWN_COLLECTION_ITEM_INJECTION_KEY,\n undefined\n )!\n\n const { collectionItemRef: rovingFocusCollectionItemRef } = inject(\n ROVING_FOCUS_ITEM_COLLECTION_INJECTION_KEY,\n undefined\n )!\n\n const {\n rovingFocusGroupItemRef,\n tabIndex,\n handleFocus,\n handleKeydown: handleItemKeydown,\n handleMousedown,\n } = inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, undefined)!\n\n const itemRef = composeRefs(\n dropdownCollectionItemRef,\n rovingFocusCollectionItemRef,\n rovingFocusGroupItemRef\n )\n\n const role = computed<string>(() => {\n if (menuRole.value === 'menu') {\n return 'menuitem'\n } else if (menuRole.value === 'navigation') {\n return 'link'\n }\n return 'button'\n })\n\n const handleKeydown = composeEventHandlers((e: KeyboardEvent) => {\n
|
1
|
+
{"version":3,"file":"dropdown-item-impl.mjs","sources":["../../../../../../packages/components/dropdown/src/dropdown-item-impl.vue"],"sourcesContent":["<template>\n <li\n v-if=\"divided\"\n role=\"separator\"\n :class=\"ns.bem('menu', 'item', 'divided')\"\n />\n <li\n :ref=\"itemRef\"\n v-bind=\"{ ...dataset, ...$attrs }\"\n :aria-disabled=\"disabled\"\n :class=\"[ns.be('menu', 'item'), ns.is('disabled', disabled)]\"\n :tabindex=\"tabIndex\"\n :role=\"role\"\n @click=\"(e) => $emit('clickimpl', e)\"\n @focus=\"handleFocus\"\n @keydown.self=\"handleKeydown\"\n @mousedown=\"handleMousedown\"\n @pointermove=\"(e) => $emit('pointermove', e)\"\n @pointerleave=\"(e) => $emit('pointerleave', e)\"\n >\n <el-icon v-if=\"icon\">\n <component :is=\"icon\" />\n </el-icon>\n <slot />\n </li>\n</template>\n\n<script lang=\"ts\">\n// @ts-nocheck\nimport { computed, defineComponent, inject } from 'vue'\nimport {\n ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY,\n ROVING_FOCUS_ITEM_COLLECTION_INJECTION_KEY,\n} from '@element-plus/components/roving-focus-group'\nimport { COLLECTION_ITEM_SIGN } from '@element-plus/components/collection'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useNamespace } from '@element-plus/hooks'\nimport { composeEventHandlers, composeRefs } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport {\n DROPDOWN_COLLECTION_ITEM_INJECTION_KEY,\n dropdownItemProps,\n} from './dropdown'\nimport { DROPDOWN_INJECTION_KEY } from './tokens'\n\nexport default defineComponent({\n name: 'DropdownItemImpl',\n components: {\n ElIcon,\n },\n props: dropdownItemProps,\n emits: ['pointermove', 'pointerleave', 'click', 'clickimpl'],\n setup(_, { emit }) {\n const ns = useNamespace('dropdown')\n\n const { role: menuRole } = inject(DROPDOWN_INJECTION_KEY, undefined)!\n\n const { collectionItemRef: dropdownCollectionItemRef } = inject(\n DROPDOWN_COLLECTION_ITEM_INJECTION_KEY,\n undefined\n )!\n\n const { collectionItemRef: rovingFocusCollectionItemRef } = inject(\n ROVING_FOCUS_ITEM_COLLECTION_INJECTION_KEY,\n undefined\n )!\n\n const {\n rovingFocusGroupItemRef,\n tabIndex,\n handleFocus,\n handleKeydown: handleItemKeydown,\n handleMousedown,\n } = inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, undefined)!\n\n const itemRef = composeRefs(\n dropdownCollectionItemRef,\n rovingFocusCollectionItemRef,\n rovingFocusGroupItemRef\n )\n\n const role = computed<string>(() => {\n if (menuRole.value === 'menu') {\n return 'menuitem'\n } else if (menuRole.value === 'navigation') {\n return 'link'\n }\n return 'button'\n })\n\n const handleKeydown = composeEventHandlers((e: KeyboardEvent) => {\n if (\n [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(\n e.code\n )\n ) {\n e.preventDefault()\n e.stopImmediatePropagation()\n emit('clickimpl', e)\n return true\n }\n }, handleItemKeydown)\n\n return {\n ns,\n itemRef,\n dataset: {\n [COLLECTION_ITEM_SIGN]: '',\n },\n role,\n tabIndex,\n handleFocus,\n handleKeydown,\n handleMousedown,\n }\n },\n})\n</script>\n"],"names":["DROPDOWN_COLLECTION_ITEM_INJECTION_KEY","ROVING_FOCUS_ITEM_COLLECTION_INJECTION_KEY","_resolveComponent","_openBlock","_createElementBlock","_Fragment","_normalizeClass","_createCommentVNode","_createElementVNode","_mergeProps","_createBlock","_withCtx","_resolveDynamicComponent"],"mappings":";;;;;;;;;;;;;;;;;;AA6CA,MAAK,YAAa,eAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,kBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAA;AAAA,GACF;AAAA,EACA,KAAO,EAAA,iBAAA;AAAA,EACP,KAAO,EAAA,CAAC,aAAe,EAAA,cAAA,EAAgB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MAAC,KAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,EAAA,CAAA,MAAA,EAAA,MAAA,CAAA,EAAA,IAAA,CAAA,EAAA,CAAA,EAAA,CAAA,UAAA,EAAA,IAAA,CAAA,QAAA,CAAA,CAAA;;;;;;;;MAlHS,cADR,EAAA,CAAA,CAAA,KAAA,IAAA,CAAA,KAAA,CAAA,cAAA,EAAA,CAAA,CAAA;AAAA,KAIE,CAAA,EAAA;AAAA,MAAA,IAAA,CAAA,IAAA,IAAAN,SAAA,EAAA,EAAAO,WAAA,CAAA,kBAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,EAAA;AAAA,QAAA,OAAA,EAAAC,OAAA,CAAA,MAAA;WAFKR,SAAA,EAAA,EAAAO,WAAA,CAAAE,uBAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;AAAA,SACJ,CAAA;AAAa,QAAA,CAAA,EAAA,CAAA;;;;;;AAKE,yBACV,qCAA6B,EAAA,CAAE,sBAAqB,CAAA,EAAA,CAAA,QAAA,EAAA,wBAAA,CAAA,CAAA,CAAA;;;;"}
|
@@ -50,7 +50,12 @@ const _sfc_main = defineComponent({
|
|
50
50
|
const scrollbar = ref(null);
|
51
51
|
const currentTabId = ref(null);
|
52
52
|
const isUsingKeyboard = ref(false);
|
53
|
-
const triggerKeys = [
|
53
|
+
const triggerKeys = [
|
54
|
+
EVENT_CODE.enter,
|
55
|
+
EVENT_CODE.numpadEnter,
|
56
|
+
EVENT_CODE.space,
|
57
|
+
EVENT_CODE.down
|
58
|
+
];
|
54
59
|
const wrapStyle = computed(() => ({
|
55
60
|
maxHeight: addUnit(props.maxHeight)
|
56
61
|
}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dropdown2.mjs","sources":["../../../../../../packages/components/dropdown/src/dropdown.vue"],"sourcesContent":["<template>\n <div :class=\"[ns.b(), ns.is('disabled', disabled)]\">\n <el-tooltip\n ref=\"popperRef\"\n :role=\"role\"\n :effect=\"effect\"\n :fallback-placements=\"['bottom', 'top']\"\n :popper-options=\"popperOptions\"\n :gpu-acceleration=\"false\"\n :hide-after=\"trigger === 'hover' ? hideTimeout : 0\"\n :manual-mode=\"true\"\n :placement=\"placement\"\n :popper-class=\"[ns.e('popper'), popperClass]\"\n :reference-element=\"referenceElementRef?.$el\"\n :trigger=\"trigger\"\n :trigger-keys=\"triggerKeys\"\n :trigger-target-el=\"contentRef\"\n :show-after=\"trigger === 'hover' ? showTimeout : 0\"\n :stop-popper-mouse-event=\"false\"\n :virtual-ref=\"triggeringElementRef\"\n :virtual-triggering=\"splitButton\"\n :disabled=\"disabled\"\n :transition=\"`${ns.namespace.value}-zoom-in-top`\"\n :teleported=\"teleported\"\n pure\n persistent\n @before-show=\"handleBeforeShowTooltip\"\n @show=\"handleShowTooltip\"\n @before-hide=\"handleBeforeHideTooltip\"\n >\n <template #content>\n <el-scrollbar\n ref=\"scrollbar\"\n :wrap-style=\"wrapStyle\"\n tag=\"div\"\n :view-class=\"ns.e('list')\"\n >\n <el-roving-focus-group\n :loop=\"loop\"\n :current-tab-id=\"currentTabId\"\n orientation=\"horizontal\"\n @current-tab-id-change=\"handleCurrentTabIdChange\"\n @entry-focus=\"handleEntryFocus\"\n >\n <el-dropdown-collection>\n <slot name=\"dropdown\" />\n </el-dropdown-collection>\n </el-roving-focus-group>\n </el-scrollbar>\n </template>\n <template v-if=\"!splitButton\" #default>\n <el-only-child\n :id=\"triggerId\"\n ref=\"triggeringElementRef\"\n role=\"button\"\n :tabindex=\"tabindex\"\n >\n <slot name=\"default\" />\n </el-only-child>\n </template>\n </el-tooltip>\n <template v-if=\"splitButton\">\n <el-button-group>\n <el-button\n ref=\"referenceElementRef\"\n v-bind=\"buttonProps\"\n :size=\"dropdownSize\"\n :type=\"type\"\n :disabled=\"disabled\"\n :tabindex=\"tabindex\"\n @click=\"handlerMainButtonClick\"\n >\n <slot name=\"default\" />\n </el-button>\n <el-button\n :id=\"triggerId\"\n ref=\"triggeringElementRef\"\n v-bind=\"buttonProps\"\n role=\"button\"\n :size=\"dropdownSize\"\n :type=\"type\"\n :class=\"ns.e('caret-button')\"\n :disabled=\"disabled\"\n :tabindex=\"tabindex\"\n :aria-label=\"t('el.dropdown.toggleDropdown')\"\n >\n <el-icon :class=\"ns.e('icon')\"><arrow-down /></el-icon>\n </el-button>\n </el-button-group>\n </template>\n </div>\n</template>\n<script lang=\"ts\">\n// @ts-nocheck\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n onBeforeUnmount,\n provide,\n ref,\n toRef,\n unref,\n watch,\n} from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport ElScrollbar from '@element-plus/components/scrollbar'\nimport ElIcon from '@element-plus/components/icon'\nimport ElRovingFocusGroup from '@element-plus/components/roving-focus-group'\nimport { ElOnlyChild } from '@element-plus/components/slot'\nimport { useFormSize } from '@element-plus/components/form'\nimport { addUnit, ensureArray } from '@element-plus/utils'\nimport { ArrowDown } from '@element-plus/icons-vue'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { useId, useLocale, useNamespace } from '@element-plus/hooks'\nimport { ElCollection as ElDropdownCollection, dropdownProps } from './dropdown'\nimport { DROPDOWN_INJECTION_KEY } from './tokens'\n\nimport type { CSSProperties } from 'vue'\n\nconst { ButtonGroup: ElButtonGroup } = ElButton\n\nexport default defineComponent({\n name: 'ElDropdown',\n components: {\n ElButton,\n ElButtonGroup,\n ElScrollbar,\n ElDropdownCollection,\n ElTooltip,\n ElRovingFocusGroup,\n ElOnlyChild,\n ElIcon,\n ArrowDown,\n },\n props: dropdownProps,\n emits: ['visible-change', 'click', 'command'],\n setup(props, { emit }) {\n const _instance = getCurrentInstance()\n const ns = useNamespace('dropdown')\n const { t } = useLocale()\n\n const triggeringElementRef = ref()\n const referenceElementRef = ref()\n const popperRef = ref<InstanceType<typeof ElTooltip> | null>(null)\n const contentRef = ref<HTMLElement | null>(null)\n const scrollbar = ref(null)\n const currentTabId = ref<string | null>(null)\n const isUsingKeyboard = ref(false)\n const triggerKeys = [EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.down]\n\n const wrapStyle = computed<CSSProperties>(() => ({\n maxHeight: addUnit(props.maxHeight),\n }))\n const dropdownTriggerKls = computed(() => [ns.m(dropdownSize.value)])\n const trigger = computed(() => ensureArray(props.trigger))\n\n const defaultTriggerId = useId().value\n const triggerId = computed<string>(() => props.id || defaultTriggerId)\n\n // The goal of this code is to focus on the tooltip triggering element when it is hovered.\n // This is a temporary fix for where closing the dropdown through pointerleave event focuses on a\n // completely different element. For a permanent solution, remove all calls to any \"element.focus()\"\n // that are triggered through pointer enter/leave events.\n watch(\n [triggeringElementRef, trigger],\n ([triggeringElement, trigger], [prevTriggeringElement]) => {\n if (prevTriggeringElement?.$el?.removeEventListener) {\n prevTriggeringElement.$el.removeEventListener(\n 'pointerenter',\n onAutofocusTriggerEnter\n )\n }\n if (triggeringElement?.$el?.removeEventListener) {\n triggeringElement.$el.removeEventListener(\n 'pointerenter',\n onAutofocusTriggerEnter\n )\n }\n if (\n triggeringElement?.$el?.addEventListener &&\n trigger.includes('hover')\n ) {\n triggeringElement.$el.addEventListener(\n 'pointerenter',\n onAutofocusTriggerEnter\n )\n }\n },\n { immediate: true }\n )\n\n onBeforeUnmount(() => {\n if (triggeringElementRef.value?.$el?.removeEventListener) {\n triggeringElementRef.value.$el.removeEventListener(\n 'pointerenter',\n onAutofocusTriggerEnter\n )\n }\n })\n\n function handleClick() {\n handleClose()\n }\n\n function handleClose() {\n popperRef.value?.onClose()\n }\n\n function handleOpen() {\n popperRef.value?.onOpen()\n }\n\n const dropdownSize = useFormSize()\n\n function commandHandler(...args: any[]) {\n emit('command', ...args)\n }\n\n function onAutofocusTriggerEnter() {\n triggeringElementRef.value?.$el?.focus()\n }\n\n function onItemEnter() {\n // NOOP for now\n }\n\n function onItemLeave() {\n const contentEl = unref(contentRef)\n\n trigger.value.includes('hover') && contentEl?.focus()\n currentTabId.value = null\n }\n\n function handleCurrentTabIdChange(id: string) {\n currentTabId.value = id\n }\n\n function handleEntryFocus(e: Event) {\n if (!isUsingKeyboard.value) {\n e.preventDefault()\n e.stopImmediatePropagation()\n }\n }\n\n function handleBeforeShowTooltip() {\n emit('visible-change', true)\n }\n\n function handleShowTooltip(event?: Event) {\n if (event?.type === 'keydown') {\n contentRef.value.focus()\n }\n }\n\n function handleBeforeHideTooltip() {\n emit('visible-change', false)\n }\n\n provide(DROPDOWN_INJECTION_KEY, {\n contentRef,\n role: computed(() => props.role),\n triggerId,\n isUsingKeyboard,\n onItemEnter,\n onItemLeave,\n })\n\n provide('elDropdown', {\n instance: _instance,\n dropdownSize,\n handleClick,\n commandHandler,\n trigger: toRef(props, 'trigger'),\n hideOnClick: toRef(props, 'hideOnClick'),\n })\n\n const onFocusAfterTrapped = (e: Event) => {\n e.preventDefault()\n contentRef.value?.focus?.({\n preventScroll: true,\n })\n }\n\n const handlerMainButtonClick = (event: MouseEvent) => {\n emit('click', event)\n }\n\n return {\n t,\n ns,\n scrollbar,\n wrapStyle,\n dropdownTriggerKls,\n dropdownSize,\n triggerId,\n triggerKeys,\n currentTabId,\n handleCurrentTabIdChange,\n handlerMainButtonClick,\n handleEntryFocus,\n handleClose,\n handleOpen,\n handleBeforeShowTooltip,\n handleShowTooltip,\n handleBeforeHideTooltip,\n onFocusAfterTrapped,\n popperRef,\n contentRef,\n triggeringElementRef,\n referenceElementRef,\n }\n },\n})\n</script>\n"],"names":["ElDropdownCollection","ElOnlyChild","ensureArray","_resolveComponent","_createSlots","_withCtx","_createVNode","_renderSlot","_openBlock","_createBlock","_mergeProps","_normalizeClass","_createCommentVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyHA,MAAM,EAAE,WAAa,EAAA,aAAA,EAAkB,GAAA,QAAA,CAAA;AAEvC,MAAK,YAAa,eAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,YAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,QAA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CAAA;AAAA,UAAA,QACI,EAAA,IAAA,CAAA,QAAA;AAAA,UAAA,QACA,EAAA,IAAA,CAAA,QAAA;AAAA,UAAA,YACH,EAAA,IAAA,CAAA,CAAA,CAAA,4BAAA,CAAA;AAAA,SAAA,CAAA,EAAA;iCAEe;AAAA,YAAAD,WAAA,CAAA,kBAAA,EAAA;AAAA,cAAA,KAAA,EAAAK,cAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA;;;;AAEzB,eAAA,CAAA;AAaY,cAZL,CAAA,EAAA,CAAA;AAAA,aACD,EAAA,CAAA,EAAA,CAAA,OAAA,CAAA,CAAA;AAAA,WAAA,CAAA;AACe,UAAA,CAAA,EACd,CAAA;AAAA,SAAA,EAAA,EACE,EAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,EAAA,UAAA,EAAA,UAAA,EAAA,YAAA,CAAA,CAAA;AAAA,OAAA,CAAA;AACA,MACN,CAAA,EAAA,CAAA;AAAW,KAAA,CAAA,IAAAC,kBACD,CAAA,MAAA,EAAA,IAAA,CAAA;AAAA,GAAA,EAAA,CAAA,CAAA,CAAA;AACA,CAAA;+BAG4C,WAAA,CAAA,SAAA,EAAA,CAAA,CAAA,QAAA,EAAA,WAAA,CAAA,EAAA,CAAA,QAAA,EAAA,cAAA,CAAA,CAAA,CAAA;;;;"}
|
1
|
+
{"version":3,"file":"dropdown2.mjs","sources":["../../../../../../packages/components/dropdown/src/dropdown.vue"],"sourcesContent":["<template>\n <div :class=\"[ns.b(), ns.is('disabled', disabled)]\">\n <el-tooltip\n ref=\"popperRef\"\n :role=\"role\"\n :effect=\"effect\"\n :fallback-placements=\"['bottom', 'top']\"\n :popper-options=\"popperOptions\"\n :gpu-acceleration=\"false\"\n :hide-after=\"trigger === 'hover' ? hideTimeout : 0\"\n :manual-mode=\"true\"\n :placement=\"placement\"\n :popper-class=\"[ns.e('popper'), popperClass]\"\n :reference-element=\"referenceElementRef?.$el\"\n :trigger=\"trigger\"\n :trigger-keys=\"triggerKeys\"\n :trigger-target-el=\"contentRef\"\n :show-after=\"trigger === 'hover' ? showTimeout : 0\"\n :stop-popper-mouse-event=\"false\"\n :virtual-ref=\"triggeringElementRef\"\n :virtual-triggering=\"splitButton\"\n :disabled=\"disabled\"\n :transition=\"`${ns.namespace.value}-zoom-in-top`\"\n :teleported=\"teleported\"\n pure\n persistent\n @before-show=\"handleBeforeShowTooltip\"\n @show=\"handleShowTooltip\"\n @before-hide=\"handleBeforeHideTooltip\"\n >\n <template #content>\n <el-scrollbar\n ref=\"scrollbar\"\n :wrap-style=\"wrapStyle\"\n tag=\"div\"\n :view-class=\"ns.e('list')\"\n >\n <el-roving-focus-group\n :loop=\"loop\"\n :current-tab-id=\"currentTabId\"\n orientation=\"horizontal\"\n @current-tab-id-change=\"handleCurrentTabIdChange\"\n @entry-focus=\"handleEntryFocus\"\n >\n <el-dropdown-collection>\n <slot name=\"dropdown\" />\n </el-dropdown-collection>\n </el-roving-focus-group>\n </el-scrollbar>\n </template>\n <template v-if=\"!splitButton\" #default>\n <el-only-child\n :id=\"triggerId\"\n ref=\"triggeringElementRef\"\n role=\"button\"\n :tabindex=\"tabindex\"\n >\n <slot name=\"default\" />\n </el-only-child>\n </template>\n </el-tooltip>\n <template v-if=\"splitButton\">\n <el-button-group>\n <el-button\n ref=\"referenceElementRef\"\n v-bind=\"buttonProps\"\n :size=\"dropdownSize\"\n :type=\"type\"\n :disabled=\"disabled\"\n :tabindex=\"tabindex\"\n @click=\"handlerMainButtonClick\"\n >\n <slot name=\"default\" />\n </el-button>\n <el-button\n :id=\"triggerId\"\n ref=\"triggeringElementRef\"\n v-bind=\"buttonProps\"\n role=\"button\"\n :size=\"dropdownSize\"\n :type=\"type\"\n :class=\"ns.e('caret-button')\"\n :disabled=\"disabled\"\n :tabindex=\"tabindex\"\n :aria-label=\"t('el.dropdown.toggleDropdown')\"\n >\n <el-icon :class=\"ns.e('icon')\"><arrow-down /></el-icon>\n </el-button>\n </el-button-group>\n </template>\n </div>\n</template>\n<script lang=\"ts\">\n// @ts-nocheck\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n onBeforeUnmount,\n provide,\n ref,\n toRef,\n unref,\n watch,\n} from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport ElScrollbar from '@element-plus/components/scrollbar'\nimport ElIcon from '@element-plus/components/icon'\nimport ElRovingFocusGroup from '@element-plus/components/roving-focus-group'\nimport { ElOnlyChild } from '@element-plus/components/slot'\nimport { useFormSize } from '@element-plus/components/form'\nimport { addUnit, ensureArray } from '@element-plus/utils'\nimport { ArrowDown } from '@element-plus/icons-vue'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { useId, useLocale, useNamespace } from '@element-plus/hooks'\nimport { ElCollection as ElDropdownCollection, dropdownProps } from './dropdown'\nimport { DROPDOWN_INJECTION_KEY } from './tokens'\n\nimport type { CSSProperties } from 'vue'\n\nconst { ButtonGroup: ElButtonGroup } = ElButton\n\nexport default defineComponent({\n name: 'ElDropdown',\n components: {\n ElButton,\n ElButtonGroup,\n ElScrollbar,\n ElDropdownCollection,\n ElTooltip,\n ElRovingFocusGroup,\n ElOnlyChild,\n ElIcon,\n ArrowDown,\n },\n props: dropdownProps,\n emits: ['visible-change', 'click', 'command'],\n setup(props, { emit }) {\n const _instance = getCurrentInstance()\n const ns = useNamespace('dropdown')\n const { t } = useLocale()\n\n const triggeringElementRef = ref()\n const referenceElementRef = ref()\n const popperRef = ref<InstanceType<typeof ElTooltip> | null>(null)\n const contentRef = ref<HTMLElement | null>(null)\n const scrollbar = ref(null)\n const currentTabId = ref<string | null>(null)\n const isUsingKeyboard = ref(false)\n const triggerKeys = [\n EVENT_CODE.enter,\n EVENT_CODE.numpadEnter,\n EVENT_CODE.space,\n EVENT_CODE.down,\n ]\n\n const wrapStyle = computed<CSSProperties>(() => ({\n maxHeight: addUnit(props.maxHeight),\n }))\n const dropdownTriggerKls = computed(() => [ns.m(dropdownSize.value)])\n const trigger = computed(() => ensureArray(props.trigger))\n\n const defaultTriggerId = useId().value\n const triggerId = computed<string>(() => props.id || defaultTriggerId)\n\n // The goal of this code is to focus on the tooltip triggering element when it is hovered.\n // This is a temporary fix for where closing the dropdown through pointerleave event focuses on a\n // completely different element. For a permanent solution, remove all calls to any \"element.focus()\"\n // that are triggered through pointer enter/leave events.\n watch(\n [triggeringElementRef, trigger],\n ([triggeringElement, trigger], [prevTriggeringElement]) => {\n if (prevTriggeringElement?.$el?.removeEventListener) {\n prevTriggeringElement.$el.removeEventListener(\n 'pointerenter',\n onAutofocusTriggerEnter\n )\n }\n if (triggeringElement?.$el?.removeEventListener) {\n triggeringElement.$el.removeEventListener(\n 'pointerenter',\n onAutofocusTriggerEnter\n )\n }\n if (\n triggeringElement?.$el?.addEventListener &&\n trigger.includes('hover')\n ) {\n triggeringElement.$el.addEventListener(\n 'pointerenter',\n onAutofocusTriggerEnter\n )\n }\n },\n { immediate: true }\n )\n\n onBeforeUnmount(() => {\n if (triggeringElementRef.value?.$el?.removeEventListener) {\n triggeringElementRef.value.$el.removeEventListener(\n 'pointerenter',\n onAutofocusTriggerEnter\n )\n }\n })\n\n function handleClick() {\n handleClose()\n }\n\n function handleClose() {\n popperRef.value?.onClose()\n }\n\n function handleOpen() {\n popperRef.value?.onOpen()\n }\n\n const dropdownSize = useFormSize()\n\n function commandHandler(...args: any[]) {\n emit('command', ...args)\n }\n\n function onAutofocusTriggerEnter() {\n triggeringElementRef.value?.$el?.focus()\n }\n\n function onItemEnter() {\n // NOOP for now\n }\n\n function onItemLeave() {\n const contentEl = unref(contentRef)\n\n trigger.value.includes('hover') && contentEl?.focus()\n currentTabId.value = null\n }\n\n function handleCurrentTabIdChange(id: string) {\n currentTabId.value = id\n }\n\n function handleEntryFocus(e: Event) {\n if (!isUsingKeyboard.value) {\n e.preventDefault()\n e.stopImmediatePropagation()\n }\n }\n\n function handleBeforeShowTooltip() {\n emit('visible-change', true)\n }\n\n function handleShowTooltip(event?: Event) {\n if (event?.type === 'keydown') {\n contentRef.value.focus()\n }\n }\n\n function handleBeforeHideTooltip() {\n emit('visible-change', false)\n }\n\n provide(DROPDOWN_INJECTION_KEY, {\n contentRef,\n role: computed(() => props.role),\n triggerId,\n isUsingKeyboard,\n onItemEnter,\n onItemLeave,\n })\n\n provide('elDropdown', {\n instance: _instance,\n dropdownSize,\n handleClick,\n commandHandler,\n trigger: toRef(props, 'trigger'),\n hideOnClick: toRef(props, 'hideOnClick'),\n })\n\n const onFocusAfterTrapped = (e: Event) => {\n e.preventDefault()\n contentRef.value?.focus?.({\n preventScroll: true,\n })\n }\n\n const handlerMainButtonClick = (event: MouseEvent) => {\n emit('click', event)\n }\n\n return {\n t,\n ns,\n scrollbar,\n wrapStyle,\n dropdownTriggerKls,\n dropdownSize,\n triggerId,\n triggerKeys,\n currentTabId,\n handleCurrentTabIdChange,\n handlerMainButtonClick,\n handleEntryFocus,\n handleClose,\n handleOpen,\n handleBeforeShowTooltip,\n handleShowTooltip,\n handleBeforeHideTooltip,\n onFocusAfterTrapped,\n popperRef,\n contentRef,\n triggeringElementRef,\n referenceElementRef,\n }\n },\n})\n</script>\n"],"names":["ElDropdownCollection","ElOnlyChild","ensureArray","_resolveComponent","_createSlots","_withCtx","_createVNode","_renderSlot","_openBlock","_createBlock","_mergeProps","_normalizeClass","_createCommentVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyHA,MAAM,EAAE,WAAa,EAAA,aAAA,EAAkB,GAAA,QAAA,CAAA;AAEvC,MAAK,YAAa,eAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,YAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,QAAA;AAAA,IACA,aAAA;AAAA,IACA,WAAA;AAAA,0BACAA,YAAA;AAAA,IACA,SAAA;AAAA,IACA,kBAAA;AAAA,iBACAC,SAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AAAA,GACF;AAAA,EACA,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A,YACH,EAAA,IAAA,CAAA,CAAA,CAAA,4BAAA,CAAA;AAAA,SAAA,CAAA,EAAA;iCAEe;AAAA,YAAAD,WAAA,CAAA,kBAAA,EAAA;AAAA,cAAA,KAAA,EAAAK,cAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA;;;;AAEzB,eAAA,CAAA;AAaY,cAZL,CAAA,EAAA,CAAA;AAAA,aACD,EAAA,CAAA,EAAA,CAAA,OAAA,CAAA,CAAA;AAAA,WAAA,CAAA;AACe,UAAA,CAAA,EACd,CAAA;AAAA,SAAA,EAAA,EACE,EAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,EAAA,UAAA,EAAA,UAAA,EAAA,YAAA,CAAA,CAAA;AAAA,OAAA,CAAA;AACA,MACN,CAAA,EAAA,CAAA;AAAW,KAAA,CAAA,IAAAC,kBACD,CAAA,MAAA,EAAA,IAAA,CAAA;AAAA,GAAA,EAAA,CAAA,CAAA,CAAA;AACA,CAAA;+BAG4C,WAAA,CAAA,SAAA,EAAA,CAAA,CAAA,QAAA,EAAA,WAAA,CAAA,EAAA,CAAA,QAAA,EAAA,cAAA,CAAA,CAAA,CAAA;;;;"}
|
@@ -39,7 +39,7 @@ const initDropdownDomEvent = (dropdownChildren, triggerElm, _instance) => {
|
|
39
39
|
menuItems.value[0].focus();
|
40
40
|
ev.preventDefault();
|
41
41
|
ev.stopPropagation();
|
42
|
-
} else if (
|
42
|
+
} else if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(code)) {
|
43
43
|
_instance.handleClick();
|
44
44
|
} else if ([EVENT_CODE.tab, EVENT_CODE.esc].includes(code)) {
|
45
45
|
_instance.hide();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDropdown.mjs","sources":["../../../../../../packages/components/dropdown/src/useDropdown.ts"],"sourcesContent":["// @ts-nocheck\nimport { computed, inject, ref } from 'vue'\nimport { addClass } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { useId, useNamespace } from '@element-plus/hooks'\nimport type { Nullable } from '@element-plus/utils'\nimport type { IElDropdownInstance } from './dropdown'\n\nexport const useDropdown = () => {\n const elDropdown = inject<IElDropdownInstance>('elDropdown', {})\n const _elDropdownSize = computed(() => elDropdown?.dropdownSize)\n\n return {\n elDropdown,\n _elDropdownSize,\n }\n}\n\nexport const initDropdownDomEvent = (\n dropdownChildren,\n triggerElm,\n _instance\n) => {\n const ns = useNamespace('dropdown')\n const menuItems = ref<Nullable<HTMLButtonElement[]>>(null)\n const menuItemsArray = ref<Nullable<HTMLElement[]>>(null)\n const dropdownElm = ref<Nullable<HTMLElement>>(null)\n const listId = useId()\n dropdownElm.value = dropdownChildren?.subTree.el\n\n function removeTabindex() {\n triggerElm.setAttribute('tabindex', '-1')\n menuItemsArray.value?.forEach((item) => item.setAttribute('tabindex', '-1'))\n }\n\n function resetTabindex(ele) {\n removeTabindex()\n ele?.setAttribute('tabindex', '0')\n }\n\n function handleTriggerKeyDown(ev: KeyboardEvent) {\n const code = ev.code\n if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {\n removeTabindex()\n resetTabindex(menuItems.value[0])\n menuItems.value[0].focus()\n ev.preventDefault()\n ev.stopPropagation()\n } else if (
|
1
|
+
{"version":3,"file":"useDropdown.mjs","sources":["../../../../../../packages/components/dropdown/src/useDropdown.ts"],"sourcesContent":["// @ts-nocheck\nimport { computed, inject, ref } from 'vue'\nimport { addClass } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { useId, useNamespace } from '@element-plus/hooks'\nimport type { Nullable } from '@element-plus/utils'\nimport type { IElDropdownInstance } from './dropdown'\n\nexport const useDropdown = () => {\n const elDropdown = inject<IElDropdownInstance>('elDropdown', {})\n const _elDropdownSize = computed(() => elDropdown?.dropdownSize)\n\n return {\n elDropdown,\n _elDropdownSize,\n }\n}\n\nexport const initDropdownDomEvent = (\n dropdownChildren,\n triggerElm,\n _instance\n) => {\n const ns = useNamespace('dropdown')\n const menuItems = ref<Nullable<HTMLButtonElement[]>>(null)\n const menuItemsArray = ref<Nullable<HTMLElement[]>>(null)\n const dropdownElm = ref<Nullable<HTMLElement>>(null)\n const listId = useId()\n dropdownElm.value = dropdownChildren?.subTree.el\n\n function removeTabindex() {\n triggerElm.setAttribute('tabindex', '-1')\n menuItemsArray.value?.forEach((item) => item.setAttribute('tabindex', '-1'))\n }\n\n function resetTabindex(ele) {\n removeTabindex()\n ele?.setAttribute('tabindex', '0')\n }\n\n function handleTriggerKeyDown(ev: KeyboardEvent) {\n const code = ev.code\n if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {\n removeTabindex()\n resetTabindex(menuItems.value[0])\n menuItems.value[0].focus()\n ev.preventDefault()\n ev.stopPropagation()\n } else if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(code)) {\n _instance.handleClick()\n } else if ([EVENT_CODE.tab, EVENT_CODE.esc].includes(code)) {\n _instance.hide()\n }\n }\n\n function handleItemKeyDown(ev) {\n const code = ev.code\n const target = ev.target\n const currentIndex = menuItemsArray.value.indexOf(target)\n const max = menuItemsArray.value.length - 1\n let nextIndex\n if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {\n if (code === EVENT_CODE.up) {\n nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0\n } else {\n nextIndex = currentIndex < max ? currentIndex + 1 : max\n }\n removeTabindex()\n resetTabindex(menuItems.value[nextIndex])\n menuItems.value[nextIndex].focus()\n ev.preventDefault()\n ev.stopPropagation()\n } else if (code === EVENT_CODE.enter) {\n triggerElmFocus()\n target.click()\n if (_instance.props.hideOnClick) {\n _instance.hide()\n }\n } else if ([EVENT_CODE.tab, EVENT_CODE.esc].includes(code)) {\n _instance.hide()\n triggerElmFocus()\n }\n }\n\n function initAria() {\n dropdownElm.value.setAttribute('id', listId.value)\n triggerElm.setAttribute('aria-haspopup', 'list')\n triggerElm.setAttribute('aria-controls', listId.value)\n if (!_instance.props.splitButton) {\n triggerElm.setAttribute('role', 'button')\n triggerElm.setAttribute('tabindex', _instance.props.tabindex)\n addClass(triggerElm, ns.b('selfdefine'))\n }\n }\n\n function initEvent() {\n triggerElm?.addEventListener('keydown', handleTriggerKeyDown)\n dropdownElm.value?.addEventListener('keydown', handleItemKeyDown, true)\n }\n\n function initDomOperation() {\n menuItems.value = dropdownElm.value.querySelectorAll(\n \"[tabindex='-1']\"\n ) as unknown as HTMLButtonElement[]\n menuItemsArray.value = Array.from(menuItems.value)\n\n initEvent()\n initAria()\n }\n\n function triggerElmFocus() {\n triggerElm.focus()\n }\n\n initDomOperation()\n}\n"],"names":[],"mappings":";;;;;;;;;AAIY,MAAC,WAAW,GAAG,MAAM;AACjC,EAAE,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC9C,EAAE,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,UAAU,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;AAChG,EAAE,OAAO;AACT,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,GAAG,CAAC;AACJ,EAAE;AACU,MAAC,oBAAoB,GAAG,CAAC,gBAAgB,EAAE,UAAU,EAAE,SAAS,KAAK;AACjF,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AACtC,EAAE,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;AAC9B,EAAE,MAAM,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;AACnC,EAAE,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;AAChC,EAAE,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;AACzB,EAAE,WAAW,CAAC,KAAK,GAAG,gBAAgB,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;AACtF,EAAE,SAAS,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AG;AAC9B,IAAI,SAAS,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;AAC5E,IAAI,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACvD,IAAI,SAAS,EAAE,CAAC;AAChB,IAAI,QAAQ,EAAE,CAAC;AACf,GAAG;AACH,EAAE,SAAS,eAAe,GAAG;AAC7B,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;AACvB,GAAG;AACH,EAAE,gBAAgB,EAAE,CAAC;AACrB;;;;"}
|
@@ -54,9 +54,9 @@ const _sfc_main = defineComponent({
|
|
54
54
|
return;
|
55
55
|
if (focusLayer.paused)
|
56
56
|
return;
|
57
|
-
const {
|
57
|
+
const { code, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
|
58
58
|
const { loop } = props;
|
59
|
-
const isTabbing =
|
59
|
+
const isTabbing = code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
|
60
60
|
const currentFocusingEl = document.activeElement;
|
61
61
|
if (isTabbing && currentFocusingEl) {
|
62
62
|
const container = currentTarget;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"focus-trap.mjs","sources":["../../../../../../packages/components/focus-trap/src/focus-trap.vue"],"sourcesContent":["<template>\n <slot :handle-keydown=\"onKeydown\" />\n</template>\n<script lang=\"ts\">\nimport {\n defineComponent,\n nextTick,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n unref,\n watch,\n} from 'vue'\nimport { isNil } from 'lodash-unified'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { useEscapeKeydown } from '@element-plus/hooks'\nimport { isString } from '@element-plus/utils'\nimport {\n createFocusOutPreventedEvent,\n focusFirstDescendant,\n focusableStack,\n getEdges,\n isFocusCausedByUserEvent,\n obtainAllFocusableElements,\n tryFocus,\n useFocusReason,\n} from './utils'\nimport {\n FOCUS_AFTER_RELEASED,\n FOCUS_AFTER_TRAPPED,\n FOCUS_AFTER_TRAPPED_OPTS,\n FOCUS_TRAP_INJECTION_KEY,\n ON_RELEASE_FOCUS_EVT,\n ON_TRAP_FOCUS_EVT,\n} from './tokens'\n\nimport type { PropType } from 'vue'\nimport type { FocusLayer } from './utils'\n\nexport default defineComponent({\n name: 'ElFocusTrap',\n inheritAttrs: false,\n props: {\n loop: Boolean,\n trapped: Boolean,\n focusTrapEl: Object as PropType<HTMLElement>,\n focusStartEl: {\n type: [Object, String] as PropType<'container' | 'first' | HTMLElement>,\n default: 'first',\n },\n },\n emits: [\n ON_TRAP_FOCUS_EVT,\n ON_RELEASE_FOCUS_EVT,\n 'focusin',\n 'focusout',\n 'focusout-prevented',\n 'release-requested',\n ],\n setup(props, { emit }) {\n const forwardRef = ref<HTMLElement | undefined>()\n let lastFocusBeforeTrapped: HTMLElement | null\n let lastFocusAfterTrapped: HTMLElement | null\n\n const { focusReason } = useFocusReason()\n\n useEscapeKeydown((event) => {\n if (props.trapped && !focusLayer.paused) {\n emit('release-requested', event)\n }\n })\n\n const focusLayer: FocusLayer = {\n paused: false,\n pause() {\n this.paused = true\n },\n resume() {\n this.paused = false\n },\n }\n\n const onKeydown = (e: KeyboardEvent) => {\n if (!props.loop && !props.trapped) return\n if (focusLayer.paused) return\n\n const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e\n const { loop } = props\n const isTabbing =\n key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey\n\n const currentFocusingEl = document.activeElement\n if (isTabbing && currentFocusingEl) {\n const container = currentTarget as HTMLElement\n const [first, last] = getEdges(container)\n const isTabbable = first && last\n if (!isTabbable) {\n if (currentFocusingEl === container) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n }\n }\n } else {\n if (!shiftKey && currentFocusingEl === last) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n if (loop) tryFocus(first, true)\n }\n } else if (\n shiftKey &&\n [first, container].includes(currentFocusingEl as HTMLElement)\n ) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n if (loop) tryFocus(last, true)\n }\n }\n }\n }\n }\n\n provide(FOCUS_TRAP_INJECTION_KEY, {\n focusTrapRef: forwardRef,\n onKeydown,\n })\n\n watch(\n () => props.focusTrapEl,\n (focusTrapEl) => {\n if (focusTrapEl) {\n forwardRef.value = focusTrapEl\n }\n },\n { immediate: true }\n )\n\n watch([forwardRef], ([forwardRef], [oldForwardRef]) => {\n if (forwardRef) {\n forwardRef.addEventListener('keydown', onKeydown)\n forwardRef.addEventListener('focusin', onFocusIn)\n forwardRef.addEventListener('focusout', onFocusOut)\n }\n if (oldForwardRef) {\n oldForwardRef.removeEventListener('keydown', onKeydown)\n oldForwardRef.removeEventListener('focusin', onFocusIn)\n oldForwardRef.removeEventListener('focusout', onFocusOut)\n }\n })\n\n const trapOnFocus = (e: Event) => {\n emit(ON_TRAP_FOCUS_EVT, e)\n }\n const releaseOnFocus = (e: Event) => emit(ON_RELEASE_FOCUS_EVT, e)\n\n const onFocusIn = (e: FocusEvent) => {\n const trapContainer = unref(forwardRef)\n if (!trapContainer) return\n\n const target = e.target as HTMLElement | null\n const relatedTarget = e.relatedTarget as HTMLElement | null\n const isFocusedInTrap = target && trapContainer.contains(target)\n\n if (!props.trapped) {\n const isPrevFocusedInTrap =\n relatedTarget && trapContainer.contains(relatedTarget)\n if (!isPrevFocusedInTrap) {\n lastFocusBeforeTrapped = relatedTarget\n }\n }\n\n if (isFocusedInTrap) emit('focusin', e)\n\n if (focusLayer.paused) return\n\n if (props.trapped) {\n if (isFocusedInTrap) {\n lastFocusAfterTrapped = target\n } else {\n tryFocus(lastFocusAfterTrapped, true)\n }\n }\n }\n\n const onFocusOut = (e: Event) => {\n const trapContainer = unref(forwardRef)\n if (focusLayer.paused || !trapContainer) return\n\n if (props.trapped) {\n const relatedTarget = (e as FocusEvent)\n .relatedTarget as HTMLElement | null\n if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {\n // Give embedded focus layer time to pause this layer before reclaiming focus\n // And only reclaim focus if it should currently be trapping\n setTimeout(() => {\n if (!focusLayer.paused && props.trapped) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n tryFocus(lastFocusAfterTrapped, true)\n }\n }\n }, 0)\n }\n } else {\n const target = e.target as HTMLElement | null\n const isFocusedInTrap = target && trapContainer.contains(target)\n if (!isFocusedInTrap) emit('focusout', e)\n }\n }\n\n async function startTrap() {\n // Wait for forwardRef to resolve\n await nextTick()\n const trapContainer = unref(forwardRef)\n if (trapContainer) {\n focusableStack.push(focusLayer)\n const prevFocusedElement = trapContainer.contains(\n document.activeElement\n )\n ? lastFocusBeforeTrapped\n : document.activeElement\n lastFocusBeforeTrapped = prevFocusedElement as HTMLElement | null\n const isPrevFocusContained = trapContainer.contains(prevFocusedElement)\n if (!isPrevFocusContained) {\n const focusEvent = new Event(\n FOCUS_AFTER_TRAPPED,\n FOCUS_AFTER_TRAPPED_OPTS\n )\n trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus)\n trapContainer.dispatchEvent(focusEvent)\n if (!focusEvent.defaultPrevented) {\n nextTick(() => {\n let focusStartEl = props.focusStartEl\n if (!isString(focusStartEl)) {\n tryFocus(focusStartEl)\n if (document.activeElement !== focusStartEl) {\n focusStartEl = 'first'\n }\n }\n if (focusStartEl === 'first') {\n focusFirstDescendant(\n obtainAllFocusableElements(trapContainer),\n true\n )\n }\n if (\n document.activeElement === prevFocusedElement ||\n focusStartEl === 'container'\n ) {\n tryFocus(trapContainer)\n }\n })\n }\n }\n }\n }\n\n function stopTrap() {\n const trapContainer = unref(forwardRef)\n\n if (trapContainer) {\n trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus)\n\n const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {\n ...FOCUS_AFTER_TRAPPED_OPTS,\n detail: {\n focusReason: focusReason.value,\n },\n })\n trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus)\n trapContainer.dispatchEvent(releasedEvent)\n if (\n !releasedEvent.defaultPrevented &&\n (focusReason.value == 'keyboard' ||\n !isFocusCausedByUserEvent() ||\n trapContainer.contains(document.activeElement))\n ) {\n tryFocus(lastFocusBeforeTrapped ?? document.body)\n }\n\n trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus)\n focusableStack.remove(focusLayer)\n }\n }\n\n onMounted(() => {\n if (props.trapped) {\n startTrap()\n }\n\n watch(\n () => props.trapped,\n (trapped) => {\n if (trapped) {\n startTrap()\n } else {\n stopTrap()\n }\n }\n )\n })\n\n onBeforeUnmount(() => {\n if (props.trapped) {\n stopTrap()\n }\n\n if (forwardRef.value) {\n forwardRef.value.removeEventListener('keydown', onKeydown)\n forwardRef.value.removeEventListener('focusin', onFocusIn)\n forwardRef.value.removeEventListener('focusout', onFocusOut)\n forwardRef.value = undefined\n }\n })\n\n return {\n onKeydown,\n }\n },\n})\n</script>\n"],"names":["forwardRef","_renderSlot"],"mappings":";;;;;;;;;;;;AAwCA,MAAK,YAAa,eAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,aAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAAA,EACd,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,OAAA;AAAA,IACT,WAAa,EAAA,MAAA;AAAA,IACb,YAAc,EAAA;AAAA,MAC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AAA,UAAA,EAAA,UAAA,CAAA,CAAA;AACjB,QAAS,UAAA,CAAA,KAAA,GAAA,KAAA,CAAA,CAAA;AAAA,OACX;AAEA,KAAA,CAAA,CAAA;AACE,IAAW,OAAA;AACX,MAAW,SAAA;AACX,KAAW,CAAA;AACX,GAAA;AAAmB,CACrB,CAAA,CAAA;AAGF,SAAO,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;AAAA,EACL,OAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,aAAA,EAAA,IAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAA,CACF;AAEJ,kBAAC,gBAAA,WAAA,CAAA,SAAA,EAAA,CAAA,CAAA,QAAA,EAAA,WAAA,CAAA,EAAA,CAAA,QAAA,EAAA,gBAAA,CAAA,CAAA,CAAA;;;;"}
|
1
|
+
{"version":3,"file":"focus-trap.mjs","sources":["../../../../../../packages/components/focus-trap/src/focus-trap.vue"],"sourcesContent":["<template>\n <slot :handle-keydown=\"onKeydown\" />\n</template>\n<script lang=\"ts\">\nimport {\n defineComponent,\n nextTick,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n unref,\n watch,\n} from 'vue'\nimport { isNil } from 'lodash-unified'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { useEscapeKeydown } from '@element-plus/hooks'\nimport { isString } from '@element-plus/utils'\nimport {\n createFocusOutPreventedEvent,\n focusFirstDescendant,\n focusableStack,\n getEdges,\n isFocusCausedByUserEvent,\n obtainAllFocusableElements,\n tryFocus,\n useFocusReason,\n} from './utils'\nimport {\n FOCUS_AFTER_RELEASED,\n FOCUS_AFTER_TRAPPED,\n FOCUS_AFTER_TRAPPED_OPTS,\n FOCUS_TRAP_INJECTION_KEY,\n ON_RELEASE_FOCUS_EVT,\n ON_TRAP_FOCUS_EVT,\n} from './tokens'\n\nimport type { PropType } from 'vue'\nimport type { FocusLayer } from './utils'\n\nexport default defineComponent({\n name: 'ElFocusTrap',\n inheritAttrs: false,\n props: {\n loop: Boolean,\n trapped: Boolean,\n focusTrapEl: Object as PropType<HTMLElement>,\n focusStartEl: {\n type: [Object, String] as PropType<'container' | 'first' | HTMLElement>,\n default: 'first',\n },\n },\n emits: [\n ON_TRAP_FOCUS_EVT,\n ON_RELEASE_FOCUS_EVT,\n 'focusin',\n 'focusout',\n 'focusout-prevented',\n 'release-requested',\n ],\n setup(props, { emit }) {\n const forwardRef = ref<HTMLElement | undefined>()\n let lastFocusBeforeTrapped: HTMLElement | null\n let lastFocusAfterTrapped: HTMLElement | null\n\n const { focusReason } = useFocusReason()\n\n useEscapeKeydown((event) => {\n if (props.trapped && !focusLayer.paused) {\n emit('release-requested', event)\n }\n })\n\n const focusLayer: FocusLayer = {\n paused: false,\n pause() {\n this.paused = true\n },\n resume() {\n this.paused = false\n },\n }\n\n const onKeydown = (e: KeyboardEvent) => {\n if (!props.loop && !props.trapped) return\n if (focusLayer.paused) return\n\n const { code, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e\n const { loop } = props\n const isTabbing =\n code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey\n\n const currentFocusingEl = document.activeElement\n if (isTabbing && currentFocusingEl) {\n const container = currentTarget as HTMLElement\n const [first, last] = getEdges(container)\n const isTabbable = first && last\n if (!isTabbable) {\n if (currentFocusingEl === container) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n }\n }\n } else {\n if (!shiftKey && currentFocusingEl === last) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n if (loop) tryFocus(first, true)\n }\n } else if (\n shiftKey &&\n [first, container].includes(currentFocusingEl as HTMLElement)\n ) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n if (loop) tryFocus(last, true)\n }\n }\n }\n }\n }\n\n provide(FOCUS_TRAP_INJECTION_KEY, {\n focusTrapRef: forwardRef,\n onKeydown,\n })\n\n watch(\n () => props.focusTrapEl,\n (focusTrapEl) => {\n if (focusTrapEl) {\n forwardRef.value = focusTrapEl\n }\n },\n { immediate: true }\n )\n\n watch([forwardRef], ([forwardRef], [oldForwardRef]) => {\n if (forwardRef) {\n forwardRef.addEventListener('keydown', onKeydown)\n forwardRef.addEventListener('focusin', onFocusIn)\n forwardRef.addEventListener('focusout', onFocusOut)\n }\n if (oldForwardRef) {\n oldForwardRef.removeEventListener('keydown', onKeydown)\n oldForwardRef.removeEventListener('focusin', onFocusIn)\n oldForwardRef.removeEventListener('focusout', onFocusOut)\n }\n })\n\n const trapOnFocus = (e: Event) => {\n emit(ON_TRAP_FOCUS_EVT, e)\n }\n const releaseOnFocus = (e: Event) => emit(ON_RELEASE_FOCUS_EVT, e)\n\n const onFocusIn = (e: FocusEvent) => {\n const trapContainer = unref(forwardRef)\n if (!trapContainer) return\n\n const target = e.target as HTMLElement | null\n const relatedTarget = e.relatedTarget as HTMLElement | null\n const isFocusedInTrap = target && trapContainer.contains(target)\n\n if (!props.trapped) {\n const isPrevFocusedInTrap =\n relatedTarget && trapContainer.contains(relatedTarget)\n if (!isPrevFocusedInTrap) {\n lastFocusBeforeTrapped = relatedTarget\n }\n }\n\n if (isFocusedInTrap) emit('focusin', e)\n\n if (focusLayer.paused) return\n\n if (props.trapped) {\n if (isFocusedInTrap) {\n lastFocusAfterTrapped = target\n } else {\n tryFocus(lastFocusAfterTrapped, true)\n }\n }\n }\n\n const onFocusOut = (e: Event) => {\n const trapContainer = unref(forwardRef)\n if (focusLayer.paused || !trapContainer) return\n\n if (props.trapped) {\n const relatedTarget = (e as FocusEvent)\n .relatedTarget as HTMLElement | null\n if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {\n // Give embedded focus layer time to pause this layer before reclaiming focus\n // And only reclaim focus if it should currently be trapping\n setTimeout(() => {\n if (!focusLayer.paused && props.trapped) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n tryFocus(lastFocusAfterTrapped, true)\n }\n }\n }, 0)\n }\n } else {\n const target = e.target as HTMLElement | null\n const isFocusedInTrap = target && trapContainer.contains(target)\n if (!isFocusedInTrap) emit('focusout', e)\n }\n }\n\n async function startTrap() {\n // Wait for forwardRef to resolve\n await nextTick()\n const trapContainer = unref(forwardRef)\n if (trapContainer) {\n focusableStack.push(focusLayer)\n const prevFocusedElement = trapContainer.contains(\n document.activeElement\n )\n ? lastFocusBeforeTrapped\n : document.activeElement\n lastFocusBeforeTrapped = prevFocusedElement as HTMLElement | null\n const isPrevFocusContained = trapContainer.contains(prevFocusedElement)\n if (!isPrevFocusContained) {\n const focusEvent = new Event(\n FOCUS_AFTER_TRAPPED,\n FOCUS_AFTER_TRAPPED_OPTS\n )\n trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus)\n trapContainer.dispatchEvent(focusEvent)\n if (!focusEvent.defaultPrevented) {\n nextTick(() => {\n let focusStartEl = props.focusStartEl\n if (!isString(focusStartEl)) {\n tryFocus(focusStartEl)\n if (document.activeElement !== focusStartEl) {\n focusStartEl = 'first'\n }\n }\n if (focusStartEl === 'first') {\n focusFirstDescendant(\n obtainAllFocusableElements(trapContainer),\n true\n )\n }\n if (\n document.activeElement === prevFocusedElement ||\n focusStartEl === 'container'\n ) {\n tryFocus(trapContainer)\n }\n })\n }\n }\n }\n }\n\n function stopTrap() {\n const trapContainer = unref(forwardRef)\n\n if (trapContainer) {\n trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus)\n\n const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {\n ...FOCUS_AFTER_TRAPPED_OPTS,\n detail: {\n focusReason: focusReason.value,\n },\n })\n trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus)\n trapContainer.dispatchEvent(releasedEvent)\n if (\n !releasedEvent.defaultPrevented &&\n (focusReason.value == 'keyboard' ||\n !isFocusCausedByUserEvent() ||\n trapContainer.contains(document.activeElement))\n ) {\n tryFocus(lastFocusBeforeTrapped ?? document.body)\n }\n\n trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus)\n focusableStack.remove(focusLayer)\n }\n }\n\n onMounted(() => {\n if (props.trapped) {\n startTrap()\n }\n\n watch(\n () => props.trapped,\n (trapped) => {\n if (trapped) {\n startTrap()\n } else {\n stopTrap()\n }\n }\n )\n })\n\n onBeforeUnmount(() => {\n if (props.trapped) {\n stopTrap()\n }\n\n if (forwardRef.value) {\n forwardRef.value.removeEventListener('keydown', onKeydown)\n forwardRef.value.removeEventListener('focusin', onFocusIn)\n forwardRef.value.removeEventListener('focusout', onFocusOut)\n forwardRef.value = undefined\n }\n })\n\n return {\n onKeydown,\n }\n },\n})\n</script>\n"],"names":["forwardRef","_renderSlot"],"mappings":";;;;;;;;;;;;AAwCA,MAAK,YAAa,eAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,aAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAAA,EACd,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,OAAA;AAAA,IACT,WAAa,EAAA,MAAA;AAAA,IACb,YAAc,EAAA;AAAA,MACZ,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,MACrB,OAAS,EAAA,OAAA;AAAA,KACX;AAAA,GACF;AAAA,EACA,KAAO,EAAA;AAAA,IACL,iBAAA;AAAA,IACA,oBAAA;AAAA,IACA,SAAA;AAA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AAA;AAAmB,CACrB,CAAA,CAAA;AAGF,SAAO,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;AAAA,EACL,OAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,aAAA,EAAA,IAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAA,CACF;AAEJ,kBAAC,gBAAA,WAAA,CAAA,SAAA,EAAA,CAAA,CAAA,QAAA,EAAA,WAAA,CAAA,EAAA,CAAA,QAAA,EAAA,gBAAA,CAAA,CAAA,CAAA;;;;"}
|
@@ -14,6 +14,7 @@ import { inputProps } from '../../input/src/input.mjs';
|
|
14
14
|
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
15
15
|
import { useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
|
16
16
|
import { useId } from '../../../hooks/use-id/index.mjs';
|
17
|
+
import { EVENT_CODE } from '../../../constants/aria.mjs';
|
17
18
|
import { isFunction } from '@vue/shared';
|
18
19
|
import { UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';
|
19
20
|
import { useFocusController } from '../../../hooks/use-focus-controller/index.mjs';
|
@@ -57,55 +58,60 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
57
58
|
emit("update:modelValue", value);
|
58
59
|
syncAfterCursorMove();
|
59
60
|
};
|
60
|
-
const handleInputKeyDown = (
|
61
|
+
const handleInputKeyDown = (event) => {
|
61
62
|
var _a, _b, _c, _d;
|
62
|
-
if (!("
|
63
|
+
if (!("code" in event) || ((_a = elInputRef.value) == null ? void 0 : _a.isComposing))
|
63
64
|
return;
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
const direction = e.key === "ArrowUp" ? "prev" : "next";
|
73
|
-
(_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(direction);
|
74
|
-
} else if (["Enter"].includes(e.key)) {
|
75
|
-
if (!visible.value)
|
76
|
-
return;
|
77
|
-
e.preventDefault();
|
78
|
-
if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
|
79
|
-
(_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
|
80
|
-
} else {
|
81
|
-
visible.value = false;
|
82
|
-
}
|
83
|
-
} else if (["Escape"].includes(e.key)) {
|
84
|
-
if (!visible.value)
|
85
|
-
return;
|
86
|
-
e.preventDefault();
|
87
|
-
visible.value = false;
|
88
|
-
} else if (["Backspace"].includes(e.key)) {
|
89
|
-
if (props.whole && mentionCtx.value) {
|
90
|
-
const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
|
91
|
-
const inputEl = getInputEl();
|
92
|
-
if (!inputEl)
|
65
|
+
switch (event.code) {
|
66
|
+
case EVENT_CODE.left:
|
67
|
+
case EVENT_CODE.right:
|
68
|
+
syncAfterCursorMove();
|
69
|
+
break;
|
70
|
+
case EVENT_CODE.up:
|
71
|
+
case EVENT_CODE.down:
|
72
|
+
if (!visible.value)
|
93
73
|
return;
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
74
|
+
event.preventDefault();
|
75
|
+
(_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(event.code === EVENT_CODE.up ? "prev" : "next");
|
76
|
+
break;
|
77
|
+
case EVENT_CODE.enter:
|
78
|
+
case EVENT_CODE.numpadEnter:
|
79
|
+
if (!visible.value)
|
80
|
+
return;
|
81
|
+
event.preventDefault();
|
82
|
+
if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
|
83
|
+
(_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
|
84
|
+
} else {
|
85
|
+
visible.value = false;
|
86
|
+
}
|
87
|
+
break;
|
88
|
+
case EVENT_CODE.esc:
|
89
|
+
if (!visible.value)
|
90
|
+
return;
|
91
|
+
event.preventDefault();
|
92
|
+
visible.value = false;
|
93
|
+
break;
|
94
|
+
case EVENT_CODE.backspace:
|
95
|
+
if (props.whole && mentionCtx.value) {
|
96
|
+
const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
|
97
|
+
const inputEl = getInputEl();
|
98
|
+
if (!inputEl)
|
99
|
+
return;
|
100
|
+
const inputValue = inputEl.value;
|
101
|
+
const matchOption = props.options.find((item) => item.value === pattern);
|
102
|
+
const isWhole = isFunction(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
|
103
|
+
if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
|
104
|
+
event.preventDefault();
|
105
|
+
const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
|
106
|
+
emit(UPDATE_MODEL_EVENT, newValue);
|
107
|
+
const newSelectionEnd = prefixIndex;
|
108
|
+
nextTick(() => {
|
109
|
+
inputEl.selectionStart = newSelectionEnd;
|
110
|
+
inputEl.selectionEnd = newSelectionEnd;
|
111
|
+
syncDropdownVisible();
|
112
|
+
});
|
113
|
+
}
|
107
114
|
}
|
108
|
-
}
|
109
115
|
}
|
110
116
|
};
|
111
117
|
const { wrapperRef } = useFocusController(elInputRef, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mention2.mjs","sources":["../../../../../../packages/components/mention/src/mention.vue"],"sourcesContent":["<template>\n <div ref=\"wrapperRef\" :class=\"ns.b()\">\n <el-input\n v-bind=\"mergeProps(passInputProps, $attrs)\"\n ref=\"elInputRef\"\n :model-value=\"modelValue\"\n :disabled=\"disabled\"\n :role=\"dropdownVisible ? 'combobox' : undefined\"\n :aria-activedescendant=\"dropdownVisible ? hoveringId || '' : undefined\"\n :aria-controls=\"dropdownVisible ? contentId : undefined\"\n :aria-expanded=\"dropdownVisible || undefined\"\n :aria-label=\"ariaLabel\"\n :aria-autocomplete=\"dropdownVisible ? 'none' : undefined\"\n :aria-haspopup=\"dropdownVisible ? 'listbox' : undefined\"\n @input=\"handleInputChange\"\n @keydown=\"handleInputKeyDown\"\n @mousedown=\"handleInputMouseDown\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]=\"slotProps\">\n <slot :name=\"name\" v-bind=\"slotProps\" />\n </template>\n </el-input>\n <el-tooltip\n ref=\"tooltipRef\"\n :visible=\"dropdownVisible\"\n :popper-class=\"[ns.e('popper'), popperClass]\"\n :popper-options=\"popperOptions\"\n :placement=\"computedPlacement\"\n :fallback-placements=\"computedFallbackPlacements\"\n effect=\"light\"\n pure\n :offset=\"offset\"\n :show-arrow=\"showArrow\"\n >\n <template #default>\n <div :style=\"cursorStyle\" />\n </template>\n <template #content>\n <el-mention-dropdown\n ref=\"dropdownRef\"\n :options=\"filteredOptions\"\n :disabled=\"disabled\"\n :loading=\"loading\"\n :content-id=\"contentId\"\n :aria-label=\"ariaLabel\"\n @select=\"handleSelect\"\n @click.stop=\"elInputRef?.focus\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]=\"slotProps\">\n <slot :name=\"name\" v-bind=\"slotProps\" />\n </template>\n </el-mention-dropdown>\n </template>\n </el-tooltip>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, mergeProps, nextTick, ref } from 'vue'\nimport { pick } from 'lodash-unified'\nimport { useFocusController, useId, useNamespace } from '@element-plus/hooks'\nimport ElInput, { inputProps } from '@element-plus/components/input'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useFormDisabled } from '@element-plus/components/form'\nimport { isFunction } from '@element-plus/utils'\nimport { mentionEmits, mentionProps } from './mention'\nimport { getCursorPosition, getMentionCtx } from './helper'\nimport ElMentionDropdown from './mention-dropdown.vue'\n\nimport type { Placement } from '@popperjs/core'\nimport type { CSSProperties } from 'vue'\nimport type { InputInstance } from '@element-plus/components/input'\nimport type { TooltipInstance } from '@element-plus/components/tooltip'\nimport type { MentionCtx, MentionOption } from './types'\n\ndefineOptions({\n name: 'ElMention',\n inheritAttrs: false,\n})\n\nconst props = defineProps(mentionProps)\nconst emit = defineEmits(mentionEmits)\n\nconst passInputProps = computed(() => pick(props, Object.keys(inputProps)))\n\nconst ns = useNamespace('mention')\nconst disabled = useFormDisabled()\nconst contentId = useId()\n\nconst elInputRef = ref<InputInstance>()\nconst tooltipRef = ref<TooltipInstance>()\nconst dropdownRef = ref<InstanceType<typeof ElMentionDropdown>>()\n\nconst visible = ref(false)\nconst cursorStyle = ref<CSSProperties>()\nconst mentionCtx = ref<MentionCtx>()\n\nconst computedPlacement = computed<Placement>(() =>\n props.showArrow ? props.placement : `${props.placement}-start`\n)\n\nconst computedFallbackPlacements = computed<Placement[]>(() =>\n props.showArrow ? ['bottom', 'top'] : ['bottom-start', 'top-start']\n)\n\nconst filteredOptions = computed(() => {\n const { filterOption, options } = props\n if (!mentionCtx.value || !filterOption) return options\n return options.filter((option) =>\n filterOption(mentionCtx.value!.pattern, option)\n )\n})\n\nconst dropdownVisible = computed(() => {\n return visible.value && (!!filteredOptions.value.length || props.loading)\n})\n\nconst hoveringId = computed(() => {\n return `${contentId.value}-${dropdownRef.value?.hoveringIndex}`\n})\n\nconst handleInputChange = (value: string) => {\n emit('update:modelValue', value)\n syncAfterCursorMove()\n}\n\nconst handleInputKeyDown = (e: KeyboardEvent | Event) => {\n if (!('key' in e)) return\n if (elInputRef.value?.isComposing) return\n if (['ArrowLeft', 'ArrowRight'].includes(e.key)) {\n syncAfterCursorMove()\n } else if (['ArrowUp', 'ArrowDown'].includes(e.key)) {\n if (!visible.value) return\n e.preventDefault()\n const direction = e.key === 'ArrowUp' ? 'prev' : 'next'\n dropdownRef.value?.navigateOptions(direction)\n } else if (['Enter'].includes(e.key)) {\n if (!visible.value) return\n e.preventDefault()\n if (dropdownRef.value?.hoverOption) {\n dropdownRef.value?.selectHoverOption()\n } else {\n visible.value = false\n }\n } else if (['Escape'].includes(e.key)) {\n if (!visible.value) return\n e.preventDefault()\n visible.value = false\n } else if (['Backspace'].includes(e.key)) {\n if (props.whole && mentionCtx.value) {\n const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } =\n mentionCtx.value\n const inputEl = getInputEl()\n if (!inputEl) return\n const inputValue = inputEl.value\n const matchOption = props.options.find((item) => item.value === pattern)\n const isWhole = isFunction(props.checkIsWhole)\n ? props.checkIsWhole(pattern, prefix)\n : matchOption\n if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {\n e.preventDefault()\n const newValue =\n inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1)\n emit(UPDATE_MODEL_EVENT, newValue)\n\n const newSelectionEnd = prefixIndex\n nextTick(() => {\n // input value is updated\n inputEl.selectionStart = newSelectionEnd\n inputEl.selectionEnd = newSelectionEnd\n syncDropdownVisible()\n })\n }\n }\n }\n}\n\nconst { wrapperRef } = useFocusController(elInputRef, {\n beforeFocus() {\n return disabled.value\n },\n afterFocus() {\n syncAfterCursorMove()\n },\n beforeBlur(event) {\n return tooltipRef.value?.isFocusInsideContent(event)\n },\n afterBlur() {\n visible.value = false\n },\n})\n\nconst handleInputMouseDown = () => {\n syncAfterCursorMove()\n}\n\nconst handleSelect = (item: MentionOption) => {\n if (!mentionCtx.value) return\n const inputEl = getInputEl()\n if (!inputEl) return\n const inputValue = inputEl.value\n const { split } = props\n\n const newEndPart = inputValue.slice(mentionCtx.value.end)\n const alreadySeparated = newEndPart.startsWith(split)\n const newMiddlePart = `${item.value}${alreadySeparated ? '' : split}`\n\n const newValue =\n inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart\n\n emit(UPDATE_MODEL_EVENT, newValue)\n emit('select', item, mentionCtx.value.prefix)\n\n const newSelectionEnd =\n mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0)\n\n nextTick(() => {\n // input value is updated\n inputEl.selectionStart = newSelectionEnd\n inputEl.selectionEnd = newSelectionEnd\n inputEl.focus()\n syncDropdownVisible()\n })\n}\n\nconst getInputEl = () =>\n props.type === 'textarea'\n ? elInputRef.value?.textarea\n : elInputRef.value?.input\n\nconst syncAfterCursorMove = () => {\n // can't use nextTick(), get cursor position will be wrong\n setTimeout(() => {\n syncCursor()\n syncDropdownVisible()\n nextTick(() => tooltipRef.value?.updatePopper())\n }, 0)\n}\n\nconst syncCursor = () => {\n const inputEl = getInputEl()\n if (!inputEl) return\n\n const caretPosition = getCursorPosition(inputEl)\n const inputRect = inputEl.getBoundingClientRect()\n const elInputRect = elInputRef.value!.$el.getBoundingClientRect()\n\n cursorStyle.value = {\n position: 'absolute',\n width: 0,\n height: `${caretPosition.height}px`,\n left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,\n top: `${caretPosition.top + inputRect.top - elInputRect.top}px`,\n }\n}\n\nconst syncDropdownVisible = () => {\n const inputEl = getInputEl()\n if (document.activeElement !== inputEl) {\n visible.value = false\n return\n }\n const { prefix, split } = props\n mentionCtx.value = getMentionCtx(inputEl, prefix, split)\n if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {\n visible.value = true\n emit('search', mentionCtx.value.pattern, mentionCtx.value.prefix)\n return\n }\n visible.value = false\n}\n\ndefineExpose({\n input: elInputRef,\n tooltip: tooltipRef,\n dropdownVisible,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;mCA4Ec,CAAA;AAAA,EACZ,IAAM,EAAA,WAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAChB,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,cAAA,GAAiB,SAAS,MAAM,IAAA,CAAK,OAAO,MAAO,CAAA,IAAA,CAAK,UAAU,CAAC,CAAC,CAAA,CAAA;AAE1E,IAAM,MAAA,EAAA,GAAK,aAAa,SAAS,CAAA,CAAA;AACjC,IAAA,MAAM,WAAW,eAAgB,EAAA,CAAA;AACjC,IAAA,MAAM,YAAY,KAAM,EAAA,CAAA;AAExB,IAAA,MAAM,aAAa,GAAmB,EAAA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A,GAAA,UAAA,EAAA,CAAA;AAEA,MAAa,IAAA,QAAA,CAAA,aAAA,KAAA,OAAA,EAAA;AAAA,QACJ,OAAA,CAAA,KAAA,GAAA,KAAA,CAAA;AAAA,QACE,OAAA;AAAA,OACT;AAAA,MACD,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,GAAA,KAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"mention2.mjs","sources":["../../../../../../packages/components/mention/src/mention.vue"],"sourcesContent":["<template>\n <div ref=\"wrapperRef\" :class=\"ns.b()\">\n <el-input\n v-bind=\"mergeProps(passInputProps, $attrs)\"\n ref=\"elInputRef\"\n :model-value=\"modelValue\"\n :disabled=\"disabled\"\n :role=\"dropdownVisible ? 'combobox' : undefined\"\n :aria-activedescendant=\"dropdownVisible ? hoveringId || '' : undefined\"\n :aria-controls=\"dropdownVisible ? contentId : undefined\"\n :aria-expanded=\"dropdownVisible || undefined\"\n :aria-label=\"ariaLabel\"\n :aria-autocomplete=\"dropdownVisible ? 'none' : undefined\"\n :aria-haspopup=\"dropdownVisible ? 'listbox' : undefined\"\n @input=\"handleInputChange\"\n @keydown=\"handleInputKeyDown\"\n @mousedown=\"handleInputMouseDown\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]=\"slotProps\">\n <slot :name=\"name\" v-bind=\"slotProps\" />\n </template>\n </el-input>\n <el-tooltip\n ref=\"tooltipRef\"\n :visible=\"dropdownVisible\"\n :popper-class=\"[ns.e('popper'), popperClass]\"\n :popper-options=\"popperOptions\"\n :placement=\"computedPlacement\"\n :fallback-placements=\"computedFallbackPlacements\"\n effect=\"light\"\n pure\n :offset=\"offset\"\n :show-arrow=\"showArrow\"\n >\n <template #default>\n <div :style=\"cursorStyle\" />\n </template>\n <template #content>\n <el-mention-dropdown\n ref=\"dropdownRef\"\n :options=\"filteredOptions\"\n :disabled=\"disabled\"\n :loading=\"loading\"\n :content-id=\"contentId\"\n :aria-label=\"ariaLabel\"\n @select=\"handleSelect\"\n @click.stop=\"elInputRef?.focus\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]=\"slotProps\">\n <slot :name=\"name\" v-bind=\"slotProps\" />\n </template>\n </el-mention-dropdown>\n </template>\n </el-tooltip>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, mergeProps, nextTick, ref } from 'vue'\nimport { pick } from 'lodash-unified'\nimport { useFocusController, useId, useNamespace } from '@element-plus/hooks'\nimport ElInput, { inputProps } from '@element-plus/components/input'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport { EVENT_CODE, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useFormDisabled } from '@element-plus/components/form'\nimport { isFunction } from '@element-plus/utils'\nimport { mentionEmits, mentionProps } from './mention'\nimport { getCursorPosition, getMentionCtx } from './helper'\nimport ElMentionDropdown from './mention-dropdown.vue'\n\nimport type { Placement } from '@popperjs/core'\nimport type { CSSProperties } from 'vue'\nimport type { InputInstance } from '@element-plus/components/input'\nimport type { TooltipInstance } from '@element-plus/components/tooltip'\nimport type { MentionCtx, MentionOption } from './types'\n\ndefineOptions({\n name: 'ElMention',\n inheritAttrs: false,\n})\n\nconst props = defineProps(mentionProps)\nconst emit = defineEmits(mentionEmits)\n\nconst passInputProps = computed(() => pick(props, Object.keys(inputProps)))\n\nconst ns = useNamespace('mention')\nconst disabled = useFormDisabled()\nconst contentId = useId()\n\nconst elInputRef = ref<InputInstance>()\nconst tooltipRef = ref<TooltipInstance>()\nconst dropdownRef = ref<InstanceType<typeof ElMentionDropdown>>()\n\nconst visible = ref(false)\nconst cursorStyle = ref<CSSProperties>()\nconst mentionCtx = ref<MentionCtx>()\n\nconst computedPlacement = computed<Placement>(() =>\n props.showArrow ? props.placement : `${props.placement}-start`\n)\n\nconst computedFallbackPlacements = computed<Placement[]>(() =>\n props.showArrow ? ['bottom', 'top'] : ['bottom-start', 'top-start']\n)\n\nconst filteredOptions = computed(() => {\n const { filterOption, options } = props\n if (!mentionCtx.value || !filterOption) return options\n return options.filter((option) =>\n filterOption(mentionCtx.value!.pattern, option)\n )\n})\n\nconst dropdownVisible = computed(() => {\n return visible.value && (!!filteredOptions.value.length || props.loading)\n})\n\nconst hoveringId = computed(() => {\n return `${contentId.value}-${dropdownRef.value?.hoveringIndex}`\n})\n\nconst handleInputChange = (value: string) => {\n emit('update:modelValue', value)\n syncAfterCursorMove()\n}\n\nconst handleInputKeyDown = (event: KeyboardEvent | Event) => {\n if (!('code' in event) || elInputRef.value?.isComposing) return\n\n switch (event.code) {\n case EVENT_CODE.left:\n case EVENT_CODE.right:\n syncAfterCursorMove()\n break\n case EVENT_CODE.up:\n case EVENT_CODE.down:\n if (!visible.value) return\n event.preventDefault()\n dropdownRef.value?.navigateOptions(\n event.code === EVENT_CODE.up ? 'prev' : 'next'\n )\n break\n case EVENT_CODE.enter:\n case EVENT_CODE.numpadEnter:\n if (!visible.value) return\n event.preventDefault()\n if (dropdownRef.value?.hoverOption) {\n dropdownRef.value?.selectHoverOption()\n } else {\n visible.value = false\n }\n break\n case EVENT_CODE.esc:\n if (!visible.value) return\n event.preventDefault()\n visible.value = false\n break\n case EVENT_CODE.backspace:\n if (props.whole && mentionCtx.value) {\n const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } =\n mentionCtx.value\n const inputEl = getInputEl()\n if (!inputEl) return\n const inputValue = inputEl.value\n const matchOption = props.options.find((item) => item.value === pattern)\n const isWhole = isFunction(props.checkIsWhole)\n ? props.checkIsWhole(pattern, prefix)\n : matchOption\n if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {\n event.preventDefault()\n const newValue =\n inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1)\n emit(UPDATE_MODEL_EVENT, newValue)\n\n const newSelectionEnd = prefixIndex\n nextTick(() => {\n // input value is updated\n inputEl.selectionStart = newSelectionEnd\n inputEl.selectionEnd = newSelectionEnd\n syncDropdownVisible()\n })\n }\n }\n }\n}\n\nconst { wrapperRef } = useFocusController(elInputRef, {\n beforeFocus() {\n return disabled.value\n },\n afterFocus() {\n syncAfterCursorMove()\n },\n beforeBlur(event) {\n return tooltipRef.value?.isFocusInsideContent(event)\n },\n afterBlur() {\n visible.value = false\n },\n})\n\nconst handleInputMouseDown = () => {\n syncAfterCursorMove()\n}\n\nconst handleSelect = (item: MentionOption) => {\n if (!mentionCtx.value) return\n const inputEl = getInputEl()\n if (!inputEl) return\n const inputValue = inputEl.value\n const { split } = props\n\n const newEndPart = inputValue.slice(mentionCtx.value.end)\n const alreadySeparated = newEndPart.startsWith(split)\n const newMiddlePart = `${item.value}${alreadySeparated ? '' : split}`\n\n const newValue =\n inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart\n\n emit(UPDATE_MODEL_EVENT, newValue)\n emit('select', item, mentionCtx.value.prefix)\n\n const newSelectionEnd =\n mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0)\n\n nextTick(() => {\n // input value is updated\n inputEl.selectionStart = newSelectionEnd\n inputEl.selectionEnd = newSelectionEnd\n inputEl.focus()\n syncDropdownVisible()\n })\n}\n\nconst getInputEl = () =>\n props.type === 'textarea'\n ? elInputRef.value?.textarea\n : elInputRef.value?.input\n\nconst syncAfterCursorMove = () => {\n // can't use nextTick(), get cursor position will be wrong\n setTimeout(() => {\n syncCursor()\n syncDropdownVisible()\n nextTick(() => tooltipRef.value?.updatePopper())\n }, 0)\n}\n\nconst syncCursor = () => {\n const inputEl = getInputEl()\n if (!inputEl) return\n\n const caretPosition = getCursorPosition(inputEl)\n const inputRect = inputEl.getBoundingClientRect()\n const elInputRect = elInputRef.value!.$el.getBoundingClientRect()\n\n cursorStyle.value = {\n position: 'absolute',\n width: 0,\n height: `${caretPosition.height}px`,\n left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,\n top: `${caretPosition.top + inputRect.top - elInputRect.top}px`,\n }\n}\n\nconst syncDropdownVisible = () => {\n const inputEl = getInputEl()\n if (document.activeElement !== inputEl) {\n visible.value = false\n return\n }\n const { prefix, split } = props\n mentionCtx.value = getMentionCtx(inputEl, prefix, split)\n if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {\n visible.value = true\n emit('search', mentionCtx.value.pattern, mentionCtx.value.prefix)\n return\n }\n visible.value = false\n}\n\ndefineExpose({\n input: elInputRef,\n tooltip: tooltipRef,\n dropdownVisible,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;mCA4Ec,CAAA;AAAA,EACZ,IAAM,EAAA,WAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAChB,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,cAAA,GAAiB,SAAS,MAAM,IAAA,CAAK,OAAO,MAAO,CAAA,IAAA,CAAK,UAAU,CAAC,CAAC,CAAA,CAAA;AAE1E,IAAM,MAAA,EAAA,GAAK,aAAa,SAAS,CAAA,CAAA;AACjC,IAAA,MAAM,WAAW,eAAgB,EAAA,CAAA;AACjC,IAAA,MAAM,YAAY,KAAM,EAAA,CAAA;AAExB,IAAA,MAAM,aAAa,GAAmB,EAAA,CAAA;AACtC,IAAA,MAAM,aAAa,GAAqB,EAAA,CAAA;AACxC,IAAA,MAAM,cAAc,GAA4C,EAAA,CAAA;AAEhE,IAAM,MAAA,OAAA,GAAU,IAAI,KAAK,CAAA,CAAA;AACzB,IAAA,MAAM,cAAc,GAAmB,EAAA,CAAA;AACvC,IAAA,MAAM,aAAa,GAAgB,EAAA,CAAA;AAEnC,IAAA,MAAM,iBAAoB,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,SAAA,GAAA,KAAA,CAAA,SAAA,GAAA,CAAA,EAAA,KAAA,CAAA,SAAA,CAAA,MAAA,CAAA,CAAA,CAAA;AAAA,IAAA,gCACA,GAAY,QAAA,CAAA,WAAkB,CAAA,SAAA,GAAA,CAAA,QA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