super-page-runtime 2.2.36 → 2.2.38
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/es/components/runtime/views/assemblys/container/fixed/YxAffix.js +60 -0
- package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.js +1 -1
- package/dist/es/style.css +11 -1
- package/package.json +1 -1
- package/dist/es/components/runtime/views/assemblys/container/fixed/SmartAffix.js +0 -42
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { defineComponent as t, ref as e, onMounted as o, nextTick as n, onUnmounted as i, createVNode as l } from "vue";
|
|
2
|
+
/* empty css */
|
|
3
|
+
const s = t({ name: "YxAffix", props: { offset: { type: Number, default: 0 }, position: { type: String, default: "top", validator: (t2) => ["top", "bottom"].includes(t2) }, target: { type: [String, HTMLElement], default: () => window }, autoDetectParentScroll: { type: Boolean, default: true }, stickyInScrollContainer: { type: Boolean, default: true }, zIndex: { type: Number, default: 100 } }, emits: { change: (t2) => "boolean" == typeof t2, "on-change": (t2) => "boolean" == typeof t2 }, setup(t2, { emit: s2, slots: a }) {
|
|
4
|
+
const r = e(null), u = e(null), f = e(false), p = e({}), c = e([]), d = e(window), v = e(0), m = () => {
|
|
5
|
+
if (!u.value || !r.value) return;
|
|
6
|
+
const e2 = u.value.getBoundingClientRect(), o2 = d.value;
|
|
7
|
+
if (o2 === window) {
|
|
8
|
+
const o3 = "top" === t2.position ? e2.top <= t2.offset : e2.bottom >= window.innerHeight - t2.offset;
|
|
9
|
+
v.value = 0, w(o3, e2);
|
|
10
|
+
} else if (t2.stickyInScrollContainer) {
|
|
11
|
+
const n2 = o2.getBoundingClientRect(), { isFixTop: i2, isFixBottom: l2, containerOffset: s3 } = ((e3) => {
|
|
12
|
+
const o3 = ["top"].includes(t2.position), n3 = ["bottom"].includes(t2.position);
|
|
13
|
+
if (!r.value) return { isTop: o3, isBottom: n3 };
|
|
14
|
+
const i3 = r.value.getBoundingClientRect(), l3 = i3.top - e3.top, s4 = i3.left - e3.left, a2 = e3.height - i3.height - l3, u2 = e3.top, f2 = window.innerHeight - e3.bottom;
|
|
15
|
+
return { isTop: o3, isBottom: n3, containerTop: u2, containerBottom: f2, containerOffset: o3 ? u2 : n3 ? f2 : 0, offsetTop: l3, offsetLeft: s4, offsetBottom: a2, isFixTop: o3 && l3 <= 0, isFixBottom: n3 && a2 <= 0 };
|
|
16
|
+
})(n2);
|
|
17
|
+
v.value = s3 ?? 0, w(i2 || l2 || false, e2);
|
|
18
|
+
}
|
|
19
|
+
}, w = (t3, e2) => {
|
|
20
|
+
t3 !== f.value && (f.value = t3, s2("change", t3), s2("on-change", t3), p.value = t3 ? { width: `${e2.width}px`, height: `${e2.height}px` } : {});
|
|
21
|
+
}, g = () => {
|
|
22
|
+
requestAnimationFrame(m);
|
|
23
|
+
};
|
|
24
|
+
let x;
|
|
25
|
+
const h = () => {
|
|
26
|
+
clearTimeout(x), x = window.setTimeout(() => {
|
|
27
|
+
m();
|
|
28
|
+
}, 100);
|
|
29
|
+
};
|
|
30
|
+
return o(() => {
|
|
31
|
+
n(() => {
|
|
32
|
+
const e2 = (() => {
|
|
33
|
+
if (t2.autoDetectParentScroll && u.value) {
|
|
34
|
+
const t3 = [];
|
|
35
|
+
let e3 = u.value.parentElement;
|
|
36
|
+
for (; e3 && e3 !== document.body; ) {
|
|
37
|
+
const { overflowY: o2 } = window.getComputedStyle(e3);
|
|
38
|
+
/(auto|scroll)/.test(o2) && t3.push(e3), e3 = e3.parentElement;
|
|
39
|
+
}
|
|
40
|
+
return [...t3, window];
|
|
41
|
+
}
|
|
42
|
+
if ("string" == typeof t2.target) {
|
|
43
|
+
const e3 = document.querySelector(t2.target);
|
|
44
|
+
return [...e3 ? [e3] : [], window];
|
|
45
|
+
}
|
|
46
|
+
return [window];
|
|
47
|
+
})();
|
|
48
|
+
c.value = e2, d.value = c.value[0], c.value.map((t3) => t3.addEventListener("scroll", g)), window.addEventListener("resize", h), m();
|
|
49
|
+
});
|
|
50
|
+
}), i(() => {
|
|
51
|
+
d.value && c.value.map((t3) => t3.removeEventListener("scroll", g)), window.removeEventListener("resize", h), clearTimeout(x);
|
|
52
|
+
}), () => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
const e2 = f.value ? { position: "fixed", width: `${(_a = u.value) == null ? void 0 : _a.offsetWidth}px`, zIndex: t2.zIndex, [t2.position]: `${t2.offset + v.value}px` } : {};
|
|
55
|
+
return l("div", { ref: r, class: "yx-affix" }, [f.value && l("div", { style: p.value, class: "yx-affix-placeholder" }, null), l("div", { ref: u, style: e2, class: ["yx-affix-content", { "is-fixed": f.value, "is-top": "top" === t2.position, "is-bottom": "bottom" === t2.position }] }, [(_b = a.default) == null ? void 0 : _b.call(a)])]);
|
|
56
|
+
};
|
|
57
|
+
} });
|
|
58
|
+
export {
|
|
59
|
+
s as default
|
|
60
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as e, ref as t, computed as o, onMounted as i, nextTick as a, onUnmounted as n, createVNode as u, isVNode as r } from "vue";
|
|
2
2
|
import l from "../../object-render.vue.js";
|
|
3
3
|
import { handleAfterInitEvent as s } from "../../../../utils/events/event-util.js";
|
|
4
|
-
import f from "../fixed/
|
|
4
|
+
import f from "../fixed/YxAffix.js";
|
|
5
5
|
import p from "../fixed/FixedBox.js";
|
|
6
6
|
function c(e2) {
|
|
7
7
|
return "function" == typeof e2 || "[object Object]" === Object.prototype.toString.call(e2) && !r(e2);
|
package/dist/es/style.css
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
.
|
|
1
|
+
.vue-affix-placeholder {
|
|
2
|
+
display: block;
|
|
3
|
+
visibility: hidden;
|
|
4
|
+
}
|
|
5
|
+
.vue-affix-content.is-fixed {
|
|
6
|
+
left: 50%;
|
|
7
|
+
transform: translateX(-50%);
|
|
8
|
+
}
|
|
9
|
+
.vue-affix-content.is-fixed[style*="position: static"] {
|
|
10
|
+
transform: none;
|
|
11
|
+
}.el-form-item[data-v-96fc65d8] {
|
|
2
12
|
margin-bottom: 0px;
|
|
3
13
|
}
|
|
4
14
|
[data-v-16a29b68] .el-empty {
|
package/package.json
CHANGED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { defineComponent as e, ref as t, computed as o, watch as l, onMounted as n, onUnmounted as r, createVNode as s, resolveComponent as a, nextTick as i } from "vue";
|
|
2
|
-
const u = e({ name: "SmartAffix", props: { offset: { type: Number, default: 0 }, position: { type: String, default: "top" }, dynamicOffset: { type: Boolean, default: true }, identifier: { type: String, default: () => `affix-${Math.random().toString(36).substr(2, 9)}` } }, setup(e2, { slots: u2 }) {
|
|
3
|
-
const f = t(), v = t(null), d = t(0), p = [], c = o(() => ["top", "bottom"].includes(e2.position)), m = (e3, t2 = 0) => {
|
|
4
|
-
if (!e3 || t2 > 20) return null;
|
|
5
|
-
const o2 = getComputedStyle(e3);
|
|
6
|
-
return /(auto|scroll|overlay)/.test(o2.overflow + o2.overflowY + o2.overflowX) ? e3 : m(e3.parentElement, t2 + 1);
|
|
7
|
-
}, w = () => {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
if (!v.value || v.value === document.documentElement) return void (d.value = 0);
|
|
10
|
-
const { top: t2 = 0, bottom: o2 = 0 } = ((_b = (_a = v.value) == null ? void 0 : _a.getBoundingClientRect) == null ? void 0 : _b.call(_a)) ?? {};
|
|
11
|
-
d.value = "top" === e2.position ? t2 : window.innerHeight - o2;
|
|
12
|
-
}, g = o(() => e2.dynamicOffset ? e2.offset + d.value : e2.offset), y = () => {
|
|
13
|
-
var _a, _b;
|
|
14
|
-
f.value && (v.value || (v.value = m(f.value), (_b = (_a = v.value) == null ? void 0 : _a.addEventListener) == null ? void 0 : _b.call(_a, "scroll", w, { passive: true })), w());
|
|
15
|
-
}, E = (e3) => {
|
|
16
|
-
var _a, _b, _c;
|
|
17
|
-
if (p.forEach((e4) => e4.disconnect()), p.length = 0, e3) {
|
|
18
|
-
const e4 = new ResizeObserver(y);
|
|
19
|
-
f.value && (e4.observe(f.value), p.push(e4));
|
|
20
|
-
let t2 = (_a = f.value) == null ? void 0 : _a.parentElement;
|
|
21
|
-
for (; t2; ) {
|
|
22
|
-
const e5 = new ResizeObserver(y);
|
|
23
|
-
e5.observe(t2), p.push(e5), t2 = t2.parentElement;
|
|
24
|
-
}
|
|
25
|
-
window.addEventListener("scroll", w, { passive: true }), i(y), setTimeout(y, 1e3);
|
|
26
|
-
} else window.removeEventListener("scroll", w), (_c = (_b = v.value) == null ? void 0 : _b.removeEventListener) == null ? void 0 : _c.call(_b, "scroll", w);
|
|
27
|
-
};
|
|
28
|
-
return l(c, E), n(() => {
|
|
29
|
-
E(c.value);
|
|
30
|
-
}), r(() => {
|
|
31
|
-
E(false);
|
|
32
|
-
}), () => {
|
|
33
|
-
var _a;
|
|
34
|
-
return c.value ? s("div", { ref: f }, [s(a("el-affix"), { target: v.value, offset: g.value, position: e2.position, key: e2.identifier }, { default: () => {
|
|
35
|
-
var _a2;
|
|
36
|
-
return [(_a2 = u2.default) == null ? void 0 : _a2.call(u2)];
|
|
37
|
-
} })]) : (_a = u2.default) == null ? void 0 : _a.call(u2);
|
|
38
|
-
};
|
|
39
|
-
} });
|
|
40
|
-
export {
|
|
41
|
-
u as default
|
|
42
|
-
};
|