@element-plus/nightly 0.0.20240715 → 0.0.20240716
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/divider/index.mjs +2 -2
- package/es/components/divider/src/divider.mjs +35 -17
- package/es/components/divider/src/divider.mjs.map +1 -1
- package/es/components/divider/src/divider2.mjs +17 -35
- package/es/components/divider/src/divider2.mjs.map +1 -1
- package/es/components/dropdown/index.mjs +2 -2
- package/es/components/dropdown/src/dropdown-item-impl.mjs +1 -1
- package/es/components/dropdown/src/dropdown-item.mjs +1 -1
- package/es/components/dropdown/src/dropdown-menu.mjs +1 -1
- package/es/components/dropdown/src/dropdown.mjs +306 -97
- package/es/components/dropdown/src/dropdown.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown2.mjs +97 -306
- package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
- package/es/components/index.mjs +6 -6
- package/es/components/popover/src/popover.mjs +1 -1
- package/es/components/slider/src/button.mjs +21 -93
- package/es/components/slider/src/button.mjs.map +1 -1
- package/es/components/slider/src/button2.mjs +93 -21
- package/es/components/slider/src/button2.mjs.map +1 -1
- package/es/components/slider/src/slider2.mjs +1 -1
- package/es/components/steps/index.mjs +2 -2
- package/es/components/steps/src/item.mjs +19 -191
- package/es/components/steps/src/item.mjs.map +1 -1
- package/es/components/steps/src/item2.mjs +191 -19
- package/es/components/steps/src/item2.mjs.map +1 -1
- package/es/components/switch/index.mjs +2 -2
- package/es/components/switch/src/switch.mjs +85 -242
- package/es/components/switch/src/switch.mjs.map +1 -1
- package/es/components/switch/src/switch2.mjs +242 -85
- package/es/components/switch/src/switch2.mjs.map +1 -1
- package/es/components/tooltip-v2/index.mjs +1 -1
- package/es/components/tooltip-v2/src/arrow.mjs +22 -37
- package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
- package/es/components/tooltip-v2/src/arrow2.mjs +37 -22
- package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip.mjs +1 -1
- package/es/components/tooltip-v2/src/tooltip2.mjs +2 -2
- package/es/components/tour/index.mjs +1 -1
- package/es/components/tour/src/content.mjs +69 -44
- package/es/components/tour/src/content.mjs.map +1 -1
- package/es/components/tour/src/content2.mjs +44 -69
- package/es/components/tour/src/content2.mjs.map +1 -1
- package/es/components/tour/src/step.mjs +1 -1
- package/es/components/tour/src/tour.mjs +1 -1
- package/es/components/tour/src/tour2.mjs +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/divider/index.js +2 -2
- package/lib/components/divider/src/divider.js +35 -17
- package/lib/components/divider/src/divider.js.map +1 -1
- package/lib/components/divider/src/divider2.js +17 -35
- package/lib/components/divider/src/divider2.js.map +1 -1
- package/lib/components/dropdown/index.js +2 -2
- package/lib/components/dropdown/src/dropdown-item-impl.js +1 -1
- package/lib/components/dropdown/src/dropdown-item.js +1 -1
- package/lib/components/dropdown/src/dropdown-menu.js +1 -1
- package/lib/components/dropdown/src/dropdown.js +306 -106
- package/lib/components/dropdown/src/dropdown.js.map +1 -1
- package/lib/components/dropdown/src/dropdown2.js +106 -306
- package/lib/components/dropdown/src/dropdown2.js.map +1 -1
- package/lib/components/index.js +6 -6
- package/lib/components/popover/src/popover.js +1 -1
- package/lib/components/slider/src/button.js +22 -93
- package/lib/components/slider/src/button.js.map +1 -1
- package/lib/components/slider/src/button2.js +93 -22
- package/lib/components/slider/src/button2.js.map +1 -1
- package/lib/components/slider/src/slider2.js +1 -1
- package/lib/components/steps/index.js +2 -2
- package/lib/components/steps/src/item.js +19 -191
- package/lib/components/steps/src/item.js.map +1 -1
- package/lib/components/steps/src/item2.js +191 -19
- package/lib/components/steps/src/item2.js.map +1 -1
- package/lib/components/switch/index.js +2 -2
- package/lib/components/switch/src/switch.js +85 -241
- package/lib/components/switch/src/switch.js.map +1 -1
- package/lib/components/switch/src/switch2.js +241 -85
- package/lib/components/switch/src/switch2.js.map +1 -1
- package/lib/components/tooltip-v2/index.js +1 -1
- package/lib/components/tooltip-v2/src/arrow.js +23 -37
- package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
- package/lib/components/tooltip-v2/src/arrow2.js +37 -23
- package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip.js +1 -1
- package/lib/components/tooltip-v2/src/tooltip2.js +2 -2
- package/lib/components/tour/index.js +1 -1
- package/lib/components/tour/src/content.js +69 -47
- package/lib/components/tour/src/content.js.map +1 -1
- package/lib/components/tour/src/content2.js +47 -69
- package/lib/components/tour/src/content2.js.map +1 -1
- package/lib/components/tour/src/step.js +1 -1
- package/lib/components/tour/src/tour.js +1 -1
- package/lib/components/tour/src/tour2.js +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,49 +1,74 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent, ref, watch, toRef, computed, inject, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, createVNode, withCtx, renderSlot, createCommentVNode } from 'vue';
|
|
2
|
+
import '../../focus-trap/index.mjs';
|
|
3
|
+
import { tourContentProps, tourContentEmits } from './content2.mjs';
|
|
4
|
+
import { useFloating, tourKey } from './helper.mjs';
|
|
5
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
6
|
+
import ElFocusTrap from '../../focus-trap/src/focus-trap.mjs';
|
|
3
7
|
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
8
|
+
const _hoisted_1 = ["data-side"];
|
|
9
|
+
const __default__ = defineComponent({
|
|
10
|
+
name: "ElTourContent"
|
|
11
|
+
});
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
+
...__default__,
|
|
14
|
+
props: tourContentProps,
|
|
15
|
+
emits: tourContentEmits,
|
|
16
|
+
setup(__props, { emit }) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const placement = ref(props.placement);
|
|
19
|
+
const strategy = ref(props.strategy);
|
|
20
|
+
const contentRef = ref(null);
|
|
21
|
+
const arrowRef = ref(null);
|
|
22
|
+
watch(() => props.placement, () => {
|
|
23
|
+
placement.value = props.placement;
|
|
24
|
+
});
|
|
25
|
+
const { contentStyle, arrowStyle } = useFloating(toRef(props, "reference"), contentRef, arrowRef, placement, strategy, toRef(props, "offset"), toRef(props, "zIndex"), toRef(props, "showArrow"));
|
|
26
|
+
const side = computed(() => {
|
|
27
|
+
return placement.value.split("-")[0];
|
|
28
|
+
});
|
|
29
|
+
const { ns } = inject(tourKey);
|
|
30
|
+
const onCloseRequested = () => {
|
|
31
|
+
emit("close");
|
|
32
|
+
};
|
|
33
|
+
const onFocusoutPrevented = (event) => {
|
|
34
|
+
if (event.detail.focusReason === "pointer") {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return (_ctx, _cache) => {
|
|
39
|
+
return openBlock(), createElementBlock("div", {
|
|
40
|
+
ref_key: "contentRef",
|
|
41
|
+
ref: contentRef,
|
|
42
|
+
style: normalizeStyle(unref(contentStyle)),
|
|
43
|
+
class: normalizeClass(unref(ns).e("content")),
|
|
44
|
+
"data-side": unref(side),
|
|
45
|
+
tabindex: "-1"
|
|
46
|
+
}, [
|
|
47
|
+
createVNode(unref(ElFocusTrap), {
|
|
48
|
+
loop: "",
|
|
49
|
+
trapped: "",
|
|
50
|
+
"focus-start-el": "container",
|
|
51
|
+
"focus-trap-el": contentRef.value || void 0,
|
|
52
|
+
onReleaseRequested: onCloseRequested,
|
|
53
|
+
onFocusoutPrevented
|
|
54
|
+
}, {
|
|
55
|
+
default: withCtx(() => [
|
|
56
|
+
renderSlot(_ctx.$slots, "default")
|
|
57
|
+
]),
|
|
58
|
+
_: 3
|
|
59
|
+
}, 8, ["focus-trap-el"]),
|
|
60
|
+
_ctx.showArrow ? (openBlock(), createElementBlock("span", {
|
|
61
|
+
key: 0,
|
|
62
|
+
ref_key: "arrowRef",
|
|
63
|
+
ref: arrowRef,
|
|
64
|
+
style: normalizeStyle(unref(arrowStyle)),
|
|
65
|
+
class: normalizeClass(unref(ns).e("arrow"))
|
|
66
|
+
}, null, 6)) : createCommentVNode("v-if", true)
|
|
67
|
+
], 14, _hoisted_1);
|
|
68
|
+
};
|
|
42
69
|
}
|
|
43
70
|
});
|
|
44
|
-
|
|
45
|
-
close: () => true
|
|
46
|
-
};
|
|
71
|
+
var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "content.vue"]]);
|
|
47
72
|
|
|
48
|
-
export {
|
|
73
|
+
export { ElTourContent as default };
|
|
49
74
|
//# sourceMappingURL=content.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.mjs","sources":["../../../../../../packages/components/tour/src/content.
|
|
1
|
+
{"version":3,"file":"content.mjs","sources":["../../../../../../packages/components/tour/src/content.vue"],"sourcesContent":["<template>\n <div\n ref=\"contentRef\"\n :style=\"contentStyle\"\n :class=\"ns.e('content')\"\n :data-side=\"side\"\n tabindex=\"-1\"\n >\n <el-focus-trap\n loop\n trapped\n focus-start-el=\"container\"\n :focus-trap-el=\"contentRef || undefined\"\n @release-requested=\"onCloseRequested\"\n @focusout-prevented=\"onFocusoutPrevented\"\n >\n <slot />\n </el-focus-trap>\n <span\n v-if=\"showArrow\"\n ref=\"arrowRef\"\n :style=\"arrowStyle\"\n :class=\"ns.e('arrow')\"\n />\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { computed, inject, ref, toRef, watch } from 'vue'\nimport ElFocusTrap from '@element-plus/components/focus-trap'\nimport { tourContentEmits, tourContentProps } from './content'\nimport { tourKey, useFloating } from './helper'\n\ndefineOptions({\n name: 'ElTourContent',\n})\n\nconst props = defineProps(tourContentProps)\nconst emit = defineEmits(tourContentEmits)\n\nconst placement = ref(props.placement)\nconst strategy = ref(props.strategy)\nconst contentRef = ref<HTMLElement | null>(null)\nconst arrowRef = ref<HTMLElement | null>(null)\n\nwatch(\n () => props.placement,\n () => {\n placement.value = props.placement\n }\n)\n\nconst { contentStyle, arrowStyle } = useFloating(\n toRef(props, 'reference'),\n contentRef,\n arrowRef,\n placement,\n strategy,\n toRef(props, 'offset'),\n toRef(props, 'zIndex'),\n toRef(props, 'showArrow')\n)\n\nconst side = computed(() => {\n return placement.value.split('-')[0]\n})\n\nconst { ns } = inject(tourKey)!\n\nconst onCloseRequested = () => {\n emit('close')\n}\n\nconst onFocusoutPrevented = (event: CustomEvent) => {\n if (event.detail.focusReason === 'pointer') {\n event.preventDefault()\n }\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;mCAgCc,CAAA;AAAA,EACZ,IAAM,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,74 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '
|
|
3
|
-
import { tourContentProps, tourContentEmits } from './content.mjs';
|
|
4
|
-
import { useFloating, tourKey } from './helper.mjs';
|
|
5
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
6
|
-
import ElFocusTrap from '../../focus-trap/src/focus-trap.mjs';
|
|
1
|
+
import '../../../utils/index.mjs';
|
|
2
|
+
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
7
3
|
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, [
|
|
47
|
-
createVNode(unref(ElFocusTrap), {
|
|
48
|
-
loop: "",
|
|
49
|
-
trapped: "",
|
|
50
|
-
"focus-start-el": "container",
|
|
51
|
-
"focus-trap-el": contentRef.value || void 0,
|
|
52
|
-
onReleaseRequested: onCloseRequested,
|
|
53
|
-
onFocusoutPrevented
|
|
54
|
-
}, {
|
|
55
|
-
default: withCtx(() => [
|
|
56
|
-
renderSlot(_ctx.$slots, "default")
|
|
57
|
-
]),
|
|
58
|
-
_: 3
|
|
59
|
-
}, 8, ["focus-trap-el"]),
|
|
60
|
-
_ctx.showArrow ? (openBlock(), createElementBlock("span", {
|
|
61
|
-
key: 0,
|
|
62
|
-
ref_key: "arrowRef",
|
|
63
|
-
ref: arrowRef,
|
|
64
|
-
style: normalizeStyle(unref(arrowStyle)),
|
|
65
|
-
class: normalizeClass(unref(ns).e("arrow"))
|
|
66
|
-
}, null, 6)) : createCommentVNode("v-if", true)
|
|
67
|
-
], 14, _hoisted_1);
|
|
68
|
-
};
|
|
4
|
+
const tourStrategies = ["absolute", "fixed"];
|
|
5
|
+
const tourPlacements = [
|
|
6
|
+
"top-start",
|
|
7
|
+
"top-end",
|
|
8
|
+
"top",
|
|
9
|
+
"bottom-start",
|
|
10
|
+
"bottom-end",
|
|
11
|
+
"bottom",
|
|
12
|
+
"left-start",
|
|
13
|
+
"left-end",
|
|
14
|
+
"left",
|
|
15
|
+
"right-start",
|
|
16
|
+
"right-end",
|
|
17
|
+
"right"
|
|
18
|
+
];
|
|
19
|
+
const tourContentProps = buildProps({
|
|
20
|
+
placement: {
|
|
21
|
+
type: definePropType(String),
|
|
22
|
+
values: tourPlacements,
|
|
23
|
+
default: "bottom"
|
|
24
|
+
},
|
|
25
|
+
reference: {
|
|
26
|
+
type: definePropType(Object),
|
|
27
|
+
default: null
|
|
28
|
+
},
|
|
29
|
+
strategy: {
|
|
30
|
+
type: definePropType(String),
|
|
31
|
+
values: tourStrategies,
|
|
32
|
+
default: "absolute"
|
|
33
|
+
},
|
|
34
|
+
offset: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 10
|
|
37
|
+
},
|
|
38
|
+
showArrow: Boolean,
|
|
39
|
+
zIndex: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 2001
|
|
69
42
|
}
|
|
70
43
|
});
|
|
71
|
-
|
|
44
|
+
const tourContentEmits = {
|
|
45
|
+
close: () => true
|
|
46
|
+
};
|
|
72
47
|
|
|
73
|
-
export {
|
|
48
|
+
export { tourContentEmits, tourContentProps, tourPlacements, tourStrategies };
|
|
74
49
|
//# sourceMappingURL=content2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content2.mjs","sources":["../../../../../../packages/components/tour/src/content.
|
|
1
|
+
{"version":3,"file":"content2.mjs","sources":["../../../../../../packages/components/tour/src/content.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { Placement, Strategy, VirtualElement } from '@floating-ui/dom'\n\nexport const tourStrategies = ['absolute', 'fixed'] as const\n\nexport const tourPlacements = [\n 'top-start',\n 'top-end',\n 'top',\n 'bottom-start',\n 'bottom-end',\n 'bottom',\n 'left-start',\n 'left-end',\n 'left',\n 'right-start',\n 'right-end',\n 'right',\n] as const\n\nexport const tourContentProps = buildProps({\n /**\n * @description position of the guide card relative to the target element\n */\n placement: {\n type: definePropType<Placement>(String),\n values: tourPlacements,\n default: 'bottom',\n },\n /**\n * @description the reference dom\n */\n reference: {\n type: definePropType<HTMLElement | VirtualElement | null>(Object),\n default: null,\n },\n /**\n * @description position strategy of the content\n */\n strategy: {\n type: definePropType<Strategy>(String),\n values: tourStrategies,\n default: 'absolute',\n },\n /**\n * @description offset of the arrow\n */\n offset: {\n type: Number,\n default: 10,\n },\n /**\n * @description @description whether to show the arrow\n */\n showArrow: Boolean,\n /**\n * @description content's zIndex\n */\n zIndex: {\n type: Number,\n default: 2001,\n },\n})\n\nexport type TourContentProps = ExtractPropTypes<typeof tourContentProps>\n\nexport const tourContentEmits = {\n close: () => true,\n}\nexport type TourContentEmits = typeof tourContentEmits\n"],"names":[],"mappings":";;;AACY,MAAC,cAAc,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE;AACxC,MAAC,cAAc,GAAG;AAC9B,EAAE,WAAW;AACb,EAAE,SAAS;AACX,EAAE,KAAK;AACP,EAAE,cAAc;AAChB,EAAE,YAAY;AACd,EAAE,QAAQ;AACV,EAAE,YAAY;AACd,EAAE,UAAU;AACZ,EAAE,MAAM;AACR,EAAE,aAAa;AACf,EAAE,WAAW;AACb,EAAE,OAAO;AACT,EAAE;AACU,MAAC,gBAAgB,GAAG,UAAU,CAAC;AAC3C,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,OAAO,EAAE,UAAU;AACvB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,gBAAgB,GAAG;AAChC,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../../../utils/index.mjs';
|
|
2
|
-
import { tourContentProps } from './
|
|
2
|
+
import { tourContentProps } from './content2.mjs';
|
|
3
3
|
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
4
4
|
import { iconPropType } from '../../../utils/vue/icon.mjs';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../../utils/index.mjs';
|
|
2
2
|
import '../../../constants/index.mjs';
|
|
3
|
-
import { tourContentProps } from './
|
|
3
|
+
import { tourContentProps } from './content2.mjs';
|
|
4
4
|
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
5
5
|
import { iconPropType } from '../../../utils/vue/icon.mjs';
|
|
6
6
|
import { UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';
|
|
@@ -3,7 +3,7 @@ import { useVModel } from '@vueuse/core';
|
|
|
3
3
|
import '../../../hooks/index.mjs';
|
|
4
4
|
import '../../../utils/index.mjs';
|
|
5
5
|
import ElTourMask from './mask2.mjs';
|
|
6
|
-
import ElTourContent from './
|
|
6
|
+
import ElTourContent from './content.mjs';
|
|
7
7
|
import ElTourSteps from './steps.mjs';
|
|
8
8
|
import { tourProps, tourEmits } from './tour.mjs';
|
|
9
9
|
import { useTarget, tourKey } from './helper.mjs';
|
package/es/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import './directives/index.mjs';
|
|
|
6
6
|
import './hooks/index.mjs';
|
|
7
7
|
export { makeInstaller } from './make-installer.mjs';
|
|
8
8
|
export { default as dayjs } from 'dayjs';
|
|
9
|
-
export { affixEmits, affixProps } from './components/affix/src/
|
|
9
|
+
export { affixEmits, affixProps } from './components/affix/src/affix2.mjs';
|
|
10
10
|
export { ElAffix } from './components/affix/index.mjs';
|
|
11
11
|
export { alertEffects, alertEmits, alertProps } from './components/alert/src/alert.mjs';
|
|
12
12
|
export { ElAlert } from './components/alert/index.mjs';
|
|
@@ -71,11 +71,11 @@ export { useDialog } from './components/dialog/src/use-dialog.mjs';
|
|
|
71
71
|
export { dialogEmits, dialogProps } from './components/dialog/src/dialog.mjs';
|
|
72
72
|
export { dialogInjectionKey } from './components/dialog/src/constants.mjs';
|
|
73
73
|
export { ElDialog } from './components/dialog/index.mjs';
|
|
74
|
-
export { dividerProps } from './components/divider/src/
|
|
74
|
+
export { dividerProps } from './components/divider/src/divider2.mjs';
|
|
75
75
|
export { ElDivider } from './components/divider/index.mjs';
|
|
76
76
|
export { drawerEmits, drawerProps } from './components/drawer/src/drawer.mjs';
|
|
77
77
|
export { ElDrawer } from './components/drawer/index.mjs';
|
|
78
|
-
export { DROPDOWN_COLLECTION_INJECTION_KEY, DROPDOWN_COLLECTION_ITEM_INJECTION_KEY, ElCollection, ElCollectionItem, FIRST_KEYS, FIRST_LAST_KEYS, LAST_KEYS, dropdownItemProps, dropdownMenuProps, dropdownProps } from './components/dropdown/src/
|
|
78
|
+
export { DROPDOWN_COLLECTION_INJECTION_KEY, DROPDOWN_COLLECTION_ITEM_INJECTION_KEY, ElCollection, ElCollectionItem, FIRST_KEYS, FIRST_LAST_KEYS, LAST_KEYS, dropdownItemProps, dropdownMenuProps, dropdownProps } from './components/dropdown/src/dropdown2.mjs';
|
|
79
79
|
export { DROPDOWN_INJECTION_KEY } from './components/dropdown/src/tokens.mjs';
|
|
80
80
|
export { ElDropdown, ElDropdownItem, ElDropdownMenu } from './components/dropdown/index.mjs';
|
|
81
81
|
export { emptyProps } from './components/empty/src/empty.mjs';
|
|
@@ -156,10 +156,10 @@ export { useSpace } from './components/space/src/use-space.mjs';
|
|
|
156
156
|
export { ElSpace } from './components/space/index.mjs';
|
|
157
157
|
export { statisticProps } from './components/statistic/src/statistic.mjs';
|
|
158
158
|
export { ElStatistic } from './components/statistic/index.mjs';
|
|
159
|
-
export { stepProps } from './components/steps/src/
|
|
159
|
+
export { stepProps } from './components/steps/src/item.mjs';
|
|
160
160
|
export { stepsEmits, stepsProps } from './components/steps/src/steps.mjs';
|
|
161
161
|
export { ElStep, ElSteps } from './components/steps/index.mjs';
|
|
162
|
-
export { switchEmits, switchProps } from './components/switch/src/
|
|
162
|
+
export { switchEmits, switchProps } from './components/switch/src/switch.mjs';
|
|
163
163
|
export { ElSwitch } from './components/switch/index.mjs';
|
|
164
164
|
export { ElTable, ElTableColumn } from './components/table/index.mjs';
|
|
165
165
|
export { Alignment as TableV2Alignment, FixedDir as TableV2FixedDir, SortOrder as TableV2SortOrder } from './components/table-v2/src/constants.mjs';
|
|
@@ -213,7 +213,7 @@ export { watermarkProps } from './components/watermark/src/watermark.mjs';
|
|
|
213
213
|
export { ElWatermark } from './components/watermark/index.mjs';
|
|
214
214
|
export { tourEmits, tourProps } from './components/tour/src/tour.mjs';
|
|
215
215
|
export { tourStepEmits, tourStepProps } from './components/tour/src/step.mjs';
|
|
216
|
-
export { tourContentEmits, tourContentProps, tourPlacements, tourStrategies } from './components/tour/src/
|
|
216
|
+
export { tourContentEmits, tourContentProps, tourPlacements, tourStrategies } from './components/tour/src/content2.mjs';
|
|
217
217
|
export { ElTour, ElTourStep } from './components/tour/index.mjs';
|
|
218
218
|
export { anchorEmits, anchorProps } from './components/anchor/src/anchor.mjs';
|
|
219
219
|
export { ElAnchor, ElAnchorLink } from './components/anchor/index.mjs';
|
package/es/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.20240716";
|
package/es/version.mjs
CHANGED
package/es/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20240716'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('../../utils/index.js');
|
|
6
|
-
var affix$1 = require('./src/
|
|
7
|
-
var affix = require('./src/
|
|
6
|
+
var affix$1 = require('./src/affix.js');
|
|
7
|
+
var affix = require('./src/affix2.js');
|
|
8
8
|
var install = require('../../utils/vue/install.js');
|
|
9
9
|
|
|
10
10
|
const ElAffix = install.withInstall(affix$1["default"]);
|
|
@@ -2,36 +2,126 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var core = require('@vueuse/core');
|
|
5
7
|
require('../../../utils/index.js');
|
|
6
|
-
require('../../../
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
require('../../../hooks/index.js');
|
|
9
|
+
var affix = require('./affix2.js');
|
|
10
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
11
|
+
var index = require('../../../hooks/use-namespace/index.js');
|
|
12
|
+
var style = require('../../../utils/dom/style.js');
|
|
13
|
+
var error = require('../../../utils/error.js');
|
|
14
|
+
var scroll = require('../../../utils/dom/scroll.js');
|
|
10
15
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
const COMPONENT_NAME = "ElAffix";
|
|
17
|
+
const __default__ = vue.defineComponent({
|
|
18
|
+
name: COMPONENT_NAME
|
|
19
|
+
});
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
21
|
+
...__default__,
|
|
22
|
+
props: affix.affixProps,
|
|
23
|
+
emits: affix.affixEmits,
|
|
24
|
+
setup(__props, { expose, emit }) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const ns = index.useNamespace("affix");
|
|
27
|
+
const target = vue.shallowRef();
|
|
28
|
+
const root = vue.shallowRef();
|
|
29
|
+
const scrollContainer = vue.shallowRef();
|
|
30
|
+
const { height: windowHeight } = core.useWindowSize();
|
|
31
|
+
const {
|
|
32
|
+
height: rootHeight,
|
|
33
|
+
width: rootWidth,
|
|
34
|
+
top: rootTop,
|
|
35
|
+
bottom: rootBottom,
|
|
36
|
+
update: updateRoot
|
|
37
|
+
} = core.useElementBounding(root, { windowScroll: false });
|
|
38
|
+
const targetRect = core.useElementBounding(target);
|
|
39
|
+
const fixed = vue.ref(false);
|
|
40
|
+
const scrollTop = vue.ref(0);
|
|
41
|
+
const transform = vue.ref(0);
|
|
42
|
+
const rootStyle = vue.computed(() => {
|
|
43
|
+
return {
|
|
44
|
+
height: fixed.value ? `${rootHeight.value}px` : "",
|
|
45
|
+
width: fixed.value ? `${rootWidth.value}px` : ""
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
const affixStyle = vue.computed(() => {
|
|
49
|
+
if (!fixed.value)
|
|
50
|
+
return {};
|
|
51
|
+
const offset = props.offset ? style.addUnit(props.offset) : 0;
|
|
52
|
+
return {
|
|
53
|
+
height: `${rootHeight.value}px`,
|
|
54
|
+
width: `${rootWidth.value}px`,
|
|
55
|
+
top: props.position === "top" ? offset : "",
|
|
56
|
+
bottom: props.position === "bottom" ? offset : "",
|
|
57
|
+
transform: transform.value ? `translateY(${transform.value}px)` : "",
|
|
58
|
+
zIndex: props.zIndex
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const update = () => {
|
|
62
|
+
if (!scrollContainer.value)
|
|
63
|
+
return;
|
|
64
|
+
scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
|
|
65
|
+
if (props.position === "top") {
|
|
66
|
+
if (props.target) {
|
|
67
|
+
const difference = targetRect.bottom.value - props.offset - rootHeight.value;
|
|
68
|
+
fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
|
|
69
|
+
transform.value = difference < 0 ? difference : 0;
|
|
70
|
+
} else {
|
|
71
|
+
fixed.value = props.offset > rootTop.value;
|
|
72
|
+
}
|
|
73
|
+
} else if (props.target) {
|
|
74
|
+
const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
|
|
75
|
+
fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
|
|
76
|
+
transform.value = difference < 0 ? -difference : 0;
|
|
77
|
+
} else {
|
|
78
|
+
fixed.value = windowHeight.value - props.offset < rootBottom.value;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const handleScroll = () => {
|
|
82
|
+
updateRoot();
|
|
83
|
+
emit("scroll", {
|
|
84
|
+
scrollTop: scrollTop.value,
|
|
85
|
+
fixed: fixed.value
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
vue.watch(fixed, (val) => emit("change", val));
|
|
89
|
+
vue.onMounted(() => {
|
|
90
|
+
var _a;
|
|
91
|
+
if (props.target) {
|
|
92
|
+
target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
|
|
93
|
+
if (!target.value)
|
|
94
|
+
error.throwError(COMPONENT_NAME, `Target does not exist: ${props.target}`);
|
|
95
|
+
} else {
|
|
96
|
+
target.value = document.documentElement;
|
|
97
|
+
}
|
|
98
|
+
scrollContainer.value = scroll.getScrollContainer(root.value, true);
|
|
99
|
+
updateRoot();
|
|
100
|
+
});
|
|
101
|
+
core.useEventListener(scrollContainer, "scroll", handleScroll);
|
|
102
|
+
vue.watchEffect(update);
|
|
103
|
+
expose({
|
|
104
|
+
update,
|
|
105
|
+
updateRoot
|
|
106
|
+
});
|
|
107
|
+
return (_ctx, _cache) => {
|
|
108
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
109
|
+
ref_key: "root",
|
|
110
|
+
ref: root,
|
|
111
|
+
class: vue.normalizeClass(vue.unref(ns).b()),
|
|
112
|
+
style: vue.normalizeStyle(vue.unref(rootStyle))
|
|
113
|
+
}, [
|
|
114
|
+
vue.createElementVNode("div", {
|
|
115
|
+
class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
|
|
116
|
+
style: vue.normalizeStyle(vue.unref(affixStyle))
|
|
117
|
+
}, [
|
|
118
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
119
|
+
], 6)
|
|
120
|
+
], 6);
|
|
121
|
+
};
|
|
28
122
|
}
|
|
29
123
|
});
|
|
30
|
-
|
|
31
|
-
scroll: ({ scrollTop, fixed }) => types.isNumber(scrollTop) && types.isBoolean(fixed),
|
|
32
|
-
[event.CHANGE_EVENT]: (fixed) => types.isBoolean(fixed)
|
|
33
|
-
};
|
|
124
|
+
var Affix = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "affix.vue"]]);
|
|
34
125
|
|
|
35
|
-
exports
|
|
36
|
-
exports.affixProps = affixProps;
|
|
126
|
+
exports["default"] = Affix;
|
|
37
127
|
//# sourceMappingURL=affix.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affix.js","sources":["../../../../../../packages/components/affix/src/affix.
|
|
1
|
+
{"version":3,"file":"affix.js","sources":["../../../../../../packages/components/affix/src/affix.vue"],"sourcesContent":["<template>\n <div ref=\"root\" :class=\"ns.b()\" :style=\"rootStyle\">\n <div :class=\"{ [ns.m('fixed')]: fixed }\" :style=\"affixStyle\">\n <slot />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onMounted, ref, shallowRef, watch, watchEffect } from 'vue'\nimport {\n useElementBounding,\n useEventListener,\n useWindowSize,\n} from '@vueuse/core'\nimport { addUnit, getScrollContainer, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { affixEmits, affixProps } from './affix'\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'ElAffix'\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = defineProps(affixProps)\nconst emit = defineEmits(affixEmits)\n\nconst ns = useNamespace('affix')\n\nconst target = shallowRef<HTMLElement>()\nconst root = shallowRef<HTMLDivElement>()\nconst scrollContainer = shallowRef<HTMLElement | Window>()\nconst { height: windowHeight } = useWindowSize()\nconst {\n height: rootHeight,\n width: rootWidth,\n top: rootTop,\n bottom: rootBottom,\n update: updateRoot,\n} = useElementBounding(root, { windowScroll: false })\nconst targetRect = useElementBounding(target)\n\nconst fixed = ref(false)\nconst scrollTop = ref(0)\nconst transform = ref(0)\n\nconst rootStyle = computed<CSSProperties>(() => {\n return {\n height: fixed.value ? `${rootHeight.value}px` : '',\n width: fixed.value ? `${rootWidth.value}px` : '',\n }\n})\n\nconst affixStyle = computed<CSSProperties>(() => {\n if (!fixed.value) return {}\n\n const offset = props.offset ? addUnit(props.offset) : 0\n return {\n height: `${rootHeight.value}px`,\n width: `${rootWidth.value}px`,\n top: props.position === 'top' ? offset : '',\n bottom: props.position === 'bottom' ? offset : '',\n transform: transform.value ? `translateY(${transform.value}px)` : '',\n zIndex: props.zIndex,\n }\n})\n\nconst update = () => {\n if (!scrollContainer.value) return\n\n scrollTop.value =\n scrollContainer.value instanceof Window\n ? document.documentElement.scrollTop\n : scrollContainer.value.scrollTop || 0\n\n if (props.position === 'top') {\n if (props.target) {\n const difference =\n targetRect.bottom.value - props.offset - rootHeight.value\n fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0\n transform.value = difference < 0 ? difference : 0\n } else {\n fixed.value = props.offset > rootTop.value\n }\n } else if (props.target) {\n const difference =\n windowHeight.value -\n targetRect.top.value -\n props.offset -\n rootHeight.value\n fixed.value =\n windowHeight.value - props.offset < rootBottom.value &&\n windowHeight.value > targetRect.top.value\n transform.value = difference < 0 ? -difference : 0\n } else {\n fixed.value = windowHeight.value - props.offset < rootBottom.value\n }\n}\n\nconst handleScroll = () => {\n updateRoot()\n emit('scroll', {\n scrollTop: scrollTop.value,\n fixed: fixed.value,\n })\n}\n\nwatch(fixed, (val) => emit('change', val))\n\nonMounted(() => {\n if (props.target) {\n target.value =\n document.querySelector<HTMLElement>(props.target) ?? undefined\n if (!target.value)\n throwError(COMPONENT_NAME, `Target does not exist: ${props.target}`)\n } else {\n target.value = document.documentElement\n }\n scrollContainer.value = getScrollContainer(root.value!, true)\n updateRoot()\n})\n\nuseEventListener(scrollContainer, 'scroll', handleScroll)\nwatchEffect(update)\n\ndefineExpose({\n /** @description update affix status */\n update,\n /** @description update rootRect info */\n updateRoot,\n})\n</script>\n"],"names":["useNamespace","shallowRef","useWindowSize","useElementBounding","ref","computed","addUnit","watch","onMounted","throwError","getScrollContainer","useEventListener","watchEffect"],"mappings":";;;;;;;;;;;;;;;;uCAqBc,CAA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