savor-ui 0.15.3 → 0.15.4
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/CHANGELOG.md +8 -0
- package/dist/es/components/src/cascader/cascader-column.vue_vue_type_script_setup_true_vapor_true_lang.mjs +25 -23
- package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs +109 -104
- package/dist/es/components/src/input/input.vue_vue_type_script_setup_true_vapor_true_lang.mjs +3 -1
- package/dist/es/components/src/popover/popover.vue_vue_type_script_setup_true_vapor_true_lang.mjs +52 -46
- package/dist/json/web-types.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## [0.15.4](https://gitee.com/mach552/savor-ui/compare/v0.15.3...v0.15.4) (2026-08-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **cascader:** 修复输入框聚焦逻辑 ([a2b0716](https://gitee.com/mach552/savor-ui/commits/a2b07160fd609dfeaaf720ff5f8be8d1403c2eac))
|
|
11
|
+
* **popover:** 修复切换页面后无法关闭问题 ([ffaf459](https://gitee.com/mach552/savor-ui/commits/ffaf4591e5485eb086ca8cb48e03fa9a3bcabe56))
|
|
12
|
+
|
|
5
13
|
## [0.15.3](https://gitee.com/mach552/savor-ui/compare/v0.15.2...v0.15.3) (2026-08-04)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -5,9 +5,9 @@ import "../../../icons/index.mjs";
|
|
|
5
5
|
import { SScrollbar as n } from "../scrollbar/index.mjs";
|
|
6
6
|
import { SCheckbox as r } from "../checkbox/index.mjs";
|
|
7
7
|
import { SRadio as i } from "../radio/index.mjs";
|
|
8
|
-
import { child as a, computed as o, createComponent as s, createComponentWithFallback as c, createFor as l, createIf as u, defineVaporComponent as d, mergeModels as f, nextTick as p, on as m, onMounted as h, ref as g, renderEffect as _, resolveComponent as
|
|
8
|
+
import { child as a, computed as o, createComponent as s, createComponentWithFallback as c, createFor as l, createIf as u, defineVaporComponent as d, mergeModels as f, nextTick as p, on as m, onMounted as h, ref as g, renderEffect as _, resolveComponent as ee, setClass as v, setInsertionState as y, setProp as b, setStaticTemplateRef as x, setStyle as S, setText as C, template as w, toDisplayString as T, txt as E, unref as D, useModel as O, useTemplateRef as k, watch as A, withModifiers as j } from "vue";
|
|
9
9
|
//#region ../components/src/cascader/cascader-column.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
10
|
-
var M =
|
|
10
|
+
var M = w("<div>"), N = w("<div><div> </div>"), P = /*@__PURE__*/ d({
|
|
11
11
|
name: "SCascaderColumn",
|
|
12
12
|
__name: "cascader-column",
|
|
13
13
|
props: /*@__PURE__*/ f({
|
|
@@ -47,12 +47,12 @@ var M = T("<div>"), N = T("<div><div> </div>"), P = /*@__PURE__*/ d({
|
|
|
47
47
|
]),
|
|
48
48
|
__multiRoot: !0,
|
|
49
49
|
setup(d, { emit: f }) {
|
|
50
|
-
let
|
|
50
|
+
let w = f, P = d, F = f, I = e("cascader"), L = o(() => ({
|
|
51
51
|
label: "label",
|
|
52
52
|
key: "key",
|
|
53
53
|
children: "children",
|
|
54
54
|
...P.fieldNames
|
|
55
|
-
})), R =
|
|
55
|
+
})), R = k("scrollbarRef"), z = O(d, "modelValue"), B = O(d, "expandedKeys"), V = O(d, "expanded"), H = g([]), U = g([]), W = g(!0), G = o(() => {
|
|
56
56
|
let e = z.value;
|
|
57
57
|
if (!Array.isArray(e)) {
|
|
58
58
|
if (P.pathMode && typeof e == "string" && e !== "") {
|
|
@@ -104,44 +104,46 @@ var M = T("<div>"), N = T("<div><div> </div>"), P = /*@__PURE__*/ d({
|
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
|
-
let ne =
|
|
108
|
-
return _(() =>
|
|
107
|
+
let ne = ee("CascaderColumn", !0), $ = M();
|
|
108
|
+
return _(() => v($, [D(I).e("column")])), y($, null, 0), x(s(D(n), { height: "100%" }, () => {
|
|
109
109
|
let e = M();
|
|
110
|
-
return _(() =>
|
|
110
|
+
return _(() => v(e, [D(I).e("list")])), y(e, null, 0), l(() => H.value, (e) => {
|
|
111
111
|
let n = N(), o = a(n, 1);
|
|
112
112
|
_(() => {
|
|
113
|
-
let t =
|
|
114
|
-
|
|
115
|
-
}),
|
|
113
|
+
let t = D(I), r = L.value;
|
|
114
|
+
v(n, [t.e("item"), t.is("checked", e.value[r.key] === B.value[d.id])]);
|
|
115
|
+
}), y(n, 0, 0), u(() => d.checkStrictly || d.multiple, () => {
|
|
116
116
|
let t = M();
|
|
117
|
-
return _(() =>
|
|
118
|
-
let t = () => Y(e.value), n = () => {};
|
|
119
|
-
return s(
|
|
117
|
+
return _(() => v(t, [D(I).e("check")])), y(t, null, 0), u(() => d.checkStrictly && !d.multiple, () => {
|
|
118
|
+
let t = () => Y(e.value), n = () => {}, r = () => {};
|
|
119
|
+
return s(D(i), {
|
|
120
120
|
value: () => e.value[L.value.key],
|
|
121
121
|
"model-value": () => G.value,
|
|
122
122
|
onChange: () => t,
|
|
123
|
-
onClick: () => j(n, ["stop"])
|
|
123
|
+
onClick: () => j(n, ["stop"]),
|
|
124
|
+
onMousedown: () => j(r, ["prevent"])
|
|
124
125
|
});
|
|
125
126
|
}, () => u(() => d.multiple, () => {
|
|
126
|
-
let t = (t) => X(t, e.value), n = () => {};
|
|
127
|
-
return s(
|
|
127
|
+
let t = (t) => X(t, e.value), n = () => {}, i = () => {};
|
|
128
|
+
return s(D(r), {
|
|
128
129
|
"model-value": () => q(e.value),
|
|
129
130
|
onChange: () => t,
|
|
130
|
-
onClick: () => j(n, ["stop"])
|
|
131
|
+
onClick: () => j(n, ["stop"]),
|
|
132
|
+
onMousedown: () => j(i, ["prevent"])
|
|
131
133
|
});
|
|
132
134
|
}), 261), t;
|
|
133
135
|
});
|
|
134
|
-
let c =
|
|
136
|
+
let c = E(o);
|
|
135
137
|
return _(() => {
|
|
136
138
|
let t = L.value;
|
|
137
|
-
|
|
138
|
-
}),
|
|
139
|
+
v(o, [D(I).e("label")]), S(o, { padding: d.checkStrictly || d.multiple ? "0 12px" : "0 16px" }), C(c, T(e.value[t.label]));
|
|
140
|
+
}), y(n, null, 2), u(() => e.value.isFolder, () => {
|
|
139
141
|
let e = M();
|
|
140
|
-
return _(() =>
|
|
141
|
-
}), m(n, "click", j(() => J(e.value), ["stop"])), m(n, "mouseenter", j(() => te(e.value), ["stop"])),
|
|
142
|
+
return _(() => v(e, [D(I).e("arrow")])), y(e, null, 0), s(D(t)), e;
|
|
143
|
+
}), m(n, "click", j(() => J(e.value), ["stop"])), m(n, "mouseenter", j(() => te(e.value), ["stop"])), b(n, "id", `item-${e.value[L.value.key]}`), n;
|
|
142
144
|
}, (e) => e[L.value.key], 9), e;
|
|
143
145
|
}), R, null, "scrollbarRef"), [$, u(() => U.value.length > 0 && W.value, () => {
|
|
144
|
-
let e = (e) =>
|
|
146
|
+
let e = (e) => w("clickItem", e), t = (e) => w("expand", e);
|
|
145
147
|
return c(ne, {
|
|
146
148
|
options: () => U.value,
|
|
147
149
|
onClickItem: () => e,
|
package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -6,15 +6,15 @@ import { useFormItem as n } from "../form/use-form-item.mjs";
|
|
|
6
6
|
import { SPopover as r } from "../popover/index.mjs";
|
|
7
7
|
import { SInput as i } from "../input/index.mjs";
|
|
8
8
|
import { SEmpty as a } from "../empty/index.mjs";
|
|
9
|
-
import
|
|
10
|
-
import { computed as
|
|
9
|
+
import ee from "./cascader-column.vue.mjs";
|
|
10
|
+
import { computed as o, createComponent as s, createComponentWithFallback as c, createIf as te, createInvoker as l, createTemplateRefSetter as u, defineVaporComponent as d, delegateEvents as f, mergeModels as p, on as m, onMounted as h, ref as g, renderEffect as _, resolveComponent as ne, setClass as v, setInsertionState as y, template as b, toRefs as x, unref as S, useModel as C, useTemplateRef as w, watch as T, withModifiers as E, withVaporModifiers as D } from "vue";
|
|
11
11
|
//#region ../components/src/cascader/cascader.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var
|
|
12
|
+
var re = b("<div style=\"padding: 12px\">"), ie = b("<div>"), ae = b("<div data-skip-blur-validation>"), oe = b("<div>", 1);
|
|
13
|
+
f("mousedown", "focusin", "click");
|
|
14
|
+
var O = /*@__PURE__*/ d({
|
|
15
15
|
name: "SCascader",
|
|
16
16
|
__name: "cascader",
|
|
17
|
-
props: /*@__PURE__*/
|
|
17
|
+
props: /*@__PURE__*/ p({
|
|
18
18
|
modelValue: {},
|
|
19
19
|
options: { default: () => [] },
|
|
20
20
|
placeholder: { default: "请选择" },
|
|
@@ -42,7 +42,7 @@ var j = /*@__PURE__*/ p({
|
|
|
42
42
|
expanded: { default: () => [] },
|
|
43
43
|
expandedModifiers: {}
|
|
44
44
|
}),
|
|
45
|
-
emits: /*@__PURE__*/
|
|
45
|
+
emits: /*@__PURE__*/ p([
|
|
46
46
|
"selectItem",
|
|
47
47
|
"expand",
|
|
48
48
|
"clear"
|
|
@@ -51,139 +51,144 @@ var j = /*@__PURE__*/ p({
|
|
|
51
51
|
"update:expandedKeys",
|
|
52
52
|
"update:expanded"
|
|
53
53
|
]),
|
|
54
|
-
setup(
|
|
55
|
-
let
|
|
56
|
-
size:
|
|
57
|
-
error:
|
|
58
|
-
}),
|
|
54
|
+
setup(d, { emit: f }) {
|
|
55
|
+
let p = d, b = e("cascader"), O = f, k = w("inputRef"), A = C(d, "modelValue"), { size: j, error: M } = x(p), { mergedSize: N, mergedError: P } = n({
|
|
56
|
+
size: j,
|
|
57
|
+
error: M
|
|
58
|
+
}), F = C(d, "expandedKeys"), I = C(d, "expanded"), L = o(() => ({
|
|
59
59
|
label: "label",
|
|
60
60
|
key: "key",
|
|
61
61
|
children: "children",
|
|
62
|
-
...
|
|
63
|
-
})),
|
|
64
|
-
if (
|
|
65
|
-
let r = e[
|
|
66
|
-
n ? i !== -1 && (
|
|
62
|
+
...p.fieldNames
|
|
63
|
+
})), R = g(""), z = g([]), B = (e) => p.pathMode ? e.map((e) => e[L.value.key]).join(p.pathSeparator) : e[e.length - 1][L.value.key], V = (e) => e.map((e) => e[L.value.label]).join(p.pathSeparator), H = ({ item: e, expandeds: t, unchecked: n }) => {
|
|
64
|
+
if (p.multiple) {
|
|
65
|
+
let r = e[L.value.key], i = z.value.findIndex((e) => e[e.length - 1][L.value.key] === r);
|
|
66
|
+
n ? i !== -1 && (z.value = z.value.toSpliced(i, 1)) : i === -1 && (z.value = [...z.value, t]), A.value = z.value.map(B), R.value = z.value.map(V).join(", "), O("selectItem", {
|
|
67
67
|
item: e,
|
|
68
68
|
expandeds: t
|
|
69
69
|
});
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
R.value = V(t), A.value = B(t), O("selectItem", {
|
|
73
73
|
item: e,
|
|
74
74
|
expandeds: t
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
let e = !
|
|
82
|
-
e &&
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
},
|
|
75
|
+
}), K(!1);
|
|
76
|
+
}, U = () => {
|
|
77
|
+
O("expand", F.value);
|
|
78
|
+
}, W = w("popoverRef"), G = g(!1), K = (e) => {
|
|
79
|
+
G.value = e, e ? W.value?.show() : W.value?.hide();
|
|
80
|
+
}, se = () => {
|
|
81
|
+
let e = !G.value;
|
|
82
|
+
e && Y(), K(e);
|
|
83
|
+
}, ce = () => {
|
|
84
|
+
K(!1);
|
|
85
|
+
}, le = (e) => {
|
|
86
|
+
e.target && k.value?.focus();
|
|
87
|
+
}, q = (e, t, n = []) => {
|
|
86
88
|
for (let r of e) {
|
|
87
89
|
let e = [...n, r];
|
|
88
|
-
if (r[
|
|
89
|
-
if (r[
|
|
90
|
-
let n =
|
|
90
|
+
if (r[L.value.key] === t) return e;
|
|
91
|
+
if (r[L.value.children]) {
|
|
92
|
+
let n = q(r[L.value.children], t, e);
|
|
91
93
|
if (n) return n;
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
return null;
|
|
95
|
-
},
|
|
97
|
+
}, J = (e, t) => {
|
|
96
98
|
let n = [], r = e;
|
|
97
99
|
for (let e of t) {
|
|
98
|
-
let t = r.find((t) => t[
|
|
100
|
+
let t = r.find((t) => t[L.value.key] === e);
|
|
99
101
|
if (!t) return null;
|
|
100
|
-
n.push(t), r = t[
|
|
102
|
+
n.push(t), r = t[L.value.children] || [];
|
|
101
103
|
}
|
|
102
104
|
return n;
|
|
103
|
-
},
|
|
104
|
-
if (
|
|
105
|
-
|
|
105
|
+
}, Y = () => {
|
|
106
|
+
if (A.value === void 0 || A.value === "") {
|
|
107
|
+
R.value = "", F.value = [], I.value = [], z.value = [];
|
|
106
108
|
return;
|
|
107
109
|
}
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
let t = e.split(
|
|
112
|
-
return
|
|
110
|
+
if (p.multiple) {
|
|
111
|
+
z.value = (Array.isArray(A.value) ? A.value : []).map((e) => {
|
|
112
|
+
if (p.pathMode && typeof e == "string") {
|
|
113
|
+
let t = e.split(p.pathSeparator);
|
|
114
|
+
return J(p.options, t);
|
|
113
115
|
}
|
|
114
|
-
return
|
|
115
|
-
}).filter((e) => e !== null),
|
|
116
|
+
return q(p.options, e);
|
|
117
|
+
}).filter((e) => e !== null), R.value = z.value.map(V).join(", ");
|
|
116
118
|
return;
|
|
117
119
|
}
|
|
118
120
|
let e = null;
|
|
119
|
-
if (
|
|
120
|
-
let t =
|
|
121
|
-
e =
|
|
122
|
-
} else Array.isArray(
|
|
123
|
-
e && (
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}) :
|
|
128
|
-
},
|
|
129
|
-
|
|
121
|
+
if (p.pathMode && typeof A.value == "string") {
|
|
122
|
+
let t = A.value.split(p.pathSeparator);
|
|
123
|
+
e = J(p.options, t);
|
|
124
|
+
} else Array.isArray(A.value) || (e = q(p.options, A.value));
|
|
125
|
+
e && (F.value = e.map((e) => e[L.value.key]), I.value = e, R.value = V(e));
|
|
126
|
+
}, X = (e) => {
|
|
127
|
+
A.value === void 0 ? e.forEach((e) => {
|
|
128
|
+
F.value.includes(e[L.value.key]) && (R.value = R.value ? `${R.value}${p.pathSeparator}${e[L.value.label]}` : e[L.value.label], e[L.value.children] && X(e[L.value.children]));
|
|
129
|
+
}) : Y();
|
|
130
|
+
}, ue = () => {
|
|
131
|
+
A.value = p.multiple ? [] : "", F.value = [], I.value = [], z.value = [], R.value = "", O("clear");
|
|
130
132
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}),
|
|
134
|
-
|
|
133
|
+
T(A, () => {
|
|
134
|
+
Y();
|
|
135
|
+
}), h(() => {
|
|
136
|
+
X(p.options);
|
|
135
137
|
});
|
|
136
|
-
let
|
|
137
|
-
return
|
|
138
|
+
let Z = u(), Q = ne("SIcon"), $ = oe();
|
|
139
|
+
return _(() => v($, [S(b).b()])), y($, null, 0), Z(s(S(r), { $: [() => ({
|
|
138
140
|
offset: [0, 4],
|
|
139
141
|
placement: "bottom-start",
|
|
140
142
|
manual: !0,
|
|
141
|
-
...
|
|
142
|
-
}), { onClickOutside: () =>
|
|
143
|
+
...d.popoverProps
|
|
144
|
+
}), { onClickOutside: () => ce }] }, {
|
|
143
145
|
content: () => {
|
|
144
|
-
let e =
|
|
145
|
-
return
|
|
146
|
-
let e =
|
|
147
|
-
return
|
|
146
|
+
let e = ae();
|
|
147
|
+
return _(() => v(e, [S(b).e("wrapper")])), y(e, null, 0), te(() => !d.options.length, () => {
|
|
148
|
+
let e = re();
|
|
149
|
+
return y(e, null, 0), s(S(a)), e;
|
|
148
150
|
}, () => {
|
|
149
|
-
let e =
|
|
150
|
-
return
|
|
151
|
-
expandTrigger: () =>
|
|
152
|
-
fieldNames: () =>
|
|
153
|
-
options: () =>
|
|
154
|
-
checkStrictly: () =>
|
|
155
|
-
multiple: () =>
|
|
156
|
-
pathMode: () =>
|
|
157
|
-
pathSeparator: () =>
|
|
158
|
-
onClickItem: () =>
|
|
159
|
-
onExpand: () =>
|
|
160
|
-
modelValue: () =>
|
|
161
|
-
"onUpdate:modelValue": () => (e) =>
|
|
162
|
-
expanded: () =>
|
|
163
|
-
"onUpdate:expanded": () => (e) =>
|
|
164
|
-
expandedKeys: () =>
|
|
165
|
-
"onUpdate:expandedKeys": () => (e) =>
|
|
151
|
+
let e = ie();
|
|
152
|
+
return _(() => v(e, [S(b).e("panel")])), y(e, null, 0), s(ee, {
|
|
153
|
+
expandTrigger: () => d.expandTrigger,
|
|
154
|
+
fieldNames: () => d.fieldNames,
|
|
155
|
+
options: () => d.options,
|
|
156
|
+
checkStrictly: () => d.checkStrictly,
|
|
157
|
+
multiple: () => d.multiple,
|
|
158
|
+
pathMode: () => d.pathMode,
|
|
159
|
+
pathSeparator: () => d.pathSeparator,
|
|
160
|
+
onClickItem: () => H,
|
|
161
|
+
onExpand: () => U,
|
|
162
|
+
modelValue: () => A.value,
|
|
163
|
+
"onUpdate:modelValue": () => (e) => A.value = e,
|
|
164
|
+
expanded: () => I.value,
|
|
165
|
+
"onUpdate:expanded": () => (e) => I.value = e,
|
|
166
|
+
expandedKeys: () => F.value,
|
|
167
|
+
"onUpdate:expandedKeys": () => (e) => F.value = e
|
|
166
168
|
}), e;
|
|
167
|
-
}, 261),
|
|
169
|
+
}, 261), m(e, "click", E(() => {}, ["stop"])), e.$evtmousedown = D(() => {}, ["prevent"]), e.$evtfocusin = l(le), e;
|
|
168
170
|
},
|
|
169
|
-
default: () =>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
171
|
+
default: () => {
|
|
172
|
+
let e = s(S(i), {
|
|
173
|
+
placeholder: () => d.placeholder,
|
|
174
|
+
disabled: () => d.disabled,
|
|
175
|
+
error: () => S(P),
|
|
176
|
+
size: () => S(N),
|
|
177
|
+
filled: () => d.filled,
|
|
178
|
+
modelValue: () => R.value,
|
|
179
|
+
"onUpdate:modelValue": () => (e) => R.value = e,
|
|
180
|
+
readonly: "",
|
|
181
|
+
clearable: () => d.clearable,
|
|
182
|
+
style: "width: 100%",
|
|
183
|
+
onClear: () => ue
|
|
184
|
+
}, { suffix: () => c(Q, {
|
|
185
|
+
class: () => [S(b).e("suffix-icon")],
|
|
186
|
+
style: () => ({ transform: G.value ? "rotate(180deg)" : "" })
|
|
187
|
+
}, () => s(S(t))) });
|
|
188
|
+
return Z(e, k, null, "inputRef"), e;
|
|
189
|
+
}
|
|
190
|
+
}), W, null, "popoverRef"), $.$evtclick = l(se), $;
|
|
186
191
|
}
|
|
187
192
|
});
|
|
188
193
|
//#endregion
|
|
189
|
-
export {
|
|
194
|
+
export { O as default };
|
package/dist/es/components/src/input/input.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -70,7 +70,9 @@ var A = /*@__PURE__*/ d({
|
|
|
70
70
|
}, de = (e) => {
|
|
71
71
|
M("focus", e);
|
|
72
72
|
}, fe = (e) => {
|
|
73
|
-
M("blur", e)
|
|
73
|
+
M("blur", e);
|
|
74
|
+
let t = e.relatedTarget;
|
|
75
|
+
t && t.closest("[data-skip-blur-validation]") || Y("blur");
|
|
74
76
|
}, pe = (e) => {
|
|
75
77
|
M("press-enter", z.value, e);
|
|
76
78
|
}, J = ae("inputRef");
|
package/dist/es/components/src/popover/popover.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import { useNamespace as t } from "../../../hooks/src/use-namespace.mjs";
|
|
|
4
4
|
import { useOutsideClick as n } from "../../../hooks/src/use-outside-click.mjs";
|
|
5
5
|
import { useZIndex as r } from "../../../hooks/src/use-zIndex.mjs";
|
|
6
6
|
import "../../../hooks/index.mjs";
|
|
7
|
-
import { VaporTeleport as i, VaporTransition as a, applyVShow as o, child as s, computed as c, createComponent as l, createDynamicComponent as ee, createIf as
|
|
8
|
-
import { arrow as
|
|
7
|
+
import { VaporTeleport as i, VaporTransition as a, applyVShow as o, child as s, computed as c, createComponent as l, createDynamicComponent as ee, createIf as te, createSlot as ne, createTemplateRefSetter as re, defineVaporComponent as u, nextTick as d, onDeactivated as ie, onMounted as ae, onUnmounted as oe, ref as f, renderEffect as p, setClass as m, setDynamicEvents as h, setInsertionState as g, setStyle as _, setText as se, template as v, toDisplayString as ce, unref as y, useSlots as le, useTemplateRef as b, watch as x, watchEffect as ue } from "vue";
|
|
8
|
+
import { arrow as de, autoUpdate as fe, computePosition as pe, flip as me, offset as he, shift as ge } from "@floating-ui/dom";
|
|
9
9
|
//#region ../components/src/popover/popover.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
10
|
-
var
|
|
10
|
+
var _e = v(" "), ve = v("<div data-popover-arrow>"), ye = v("<div>"), be = v("<div><div>"), S = /*@__PURE__*/ u({
|
|
11
11
|
name: "SPopover",
|
|
12
12
|
__name: "popover",
|
|
13
13
|
props: {
|
|
@@ -34,9 +34,9 @@ var ge = v(" "), _e = v("<div data-popover-arrow>"), ve = v("<div>"), ye = v("<d
|
|
|
34
34
|
},
|
|
35
35
|
emits: ["change", "click-outside"],
|
|
36
36
|
__multiRoot: !0,
|
|
37
|
-
setup(
|
|
38
|
-
let C =
|
|
39
|
-
let e =
|
|
37
|
+
setup(u, { expose: v, emit: S }) {
|
|
38
|
+
let C = u, w = S, T = t("popover"), xe = le(), E = f(!1), D = f(!1), { nextZIndex: Se } = r(), O = f(), k = b("containerNode"), A = b("wrapperNode"), j = b("contentNode"), M = f(null), Ce = () => {
|
|
39
|
+
let e = xe.default?.();
|
|
40
40
|
return M.value = e, e;
|
|
41
41
|
}, N = f(null), P = f({}), F = f({}), I = f({}), L = f(null), R = () => {
|
|
42
42
|
N.value && Object.entries(F.value).forEach(([e, t]) => {
|
|
@@ -66,25 +66,25 @@ var ge = v(" "), _e = v("<div data-popover-arrow>"), ve = v("<div>"), ye = v("<d
|
|
|
66
66
|
if (!e || N.value) return;
|
|
67
67
|
let t = null;
|
|
68
68
|
t = e instanceof HTMLElement ? e : B(e), t && t !== N.value && (R(), N.value = t);
|
|
69
|
-
}, { flush: "post" }),
|
|
69
|
+
}, { flush: "post" }), ae(() => {
|
|
70
70
|
if (N.value) return;
|
|
71
71
|
let e = M.value;
|
|
72
72
|
if (!e) return;
|
|
73
73
|
let t = e instanceof HTMLElement ? e : B(e);
|
|
74
74
|
t && t !== N.value && (R(), N.value = t);
|
|
75
75
|
}), x(N, (e) => {
|
|
76
|
-
e &&
|
|
76
|
+
e && d().then(() => {
|
|
77
77
|
Object.entries(F.value).forEach(([t, n]) => {
|
|
78
78
|
e.addEventListener(t, n);
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
}, { flush: "post" });
|
|
82
|
-
let
|
|
82
|
+
let we = () => {
|
|
83
83
|
if (!j.value || !N.value) return;
|
|
84
84
|
j.value.style.width = "";
|
|
85
85
|
let e = "";
|
|
86
86
|
typeof C.width == "number" ? (e = `${C.width}px`, j.value.style.width = e) : C.width === "sameWidth" ? (e = `${N.value.getBoundingClientRect().width}px`, j.value.style.width = e) : C.width === "auto" && (e = "", j.value.style.width = e);
|
|
87
|
-
},
|
|
87
|
+
}, Te = c(() => C.offset ? C.offset : C.trigger === "contextmenu" && C.alignPoint ? [0, 0] : C.showArrow ? [0, 8] : [0, 0]), V = () => {
|
|
88
88
|
if (C.trigger === "contextmenu" && C.alignPoint && L.value) {
|
|
89
89
|
let e = L.value;
|
|
90
90
|
return { getBoundingClientRect() {
|
|
@@ -106,19 +106,19 @@ var ge = v(" "), _e = v("<div data-popover-arrow>"), ve = v("<div>"), ye = v("<d
|
|
|
106
106
|
H &&= (H(), null);
|
|
107
107
|
}, W = async () => {
|
|
108
108
|
if (!A.value || !N.value) return;
|
|
109
|
-
let e = V(), t = j.value?.querySelector("[data-popover-arrow]"), [n, r] =
|
|
110
|
-
|
|
109
|
+
let e = V(), t = j.value?.querySelector("[data-popover-arrow]"), [n, r] = Te.value, i = [
|
|
110
|
+
he({
|
|
111
111
|
mainAxis: r,
|
|
112
112
|
crossAxis: n
|
|
113
113
|
}),
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
me(),
|
|
115
|
+
ge()
|
|
116
116
|
];
|
|
117
|
-
t && i.push(
|
|
117
|
+
t && i.push(de({
|
|
118
118
|
element: t,
|
|
119
119
|
padding: 8
|
|
120
120
|
}));
|
|
121
|
-
let { x: a, y: o, placement: s, middlewareData: c } = await
|
|
121
|
+
let { x: a, y: o, placement: s, middlewareData: c } = await pe(e, A.value, {
|
|
122
122
|
placement: C.placement,
|
|
123
123
|
strategy: "fixed",
|
|
124
124
|
middleware: i
|
|
@@ -140,18 +140,18 @@ var ge = v(" "), _e = v("<div data-popover-arrow>"), ve = v("<div>"), ye = v("<d
|
|
|
140
140
|
} : {
|
|
141
141
|
openDelay: typeof C.delay == "number" ? C.delay : C.delay[0],
|
|
142
142
|
closeDelay: typeof C.delay == "number" ? 50 : C.delay[1]
|
|
143
|
-
}), K = null,
|
|
144
|
-
C.disabled || (K &&= (clearTimeout(K), null), D.value = !0,
|
|
143
|
+
}), K = null, Ee = () => {
|
|
144
|
+
C.disabled || (K &&= (clearTimeout(K), null), D.value = !0, d(() => {
|
|
145
145
|
E.value = !0, w("change", !0);
|
|
146
146
|
}));
|
|
147
|
-
},
|
|
147
|
+
}, De = () => {
|
|
148
148
|
E.value = !1, L.value = null, w("change", !1), K && clearTimeout(K), K = setTimeout(() => {
|
|
149
149
|
C.destroyOnClose && (D.value = !1), K = null;
|
|
150
150
|
}, 300);
|
|
151
|
-
}, q = f(null), J = f(null),
|
|
152
|
-
q.value?.cancel(), J.value?.cancel(), q.value = e(
|
|
151
|
+
}, q = f(null), J = f(null), Oe = () => {
|
|
152
|
+
q.value?.cancel(), J.value?.cancel(), q.value = e(Ee, G.value.openDelay), J.value = e(De, G.value.closeDelay);
|
|
153
153
|
};
|
|
154
|
-
|
|
154
|
+
Oe(), x(G, Oe);
|
|
155
155
|
let Y = () => {
|
|
156
156
|
J.value?.cancel(), q.value?.();
|
|
157
157
|
}, X = () => {
|
|
@@ -160,9 +160,9 @@ var ge = v(" "), _e = v("<div data-popover-arrow>"), ve = v("<div>"), ye = v("<d
|
|
|
160
160
|
n(k, (e) => {
|
|
161
161
|
N.value && e.target && typeof N.value.contains == "function" && N.value.contains(e.target) || (E.value && w("click-outside", e), !C.manual && (C.trigger === "hover" || C.trigger === "contextmenu" || C.trigger === "click") && X());
|
|
162
162
|
});
|
|
163
|
-
let
|
|
164
|
-
F.value = {}, P.value = {}, I.value = {},
|
|
165
|
-
},
|
|
163
|
+
let ke = () => {
|
|
164
|
+
F.value = {}, P.value = {}, I.value = {}, Z();
|
|
165
|
+
}, Z = () => {
|
|
166
166
|
C.manual || (C.trigger === "hover" && (F.value.mouseenter = Y, F.value.mouseleave = X, P.value.mouseenter = Y, P.value.mouseleave = X), C.trigger === "click" && (F.value.click = () => {
|
|
167
167
|
let e = E.value ? J.value : q.value;
|
|
168
168
|
(E.value ? q.value : J.value)?.cancel(), e?.();
|
|
@@ -177,14 +177,14 @@ var ge = v(" "), _e = v("<div data-popover-arrow>"), ve = v("<div>"), ye = v("<d
|
|
|
177
177
|
}, Y();
|
|
178
178
|
}));
|
|
179
179
|
};
|
|
180
|
-
|
|
181
|
-
C.manual ||
|
|
180
|
+
ue(() => {
|
|
181
|
+
C.manual || Z();
|
|
182
182
|
});
|
|
183
|
-
let
|
|
183
|
+
let Ae = () => {
|
|
184
184
|
E.value || U();
|
|
185
185
|
};
|
|
186
186
|
x(E, (e) => {
|
|
187
|
-
e && (!A.value || !N.value || (O.value =
|
|
187
|
+
e && (!A.value || !N.value || (O.value = Se(), we(), U(), H = fe(V(), A.value, W)));
|
|
188
188
|
}, { flush: "post" }), x([
|
|
189
189
|
() => C.placement,
|
|
190
190
|
() => C.offset,
|
|
@@ -192,39 +192,45 @@ var ge = v(" "), _e = v("<div data-popover-arrow>"), ve = v("<div>"), ye = v("<d
|
|
|
192
192
|
], () => {
|
|
193
193
|
E.value && W();
|
|
194
194
|
}), x(() => C.manual, (e) => {
|
|
195
|
-
e ?
|
|
195
|
+
e ? ke() : Z();
|
|
196
196
|
}), x(() => C.trigger, (e, t) => {
|
|
197
|
-
e !== t && (q.value?.cancel(), E.value = !1, w("change", !1),
|
|
198
|
-
})
|
|
199
|
-
|
|
197
|
+
e !== t && (q.value?.cancel(), E.value = !1, w("change", !1), ke());
|
|
198
|
+
});
|
|
199
|
+
let Q = () => {
|
|
200
|
+
q.value?.cancel(), J.value?.cancel(), K &&= (clearTimeout(K), null), E.value = !1, D.value = !1, U();
|
|
201
|
+
};
|
|
202
|
+
ie(() => {
|
|
203
|
+
Q();
|
|
204
|
+
}), oe(() => {
|
|
205
|
+
Q(), R();
|
|
200
206
|
}), v({
|
|
201
207
|
show: Y,
|
|
202
208
|
hide: X
|
|
203
209
|
});
|
|
204
|
-
let $ =
|
|
205
|
-
return [ee(() =>
|
|
206
|
-
disabled: () => !
|
|
207
|
-
to: () =>
|
|
208
|
-
}, () =>
|
|
209
|
-
let e =
|
|
210
|
+
let $ = re();
|
|
211
|
+
return [ee(() => Ce()), l(i, {
|
|
212
|
+
disabled: () => !u.teleportBody,
|
|
213
|
+
to: () => u.teleport
|
|
214
|
+
}, () => te(() => D.value, () => {
|
|
215
|
+
let e = be(), t = s(e);
|
|
210
216
|
return p(() => {
|
|
211
217
|
let n = y(T);
|
|
212
218
|
h(e, P.value), m(e, [n.b()]), m(t, [n.e("wrapper")]), _(t, { zIndex: O.value });
|
|
213
219
|
}), g(t, null, 0), l(a, {
|
|
214
220
|
name: "popover-fade",
|
|
215
|
-
onAfterLeave: () =>
|
|
221
|
+
onAfterLeave: () => Ae,
|
|
216
222
|
persisted: ""
|
|
217
223
|
}, () => {
|
|
218
|
-
let e =
|
|
224
|
+
let e = ye();
|
|
219
225
|
return p(() => {
|
|
220
226
|
h(e, I.value), m(e, [y(T).e("content")]);
|
|
221
|
-
}), g(e, null, 0),
|
|
222
|
-
let e = ge();
|
|
223
|
-
return p(() => oe(e, se(d.content))), e;
|
|
224
|
-
}), g(e, null, 1), u(() => d.showArrow, () => {
|
|
227
|
+
}), g(e, null, 0), ne("content", null, () => {
|
|
225
228
|
let e = _e();
|
|
229
|
+
return p(() => se(e, ce(u.content))), e;
|
|
230
|
+
}), g(e, null, 1), te(() => u.showArrow, () => {
|
|
231
|
+
let e = ve();
|
|
226
232
|
return p(() => {
|
|
227
|
-
m(e, [y(T).e("arrow")]), _(e,
|
|
233
|
+
m(e, [y(T).e("arrow")]), _(e, u.arrowStyle);
|
|
228
234
|
}), e;
|
|
229
235
|
}), o(e, () => E.value), $(e, j, null, "contentNode"), e;
|
|
230
236
|
}), $(t, A, null, "wrapperNode"), $(e, k, null, "containerNode"), e;
|
package/dist/json/web-types.json
CHANGED