@element-plus/nightly 0.0.20240531 → 0.0.20240601
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.full.js +2 -2
- package/dist/index.full.min.js +2 -2
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +2 -2
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +2 -2
- 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/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/affix/index.mjs +2 -2
- package/es/components/affix/src/affix.mjs +117 -26
- package/es/components/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +26 -117
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/index.mjs +6 -6
- package/es/components/row/index.mjs +2 -2
- package/es/components/row/src/row.mjs +45 -29
- package/es/components/row/src/row.mjs.map +1 -1
- package/es/components/row/src/row2.mjs +29 -45
- package/es/components/row/src/row2.mjs.map +1 -1
- package/es/components/scrollbar/src/bar.mjs +64 -11
- package/es/components/scrollbar/src/bar.mjs.map +1 -1
- package/es/components/scrollbar/src/bar2.mjs +11 -64
- package/es/components/scrollbar/src/bar2.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar2.mjs +1 -1
- package/es/components/slider/index.mjs +2 -2
- package/es/components/slider/src/slider.mjs +242 -94
- package/es/components/slider/src/slider.mjs.map +1 -1
- package/es/components/slider/src/slider2.mjs +94 -242
- package/es/components/slider/src/slider2.mjs.map +1 -1
- package/es/components/steps/index.mjs +2 -2
- package/es/components/steps/src/steps.mjs +39 -36
- package/es/components/steps/src/steps.mjs.map +1 -1
- package/es/components/steps/src/steps2.mjs +36 -39
- package/es/components/steps/src/steps2.mjs.map +1 -1
- package/es/components/tabs/index.mjs +2 -2
- package/es/components/tabs/src/tab-pane.mjs +72 -13
- package/es/components/tabs/src/tab-pane.mjs.map +1 -1
- package/es/components/tabs/src/tab-pane2.mjs +13 -72
- package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
- package/es/components/tooltip/index.mjs +2 -2
- package/es/components/tooltip/src/tooltip.mjs +170 -31
- package/es/components/tooltip/src/tooltip.mjs.map +1 -1
- package/es/components/tooltip/src/tooltip2.mjs +31 -170
- package/es/components/tooltip/src/tooltip2.mjs.map +1 -1
- package/es/index.mjs +6 -6
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/affix/index.js +2 -2
- package/lib/components/affix/src/affix.js +117 -27
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +27 -117
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/index.js +6 -6
- package/lib/components/row/index.js +2 -2
- package/lib/components/row/src/row.js +45 -31
- package/lib/components/row/src/row.js.map +1 -1
- package/lib/components/row/src/row2.js +31 -45
- package/lib/components/row/src/row2.js.map +1 -1
- package/lib/components/scrollbar/src/bar.js +64 -11
- package/lib/components/scrollbar/src/bar.js.map +1 -1
- package/lib/components/scrollbar/src/bar2.js +11 -64
- package/lib/components/scrollbar/src/bar2.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar2.js +1 -1
- package/lib/components/slider/index.js +2 -2
- package/lib/components/slider/src/slider.js +242 -95
- package/lib/components/slider/src/slider.js.map +1 -1
- package/lib/components/slider/src/slider2.js +95 -242
- package/lib/components/slider/src/slider2.js.map +1 -1
- package/lib/components/steps/index.js +2 -2
- package/lib/components/steps/src/steps.js +39 -37
- package/lib/components/steps/src/steps.js.map +1 -1
- package/lib/components/steps/src/steps2.js +37 -39
- package/lib/components/steps/src/steps2.js.map +1 -1
- package/lib/components/tabs/index.js +2 -2
- package/lib/components/tabs/src/tab-pane.js +72 -13
- package/lib/components/tabs/src/tab-pane.js.map +1 -1
- package/lib/components/tabs/src/tab-pane2.js +13 -72
- package/lib/components/tabs/src/tab-pane2.js.map +1 -1
- package/lib/components/tooltip/index.js +2 -2
- package/lib/components/tooltip/src/tooltip.js +170 -35
- package/lib/components/tooltip/src/tooltip.js.map +1 -1
- package/lib/components/tooltip/src/tooltip2.js +35 -170
- package/lib/components/tooltip/src/tooltip2.js.map +1 -1
- package/lib/index.js +6 -6
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1,18 +1,77 @@
|
|
|
1
|
+
import { defineComponent, getCurrentInstance, useSlots, inject, ref, computed, watch, reactive, onMounted, onUnmounted, unref, withDirectives, openBlock, createElementBlock, normalizeClass, renderSlot, vShow, createCommentVNode } from 'vue';
|
|
2
|
+
import { eagerComputed } from '@vueuse/core';
|
|
1
3
|
import '../../../utils/index.mjs';
|
|
2
|
-
import
|
|
4
|
+
import '../../../hooks/index.mjs';
|
|
5
|
+
import { tabsRootContextKey } from './constants.mjs';
|
|
6
|
+
import { tabPaneProps } from './tab-pane2.mjs';
|
|
7
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
+
import { throwError } from '../../../utils/error.mjs';
|
|
9
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
3
10
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
name: {
|
|
10
|
-
type: [String, Number]
|
|
11
|
-
},
|
|
12
|
-
closable: Boolean,
|
|
13
|
-
disabled: Boolean,
|
|
14
|
-
lazy: Boolean
|
|
11
|
+
const _hoisted_1 = ["id", "aria-hidden", "aria-labelledby"];
|
|
12
|
+
const COMPONENT_NAME = "ElTabPane";
|
|
13
|
+
const __default__ = defineComponent({
|
|
14
|
+
name: COMPONENT_NAME
|
|
15
15
|
});
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
...__default__,
|
|
18
|
+
props: tabPaneProps,
|
|
19
|
+
setup(__props) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const instance = getCurrentInstance();
|
|
22
|
+
const slots = useSlots();
|
|
23
|
+
const tabsRoot = inject(tabsRootContextKey);
|
|
24
|
+
if (!tabsRoot)
|
|
25
|
+
throwError(COMPONENT_NAME, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
|
|
26
|
+
const ns = useNamespace("tab-pane");
|
|
27
|
+
const index = ref();
|
|
28
|
+
const isClosable = computed(() => props.closable || tabsRoot.props.closable);
|
|
29
|
+
const active = eagerComputed(() => {
|
|
30
|
+
var _a;
|
|
31
|
+
return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
|
|
32
|
+
});
|
|
33
|
+
const loaded = ref(active.value);
|
|
34
|
+
const paneName = computed(() => {
|
|
35
|
+
var _a;
|
|
36
|
+
return (_a = props.name) != null ? _a : index.value;
|
|
37
|
+
});
|
|
38
|
+
const shouldBeRender = eagerComputed(() => !props.lazy || loaded.value || active.value);
|
|
39
|
+
watch(active, (val) => {
|
|
40
|
+
if (val)
|
|
41
|
+
loaded.value = true;
|
|
42
|
+
});
|
|
43
|
+
const pane = reactive({
|
|
44
|
+
uid: instance.uid,
|
|
45
|
+
slots,
|
|
46
|
+
props,
|
|
47
|
+
paneName,
|
|
48
|
+
active,
|
|
49
|
+
index,
|
|
50
|
+
isClosable
|
|
51
|
+
});
|
|
52
|
+
onMounted(() => {
|
|
53
|
+
tabsRoot.registerPane(pane);
|
|
54
|
+
});
|
|
55
|
+
onUnmounted(() => {
|
|
56
|
+
tabsRoot.unregisterPane(pane.uid);
|
|
57
|
+
});
|
|
58
|
+
return (_ctx, _cache) => {
|
|
59
|
+
return unref(shouldBeRender) ? withDirectives((openBlock(), createElementBlock("div", {
|
|
60
|
+
key: 0,
|
|
61
|
+
id: `pane-${unref(paneName)}`,
|
|
62
|
+
class: normalizeClass(unref(ns).b()),
|
|
63
|
+
role: "tabpanel",
|
|
64
|
+
"aria-hidden": !unref(active),
|
|
65
|
+
"aria-labelledby": `tab-${unref(paneName)}`
|
|
66
|
+
}, [
|
|
67
|
+
renderSlot(_ctx.$slots, "default")
|
|
68
|
+
], 10, _hoisted_1)), [
|
|
69
|
+
[vShow, unref(active)]
|
|
70
|
+
]) : createCommentVNode("v-if", true);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "tab-pane.vue"]]);
|
|
16
75
|
|
|
17
|
-
export {
|
|
76
|
+
export { TabPane as default };
|
|
18
77
|
//# sourceMappingURL=tab-pane.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-pane.mjs","sources":["../../../../../../packages/components/tabs/src/tab-pane.
|
|
1
|
+
{"version":3,"file":"tab-pane.mjs","sources":["../../../../../../packages/components/tabs/src/tab-pane.vue"],"sourcesContent":["<template>\n <div\n v-if=\"shouldBeRender\"\n v-show=\"active\"\n :id=\"`pane-${paneName}`\"\n :class=\"ns.b()\"\n role=\"tabpanel\"\n :aria-hidden=\"!active\"\n :aria-labelledby=\"`tab-${paneName}`\"\n >\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n getCurrentInstance,\n inject,\n onMounted,\n onUnmounted,\n reactive,\n ref,\n useSlots,\n watch,\n} from 'vue'\nimport { eagerComputed } from '@vueuse/core'\nimport { throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { tabsRootContextKey } from './constants'\nimport { tabPaneProps } from './tab-pane'\n\nconst COMPONENT_NAME = 'ElTabPane'\ndefineOptions({\n name: COMPONENT_NAME,\n})\nconst props = defineProps(tabPaneProps)\n\nconst instance = getCurrentInstance()!\nconst slots = useSlots()\n\nconst tabsRoot = inject(tabsRootContextKey)\nif (!tabsRoot)\n throwError(COMPONENT_NAME, 'usage: <el-tabs><el-tab-pane /></el-tabs/>')\n\nconst ns = useNamespace('tab-pane')\n\nconst index = ref<string>()\nconst isClosable = computed(() => props.closable || tabsRoot.props.closable)\nconst active = eagerComputed(\n () => tabsRoot.currentName.value === (props.name ?? index.value)\n)\nconst loaded = ref(active.value)\nconst paneName = computed(() => props.name ?? index.value)\nconst shouldBeRender = eagerComputed(\n () => !props.lazy || loaded.value || active.value\n)\n\nwatch(active, (val) => {\n if (val) loaded.value = true\n})\n\nconst pane = reactive({\n uid: instance.uid,\n slots,\n props,\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,KAAA,IAAA,MAAA,CAAA,KAAA,CAAA,CAAA;AAAA,IACd,KAAA,CAAA,MAAA,EAAA,CAAA,GAAA,KAAA;AAAA,MACA,IAAA,GAAA;AAAA,QACA,MAAA,CAAA,KAAA,GAAA,IAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAAA,IACA,MAAA,IAAA,GAAA,QAAA,CAAA;AAAA,MACA,GAAA,EAAA,QAAA,CAAA,GAAA;AAAA,MACD,KAAA;AAED,MAAA,KAAA;AACE,MAAA,QAAA;AAA0B,MAC3B,MAAA;AAED,MAAA,KAAA;AACE,MAAS,UAAA;AAAuB,KACjC,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,77 +1,18 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, useSlots, inject, ref, computed, watch, reactive, onMounted, onUnmounted, unref, withDirectives, openBlock, createElementBlock, normalizeClass, renderSlot, vShow, createCommentVNode } from 'vue';
|
|
2
|
-
import { eagerComputed } from '@vueuse/core';
|
|
3
1
|
import '../../../utils/index.mjs';
|
|
4
|
-
import '../../../
|
|
5
|
-
import { tabsRootContextKey } from './constants.mjs';
|
|
6
|
-
import { tabPaneProps } from './tab-pane.mjs';
|
|
7
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
-
import { throwError } from '../../../utils/error.mjs';
|
|
9
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
2
|
+
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
|
10
3
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
const tabPaneProps = buildProps({
|
|
5
|
+
label: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: ""
|
|
8
|
+
},
|
|
9
|
+
name: {
|
|
10
|
+
type: [String, Number]
|
|
11
|
+
},
|
|
12
|
+
closable: Boolean,
|
|
13
|
+
disabled: Boolean,
|
|
14
|
+
lazy: Boolean
|
|
15
15
|
});
|
|
16
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
-
...__default__,
|
|
18
|
-
props: tabPaneProps,
|
|
19
|
-
setup(__props) {
|
|
20
|
-
const props = __props;
|
|
21
|
-
const instance = getCurrentInstance();
|
|
22
|
-
const slots = useSlots();
|
|
23
|
-
const tabsRoot = inject(tabsRootContextKey);
|
|
24
|
-
if (!tabsRoot)
|
|
25
|
-
throwError(COMPONENT_NAME, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
|
|
26
|
-
const ns = useNamespace("tab-pane");
|
|
27
|
-
const index = ref();
|
|
28
|
-
const isClosable = computed(() => props.closable || tabsRoot.props.closable);
|
|
29
|
-
const active = eagerComputed(() => {
|
|
30
|
-
var _a;
|
|
31
|
-
return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
|
|
32
|
-
});
|
|
33
|
-
const loaded = ref(active.value);
|
|
34
|
-
const paneName = computed(() => {
|
|
35
|
-
var _a;
|
|
36
|
-
return (_a = props.name) != null ? _a : index.value;
|
|
37
|
-
});
|
|
38
|
-
const shouldBeRender = eagerComputed(() => !props.lazy || loaded.value || active.value);
|
|
39
|
-
watch(active, (val) => {
|
|
40
|
-
if (val)
|
|
41
|
-
loaded.value = true;
|
|
42
|
-
});
|
|
43
|
-
const pane = reactive({
|
|
44
|
-
uid: instance.uid,
|
|
45
|
-
slots,
|
|
46
|
-
props,
|
|
47
|
-
paneName,
|
|
48
|
-
active,
|
|
49
|
-
index,
|
|
50
|
-
isClosable
|
|
51
|
-
});
|
|
52
|
-
onMounted(() => {
|
|
53
|
-
tabsRoot.registerPane(pane);
|
|
54
|
-
});
|
|
55
|
-
onUnmounted(() => {
|
|
56
|
-
tabsRoot.unregisterPane(pane.uid);
|
|
57
|
-
});
|
|
58
|
-
return (_ctx, _cache) => {
|
|
59
|
-
return unref(shouldBeRender) ? withDirectives((openBlock(), createElementBlock("div", {
|
|
60
|
-
key: 0,
|
|
61
|
-
id: `pane-${unref(paneName)}`,
|
|
62
|
-
class: normalizeClass(unref(ns).b()),
|
|
63
|
-
role: "tabpanel",
|
|
64
|
-
"aria-hidden": !unref(active),
|
|
65
|
-
"aria-labelledby": `tab-${unref(paneName)}`
|
|
66
|
-
}, [
|
|
67
|
-
renderSlot(_ctx.$slots, "default")
|
|
68
|
-
], 10, _hoisted_1)), [
|
|
69
|
-
[vShow, unref(active)]
|
|
70
|
-
]) : createCommentVNode("v-if", true);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "tab-pane.vue"]]);
|
|
75
16
|
|
|
76
|
-
export {
|
|
17
|
+
export { tabPaneProps };
|
|
77
18
|
//# sourceMappingURL=tab-pane2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-pane2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-pane.
|
|
1
|
+
{"version":3,"file":"tab-pane2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-pane.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type TabPane from './tab-pane.vue'\n\nexport const tabPaneProps = buildProps({\n label: {\n type: String,\n default: '',\n },\n name: {\n type: [String, Number],\n },\n closable: Boolean,\n disabled: Boolean,\n lazy: Boolean,\n} as const)\n\nexport type TabPaneProps = ExtractPropTypes<typeof tabPaneProps>\n\nexport type TabPaneInstance = InstanceType<typeof TabPane>\n"],"names":[],"mappings":";;;AACY,MAAC,YAAY,GAAG,UAAU,CAAC;AACvC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,IAAI,EAAE,OAAO;AACf,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import Tooltip from './src/
|
|
3
|
-
export { tooltipEmits, useTooltipModelToggle, useTooltipModelToggleEmits, useTooltipModelToggleProps, useTooltipProps } from './src/
|
|
2
|
+
import Tooltip from './src/tooltip.mjs';
|
|
3
|
+
export { tooltipEmits, useTooltipModelToggle, useTooltipModelToggleEmits, useTooltipModelToggleProps, useTooltipProps } from './src/tooltip2.mjs';
|
|
4
4
|
export { useTooltipTriggerProps } from './src/trigger.mjs';
|
|
5
5
|
export { useTooltipContentProps } from './src/content.mjs';
|
|
6
6
|
export { TOOLTIP_INJECTION_KEY } from './src/constants.mjs';
|
|
@@ -1,38 +1,177 @@
|
|
|
1
|
+
import { defineComponent, ref, unref, toRef, computed, provide, readonly, watch, onDeactivated, openBlock, createBlock, withCtx, createVNode, renderSlot, createCommentVNode, createElementBlock, toDisplayString } from 'vue';
|
|
2
|
+
import { ElPopper } from '../../popper/index.mjs';
|
|
1
3
|
import '../../../utils/index.mjs';
|
|
2
4
|
import '../../../hooks/index.mjs';
|
|
3
|
-
import '
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { TOOLTIP_INJECTION_KEY } from './constants.mjs';
|
|
6
|
+
import { useTooltipProps, tooltipEmits, useTooltipModelToggle } from './tooltip2.mjs';
|
|
7
|
+
import ElTooltipTrigger from './trigger2.mjs';
|
|
8
|
+
import ElTooltipContent from './content2.mjs';
|
|
9
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
10
|
+
import { usePopperContainer } from '../../../hooks/use-popper-container/index.mjs';
|
|
11
|
+
import { useId } from '../../../hooks/use-id/index.mjs';
|
|
12
|
+
import { useDelayedToggle } from '../../../hooks/use-delayed-toggle/index.mjs';
|
|
13
|
+
import { isBoolean } from '../../../utils/types.mjs';
|
|
14
|
+
import ElPopperArrow from '../../popper/src/arrow2.mjs';
|
|
10
15
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
const
|
|
17
|
-
...
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
const _hoisted_1 = ["innerHTML"];
|
|
17
|
+
const _hoisted_2 = { key: 1 };
|
|
18
|
+
const __default__ = defineComponent({
|
|
19
|
+
name: "ElTooltip"
|
|
20
|
+
});
|
|
21
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
22
|
+
...__default__,
|
|
23
|
+
props: useTooltipProps,
|
|
24
|
+
emits: tooltipEmits,
|
|
25
|
+
setup(__props, { expose, emit }) {
|
|
26
|
+
const props = __props;
|
|
27
|
+
usePopperContainer();
|
|
28
|
+
const id = useId();
|
|
29
|
+
const popperRef = ref();
|
|
30
|
+
const contentRef = ref();
|
|
31
|
+
const updatePopper = () => {
|
|
32
|
+
var _a;
|
|
33
|
+
const popperComponent = unref(popperRef);
|
|
34
|
+
if (popperComponent) {
|
|
35
|
+
(_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const open = ref(false);
|
|
39
|
+
const toggleReason = ref();
|
|
40
|
+
const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
|
|
41
|
+
indicator: open,
|
|
42
|
+
toggleReason
|
|
43
|
+
});
|
|
44
|
+
const { onOpen, onClose } = useDelayedToggle({
|
|
45
|
+
showAfter: toRef(props, "showAfter"),
|
|
46
|
+
hideAfter: toRef(props, "hideAfter"),
|
|
47
|
+
autoClose: toRef(props, "autoClose"),
|
|
48
|
+
open: show,
|
|
49
|
+
close: hide
|
|
50
|
+
});
|
|
51
|
+
const controlled = computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
|
|
52
|
+
provide(TOOLTIP_INJECTION_KEY, {
|
|
53
|
+
controlled,
|
|
54
|
+
id,
|
|
55
|
+
open: readonly(open),
|
|
56
|
+
trigger: toRef(props, "trigger"),
|
|
57
|
+
onOpen: (event) => {
|
|
58
|
+
onOpen(event);
|
|
59
|
+
},
|
|
60
|
+
onClose: (event) => {
|
|
61
|
+
onClose(event);
|
|
62
|
+
},
|
|
63
|
+
onToggle: (event) => {
|
|
64
|
+
if (unref(open)) {
|
|
65
|
+
onClose(event);
|
|
66
|
+
} else {
|
|
67
|
+
onOpen(event);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
onShow: () => {
|
|
71
|
+
emit("show", toggleReason.value);
|
|
72
|
+
},
|
|
73
|
+
onHide: () => {
|
|
74
|
+
emit("hide", toggleReason.value);
|
|
75
|
+
},
|
|
76
|
+
onBeforeShow: () => {
|
|
77
|
+
emit("before-show", toggleReason.value);
|
|
78
|
+
},
|
|
79
|
+
onBeforeHide: () => {
|
|
80
|
+
emit("before-hide", toggleReason.value);
|
|
81
|
+
},
|
|
82
|
+
updatePopper
|
|
83
|
+
});
|
|
84
|
+
watch(() => props.disabled, (disabled) => {
|
|
85
|
+
if (disabled && open.value) {
|
|
86
|
+
open.value = false;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const isFocusInsideContent = (event) => {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef;
|
|
92
|
+
const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
|
|
93
|
+
return popperContent && popperContent.contains(activeElement);
|
|
94
|
+
};
|
|
95
|
+
onDeactivated(() => open.value && hide());
|
|
96
|
+
expose({
|
|
97
|
+
popperRef,
|
|
98
|
+
contentRef,
|
|
99
|
+
isFocusInsideContent,
|
|
100
|
+
updatePopper,
|
|
101
|
+
onOpen,
|
|
102
|
+
onClose,
|
|
103
|
+
hide
|
|
104
|
+
});
|
|
105
|
+
return (_ctx, _cache) => {
|
|
106
|
+
return openBlock(), createBlock(unref(ElPopper), {
|
|
107
|
+
ref_key: "popperRef",
|
|
108
|
+
ref: popperRef,
|
|
109
|
+
role: _ctx.role
|
|
110
|
+
}, {
|
|
111
|
+
default: withCtx(() => [
|
|
112
|
+
createVNode(ElTooltipTrigger, {
|
|
113
|
+
disabled: _ctx.disabled,
|
|
114
|
+
trigger: _ctx.trigger,
|
|
115
|
+
"trigger-keys": _ctx.triggerKeys,
|
|
116
|
+
"virtual-ref": _ctx.virtualRef,
|
|
117
|
+
"virtual-triggering": _ctx.virtualTriggering
|
|
118
|
+
}, {
|
|
119
|
+
default: withCtx(() => [
|
|
120
|
+
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
|
|
121
|
+
]),
|
|
122
|
+
_: 3
|
|
123
|
+
}, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
|
|
124
|
+
createVNode(ElTooltipContent, {
|
|
125
|
+
ref_key: "contentRef",
|
|
126
|
+
ref: contentRef,
|
|
127
|
+
"aria-label": _ctx.ariaLabel,
|
|
128
|
+
"boundaries-padding": _ctx.boundariesPadding,
|
|
129
|
+
content: _ctx.content,
|
|
130
|
+
disabled: _ctx.disabled,
|
|
131
|
+
effect: _ctx.effect,
|
|
132
|
+
enterable: _ctx.enterable,
|
|
133
|
+
"fallback-placements": _ctx.fallbackPlacements,
|
|
134
|
+
"hide-after": _ctx.hideAfter,
|
|
135
|
+
"gpu-acceleration": _ctx.gpuAcceleration,
|
|
136
|
+
offset: _ctx.offset,
|
|
137
|
+
persistent: _ctx.persistent,
|
|
138
|
+
"popper-class": _ctx.popperClass,
|
|
139
|
+
"popper-style": _ctx.popperStyle,
|
|
140
|
+
placement: _ctx.placement,
|
|
141
|
+
"popper-options": _ctx.popperOptions,
|
|
142
|
+
pure: _ctx.pure,
|
|
143
|
+
"raw-content": _ctx.rawContent,
|
|
144
|
+
"reference-el": _ctx.referenceEl,
|
|
145
|
+
"trigger-target-el": _ctx.triggerTargetEl,
|
|
146
|
+
"show-after": _ctx.showAfter,
|
|
147
|
+
strategy: _ctx.strategy,
|
|
148
|
+
teleported: _ctx.teleported,
|
|
149
|
+
transition: _ctx.transition,
|
|
150
|
+
"virtual-triggering": _ctx.virtualTriggering,
|
|
151
|
+
"z-index": _ctx.zIndex,
|
|
152
|
+
"append-to": _ctx.appendTo
|
|
153
|
+
}, {
|
|
154
|
+
default: withCtx(() => [
|
|
155
|
+
renderSlot(_ctx.$slots, "content", {}, () => [
|
|
156
|
+
_ctx.rawContent ? (openBlock(), createElementBlock("span", {
|
|
157
|
+
key: 0,
|
|
158
|
+
innerHTML: _ctx.content
|
|
159
|
+
}, null, 8, _hoisted_1)) : (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(_ctx.content), 1))
|
|
160
|
+
]),
|
|
161
|
+
_ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), {
|
|
162
|
+
key: 0,
|
|
163
|
+
"arrow-offset": _ctx.arrowOffset
|
|
164
|
+
}, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
|
|
165
|
+
]),
|
|
166
|
+
_: 3
|
|
167
|
+
}, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
|
|
168
|
+
]),
|
|
169
|
+
_: 3
|
|
170
|
+
}, 8, ["role"]);
|
|
171
|
+
};
|
|
25
172
|
}
|
|
26
173
|
});
|
|
27
|
-
|
|
28
|
-
...useTooltipModelToggleEmits,
|
|
29
|
-
"before-show",
|
|
30
|
-
"before-hide",
|
|
31
|
-
"show",
|
|
32
|
-
"hide",
|
|
33
|
-
"open",
|
|
34
|
-
"close"
|
|
35
|
-
];
|
|
174
|
+
var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "tooltip.vue"]]);
|
|
36
175
|
|
|
37
|
-
export {
|
|
176
|
+
export { Tooltip as default };
|
|
38
177
|
//# sourceMappingURL=tooltip.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.mjs","sources":["../../../../../../packages/components/tooltip/src/tooltip.
|
|
1
|
+
{"version":3,"file":"tooltip.mjs","sources":["../../../../../../packages/components/tooltip/src/tooltip.vue"],"sourcesContent":["<template>\n <el-popper ref=\"popperRef\" :role=\"role\">\n <el-tooltip-trigger\n :disabled=\"disabled\"\n :trigger=\"trigger\"\n :trigger-keys=\"triggerKeys\"\n :virtual-ref=\"virtualRef\"\n :virtual-triggering=\"virtualTriggering\"\n >\n <slot v-if=\"$slots.default\" />\n </el-tooltip-trigger>\n <el-tooltip-content\n ref=\"contentRef\"\n :aria-label=\"ariaLabel\"\n :boundaries-padding=\"boundariesPadding\"\n :content=\"content\"\n :disabled=\"disabled\"\n :effect=\"effect\"\n :enterable=\"enterable\"\n :fallback-placements=\"fallbackPlacements\"\n :hide-after=\"hideAfter\"\n :gpu-acceleration=\"gpuAcceleration\"\n :offset=\"offset\"\n :persistent=\"persistent\"\n :popper-class=\"popperClass\"\n :popper-style=\"popperStyle\"\n :placement=\"placement\"\n :popper-options=\"popperOptions\"\n :pure=\"pure\"\n :raw-content=\"rawContent\"\n :reference-el=\"referenceEl\"\n :trigger-target-el=\"triggerTargetEl\"\n :show-after=\"showAfter\"\n :strategy=\"strategy\"\n :teleported=\"teleported\"\n :transition=\"transition\"\n :virtual-triggering=\"virtualTriggering\"\n :z-index=\"zIndex\"\n :append-to=\"appendTo\"\n >\n <slot name=\"content\">\n <span v-if=\"rawContent\" v-html=\"content\" />\n <span v-else>{{ content }}</span>\n </slot>\n <el-popper-arrow v-if=\"showArrow\" :arrow-offset=\"arrowOffset\" />\n </el-tooltip-content>\n </el-popper>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n onDeactivated,\n provide,\n readonly,\n ref,\n toRef,\n unref,\n watch,\n} from 'vue'\nimport { ElPopper, ElPopperArrow } from '@element-plus/components/popper'\n\nimport { isBoolean } from '@element-plus/utils'\nimport {\n useDelayedToggle,\n useId,\n usePopperContainer,\n} from '@element-plus/hooks'\nimport { TOOLTIP_INJECTION_KEY } from './constants'\nimport { tooltipEmits, useTooltipModelToggle, useTooltipProps } from './tooltip'\nimport ElTooltipTrigger from './trigger.vue'\nimport ElTooltipContent from './content.vue'\nimport type { PopperInstance } from '@element-plus/components/popper'\n\ndefineOptions({\n name: 'ElTooltip',\n})\n\nconst props = defineProps(useTooltipProps)\nconst emit = defineEmits(tooltipEmits)\n\nusePopperContainer()\n\nconst id = useId()\nconst popperRef = ref<PopperInstance>()\n// TODO any is temporary, replace with `TooltipContentInstance` later\nconst contentRef = ref<any>()\n\nconst updatePopper = () => {\n const popperComponent = unref(popperRef)\n if (popperComponent) {\n popperComponent.popperInstanceRef?.update()\n }\n}\nconst open = ref(false)\nconst toggleReason = ref<Event>()\n\nconst { show, hide, hasUpdateHandler } = useTooltipModelToggle({\n indicator: open,\n toggleReason,\n})\n\nconst { onOpen, onClose } = useDelayedToggle({\n showAfter: toRef(props, 'showAfter'),\n hideAfter: toRef(props, 'hideAfter'),\n autoClose: toRef(props, 'autoClose'),\n open: show,\n close: hide,\n})\n\nconst controlled = computed(\n () => isBoolean(props.visible) && !hasUpdateHandler.value\n)\n\nprovide(TOOLTIP_INJECTION_KEY, {\n controlled,\n id,\n open: readonly(open),\n trigger: toRef(props, 'trigger'),\n onOpen: (event?: Event) => {\n onOpen(event)\n },\n onClose: (event?: Event) => {\n onClose(event)\n },\n onToggle: (event?: Event) => {\n if (unref(open)) {\n onClose(event)\n } else {\n onOpen(event)\n }\n },\n onShow: () => {\n emit('show', toggleReason.value)\n },\n onHide: () => {\n emit('hide', toggleReason.value)\n },\n onBeforeShow: () => {\n emit('before-show', toggleReason.value)\n },\n onBeforeHide: () => {\n emit('before-hide', toggleReason.value)\n },\n updatePopper,\n})\n\nwatch(\n () => props.disabled,\n (disabled) => {\n if (disabled && open.value) {\n open.value = false\n }\n }\n)\n\nconst isFocusInsideContent = (event?: FocusEvent) => {\n const popperContent: HTMLElement | undefined =\n contentRef.value?.contentRef?.popperContentRef\n const activeElement = (event?.relatedTarget as Node) || document.activeElement\n\n return popperContent && popperContent.contains(activeElement)\n}\n\nonDeactivated(() => open.value && hide())\n\ndefineExpose({\n /**\n * @description el-popper component instance\n */\n popperRef,\n /**\n * @description el-tooltip-content component instance\n */\n contentRef,\n /**\n * @description validate current focus event is trigger inside el-tooltip-content\n */\n isFocusInsideContent,\n /**\n * @description update el-popper component instance\n */\n updatePopper,\n /**\n * @description expose onOpen function to mange el-tooltip open state\n */\n onOpen,\n /**\n * @description expose onOpen function to mange el-tooltip open state\n */\n onClose,\n /**\n * @description expose hide function\n */\n hide,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;mCA0Ec,CAAA;AAAA,EACZ,IAAM,EAAA,WAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAmB,kBAAA,EAAA,CAAA;AAEnB,IAAA,MAAM,KAAK,KAAM,EAAA,CAAA;AACjB,IAAA,MAAM,YAAY,GAAoB,EAAA,CAAA;AAEtC,IAAA,MAAM,aAAa,GAAS,EAAA,CAAA;AAE5B,IAAA,MAAM,eAAe,MAAM;AACzB,MAAM,IAAA,EAAA,CAAA;AACN,MAAA,MAAqB,eAAA,GAAA,KAAA,CAAA,SAAA,CAAA,CAAA;AACnB,MAAA,IAAA;AAA0C,QAC5C,CAAA,EAAA,GAAA,eAAA,CAAA,iBAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,EAAA,CAAA;AAAA,OACF;AACA,KAAM,CAAA;AACN,IAAA,MAAM,gBAA0B,CAAA,CAAA;AAEh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