@element-plus/nightly 0.0.20220721 → 0.0.20220724
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.full.js +2 -46
- package/dist/index.full.min.js +9 -9
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +9 -9
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +3 -46
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/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/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/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/avatar/index.mjs +2 -2
- package/es/components/avatar/src/avatar.mjs +32 -67
- package/es/components/avatar/src/avatar.mjs.map +1 -1
- package/es/components/avatar/src/avatar2.mjs +67 -32
- package/es/components/avatar/src/avatar2.mjs.map +1 -1
- package/es/components/index.mjs +4 -4
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/trigger.mjs +120 -16
- package/es/components/popper/src/trigger.mjs.map +1 -1
- package/es/components/popper/src/trigger2.mjs +16 -120
- package/es/components/popper/src/trigger2.mjs.map +1 -1
- package/es/components/progress/index.mjs +2 -2
- package/es/components/progress/src/progress.mjs +202 -57
- package/es/components/progress/src/progress.mjs.map +1 -1
- package/es/components/progress/src/progress2.mjs +57 -202
- package/es/components/progress/src/progress2.mjs.map +1 -1
- package/es/components/tooltip/src/tooltip.mjs +1 -1
- package/es/components/tooltip/src/trigger.mjs +1 -1
- package/es/directives/index.d.ts +0 -1
- package/es/directives/index.mjs +0 -1
- package/es/directives/index.mjs.map +1 -1
- package/es/index.mjs +4 -5
- package/es/index.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/avatar/index.js +2 -2
- package/lib/components/avatar/src/avatar.js +33 -67
- package/lib/components/avatar/src/avatar.js.map +1 -1
- package/lib/components/avatar/src/avatar2.js +67 -33
- package/lib/components/avatar/src/avatar2.js.map +1 -1
- package/lib/components/index.js +4 -4
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/trigger.js +120 -16
- package/lib/components/popper/src/trigger.js.map +1 -1
- package/lib/components/popper/src/trigger2.js +16 -120
- package/lib/components/popper/src/trigger2.js.map +1 -1
- package/lib/components/progress/index.js +2 -2
- package/lib/components/progress/src/progress.js +202 -57
- package/lib/components/progress/src/progress.js.map +1 -1
- package/lib/components/progress/src/progress2.js +57 -202
- package/lib/components/progress/src/progress2.js.map +1 -1
- package/lib/components/tooltip/src/tooltip.js +1 -1
- package/lib/components/tooltip/src/trigger.js +1 -1
- package/lib/directives/index.d.ts +0 -1
- package/lib/directives/index.js +0 -2
- package/lib/directives/index.js.map +1 -1
- package/lib/index.js +83 -85
- package/lib/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/theme-chalk/el-message.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/common/var.scss +1 -1
- package/theme-chalk/src/message.scss +2 -1
- package/web-types.json +1 -1
- package/es/directives/resize/index.d.ts +0 -3
- package/es/directives/resize/index.mjs +0 -18
- package/es/directives/resize/index.mjs.map +0 -1
- package/lib/directives/resize/index.d.ts +0 -3
- package/lib/directives/resize/index.js +0 -22
- package/lib/directives/resize/index.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Element Plus v0.0.
|
|
1
|
+
/*! Element Plus v0.0.20220724 */var u={name:"zh-tw",el:{colorpicker:{confirm:"\u78BA\u8A8D",clear:"\u6E05\u7A7A"},datepicker:{now:"\u73FE\u5728",today:"\u4ECA\u5929",cancel:"\u53D6\u6D88",clear:"\u6E05\u7A7A",confirm:"\u78BA\u8A8D",selectDate:"\u9078\u64C7\u65E5\u671F",selectTime:"\u9078\u64C7\u6642\u9593",startDate:"\u958B\u59CB\u65E5\u671F",startTime:"\u958B\u59CB\u6642\u9593",endDate:"\u7D50\u675F\u65E5\u671F",endTime:"\u7D50\u675F\u6642\u9593",prevYear:"\u524D\u4E00\u5E74",nextYear:"\u5F8C\u4E00\u5E74",prevMonth:"\u4E0A\u500B\u6708",nextMonth:"\u4E0B\u500B\u6708",year:"\u5E74",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{jan:"\u4E00\u6708",feb:"\u4E8C\u6708",mar:"\u4E09\u6708",apr:"\u56DB\u6708",may:"\u4E94\u6708",jun:"\u516D\u6708",jul:"\u4E03\u6708",aug:"\u516B\u6708",sep:"\u4E5D\u6708",oct:"\u5341\u6708",nov:"\u5341\u4E00\u6708",dec:"\u5341\u4E8C\u6708"}},select:{loading:"\u52A0\u8F09\u4E2D",noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",placeholder:"\u8ACB\u9078\u64C7"},cascader:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",loading:"\u52A0\u8F09\u4E2D",placeholder:"\u8ACB\u9078\u64C7",noData:"\u7121\u8CC7\u6599"},pagination:{goto:"\u524D\u5F80",pagesize:"\u9805/\u9801",total:"\u5171 {total} \u9805",pageClassifier:"\u9801"},messagebox:{title:"\u63D0\u793A",confirm:"\u78BA\u5B9A",cancel:"\u53D6\u6D88",error:"\u8F38\u5165\u7684\u8CC7\u6599\u4E0D\u7B26\u898F\u5B9A!"},upload:{deleteTip:"\u6309 delete \u9375\u53EF\u522A\u9664",delete:"\u522A\u9664",preview:"\u67E5\u770B\u5716\u7247",continue:"\u7E7C\u7E8C\u4E0A\u50B3"},table:{emptyText:"\u66AB\u7121\u8CC7\u6599",confirmFilter:"\u7BE9\u9078",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8A08"},tree:{emptyText:"\u66AB\u7121\u8CC7\u6599"},transfer:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",titles:["\u5217\u8868 1","\u5217\u8868 2"],filterPlaceholder:"\u8ACB\u8F38\u5165\u641C\u7D22\u5167\u5BB9",noCheckedFormat:"\u5171 {total} \u9805",hasCheckedFormat:"\u5DF2\u9078 {checked}/{total} \u9805"},image:{error:"\u52A0\u8F09\u5931\u6557"},pageHeader:{title:"\u8FD4\u56DE"},popconfirm:{confirmButtonText:"\u78BA\u8A8D",cancelButtonText:"\u53D6\u6D88"}}};export{u as default};
|
|
2
2
|
//# sourceMappingURL=zh-tw.min.mjs.map
|
package/dist/locale/zh-tw.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import Avatar from './src/
|
|
3
|
-
export { avatarEmits, avatarProps } from './src/
|
|
2
|
+
import Avatar from './src/avatar2.mjs';
|
|
3
|
+
export { avatarEmits, avatarProps } from './src/avatar.mjs';
|
|
4
4
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
5
5
|
|
|
6
6
|
const ElAvatar = withInstall(Avatar);
|
|
@@ -1,74 +1,39 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createBlock, withCtx, resolveDynamicComponent, renderSlot } from 'vue';
|
|
2
|
-
import { ElIcon } from '../../icon/index.mjs';
|
|
3
|
-
import '../../../hooks/index.mjs';
|
|
4
1
|
import '../../../utils/index.mjs';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { isString } from '@vue/shared';
|
|
2
|
+
import '../../../constants/index.mjs';
|
|
3
|
+
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
4
|
+
import { componentSizes } from '../../../constants/size.mjs';
|
|
9
5
|
import { isNumber } from '@vueuse/core';
|
|
10
|
-
import {
|
|
6
|
+
import { iconPropType } from '../../../utils/vue/icon.mjs';
|
|
11
7
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const { size } = props;
|
|
37
|
-
return isNumber(size) ? ns.cssVarBlock({
|
|
38
|
-
size: addUnit(size) || ""
|
|
39
|
-
}) : void 0;
|
|
40
|
-
});
|
|
41
|
-
const fitStyle = computed(() => ({
|
|
42
|
-
objectFit: props.fit
|
|
43
|
-
}));
|
|
44
|
-
watch(() => props.src, () => hasLoadError.value = false);
|
|
45
|
-
function handleError(e) {
|
|
46
|
-
hasLoadError.value = true;
|
|
47
|
-
emit("error", e);
|
|
48
|
-
}
|
|
49
|
-
return (_ctx, _cache) => {
|
|
50
|
-
return openBlock(), createElementBlock("span", {
|
|
51
|
-
class: normalizeClass(unref(avatarClass)),
|
|
52
|
-
style: normalizeStyle(unref(sizeStyle))
|
|
53
|
-
}, [
|
|
54
|
-
(_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
|
|
55
|
-
key: 0,
|
|
56
|
-
src: _ctx.src,
|
|
57
|
-
alt: _ctx.alt,
|
|
58
|
-
srcset: _ctx.srcSet,
|
|
59
|
-
style: normalizeStyle(unref(fitStyle)),
|
|
60
|
-
onError: handleError
|
|
61
|
-
}, null, 44, _hoisted_1)) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
62
|
-
default: withCtx(() => [
|
|
63
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
|
|
64
|
-
]),
|
|
65
|
-
_: 1
|
|
66
|
-
})) : renderSlot(_ctx.$slots, "default", { key: 2 })
|
|
67
|
-
], 6);
|
|
68
|
-
};
|
|
8
|
+
const avatarProps = buildProps({
|
|
9
|
+
size: {
|
|
10
|
+
type: [Number, String],
|
|
11
|
+
values: componentSizes,
|
|
12
|
+
default: "",
|
|
13
|
+
validator: (val) => isNumber(val)
|
|
14
|
+
},
|
|
15
|
+
shape: {
|
|
16
|
+
type: String,
|
|
17
|
+
values: ["circle", "square"],
|
|
18
|
+
default: "circle"
|
|
19
|
+
},
|
|
20
|
+
icon: {
|
|
21
|
+
type: iconPropType
|
|
22
|
+
},
|
|
23
|
+
src: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ""
|
|
26
|
+
},
|
|
27
|
+
alt: String,
|
|
28
|
+
srcSet: String,
|
|
29
|
+
fit: {
|
|
30
|
+
type: definePropType(String),
|
|
31
|
+
default: "cover"
|
|
69
32
|
}
|
|
70
33
|
});
|
|
71
|
-
|
|
34
|
+
const avatarEmits = {
|
|
35
|
+
error: (evt) => evt instanceof Event
|
|
36
|
+
};
|
|
72
37
|
|
|
73
|
-
export {
|
|
38
|
+
export { avatarEmits, avatarProps };
|
|
74
39
|
//# sourceMappingURL=avatar.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.
|
|
1
|
+
{"version":3,"file":"avatar.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n iconPropType,\n isNumber,\n} from '@element-plus/utils'\nimport { componentSizes } from '@element-plus/constants'\nimport type { ExtractPropTypes } from 'vue'\nimport type { ObjectFitProperty } from 'csstype'\nimport type Avatar from './avatar.vue'\n\nexport const avatarProps = buildProps({\n size: {\n type: [Number, String],\n values: componentSizes,\n default: '',\n validator: (val: unknown): val is number => isNumber(val),\n },\n shape: {\n type: String,\n values: ['circle', 'square'],\n default: 'circle',\n },\n icon: {\n type: iconPropType,\n },\n src: {\n type: String,\n default: '',\n },\n alt: String,\n srcSet: String,\n fit: {\n type: definePropType<ObjectFitProperty>(String),\n default: 'cover',\n },\n} as const)\nexport type AvatarProps = ExtractPropTypes<typeof avatarProps>\n\nexport const avatarEmits = {\n error: (evt: Event) => evt instanceof Event,\n}\nexport type AvatarEmits = typeof avatarEmits\n\nexport type AvatarInstance = InstanceType<typeof Avatar>\n"],"names":[],"mappings":";;;;;;;AAOY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,SAAS,EAAE,CAAC,GAAG,KAAK,QAAQ,CAAC,GAAG,CAAC;AACrC,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAChC,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,WAAW,GAAG;AAC3B,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,KAAK;AACtC;;;;"}
|
|
@@ -1,39 +1,74 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createBlock, withCtx, resolveDynamicComponent, renderSlot } from 'vue';
|
|
2
|
+
import { ElIcon } from '../../icon/index.mjs';
|
|
3
|
+
import '../../../hooks/index.mjs';
|
|
1
4
|
import '../../../utils/index.mjs';
|
|
2
|
-
import '
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
+
import { avatarProps, avatarEmits } from './avatar.mjs';
|
|
6
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
7
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
8
|
+
import { isString } from '@vue/shared';
|
|
5
9
|
import { isNumber } from '@vueuse/core';
|
|
6
|
-
import {
|
|
10
|
+
import { addUnit } from '../../../utils/dom/style.mjs';
|
|
7
11
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
12
|
+
const _hoisted_1 = ["src", "alt", "srcset"];
|
|
13
|
+
const __default__ = {
|
|
14
|
+
name: "ElAvatar"
|
|
15
|
+
};
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
...__default__,
|
|
18
|
+
props: avatarProps,
|
|
19
|
+
emits: avatarEmits,
|
|
20
|
+
setup(__props, { emit }) {
|
|
21
|
+
const props = __props;
|
|
22
|
+
const ns = useNamespace("avatar");
|
|
23
|
+
const hasLoadError = ref(false);
|
|
24
|
+
const avatarClass = computed(() => {
|
|
25
|
+
const { size, icon, shape } = props;
|
|
26
|
+
const classList = [ns.b()];
|
|
27
|
+
if (isString(size))
|
|
28
|
+
classList.push(ns.m(size));
|
|
29
|
+
if (icon)
|
|
30
|
+
classList.push(ns.m("icon"));
|
|
31
|
+
if (shape)
|
|
32
|
+
classList.push(ns.m(shape));
|
|
33
|
+
return classList;
|
|
34
|
+
});
|
|
35
|
+
const sizeStyle = computed(() => {
|
|
36
|
+
const { size } = props;
|
|
37
|
+
return isNumber(size) ? ns.cssVarBlock({
|
|
38
|
+
size: addUnit(size) || ""
|
|
39
|
+
}) : void 0;
|
|
40
|
+
});
|
|
41
|
+
const fitStyle = computed(() => ({
|
|
42
|
+
objectFit: props.fit
|
|
43
|
+
}));
|
|
44
|
+
watch(() => props.src, () => hasLoadError.value = false);
|
|
45
|
+
function handleError(e) {
|
|
46
|
+
hasLoadError.value = true;
|
|
47
|
+
emit("error", e);
|
|
48
|
+
}
|
|
49
|
+
return (_ctx, _cache) => {
|
|
50
|
+
return openBlock(), createElementBlock("span", {
|
|
51
|
+
class: normalizeClass(unref(avatarClass)),
|
|
52
|
+
style: normalizeStyle(unref(sizeStyle))
|
|
53
|
+
}, [
|
|
54
|
+
(_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
|
|
55
|
+
key: 0,
|
|
56
|
+
src: _ctx.src,
|
|
57
|
+
alt: _ctx.alt,
|
|
58
|
+
srcset: _ctx.srcSet,
|
|
59
|
+
style: normalizeStyle(unref(fitStyle)),
|
|
60
|
+
onError: handleError
|
|
61
|
+
}, null, 44, _hoisted_1)) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
62
|
+
default: withCtx(() => [
|
|
63
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
|
|
64
|
+
]),
|
|
65
|
+
_: 1
|
|
66
|
+
})) : renderSlot(_ctx.$slots, "default", { key: 2 })
|
|
67
|
+
], 6);
|
|
68
|
+
};
|
|
32
69
|
}
|
|
33
70
|
});
|
|
34
|
-
|
|
35
|
-
error: (evt) => evt instanceof Event
|
|
36
|
-
};
|
|
71
|
+
var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/avatar/src/avatar.vue"]]);
|
|
37
72
|
|
|
38
|
-
export {
|
|
73
|
+
export { Avatar as default };
|
|
39
74
|
//# sourceMappingURL=avatar2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar2.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.
|
|
1
|
+
{"version":3,"file":"avatar2.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.vue"],"sourcesContent":["<template>\n <span :class=\"avatarClass\" :style=\"sizeStyle\">\n <img\n v-if=\"(src || srcSet) && !hasLoadError\"\n :src=\"src\"\n :alt=\"alt\"\n :srcset=\"srcSet\"\n :style=\"fitStyle\"\n @error=\"handleError\"\n />\n <el-icon v-else-if=\"icon\">\n <component :is=\"icon\" />\n </el-icon>\n <slot v-else />\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, watch } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useNamespace } from '@element-plus/hooks'\nimport { addUnit, isNumber, isString } from '@element-plus/utils'\nimport { avatarEmits, avatarProps } from './avatar'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElAvatar',\n})\n\nconst props = defineProps(avatarProps)\nconst emit = defineEmits(avatarEmits)\n\nconst ns = useNamespace('avatar')\n\nconst hasLoadError = ref(false)\n\nconst avatarClass = computed(() => {\n const { size, icon, shape } = props\n const classList = [ns.b()]\n if (isString(size)) classList.push(ns.m(size))\n if (icon) classList.push(ns.m('icon'))\n if (shape) classList.push(ns.m(shape))\n return classList\n})\n\nconst sizeStyle = computed(() => {\n const { size } = props\n return isNumber(size)\n ? (ns.cssVarBlock({\n size: addUnit(size) || '',\n }) as CSSProperties)\n : undefined\n})\n\nconst fitStyle = computed<CSSProperties>(() => ({\n objectFit: props.fit,\n}))\n\n// need reset hasLoadError to false if src changed\nwatch(\n () => props.src,\n () => (hasLoadError.value = false)\n)\n\nfunction handleError(e: Event) {\n hasLoadError.value = true\n emit('error', e)\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiCA,IAAA,MAAA,EAAA,GAAA,aAAA,QAAA,CAAA,CAAA;AAEA,IAAA,MAAA,YAAA,GAAA,IAAA,KAAA,CAAA,CAAA;AAEA,IAAA,MAAA,WAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,EAAA,IAAA,EAAA,IAAA,EAAA,KAAA,EAAA,GAAA,KAAA,CAAA;AACA,MAAA,MAAA,SAAA,GAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA;AACA,MAAA,IAAA,SAAA,IAAA,CAAA;AAAA,QAAA,SAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA,MAAA,IAAA,IAAA;AAAA,QAAA,SAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA;AACA,MAAA,IAAA,KAAA;AAAA,QAAA,SAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AACA,MAAA,OAAA,SAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,SAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,EAAA,IAAA,EAAA,GAAA,KAAA,CAAA;AACA,MAAA,OAAA,QAAA,CAAA,IAAA,CACA,GAAA,EAAA,CAAA,WAAA,CAAA;AAAA,QACA,IAAA,EAAA,OAAA,CAAA,IAAA,CAAA,IAAA,EAAA;AAAA,OACA,CACA,GAAA,KAAA,CAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,QAAA,GAAA,SAAA,OAAA;AAAA,MACA,WAAA,KAAA,CAAA,GAAA;AAAA,KACA,CAAA,CAAA,CAAA;AAGA,IAAA,KAAA,CACA,MAAA,KAAA,CAAA,GAAA,EACA,MAAA,YAAA,CAAA,QAAA,KACA,CAAA,CAAA;AAEA,IAAA,SAAA,WAAA,CAAA,CAAA,EAAA;AACA,MAAA,YAAA,CAAA,KAAA,GAAA,IAAA,CAAA;AACA,MAAA,IAAA,CAAA,SAAA,CAAA,CAAA,CAAA;AAAA,KACA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/es/components/index.mjs
CHANGED
|
@@ -75,7 +75,7 @@ export { ElPopover, ElPopoverDirective } from './popover/index.mjs';
|
|
|
75
75
|
export { affixEmits, affixProps } from './affix/src/affix.mjs';
|
|
76
76
|
export { alertEffects, alertEmits, alertProps } from './alert/src/alert.mjs';
|
|
77
77
|
export { autocompleteEmits, autocompleteProps } from './autocomplete/src/autocomplete.mjs';
|
|
78
|
-
export { avatarEmits, avatarProps } from './avatar/src/
|
|
78
|
+
export { avatarEmits, avatarProps } from './avatar/src/avatar.mjs';
|
|
79
79
|
export { backtopEmits, backtopProps } from './backtop/src/backtop.mjs';
|
|
80
80
|
export { badgeProps } from './badge/src/badge.mjs';
|
|
81
81
|
export { breadcrumbProps } from './breadcrumb/src/breadcrumb.mjs';
|
|
@@ -118,13 +118,13 @@ export { pageHeaderEmits, pageHeaderProps } from './page-header/src/page-header.
|
|
|
118
118
|
export { paginationEmits, paginationProps } from './pagination/src/pagination.mjs';
|
|
119
119
|
export { popconfirmProps } from './popconfirm/src/popconfirm.mjs';
|
|
120
120
|
export { Effect, usePopperProps } from './popper/src/popper.mjs';
|
|
121
|
-
export { usePopperTriggerProps } from './popper/src/
|
|
121
|
+
export { usePopperTriggerProps } from './popper/src/trigger2.mjs';
|
|
122
122
|
export { usePopperContentEmits, usePopperContentProps, usePopperCoreConfigProps } from './popper/src/content.mjs';
|
|
123
123
|
export { usePopperArrowProps } from './popper/src/arrow.mjs';
|
|
124
124
|
export { default as ElPopperArrow } from './popper/src/arrow2.mjs';
|
|
125
|
-
export { default as ElPopperTrigger } from './popper/src/
|
|
125
|
+
export { default as ElPopperTrigger } from './popper/src/trigger.mjs';
|
|
126
126
|
export { default as ElPopperContent } from './popper/src/content2.mjs';
|
|
127
|
-
export { progressProps } from './progress/src/
|
|
127
|
+
export { progressProps } from './progress/src/progress2.mjs';
|
|
128
128
|
export { radioEmits, radioProps, radioPropsBase } from './radio/src/radio.mjs';
|
|
129
129
|
export { radioGroupEmits, radioGroupProps } from './radio/src/radio-group.mjs';
|
|
130
130
|
export { radioButtonProps } from './radio/src/radio-button.mjs';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
2
|
import Popper from './src/popper2.mjs';
|
|
3
3
|
export { default as ElPopperArrow } from './src/arrow2.mjs';
|
|
4
|
-
export { default as ElPopperTrigger } from './src/
|
|
4
|
+
export { default as ElPopperTrigger } from './src/trigger.mjs';
|
|
5
5
|
export { default as ElPopperContent } from './src/content2.mjs';
|
|
6
6
|
export { Effect, usePopperProps } from './src/popper.mjs';
|
|
7
|
-
export { usePopperTriggerProps } from './src/
|
|
7
|
+
export { usePopperTriggerProps } from './src/trigger2.mjs';
|
|
8
8
|
export { usePopperContentEmits, usePopperContentProps, usePopperCoreConfigProps } from './src/content.mjs';
|
|
9
9
|
export { usePopperArrowProps } from './src/arrow.mjs';
|
|
10
10
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
@@ -1,21 +1,125 @@
|
|
|
1
|
+
import { defineComponent, inject, computed, onMounted, watch, onBeforeUnmount, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createCommentVNode } from 'vue';
|
|
2
|
+
import { isNil } from 'lodash-unified';
|
|
3
|
+
import { unrefElement } from '@vueuse/core';
|
|
4
|
+
import '../../slot/index.mjs';
|
|
5
|
+
import '../../../hooks/index.mjs';
|
|
6
|
+
import '../../../tokens/index.mjs';
|
|
1
7
|
import '../../../utils/index.mjs';
|
|
2
|
-
import {
|
|
8
|
+
import { usePopperTriggerProps } from './trigger2.mjs';
|
|
9
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
10
|
+
import { POPPER_INJECTION_KEY } from '../../../tokens/popper.mjs';
|
|
11
|
+
import { useForwardRef } from '../../../hooks/use-forward-ref/index.mjs';
|
|
12
|
+
import { isElement } from '../../../utils/types.mjs';
|
|
13
|
+
import { OnlyChild } from '../../slot/src/only-child.mjs';
|
|
3
14
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const __default__ = {
|
|
16
|
+
name: "ElPopperTrigger",
|
|
17
|
+
inheritAttrs: false
|
|
18
|
+
};
|
|
19
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
20
|
+
...__default__,
|
|
21
|
+
props: usePopperTriggerProps,
|
|
22
|
+
setup(__props, { expose }) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const { role, triggerRef } = inject(POPPER_INJECTION_KEY, void 0);
|
|
25
|
+
useForwardRef(triggerRef);
|
|
26
|
+
const ariaControls = computed(() => {
|
|
27
|
+
return ariaHaspopup.value ? props.id : void 0;
|
|
28
|
+
});
|
|
29
|
+
const ariaDescribedby = computed(() => {
|
|
30
|
+
if (role && role.value === "tooltip") {
|
|
31
|
+
return props.open && props.id ? props.id : void 0;
|
|
32
|
+
}
|
|
33
|
+
return void 0;
|
|
34
|
+
});
|
|
35
|
+
const ariaHaspopup = computed(() => {
|
|
36
|
+
if (role && role.value !== "tooltip") {
|
|
37
|
+
return role.value;
|
|
38
|
+
}
|
|
39
|
+
return void 0;
|
|
40
|
+
});
|
|
41
|
+
const ariaExpanded = computed(() => {
|
|
42
|
+
return ariaHaspopup.value ? `${props.open}` : void 0;
|
|
43
|
+
});
|
|
44
|
+
let virtualTriggerAriaStopWatch = void 0;
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
watch(() => props.virtualRef, (virtualEl) => {
|
|
47
|
+
if (virtualEl) {
|
|
48
|
+
triggerRef.value = unrefElement(virtualEl);
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
immediate: true
|
|
52
|
+
});
|
|
53
|
+
watch(() => triggerRef.value, (el, prevEl) => {
|
|
54
|
+
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
|
|
55
|
+
virtualTriggerAriaStopWatch = void 0;
|
|
56
|
+
if (isElement(el)) {
|
|
57
|
+
;
|
|
58
|
+
[
|
|
59
|
+
"onMouseenter",
|
|
60
|
+
"onMouseleave",
|
|
61
|
+
"onClick",
|
|
62
|
+
"onKeydown",
|
|
63
|
+
"onFocus",
|
|
64
|
+
"onBlur",
|
|
65
|
+
"onContextmenu"
|
|
66
|
+
].forEach((eventName) => {
|
|
67
|
+
var _a;
|
|
68
|
+
const handler = props[eventName];
|
|
69
|
+
if (handler) {
|
|
70
|
+
;
|
|
71
|
+
el.addEventListener(eventName.slice(2).toLowerCase(), handler);
|
|
72
|
+
(_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
|
|
76
|
+
;
|
|
77
|
+
[
|
|
78
|
+
"aria-controls",
|
|
79
|
+
"aria-describedby",
|
|
80
|
+
"aria-haspopup",
|
|
81
|
+
"aria-expanded"
|
|
82
|
+
].forEach((key, idx) => {
|
|
83
|
+
isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
|
|
84
|
+
});
|
|
85
|
+
}, { immediate: true });
|
|
86
|
+
}
|
|
87
|
+
if (isElement(prevEl)) {
|
|
88
|
+
;
|
|
89
|
+
[
|
|
90
|
+
"aria-controls",
|
|
91
|
+
"aria-describedby",
|
|
92
|
+
"aria-haspopup",
|
|
93
|
+
"aria-expanded"
|
|
94
|
+
].forEach((key) => prevEl.removeAttribute(key));
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
immediate: true
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
onBeforeUnmount(() => {
|
|
101
|
+
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
|
|
102
|
+
virtualTriggerAriaStopWatch = void 0;
|
|
103
|
+
});
|
|
104
|
+
expose({
|
|
105
|
+
triggerRef
|
|
106
|
+
});
|
|
107
|
+
return (_ctx, _cache) => {
|
|
108
|
+
return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
109
|
+
"aria-controls": unref(ariaControls),
|
|
110
|
+
"aria-describedby": unref(ariaDescribedby),
|
|
111
|
+
"aria-expanded": unref(ariaExpanded),
|
|
112
|
+
"aria-haspopup": unref(ariaHaspopup)
|
|
113
|
+
}), {
|
|
114
|
+
default: withCtx(() => [
|
|
115
|
+
renderSlot(_ctx.$slots, "default")
|
|
116
|
+
]),
|
|
117
|
+
_: 3
|
|
118
|
+
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
18
121
|
});
|
|
122
|
+
var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
|
|
19
123
|
|
|
20
|
-
export {
|
|
124
|
+
export { ElPopperTrigger as default };
|
|
21
125
|
//# sourceMappingURL=trigger.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.mjs","sources":["../../../../../../packages/components/popper/src/trigger.
|
|
1
|
+
{"version":3,"file":"trigger.mjs","sources":["../../../../../../packages/components/popper/src/trigger.vue"],"sourcesContent":["<template>\n <el-only-child\n v-if=\"!virtualTriggering\"\n v-bind=\"$attrs\"\n :aria-controls=\"ariaControls\"\n :aria-describedby=\"ariaDescribedby\"\n :aria-expanded=\"ariaExpanded\"\n :aria-haspopup=\"ariaHaspopup\"\n >\n <slot />\n </el-only-child>\n</template>\n\n<script lang=\"ts\" setup>\n// @ts-nocheck\nimport { computed, inject, onBeforeUnmount, onMounted, watch } from 'vue'\nimport { isNil } from 'lodash-unified'\nimport { unrefElement } from '@vueuse/core'\nimport { ElOnlyChild } from '@element-plus/components/slot'\nimport { useForwardRef } from '@element-plus/hooks'\nimport { POPPER_INJECTION_KEY } from '@element-plus/tokens'\nimport { isElement } from '@element-plus/utils'\nimport { usePopperTriggerProps } from './trigger'\n\nimport type { WatchStopHandle } from 'vue'\n\ndefineOptions({\n name: 'ElPopperTrigger',\n inheritAttrs: false,\n})\n\nconst props = defineProps(usePopperTriggerProps)\n\nconst { role, triggerRef } = inject(POPPER_INJECTION_KEY, undefined)!\n\nuseForwardRef(triggerRef)\n\nconst ariaControls = computed<string | undefined>(() => {\n return ariaHaspopup.value ? props.id : undefined\n})\n\nconst ariaDescribedby = computed<string | undefined>(() => {\n if (role && role.value === 'tooltip') {\n return props.open && props.id ? props.id : undefined\n }\n return undefined\n})\n\nconst ariaHaspopup = computed<string | undefined>(() => {\n if (role && role.value !== 'tooltip') {\n return role.value\n }\n return undefined\n})\n\nconst ariaExpanded = computed<string | undefined>(() => {\n return ariaHaspopup.value ? `${props.open}` : undefined\n})\n\nlet virtualTriggerAriaStopWatch: WatchStopHandle | undefined = undefined\n\nonMounted(() => {\n watch(\n () => props.virtualRef,\n (virtualEl) => {\n if (virtualEl) {\n triggerRef.value = unrefElement(virtualEl as HTMLElement)\n }\n },\n {\n immediate: true,\n }\n )\n\n watch(\n () => triggerRef.value,\n (el, prevEl) => {\n virtualTriggerAriaStopWatch?.()\n virtualTriggerAriaStopWatch = undefined\n if (isElement(el)) {\n ;[\n 'onMouseenter',\n 'onMouseleave',\n 'onClick',\n 'onKeydown',\n 'onFocus',\n 'onBlur',\n 'onContextmenu',\n ].forEach((eventName) => {\n const handler = props[eventName]\n if (handler) {\n ;(el as HTMLElement).addEventListener(\n eventName.slice(2).toLowerCase(),\n handler\n )\n ;(prevEl as HTMLElement)?.removeEventListener?.(\n eventName.slice(2).toLowerCase(),\n handler\n )\n }\n })\n virtualTriggerAriaStopWatch = watch(\n [ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded],\n (watches) => {\n ;[\n 'aria-controls',\n 'aria-describedby',\n 'aria-haspopup',\n 'aria-expanded',\n ].forEach((key, idx) => {\n isNil(watches[idx])\n ? el.removeAttribute(key)\n : el.setAttribute(key, watches[idx])\n })\n },\n { immediate: true }\n )\n }\n if (isElement(prevEl)) {\n ;[\n 'aria-controls',\n 'aria-describedby',\n 'aria-haspopup',\n 'aria-expanded',\n ].forEach((key) => prevEl.removeAttribute(key))\n }\n },\n {\n immediate: true,\n }\n )\n})\n\nonBeforeUnmount(() => {\n virtualTriggerAriaStopWatch?.()\n virtualTriggerAriaStopWatch = undefined\n})\n\ndefineExpose({\n /**\n * @description trigger element\n */\n triggerRef,\n})\n</script>\n"],"names":[],"mappings":"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"}
|