@element-plus/nightly 0.0.20240907 → 0.0.20240909
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.json +1 -1
- package/dist/index.full.js +16 -6
- package/dist/index.full.min.js +4 -4
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +4 -4
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +16 -6
- 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/index.mjs +2 -2
- package/es/components/pagination/src/components/pager.mjs +210 -17
- package/es/components/pagination/src/components/pager.mjs.map +1 -1
- package/es/components/pagination/src/components/pager2.mjs +17 -210
- package/es/components/pagination/src/components/pager2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +1 -1
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/trigger.mjs +31 -129
- package/es/components/popper/src/trigger.mjs.map +1 -1
- package/es/components/popper/src/trigger2.mjs +129 -31
- package/es/components/popper/src/trigger2.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar.d.ts +1 -0
- package/es/components/scrollbar/src/scrollbar.mjs +4 -0
- package/es/components/scrollbar/src/scrollbar.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar.vue.d.ts +3 -0
- package/es/components/scrollbar/src/scrollbar2.mjs +2 -1
- package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
- package/es/components/table/src/table/defaults.d.ts +5 -0
- package/es/components/table/src/table/defaults.mjs +5 -1
- package/es/components/table/src/table/defaults.mjs.map +1 -1
- package/es/components/table/src/table.mjs +3 -2
- package/es/components/table/src/table.mjs.map +1 -1
- package/es/components/table/src/table.vue.d.ts +9 -0
- package/es/components/tooltip/src/trigger.mjs +1 -1
- package/es/components/tooltip/src/trigger2.mjs +1 -1
- package/es/index.mjs +2 -2
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/index.js +2 -2
- package/lib/components/pagination/src/components/pager.js +210 -17
- package/lib/components/pagination/src/components/pager.js.map +1 -1
- package/lib/components/pagination/src/components/pager2.js +17 -210
- package/lib/components/pagination/src/components/pager2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +1 -1
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/trigger.js +32 -129
- package/lib/components/popper/src/trigger.js.map +1 -1
- package/lib/components/popper/src/trigger2.js +129 -32
- package/lib/components/popper/src/trigger2.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar.d.ts +1 -0
- package/lib/components/scrollbar/src/scrollbar.js +4 -0
- package/lib/components/scrollbar/src/scrollbar.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar.vue.d.ts +3 -0
- package/lib/components/scrollbar/src/scrollbar2.js +2 -1
- package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
- package/lib/components/table/src/table/defaults.d.ts +5 -0
- package/lib/components/table/src/table/defaults.js +5 -1
- package/lib/components/table/src/table/defaults.js.map +1 -1
- package/lib/components/table/src/table.js +3 -2
- package/lib/components/table/src/table.js.map +1 -1
- package/lib/components/table/src/table.vue.d.ts +9 -0
- package/lib/components/tooltip/src/trigger.js +1 -1
- package/lib/components/tooltip/src/trigger2.js +1 -1
- package/lib/index.js +2 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/tags.json +1 -1
- package/theme-chalk/src/table-v2.scss +1 -1
- package/web-types.json +1 -1
|
@@ -2,137 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var vue = require('vue');
|
|
6
|
-
var lodashUnified = require('lodash-unified');
|
|
7
|
-
var core = require('@vueuse/core');
|
|
8
|
-
require('../../slot/index.js');
|
|
9
|
-
require('../../../hooks/index.js');
|
|
10
5
|
require('../../../utils/index.js');
|
|
11
|
-
var
|
|
12
|
-
var trigger = require('./trigger2.js');
|
|
13
|
-
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
14
|
-
var index = require('../../../hooks/use-forward-ref/index.js');
|
|
15
|
-
var types = require('../../../utils/types.js');
|
|
16
|
-
var onlyChild = require('../../slot/src/only-child.js');
|
|
6
|
+
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
17
7
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
const popperTriggerProps = runtime.buildProps({
|
|
9
|
+
virtualRef: {
|
|
10
|
+
type: runtime.definePropType(Object)
|
|
11
|
+
},
|
|
12
|
+
virtualTriggering: Boolean,
|
|
13
|
+
onMouseenter: {
|
|
14
|
+
type: runtime.definePropType(Function)
|
|
15
|
+
},
|
|
16
|
+
onMouseleave: {
|
|
17
|
+
type: runtime.definePropType(Function)
|
|
18
|
+
},
|
|
19
|
+
onClick: {
|
|
20
|
+
type: runtime.definePropType(Function)
|
|
21
|
+
},
|
|
22
|
+
onKeydown: {
|
|
23
|
+
type: runtime.definePropType(Function)
|
|
24
|
+
},
|
|
25
|
+
onFocus: {
|
|
26
|
+
type: runtime.definePropType(Function)
|
|
27
|
+
},
|
|
28
|
+
onBlur: {
|
|
29
|
+
type: runtime.definePropType(Function)
|
|
30
|
+
},
|
|
31
|
+
onContextmenu: {
|
|
32
|
+
type: runtime.definePropType(Function)
|
|
33
|
+
},
|
|
34
|
+
id: String,
|
|
35
|
+
open: Boolean
|
|
21
36
|
});
|
|
22
|
-
const
|
|
23
|
-
...__default__,
|
|
24
|
-
props: trigger.popperTriggerProps,
|
|
25
|
-
setup(__props, { expose }) {
|
|
26
|
-
const props = __props;
|
|
27
|
-
const { role, triggerRef } = vue.inject(constants.POPPER_INJECTION_KEY, void 0);
|
|
28
|
-
index.useForwardRef(triggerRef);
|
|
29
|
-
const ariaControls = vue.computed(() => {
|
|
30
|
-
return ariaHaspopup.value ? props.id : void 0;
|
|
31
|
-
});
|
|
32
|
-
const ariaDescribedby = vue.computed(() => {
|
|
33
|
-
if (role && role.value === "tooltip") {
|
|
34
|
-
return props.open && props.id ? props.id : void 0;
|
|
35
|
-
}
|
|
36
|
-
return void 0;
|
|
37
|
-
});
|
|
38
|
-
const ariaHaspopup = vue.computed(() => {
|
|
39
|
-
if (role && role.value !== "tooltip") {
|
|
40
|
-
return role.value;
|
|
41
|
-
}
|
|
42
|
-
return void 0;
|
|
43
|
-
});
|
|
44
|
-
const ariaExpanded = vue.computed(() => {
|
|
45
|
-
return ariaHaspopup.value ? `${props.open}` : void 0;
|
|
46
|
-
});
|
|
47
|
-
let virtualTriggerAriaStopWatch = void 0;
|
|
48
|
-
const TRIGGER_ELE_EVENTS = [
|
|
49
|
-
"onMouseenter",
|
|
50
|
-
"onMouseleave",
|
|
51
|
-
"onClick",
|
|
52
|
-
"onKeydown",
|
|
53
|
-
"onFocus",
|
|
54
|
-
"onBlur",
|
|
55
|
-
"onContextmenu"
|
|
56
|
-
];
|
|
57
|
-
vue.onMounted(() => {
|
|
58
|
-
vue.watch(() => props.virtualRef, (virtualEl) => {
|
|
59
|
-
if (virtualEl) {
|
|
60
|
-
triggerRef.value = core.unrefElement(virtualEl);
|
|
61
|
-
}
|
|
62
|
-
}, {
|
|
63
|
-
immediate: true
|
|
64
|
-
});
|
|
65
|
-
vue.watch(triggerRef, (el, prevEl) => {
|
|
66
|
-
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
|
|
67
|
-
virtualTriggerAriaStopWatch = void 0;
|
|
68
|
-
if (types.isElement(el)) {
|
|
69
|
-
TRIGGER_ELE_EVENTS.forEach((eventName) => {
|
|
70
|
-
var _a;
|
|
71
|
-
const handler = props[eventName];
|
|
72
|
-
if (handler) {
|
|
73
|
-
;
|
|
74
|
-
el.addEventListener(eventName.slice(2).toLowerCase(), handler);
|
|
75
|
-
(_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
|
|
79
|
-
;
|
|
80
|
-
[
|
|
81
|
-
"aria-controls",
|
|
82
|
-
"aria-describedby",
|
|
83
|
-
"aria-haspopup",
|
|
84
|
-
"aria-expanded"
|
|
85
|
-
].forEach((key, idx) => {
|
|
86
|
-
lodashUnified.isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
|
|
87
|
-
});
|
|
88
|
-
}, { immediate: true });
|
|
89
|
-
}
|
|
90
|
-
if (types.isElement(prevEl)) {
|
|
91
|
-
;
|
|
92
|
-
[
|
|
93
|
-
"aria-controls",
|
|
94
|
-
"aria-describedby",
|
|
95
|
-
"aria-haspopup",
|
|
96
|
-
"aria-expanded"
|
|
97
|
-
].forEach((key) => prevEl.removeAttribute(key));
|
|
98
|
-
}
|
|
99
|
-
}, {
|
|
100
|
-
immediate: true
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
vue.onBeforeUnmount(() => {
|
|
104
|
-
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
|
|
105
|
-
virtualTriggerAriaStopWatch = void 0;
|
|
106
|
-
if (triggerRef.value && types.isElement(triggerRef.value)) {
|
|
107
|
-
const el = triggerRef.value;
|
|
108
|
-
TRIGGER_ELE_EVENTS.forEach((eventName) => {
|
|
109
|
-
const handler = props[eventName];
|
|
110
|
-
if (handler) {
|
|
111
|
-
el.removeEventListener(eventName.slice(2).toLowerCase(), handler);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
triggerRef.value = void 0;
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
expose({
|
|
118
|
-
triggerRef
|
|
119
|
-
});
|
|
120
|
-
return (_ctx, _cache) => {
|
|
121
|
-
return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(onlyChild.OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
122
|
-
"aria-controls": vue.unref(ariaControls),
|
|
123
|
-
"aria-describedby": vue.unref(ariaDescribedby),
|
|
124
|
-
"aria-expanded": vue.unref(ariaExpanded),
|
|
125
|
-
"aria-haspopup": vue.unref(ariaHaspopup)
|
|
126
|
-
}), {
|
|
127
|
-
default: vue.withCtx(() => [
|
|
128
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
129
|
-
]),
|
|
130
|
-
_: 3
|
|
131
|
-
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
var ElPopperTrigger = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "trigger.vue"]]);
|
|
37
|
+
const usePopperTriggerProps = popperTriggerProps;
|
|
136
38
|
|
|
137
|
-
exports
|
|
39
|
+
exports.popperTriggerProps = popperTriggerProps;
|
|
40
|
+
exports.usePopperTriggerProps = usePopperTriggerProps;
|
|
138
41
|
//# sourceMappingURL=trigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.js","sources":["../../../../../../packages/components/popper/src/trigger.
|
|
1
|
+
{"version":3,"file":"trigger.js","sources":["../../../../../../packages/components/popper/src/trigger.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { Measurable } from './constants'\nimport type Trigger from './trigger.vue'\n\nexport const popperTriggerProps = buildProps({\n virtualRef: {\n type: definePropType<Measurable>(Object),\n },\n virtualTriggering: Boolean,\n onMouseenter: {\n type: definePropType<(e: Event) => void>(Function),\n },\n onMouseleave: {\n type: definePropType<(e: Event) => void>(Function),\n },\n onClick: {\n type: definePropType<(e: Event) => void>(Function),\n },\n onKeydown: {\n type: definePropType<(e: Event) => void>(Function),\n },\n onFocus: {\n type: definePropType<(e: Event) => void>(Function),\n },\n onBlur: {\n type: definePropType<(e: Event) => void>(Function),\n },\n onContextmenu: {\n type: definePropType<(e: Event) => void>(Function),\n },\n id: String,\n open: Boolean,\n} as const)\n\nexport type PopperTriggerProps = typeof popperTriggerProps\n\nexport type PopperTriggerInstance = InstanceType<typeof Trigger>\n\n/** @deprecated use `popperTriggerProps` instead, and it will be deprecated in the next major version */\nexport const usePopperTriggerProps = popperTriggerProps\n\n/** @deprecated use `PopperTriggerInstance` instead, and it will be deprecated in the next major version */\nexport type ElPopperArrowTrigger = PopperTriggerInstance\n"],"names":["buildProps","definePropType"],"mappings":";;;;;;;AACY,MAAC,kBAAkB,GAAGA,kBAAU,CAAC;AAC7C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAEC,sBAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,iBAAiB,EAAE,OAAO;AAC5B,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAEA,sBAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAEA,sBAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAEA,sBAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAEA,sBAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAEA,sBAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAEA,sBAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAEA,sBAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,EAAE,EAAE,MAAM;AACZ,EAAE,IAAI,EAAE,OAAO;AACf,CAAC,EAAE;AACS,MAAC,qBAAqB,GAAG;;;;;"}
|
|
@@ -2,40 +2,137 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var lodashUnified = require('lodash-unified');
|
|
7
|
+
var core = require('@vueuse/core');
|
|
8
|
+
require('../../slot/index.js');
|
|
9
|
+
require('../../../hooks/index.js');
|
|
5
10
|
require('../../../utils/index.js');
|
|
6
|
-
var
|
|
11
|
+
var constants = require('./constants.js');
|
|
12
|
+
var trigger = require('./trigger.js');
|
|
13
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
14
|
+
var index = require('../../../hooks/use-forward-ref/index.js');
|
|
15
|
+
var types = require('../../../utils/types.js');
|
|
16
|
+
var onlyChild = require('../../slot/src/only-child.js');
|
|
7
17
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
virtualTriggering: Boolean,
|
|
13
|
-
onMouseenter: {
|
|
14
|
-
type: runtime.definePropType(Function)
|
|
15
|
-
},
|
|
16
|
-
onMouseleave: {
|
|
17
|
-
type: runtime.definePropType(Function)
|
|
18
|
-
},
|
|
19
|
-
onClick: {
|
|
20
|
-
type: runtime.definePropType(Function)
|
|
21
|
-
},
|
|
22
|
-
onKeydown: {
|
|
23
|
-
type: runtime.definePropType(Function)
|
|
24
|
-
},
|
|
25
|
-
onFocus: {
|
|
26
|
-
type: runtime.definePropType(Function)
|
|
27
|
-
},
|
|
28
|
-
onBlur: {
|
|
29
|
-
type: runtime.definePropType(Function)
|
|
30
|
-
},
|
|
31
|
-
onContextmenu: {
|
|
32
|
-
type: runtime.definePropType(Function)
|
|
33
|
-
},
|
|
34
|
-
id: String,
|
|
35
|
-
open: Boolean
|
|
18
|
+
const __default__ = vue.defineComponent({
|
|
19
|
+
name: "ElPopperTrigger",
|
|
20
|
+
inheritAttrs: false
|
|
36
21
|
});
|
|
37
|
-
const
|
|
22
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
23
|
+
...__default__,
|
|
24
|
+
props: trigger.popperTriggerProps,
|
|
25
|
+
setup(__props, { expose }) {
|
|
26
|
+
const props = __props;
|
|
27
|
+
const { role, triggerRef } = vue.inject(constants.POPPER_INJECTION_KEY, void 0);
|
|
28
|
+
index.useForwardRef(triggerRef);
|
|
29
|
+
const ariaControls = vue.computed(() => {
|
|
30
|
+
return ariaHaspopup.value ? props.id : void 0;
|
|
31
|
+
});
|
|
32
|
+
const ariaDescribedby = vue.computed(() => {
|
|
33
|
+
if (role && role.value === "tooltip") {
|
|
34
|
+
return props.open && props.id ? props.id : void 0;
|
|
35
|
+
}
|
|
36
|
+
return void 0;
|
|
37
|
+
});
|
|
38
|
+
const ariaHaspopup = vue.computed(() => {
|
|
39
|
+
if (role && role.value !== "tooltip") {
|
|
40
|
+
return role.value;
|
|
41
|
+
}
|
|
42
|
+
return void 0;
|
|
43
|
+
});
|
|
44
|
+
const ariaExpanded = vue.computed(() => {
|
|
45
|
+
return ariaHaspopup.value ? `${props.open}` : void 0;
|
|
46
|
+
});
|
|
47
|
+
let virtualTriggerAriaStopWatch = void 0;
|
|
48
|
+
const TRIGGER_ELE_EVENTS = [
|
|
49
|
+
"onMouseenter",
|
|
50
|
+
"onMouseleave",
|
|
51
|
+
"onClick",
|
|
52
|
+
"onKeydown",
|
|
53
|
+
"onFocus",
|
|
54
|
+
"onBlur",
|
|
55
|
+
"onContextmenu"
|
|
56
|
+
];
|
|
57
|
+
vue.onMounted(() => {
|
|
58
|
+
vue.watch(() => props.virtualRef, (virtualEl) => {
|
|
59
|
+
if (virtualEl) {
|
|
60
|
+
triggerRef.value = core.unrefElement(virtualEl);
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
immediate: true
|
|
64
|
+
});
|
|
65
|
+
vue.watch(triggerRef, (el, prevEl) => {
|
|
66
|
+
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
|
|
67
|
+
virtualTriggerAriaStopWatch = void 0;
|
|
68
|
+
if (types.isElement(el)) {
|
|
69
|
+
TRIGGER_ELE_EVENTS.forEach((eventName) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const handler = props[eventName];
|
|
72
|
+
if (handler) {
|
|
73
|
+
;
|
|
74
|
+
el.addEventListener(eventName.slice(2).toLowerCase(), handler);
|
|
75
|
+
(_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
|
|
79
|
+
;
|
|
80
|
+
[
|
|
81
|
+
"aria-controls",
|
|
82
|
+
"aria-describedby",
|
|
83
|
+
"aria-haspopup",
|
|
84
|
+
"aria-expanded"
|
|
85
|
+
].forEach((key, idx) => {
|
|
86
|
+
lodashUnified.isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
|
|
87
|
+
});
|
|
88
|
+
}, { immediate: true });
|
|
89
|
+
}
|
|
90
|
+
if (types.isElement(prevEl)) {
|
|
91
|
+
;
|
|
92
|
+
[
|
|
93
|
+
"aria-controls",
|
|
94
|
+
"aria-describedby",
|
|
95
|
+
"aria-haspopup",
|
|
96
|
+
"aria-expanded"
|
|
97
|
+
].forEach((key) => prevEl.removeAttribute(key));
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
immediate: true
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
vue.onBeforeUnmount(() => {
|
|
104
|
+
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
|
|
105
|
+
virtualTriggerAriaStopWatch = void 0;
|
|
106
|
+
if (triggerRef.value && types.isElement(triggerRef.value)) {
|
|
107
|
+
const el = triggerRef.value;
|
|
108
|
+
TRIGGER_ELE_EVENTS.forEach((eventName) => {
|
|
109
|
+
const handler = props[eventName];
|
|
110
|
+
if (handler) {
|
|
111
|
+
el.removeEventListener(eventName.slice(2).toLowerCase(), handler);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
triggerRef.value = void 0;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
expose({
|
|
118
|
+
triggerRef
|
|
119
|
+
});
|
|
120
|
+
return (_ctx, _cache) => {
|
|
121
|
+
return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(onlyChild.OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
122
|
+
"aria-controls": vue.unref(ariaControls),
|
|
123
|
+
"aria-describedby": vue.unref(ariaDescribedby),
|
|
124
|
+
"aria-expanded": vue.unref(ariaExpanded),
|
|
125
|
+
"aria-haspopup": vue.unref(ariaHaspopup)
|
|
126
|
+
}), {
|
|
127
|
+
default: vue.withCtx(() => [
|
|
128
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
129
|
+
]),
|
|
130
|
+
_: 3
|
|
131
|
+
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
var ElPopperTrigger = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "trigger.vue"]]);
|
|
38
136
|
|
|
39
|
-
exports
|
|
40
|
-
exports.usePopperTriggerProps = usePopperTriggerProps;
|
|
137
|
+
exports["default"] = ElPopperTrigger;
|
|
41
138
|
//# sourceMappingURL=trigger2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger2.js","sources":["../../../../../../packages/components/popper/src/trigger.
|
|
1
|
+
{"version":3,"file":"trigger2.js","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>\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 { isElement } from '@element-plus/utils'\nimport { POPPER_INJECTION_KEY } from './constants'\nimport { popperTriggerProps } from './trigger'\n\nimport type { WatchStopHandle } from 'vue'\n\ndefineOptions({\n name: 'ElPopperTrigger',\n inheritAttrs: false,\n})\n\nconst props = defineProps(popperTriggerProps)\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\nconst TRIGGER_ELE_EVENTS = [\n 'onMouseenter',\n 'onMouseleave',\n 'onClick',\n 'onKeydown',\n 'onFocus',\n 'onBlur',\n 'onContextmenu',\n] as const\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,\n (el, prevEl) => {\n virtualTriggerAriaStopWatch?.()\n virtualTriggerAriaStopWatch = undefined\n if (isElement(el)) {\n TRIGGER_ELE_EVENTS.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 if (triggerRef.value && isElement(triggerRef.value)) {\n const el = triggerRef.value as HTMLElement\n TRIGGER_ELE_EVENTS.forEach((eventName) => {\n const handler = props[eventName]\n if (handler) {\n el.removeEventListener(eventName.slice(2).toLowerCase(), handler)\n }\n })\n triggerRef.value = undefined\n }\n})\n\ndefineExpose({\n /**\n * @description trigger element\n */\n triggerRef,\n})\n</script>\n"],"names":["inject","POPPER_INJECTION_KEY","useForwardRef","computed","onMounted","watch","unrefElement","isElement","isNil","onBeforeUnmount"],"mappings":";;;;;;;;;;;;;;;;;uCAyBc,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAChB,CAAA,CAAA,CAAA;;;;;;AAIA,IAAA,MAAM,EAAE,IAAA,EAAM,UAAe,EAAA,GAAAA,UAAA,CAAOC,gCAAsB,KAAS,CAAA,CAAA,CAAA;AAEnE,IAAAC,mBAAA,CAAc,UAAU,CAAA,CAAA;AAExB,IAAM,MAAA,YAAA,GAAeC,aAA6B,MAAM;AACtD,MAAO,OAAA,YAAA,CAAa,KAAQ,GAAA,KAAA,CAAM,EAAK,GAAA,KA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: import("@element-plus/nightly/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "div", boolean>;
|
|
20
20
|
readonly always: BooleanConstructor;
|
|
21
21
|
readonly minSize: import("@element-plus/nightly/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 20, boolean>;
|
|
22
|
+
readonly tabindex: import("@element-plus/nightly/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, undefined, boolean>;
|
|
22
23
|
readonly id: StringConstructor;
|
|
23
24
|
readonly role: StringConstructor;
|
|
24
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollbar.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.ts"],"sourcesContent":["import { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\nimport type { ExtractPropTypes, StyleValue } from 'vue'\nimport type Scrollbar from './scrollbar.vue'\n\nexport const scrollbarProps = buildProps({\n /**\n * @description height of scrollbar\n */\n height: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description max height of scrollbar\n */\n maxHeight: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description whether to use the native scrollbar\n */\n native: {\n type: Boolean,\n default: false,\n },\n /**\n * @description style of wrap\n */\n wrapStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n default: '',\n },\n /**\n * @description class of wrap\n */\n wrapClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description class of view\n */\n viewClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description style of view\n */\n viewStyle: {\n type: [String, Array, Object],\n default: '',\n },\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能\n /**\n * @description element tag of the view\n */\n tag: {\n type: String,\n default: 'div',\n },\n /**\n * @description always show\n */\n always: Boolean,\n /**\n * @description minimum size of scrollbar\n */\n minSize: {\n type: Number,\n default: 20,\n },\n /**\n * @description id of view\n */\n id: String,\n /**\n * @description role of view\n */\n role: String,\n ...useAriaProps(['ariaLabel', 'ariaOrientation']),\n} as const)\nexport type ScrollbarProps = ExtractPropTypes<typeof scrollbarProps>\n\nexport const scrollbarEmits = {\n scroll: ({\n scrollTop,\n scrollLeft,\n }: {\n scrollTop: number\n scrollLeft: number\n }) => [scrollTop, scrollLeft].every(isNumber),\n}\nexport type ScrollbarEmits = typeof scrollbarEmits\n\nexport type ScrollbarInstance = InstanceType<typeof Scrollbar>\n"],"names":["buildProps","definePropType","useAriaProps","isNumber"],"mappings":";;;;;;;;;;AAEY,MAAC,cAAc,GAAGA,kBAAU,CAAC;AACzC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAEC,sBAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACzB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACzB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;AACjC,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,EAAE,EAAE,MAAM;AACZ,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,GAAGC,kBAAY,CAAC,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;AACnD,CAAC,EAAE;AACS,MAAC,cAAc,GAAG;AAC9B,EAAE,MAAM,EAAE,CAAC;AACX,IAAI,SAAS;AACb,IAAI,UAAU;AACd,GAAG,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,KAAK,CAACC,cAAQ,CAAC;AAC/C;;;;;"}
|
|
1
|
+
{"version":3,"file":"scrollbar.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.ts"],"sourcesContent":["import { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\nimport type { ExtractPropTypes, StyleValue } from 'vue'\nimport type Scrollbar from './scrollbar.vue'\n\nexport const scrollbarProps = buildProps({\n /**\n * @description height of scrollbar\n */\n height: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description max height of scrollbar\n */\n maxHeight: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description whether to use the native scrollbar\n */\n native: {\n type: Boolean,\n default: false,\n },\n /**\n * @description style of wrap\n */\n wrapStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n default: '',\n },\n /**\n * @description class of wrap\n */\n wrapClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description class of view\n */\n viewClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description style of view\n */\n viewStyle: {\n type: [String, Array, Object],\n default: '',\n },\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能\n /**\n * @description element tag of the view\n */\n tag: {\n type: String,\n default: 'div',\n },\n /**\n * @description always show\n */\n always: Boolean,\n /**\n * @description minimum size of scrollbar\n */\n minSize: {\n type: Number,\n default: 20,\n },\n /**\n * @description Wrap tabindex\n */\n tabindex: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description id of view\n */\n id: String,\n /**\n * @description role of view\n */\n role: String,\n ...useAriaProps(['ariaLabel', 'ariaOrientation']),\n} as const)\nexport type ScrollbarProps = ExtractPropTypes<typeof scrollbarProps>\n\nexport const scrollbarEmits = {\n scroll: ({\n scrollTop,\n scrollLeft,\n }: {\n scrollTop: number\n scrollLeft: number\n }) => [scrollTop, scrollLeft].every(isNumber),\n}\nexport type ScrollbarEmits = typeof scrollbarEmits\n\nexport type ScrollbarInstance = InstanceType<typeof Scrollbar>\n"],"names":["buildProps","definePropType","useAriaProps","isNumber"],"mappings":";;;;;;;;;;AAEY,MAAC,cAAc,GAAGA,kBAAU,CAAC;AACzC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAEC,sBAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACzB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACzB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;AACjC,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,EAAE,EAAE,MAAM;AACZ,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,GAAGC,kBAAY,CAAC,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;AACnD,CAAC,EAAE;AACS,MAAC,cAAc,GAAG;AAC9B,EAAE,MAAM,EAAE,CAAC;AACX,IAAI,SAAS;AACb,IAAI,UAAU;AACd,GAAG,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,KAAK,CAACC,cAAQ,CAAC;AAC/C;;;;;"}
|
|
@@ -20,6 +20,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
20
20
|
readonly tag: import("@element-plus/nightly/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "div", boolean>;
|
|
21
21
|
readonly always: BooleanConstructor;
|
|
22
22
|
readonly minSize: import("@element-plus/nightly/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 20, boolean>;
|
|
23
|
+
readonly tabindex: import("@element-plus/nightly/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, undefined, boolean>;
|
|
23
24
|
readonly id: StringConstructor;
|
|
24
25
|
readonly role: StringConstructor;
|
|
25
26
|
}, {
|
|
@@ -59,6 +60,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
59
60
|
readonly tag: import("@element-plus/nightly/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "div", boolean>;
|
|
60
61
|
readonly always: BooleanConstructor;
|
|
61
62
|
readonly minSize: import("@element-plus/nightly/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 20, boolean>;
|
|
63
|
+
readonly tabindex: import("@element-plus/nightly/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, undefined, boolean>;
|
|
62
64
|
readonly id: StringConstructor;
|
|
63
65
|
readonly role: StringConstructor;
|
|
64
66
|
}>> & {
|
|
@@ -70,6 +72,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
70
72
|
readonly height: import("@element-plus/nightly/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
|
|
71
73
|
readonly maxHeight: import("@element-plus/nightly/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
|
|
72
74
|
readonly always: boolean;
|
|
75
|
+
readonly tabindex: import("@element-plus/nightly/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
|
|
73
76
|
readonly minSize: number;
|
|
74
77
|
readonly native: import("@element-plus/nightly/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
75
78
|
readonly wrapStyle: StyleValue;
|
|
@@ -144,6 +144,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
144
144
|
ref: wrapRef,
|
|
145
145
|
class: vue.normalizeClass(vue.unref(wrapKls)),
|
|
146
146
|
style: vue.normalizeStyle(vue.unref(wrapStyle)),
|
|
147
|
+
tabindex: _ctx.tabindex,
|
|
147
148
|
onScroll: handleScroll
|
|
148
149
|
}, [
|
|
149
150
|
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
|
|
@@ -161,7 +162,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
161
162
|
]),
|
|
162
163
|
_: 3
|
|
163
164
|
}, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
|
|
164
|
-
],
|
|
165
|
+
], 46, ["tabindex"]),
|
|
165
166
|
!_ctx.native ? (vue.openBlock(), vue.createBlock(bar["default"], {
|
|
166
167
|
key: 0,
|
|
167
168
|
ref_key: "barRef",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollbar2.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.vue"],"sourcesContent":["<template>\n <div ref=\"scrollbarRef\" :class=\"ns.b()\">\n <div\n ref=\"wrapRef\"\n :class=\"wrapKls\"\n :style=\"wrapStyle\"\n @scroll=\"handleScroll\"\n >\n <component\n :is=\"tag\"\n :id=\"id\"\n ref=\"resizeRef\"\n :class=\"resizeKls\"\n :style=\"viewStyle\"\n :role=\"role\"\n :aria-label=\"ariaLabel\"\n :aria-orientation=\"ariaOrientation\"\n >\n <slot />\n </component>\n </div>\n <template v-if=\"!native\">\n <bar ref=\"barRef\" :always=\"always\" :min-size=\"minSize\" />\n </template>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onActivated,\n onMounted,\n onUpdated,\n provide,\n reactive,\n ref,\n watch,\n} from 'vue'\nimport { useEventListener, useResizeObserver } from '@vueuse/core'\nimport { addUnit, debugWarn, isNumber, isObject } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport Bar from './bar.vue'\nimport { scrollbarContextKey } from './constants'\nimport { scrollbarEmits, scrollbarProps } from './scrollbar'\nimport type { BarInstance } from './bar'\nimport type { CSSProperties, StyleValue } from 'vue'\n\nconst COMPONENT_NAME = 'ElScrollbar'\n\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = defineProps(scrollbarProps)\nconst emit = defineEmits(scrollbarEmits)\n\nconst ns = useNamespace('scrollbar')\n\nlet stopResizeObserver: (() => void) | undefined = undefined\nlet stopResizeListener: (() => void) | undefined = undefined\nlet wrapScrollTop = 0\nlet wrapScrollLeft = 0\n\nconst scrollbarRef = ref<HTMLDivElement>()\nconst wrapRef = ref<HTMLDivElement>()\nconst resizeRef = ref<HTMLElement>()\nconst barRef = ref<BarInstance>()\n\nconst wrapStyle = computed<StyleValue>(() => {\n const style: CSSProperties = {}\n if (props.height) style.height = addUnit(props.height)\n if (props.maxHeight) style.maxHeight = addUnit(props.maxHeight)\n return [props.wrapStyle, style]\n})\n\nconst wrapKls = computed(() => {\n return [\n props.wrapClass,\n ns.e('wrap'),\n { [ns.em('wrap', 'hidden-default')]: !props.native },\n ]\n})\n\nconst resizeKls = computed(() => {\n return [ns.e('view'), props.viewClass]\n})\n\nconst handleScroll = () => {\n if (wrapRef.value) {\n barRef.value?.handleScroll(wrapRef.value)\n wrapScrollTop = wrapRef.value.scrollTop\n wrapScrollLeft = wrapRef.value.scrollLeft\n\n emit('scroll', {\n scrollTop: wrapRef.value.scrollTop,\n scrollLeft: wrapRef.value.scrollLeft,\n })\n }\n}\n\n// TODO: refactor method overrides, due to script setup dts\n// @ts-nocheck\nfunction scrollTo(xCord: number, yCord?: number): void\nfunction scrollTo(options: ScrollToOptions): void\nfunction scrollTo(arg1: unknown, arg2?: number) {\n if (isObject(arg1)) {\n wrapRef.value!.scrollTo(arg1)\n } else if (isNumber(arg1) && isNumber(arg2)) {\n wrapRef.value!.scrollTo(arg1, arg2)\n }\n}\n\nconst setScrollTop = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(COMPONENT_NAME, 'value must be a number')\n return\n }\n wrapRef.value!.scrollTop = value\n}\n\nconst setScrollLeft = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(COMPONENT_NAME, 'value must be a number')\n return\n }\n wrapRef.value!.scrollLeft = value\n}\n\nconst update = () => {\n barRef.value?.update()\n}\n\nwatch(\n () => props.noresize,\n (noresize) => {\n if (noresize) {\n stopResizeObserver?.()\n stopResizeListener?.()\n } else {\n ;({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update))\n stopResizeListener = useEventListener('resize', update)\n }\n },\n { immediate: true }\n)\n\nwatch(\n () => [props.maxHeight, props.height],\n () => {\n if (!props.native)\n nextTick(() => {\n update()\n if (wrapRef.value) {\n barRef.value?.handleScroll(wrapRef.value)\n }\n })\n }\n)\n\nprovide(\n scrollbarContextKey,\n reactive({\n scrollbarElement: scrollbarRef,\n wrapElement: wrapRef,\n })\n)\n\nonActivated(() => {\n wrapRef.value!.scrollTop = wrapScrollTop\n wrapRef.value!.scrollLeft = wrapScrollLeft\n})\n\nonMounted(() => {\n if (!props.native)\n nextTick(() => {\n update()\n })\n})\nonUpdated(() => update())\n\ndefineExpose({\n /** @description scrollbar wrap ref */\n wrapRef,\n /** @description update scrollbar state manually */\n update,\n /** @description scrolls to a particular set of coordinates */\n scrollTo,\n /** @description set distance to scroll top */\n setScrollTop,\n /** @description set distance to scroll left */\n setScrollLeft,\n /** @description handle scroll event */\n handleScroll,\n})\n</script>\n"],"names":["useNamespace","ref","computed","style","addUnit","isObject","isNumber","debugWarn","watch","useResizeObserver","useEventListener","nextTick","provide","scrollbarContextKey","reactive","onActivated","onMounted","onUpdated"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"scrollbar2.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.vue"],"sourcesContent":["<template>\n <div ref=\"scrollbarRef\" :class=\"ns.b()\">\n <div\n ref=\"wrapRef\"\n :class=\"wrapKls\"\n :style=\"wrapStyle\"\n :tabindex=\"tabindex\"\n @scroll=\"handleScroll\"\n >\n <component\n :is=\"tag\"\n :id=\"id\"\n ref=\"resizeRef\"\n :class=\"resizeKls\"\n :style=\"viewStyle\"\n :role=\"role\"\n :aria-label=\"ariaLabel\"\n :aria-orientation=\"ariaOrientation\"\n >\n <slot />\n </component>\n </div>\n <template v-if=\"!native\">\n <bar ref=\"barRef\" :always=\"always\" :min-size=\"minSize\" />\n </template>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onActivated,\n onMounted,\n onUpdated,\n provide,\n reactive,\n ref,\n watch,\n} from 'vue'\nimport { useEventListener, useResizeObserver } from '@vueuse/core'\nimport { addUnit, debugWarn, isNumber, isObject } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport Bar from './bar.vue'\nimport { scrollbarContextKey } from './constants'\nimport { scrollbarEmits, scrollbarProps } from './scrollbar'\nimport type { BarInstance } from './bar'\nimport type { CSSProperties, StyleValue } from 'vue'\n\nconst COMPONENT_NAME = 'ElScrollbar'\n\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = defineProps(scrollbarProps)\nconst emit = defineEmits(scrollbarEmits)\n\nconst ns = useNamespace('scrollbar')\n\nlet stopResizeObserver: (() => void) | undefined = undefined\nlet stopResizeListener: (() => void) | undefined = undefined\nlet wrapScrollTop = 0\nlet wrapScrollLeft = 0\n\nconst scrollbarRef = ref<HTMLDivElement>()\nconst wrapRef = ref<HTMLDivElement>()\nconst resizeRef = ref<HTMLElement>()\nconst barRef = ref<BarInstance>()\n\nconst wrapStyle = computed<StyleValue>(() => {\n const style: CSSProperties = {}\n if (props.height) style.height = addUnit(props.height)\n if (props.maxHeight) style.maxHeight = addUnit(props.maxHeight)\n return [props.wrapStyle, style]\n})\n\nconst wrapKls = computed(() => {\n return [\n props.wrapClass,\n ns.e('wrap'),\n { [ns.em('wrap', 'hidden-default')]: !props.native },\n ]\n})\n\nconst resizeKls = computed(() => {\n return [ns.e('view'), props.viewClass]\n})\n\nconst handleScroll = () => {\n if (wrapRef.value) {\n barRef.value?.handleScroll(wrapRef.value)\n wrapScrollTop = wrapRef.value.scrollTop\n wrapScrollLeft = wrapRef.value.scrollLeft\n\n emit('scroll', {\n scrollTop: wrapRef.value.scrollTop,\n scrollLeft: wrapRef.value.scrollLeft,\n })\n }\n}\n\n// TODO: refactor method overrides, due to script setup dts\n// @ts-nocheck\nfunction scrollTo(xCord: number, yCord?: number): void\nfunction scrollTo(options: ScrollToOptions): void\nfunction scrollTo(arg1: unknown, arg2?: number) {\n if (isObject(arg1)) {\n wrapRef.value!.scrollTo(arg1)\n } else if (isNumber(arg1) && isNumber(arg2)) {\n wrapRef.value!.scrollTo(arg1, arg2)\n }\n}\n\nconst setScrollTop = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(COMPONENT_NAME, 'value must be a number')\n return\n }\n wrapRef.value!.scrollTop = value\n}\n\nconst setScrollLeft = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(COMPONENT_NAME, 'value must be a number')\n return\n }\n wrapRef.value!.scrollLeft = value\n}\n\nconst update = () => {\n barRef.value?.update()\n}\n\nwatch(\n () => props.noresize,\n (noresize) => {\n if (noresize) {\n stopResizeObserver?.()\n stopResizeListener?.()\n } else {\n ;({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update))\n stopResizeListener = useEventListener('resize', update)\n }\n },\n { immediate: true }\n)\n\nwatch(\n () => [props.maxHeight, props.height],\n () => {\n if (!props.native)\n nextTick(() => {\n update()\n if (wrapRef.value) {\n barRef.value?.handleScroll(wrapRef.value)\n }\n })\n }\n)\n\nprovide(\n scrollbarContextKey,\n reactive({\n scrollbarElement: scrollbarRef,\n wrapElement: wrapRef,\n })\n)\n\nonActivated(() => {\n wrapRef.value!.scrollTop = wrapScrollTop\n wrapRef.value!.scrollLeft = wrapScrollLeft\n})\n\nonMounted(() => {\n if (!props.native)\n nextTick(() => {\n update()\n })\n})\nonUpdated(() => update())\n\ndefineExpose({\n /** @description scrollbar wrap ref */\n wrapRef,\n /** @description update scrollbar state manually */\n update,\n /** @description scrolls to a particular set of coordinates */\n scrollTo,\n /** @description set distance to scroll top */\n setScrollTop,\n /** @description set distance to scroll left */\n setScrollLeft,\n /** @description handle scroll event */\n handleScroll,\n})\n</script>\n"],"names":["useNamespace","ref","computed","style","addUnit","isObject","isNumber","debugWarn","watch","useResizeObserver","useEventListener","nextTick","provide","scrollbarContextKey","reactive","onActivated","onMounted","onUpdated"],"mappings":";;;;;;;;;;;;;;;;;;;uCAkDc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR;;;;;;;AAKA,IAAM,MAAA,EAAA,GAAKA,mBAAa,WAAW,CAAA,CAAA;AAEnC,IAAA,IAAI,kBAA+C,GAAA,KAAA,CAAA,CAAA;AACnD,IAAA,IAAI,kBAA+C,GAAA,KAAA,CAAA,CAAA;AACnD,IAAA,IAAI,aAAgB,GAAA,CAAA,CAAA;AACpB,IAAA,IAAI,cAAiB,GAAA,CAAA,CAAA;AAErB,IAAA,MAAM,eAAeC,OAAoB,EAAA,CAAA;AACzC,IAAA,MAAM,UAAUA,OAAoB,EAAA,CAAA;AACpC,IAAA,MAAM,YAAYA,OAAiB,EAAA,CAAA;AACnC,IAAA,MAAM,SAASA,OAAiB,EAAA,CAAA;AAEhC,IAAM,MAAA,SAAA,GAAYC,aAAqB,MAAM;AAC3C,MAAA,MAAMC,UAAuB,EAAC,CAAA;AAC9B,MAAA,IAAI,KAAM,CAAA,MAAA;AAAQ,QAAMA,OAAA,CAAA,MAAA,GAASC,aAAQ,CAAA,KAAA,CAAM,MAAM,CAAA,CAAA;AACrD,MAAA,IAAI,KAAM,CAAA,SAAA;AAAW,QAAMD,OAAA,CAAA,SAAA,GAAYC,aAAQ,CAAA,KAAA,CAAM,SAAS,CAAA,CAAA;AAC9D,MAAO,OAAA,CAAC,KAAM,CAAA,SAAA,EAAWD,OAAK,CAAA,CAAA;AAAA,KAC/B,CAAA,CAAA;AAED,IAAM,MAAA,OAAA,GAAUD,aAAS,MAAM;AAC7B,M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ipOptions;
|
|
131
|
+
scrollbarTabindex?: number | string;
|
|
131
132
|
}
|
|
132
133
|
interface Sort {
|
|
133
134
|
prop: string;
|
|
@@ -357,6 +358,10 @@ declare const _default: {
|
|
|
357
358
|
* @description whether to hide extra content and show them in a tooltip when hovering on the cell.It will affect all the table columns
|
|
358
359
|
*/
|
|
359
360
|
showOverflowTooltip: PropType<boolean | Partial<Pick<import("../../..").ElTooltipProps, "offset" | "transition" | "placement" | "effect" | "showAfter" | "hideAfter" | "popperOptions" | "enterable" | "popperClass" | "appendTo" | "showArrow">> | undefined>;
|
|
361
|
+
scrollbarTabindex: {
|
|
362
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
363
|
+
default: undefined;
|
|
364
|
+
};
|
|
360
365
|
};
|
|
361
366
|
export default _default;
|
|
362
367
|
export type { SummaryMethod, Table, TableProps, TableRefs, ColumnCls, ColumnStyle, CellCls, CellStyle, TreeNode, RenderRowData, Sort, Filter, TableColumnCtx, TreeProps, };
|
|
@@ -79,7 +79,11 @@ var defaultProps = {
|
|
|
79
79
|
},
|
|
80
80
|
scrollbarAlwaysOn: Boolean,
|
|
81
81
|
flexible: Boolean,
|
|
82
|
-
showOverflowTooltip: [Boolean, Object]
|
|
82
|
+
showOverflowTooltip: [Boolean, Object],
|
|
83
|
+
scrollbarTabindex: {
|
|
84
|
+
type: [Number, String],
|
|
85
|
+
default: void 0
|
|
86
|
+
}
|
|
83
87
|
};
|
|
84
88
|
|
|
85
89
|
exports["default"] = defaultProps;
|