savor-ui 0.16.0 → 0.18.0
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 +22 -0
- package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs +30 -28
- package/dist/es/components/src/grid/grid-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +6 -3
- package/dist/es/components/src/grid/grid.vue_vue_type_script_setup_true_vapor_true_lang.mjs +16 -10
- package/dist/es/components/src/grid/types.d.ts +2 -0
- package/dist/es/components/src/menu/index.d.ts +5 -0
- package/dist/es/components/src/menu/menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +14 -2
- package/dist/es/components/src/menu/types.d.ts +10 -0
- package/dist/es/components/src/modal/index.d.ts +6 -0
- package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +109 -93
- package/dist/es/components/src/modal/types.d.ts +13 -0
- package/dist/es/components/src/tree/index.d.ts +4 -3
- package/dist/es/components/src/tree/node.d.ts +9 -1
- package/dist/es/components/src/tree/node.vue_vue_type_script_setup_true_vapor_true_lang.mjs +42 -29
- package/dist/es/components/src/tree/tree.d.ts +2 -2
- package/dist/es/components/src/tree/tree.vue_vue_type_script_setup_true_vapor_true_lang.mjs +81 -74
- package/dist/es/components/src/tree/types.d.ts +14 -2
- package/dist/es/theme/components/avatar.scss +2 -0
- package/dist/es/theme/components/grid.scss +1 -0
- package/dist/es/theme/components/menu.scss +14 -11
- package/dist/es/theme/components/modal.scss +18 -1
- package/dist/es/theme/components/statistic.scss +11 -11
- package/dist/es/theme/components/tree.scss +53 -7
- package/dist/json/vetur-attributes.json +40 -0
- package/dist/json/vetur-tags.json +12 -1
- package/dist/json/web-types.json +99 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
# [0.18.0](https://gitee.com/mach552/savor-ui/compare/v0.17.0...v0.18.0) (2026-08-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **menu:** 新增样式颜色属性 ([a2dd967](https://gitee.com/mach552/savor-ui/commits/a2dd9678707ac3c9eb3631ecf0ac92c42f5d8a3f))
|
|
11
|
+
* **modal:** 新增类型和图标 ([7973598](https://gitee.com/mach552/savor-ui/commits/797359852caed0d019a3f86ed24379104030ccd3))
|
|
12
|
+
* **tree:** 新增节点图标和额外内容插槽 ([b3f7953](https://gitee.com/mach552/savor-ui/commits/b3f79533fbeb4c589c74dbc4e240b1bb336489cb))
|
|
13
|
+
|
|
14
|
+
# [0.17.0](https://gitee.com/mach552/savor-ui/compare/v0.16.0...v0.17.0) (2026-08-07)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **cascader:** 修复选项列表更新时不刷新值的问题 ([a31af18](https://gitee.com/mach552/savor-ui/commits/a31af1880ec72b9445b411751f5e628aa992bd42))
|
|
20
|
+
* **grid:** 修复换行会残留间隔的问题 ([9dace33](https://gitee.com/mach552/savor-ui/commits/9dace337a3c5ff6c25d13d49e5ee0554b5a26fc6))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **modal:** 添加按钮相关属性 ([3c46e27](https://gitee.com/mach552/savor-ui/commits/3c46e278714fe20280d139879ead9cedd690df37))
|
|
26
|
+
|
|
5
27
|
# [0.16.0](https://gitee.com/mach552/savor-ui/compare/v0.15.7...v0.16.0) (2026-08-06)
|
|
6
28
|
|
|
7
29
|
|
package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -7,11 +7,11 @@ 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
9
|
import ee from "./cascader-column.vue.mjs";
|
|
10
|
-
import { computed as o, createComponent as s, createComponentWithFallback as c, createIf as
|
|
10
|
+
import { computed as o, createComponent as s, createComponentWithFallback as c, createIf as l, createInvoker as u, createTemplateRefSetter as te, 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
|
|
12
|
+
var O = b("<div style=\"padding: 12px\">"), re = b("<div>"), ie = b("<div data-skip-blur-validation>"), ae = b("<div>", 1);
|
|
13
13
|
f("mousedown", "focusin", "click");
|
|
14
|
-
var
|
|
14
|
+
var k = /*@__PURE__*/ d({
|
|
15
15
|
name: "SCascader",
|
|
16
16
|
__name: "cascader",
|
|
17
17
|
props: /*@__PURE__*/ p({
|
|
@@ -52,8 +52,8 @@ var O = /*@__PURE__*/ d({
|
|
|
52
52
|
"update:expanded"
|
|
53
53
|
]),
|
|
54
54
|
setup(d, { emit: f }) {
|
|
55
|
-
let p = d, b = e("cascader"),
|
|
56
|
-
size:
|
|
55
|
+
let p = d, b = e("cascader"), k = f, A = w("inputRef"), j = C(d, "modelValue"), { size: oe, error: M } = x(p), { mergedSize: N, mergedError: P } = n({
|
|
56
|
+
size: oe,
|
|
57
57
|
error: M
|
|
58
58
|
}), F = C(d, "expandedKeys"), I = C(d, "expanded"), L = o(() => ({
|
|
59
59
|
label: "label",
|
|
@@ -63,18 +63,18 @@ var O = /*@__PURE__*/ d({
|
|
|
63
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
64
|
if (p.multiple) {
|
|
65
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]),
|
|
66
|
+
n ? i !== -1 && (z.value = z.value.toSpliced(i, 1)) : i === -1 && (z.value = [...z.value, t]), j.value = z.value.map(B), R.value = z.value.map(V).join(", "), k("selectItem", {
|
|
67
67
|
item: e,
|
|
68
68
|
expandeds: t
|
|
69
69
|
});
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
R.value = V(t),
|
|
72
|
+
R.value = V(t), j.value = B(t), k("selectItem", {
|
|
73
73
|
item: e,
|
|
74
74
|
expandeds: t
|
|
75
75
|
}), K(!1);
|
|
76
76
|
}, U = () => {
|
|
77
|
-
|
|
77
|
+
k("expand", F.value);
|
|
78
78
|
}, W = w("popoverRef"), G = g(!1), K = (e) => {
|
|
79
79
|
G.value = e, e ? W.value?.show() : W.value?.hide();
|
|
80
80
|
}, se = () => {
|
|
@@ -83,7 +83,7 @@ var O = /*@__PURE__*/ d({
|
|
|
83
83
|
}, ce = () => {
|
|
84
84
|
K(!1);
|
|
85
85
|
}, le = (e) => {
|
|
86
|
-
e.target &&
|
|
86
|
+
e.target && A.value?.focus();
|
|
87
87
|
}, q = (e, t, n = []) => {
|
|
88
88
|
for (let r of e) {
|
|
89
89
|
let e = [...n, r];
|
|
@@ -103,12 +103,12 @@ var O = /*@__PURE__*/ d({
|
|
|
103
103
|
}
|
|
104
104
|
return n;
|
|
105
105
|
}, Y = () => {
|
|
106
|
-
if (
|
|
106
|
+
if (j.value === void 0 || j.value === "") {
|
|
107
107
|
R.value = "", F.value = [], I.value = [], z.value = [];
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
if (p.multiple) {
|
|
111
|
-
z.value = (Array.isArray(
|
|
111
|
+
z.value = (Array.isArray(j.value) ? j.value : []).map((e) => {
|
|
112
112
|
if (p.pathMode && typeof e == "string") {
|
|
113
113
|
let t = e.split(p.pathSeparator);
|
|
114
114
|
return J(p.options, t);
|
|
@@ -118,24 +118,26 @@ var O = /*@__PURE__*/ d({
|
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
let e = null;
|
|
121
|
-
if (p.pathMode && typeof
|
|
122
|
-
let t =
|
|
121
|
+
if (p.pathMode && typeof j.value == "string") {
|
|
122
|
+
let t = j.value.split(p.pathSeparator);
|
|
123
123
|
e = J(p.options, t);
|
|
124
|
-
} else Array.isArray(
|
|
124
|
+
} else Array.isArray(j.value) || (e = q(p.options, j.value));
|
|
125
125
|
e && (F.value = e.map((e) => e[L.value.key]), I.value = e, R.value = V(e));
|
|
126
126
|
}, X = (e) => {
|
|
127
|
-
|
|
127
|
+
j.value === void 0 ? e.forEach((e) => {
|
|
128
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
129
|
}) : Y();
|
|
130
130
|
}, ue = () => {
|
|
131
|
-
|
|
131
|
+
j.value = p.multiple ? [] : "", F.value = [], I.value = [], z.value = [], R.value = "", k("clear");
|
|
132
132
|
};
|
|
133
|
-
T(
|
|
133
|
+
T(j, () => {
|
|
134
134
|
Y();
|
|
135
|
+
}), T(() => p.options, () => {
|
|
136
|
+
j.value !== void 0 && j.value !== "" && Y();
|
|
135
137
|
}), h(() => {
|
|
136
138
|
X(p.options);
|
|
137
139
|
});
|
|
138
|
-
let Z =
|
|
140
|
+
let Z = te(), Q = ne("SIcon"), $ = ae();
|
|
139
141
|
return _(() => v($, [S(b).b()])), y($, null, 0), Z(s(S(r), { $: [() => ({
|
|
140
142
|
offset: [0, 4],
|
|
141
143
|
placement: "bottom-start",
|
|
@@ -143,12 +145,12 @@ var O = /*@__PURE__*/ d({
|
|
|
143
145
|
...d.popoverProps
|
|
144
146
|
}), { onClickOutside: () => ce }] }, {
|
|
145
147
|
content: () => {
|
|
146
|
-
let e =
|
|
147
|
-
return _(() => v(e, [S(b).e("wrapper")])), y(e, null, 0),
|
|
148
|
-
let e =
|
|
148
|
+
let e = ie();
|
|
149
|
+
return _(() => v(e, [S(b).e("wrapper")])), y(e, null, 0), l(() => !d.options.length, () => {
|
|
150
|
+
let e = O();
|
|
149
151
|
return y(e, null, 0), s(S(a)), e;
|
|
150
152
|
}, () => {
|
|
151
|
-
let e =
|
|
153
|
+
let e = re();
|
|
152
154
|
return _(() => v(e, [S(b).e("panel")])), y(e, null, 0), s(ee, {
|
|
153
155
|
expandTrigger: () => d.expandTrigger,
|
|
154
156
|
fieldNames: () => d.fieldNames,
|
|
@@ -159,14 +161,14 @@ var O = /*@__PURE__*/ d({
|
|
|
159
161
|
pathSeparator: () => d.pathSeparator,
|
|
160
162
|
onClickItem: () => H,
|
|
161
163
|
onExpand: () => U,
|
|
162
|
-
modelValue: () =>
|
|
163
|
-
"onUpdate:modelValue": () => (e) =>
|
|
164
|
+
modelValue: () => j.value,
|
|
165
|
+
"onUpdate:modelValue": () => (e) => j.value = e,
|
|
164
166
|
expanded: () => I.value,
|
|
165
167
|
"onUpdate:expanded": () => (e) => I.value = e,
|
|
166
168
|
expandedKeys: () => F.value,
|
|
167
169
|
"onUpdate:expandedKeys": () => (e) => F.value = e
|
|
168
170
|
}), e;
|
|
169
|
-
}, 261), m(e, "click", E(() => {}, ["stop"])), e.$evtmousedown = D(() => {}, ["prevent"]), e.$evtfocusin =
|
|
171
|
+
}, 261), m(e, "click", E(() => {}, ["stop"])), e.$evtmousedown = D(() => {}, ["prevent"]), e.$evtfocusin = u(le), e;
|
|
170
172
|
},
|
|
171
173
|
default: () => {
|
|
172
174
|
let e = s(S(i), {
|
|
@@ -185,10 +187,10 @@ var O = /*@__PURE__*/ d({
|
|
|
185
187
|
class: () => [S(b).e("suffix-icon")],
|
|
186
188
|
style: () => ({ transform: G.value ? "rotate(180deg)" : "" })
|
|
187
189
|
}, () => s(S(t))) });
|
|
188
|
-
return Z(e,
|
|
190
|
+
return Z(e, A, null, "inputRef"), e;
|
|
189
191
|
}
|
|
190
|
-
}), W, null, "popoverRef"), $.$evtclick =
|
|
192
|
+
}), W, null, "popoverRef"), $.$evtclick = u(se), $;
|
|
191
193
|
}
|
|
192
194
|
});
|
|
193
195
|
//#endregion
|
|
194
|
-
export {
|
|
196
|
+
export { k as default };
|
package/dist/es/components/src/grid/grid-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -12,9 +12,12 @@ var v = p("<div>", 1), y = /*@__PURE__*/ i({
|
|
|
12
12
|
},
|
|
13
13
|
setup(i) {
|
|
14
14
|
let p = i, y = g("gridItemRef"), b = e("grid"), x = "grid-item-" + h(), S = a(t, {}), C = n(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
let e = S?.positionList?.value[x];
|
|
16
|
+
return {
|
|
17
|
+
...e ? { gridColumn: `${e.start} / ${e.end}` } : {},
|
|
18
|
+
paddingLeft: e?.isFirst ? "0px" : "var(--s-grid-gutter-x, 0px)",
|
|
19
|
+
paddingRight: e?.isLast ? "0px" : "var(--s-grid-gutter-x, 0px)"
|
|
20
|
+
};
|
|
18
21
|
}), w = () => {
|
|
19
22
|
S?.addGridItem?.({
|
|
20
23
|
...p,
|
|
@@ -13,10 +13,12 @@ var m = f("<div>", 1), h = /*@__PURE__*/ a({
|
|
|
13
13
|
},
|
|
14
14
|
setup(a) {
|
|
15
15
|
let f = a, h = t("grid"), { current: g } = e(), _ = s([]), v = (e, t) => e ? e?.[t] ?? 24 : 24, y = r(() => v(f.cols, g.value)), b = r(() => `repeat(${v(f.cols, g.value)}, 1fr)`), x = r(() => {
|
|
16
|
-
let e;
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
gridTemplateColumns: b.value
|
|
16
|
+
let e = 0, t = 0;
|
|
17
|
+
return Array.isArray(f.gutter) ? (e = f.gutter[0], t = f.gutter[1]) : (e = f.gutter, t = f.gutter), {
|
|
18
|
+
"--s-grid-gutter-x": `${e / 2}px`,
|
|
19
|
+
gridTemplateColumns: b.value,
|
|
20
|
+
rowGap: `${t}px`,
|
|
21
|
+
columnGap: "0px"
|
|
20
22
|
};
|
|
21
23
|
});
|
|
22
24
|
o(n, {
|
|
@@ -32,12 +34,16 @@ var m = f("<div>", 1), h = /*@__PURE__*/ a({
|
|
|
32
34
|
},
|
|
33
35
|
positionList: r(() => {
|
|
34
36
|
let e = 1, t = {}, n = y.value, r = [..._.value].sort((e, t) => e.el && t.el ? e.el.compareDocumentPosition(t.el) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1 : 0);
|
|
35
|
-
for (let i
|
|
36
|
-
let { uid:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
for (let i = 0; i < r.length; i++) {
|
|
38
|
+
let { uid: a, span: o = 1, offset: s = 0 } = r[i], c = e + s, l = c + o;
|
|
39
|
+
l > n + 1 && (e = 1, c = e + s, l = c + o);
|
|
40
|
+
let u = c - s === 1, d = r[i + 1], f = !d || l + (d.offset || 0) + (d.span || 1) > n + 1;
|
|
41
|
+
t[a] = {
|
|
42
|
+
start: c,
|
|
43
|
+
end: l,
|
|
44
|
+
isFirst: u,
|
|
45
|
+
isLast: f
|
|
46
|
+
}, e = l;
|
|
41
47
|
}
|
|
42
48
|
return t;
|
|
43
49
|
})
|
|
@@ -55,6 +55,11 @@ export declare const SMenu: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
55
55
|
selectedKey?: string | undefined;
|
|
56
56
|
accordion?: boolean | undefined;
|
|
57
57
|
scrollbarProps?: ScrollbarProps | undefined;
|
|
58
|
+
bgColor?: string | undefined;
|
|
59
|
+
textColor?: string | undefined;
|
|
60
|
+
activeTextColor?: string | undefined;
|
|
61
|
+
activeBgColor?: string | undefined;
|
|
62
|
+
hoverBgColor?: string | undefined;
|
|
58
63
|
activeKey?: string | number | undefined;
|
|
59
64
|
onItemClick?: ((name: string | number, item: any) => any) | undefined;
|
|
60
65
|
onOpenChange?: ((keys: string[]) => any) | undefined;
|
|
@@ -17,7 +17,12 @@ var S = _("<div>"), C = _("<div>", 1), w = /*@__PURE__*/ c({
|
|
|
17
17
|
openKeys: {},
|
|
18
18
|
selectedKey: {},
|
|
19
19
|
accordion: { type: Boolean },
|
|
20
|
-
scrollbarProps: {}
|
|
20
|
+
scrollbarProps: {},
|
|
21
|
+
bgColor: { default: "transparent" },
|
|
22
|
+
textColor: { default: "var(--s-color-text-1)" },
|
|
23
|
+
activeTextColor: { default: "var(--s-color-primary-6)" },
|
|
24
|
+
activeBgColor: { default: "var(--s-color-primary-1)" },
|
|
25
|
+
hoverBgColor: { default: "var(--s-color-fill-2)" }
|
|
21
26
|
}, {
|
|
22
27
|
activeKey: {},
|
|
23
28
|
activeKeyModifiers: {},
|
|
@@ -26,7 +31,14 @@ var S = _("<div>"), C = _("<div>", 1), w = /*@__PURE__*/ c({
|
|
|
26
31
|
}),
|
|
27
32
|
emits: /*@__PURE__*/ l(["itemClick", "openChange"], ["update:activeKey", "update:openKeys"]),
|
|
28
33
|
setup(c, { emit: l }) {
|
|
29
|
-
let _ = c, w = l, T = t("menu"), E = a(() => ({
|
|
34
|
+
let _ = c, w = l, T = t("menu"), E = a(() => ({
|
|
35
|
+
"--s-menu-bg-color": _.bgColor,
|
|
36
|
+
"--s-menu-text-color": _.textColor,
|
|
37
|
+
"--s-menu-active-text-color": _.activeTextColor,
|
|
38
|
+
"--s-menu-active-bg-color": _.activeBgColor,
|
|
39
|
+
"--s-menu-hover-bg-color": _.hoverBgColor,
|
|
40
|
+
width: _.collapsed ? e(_.collapsedWidth) : e(_.width)
|
|
41
|
+
})), D = b(c, "activeKey"), O = b(c, "openKeys"), k = (e, t) => {
|
|
30
42
|
D.value = e, w("itemClick", e, t);
|
|
31
43
|
}, A = (e) => {
|
|
32
44
|
if (_.accordion) {
|
|
@@ -15,6 +15,16 @@ export interface MenuProps {
|
|
|
15
15
|
accordion?: boolean;
|
|
16
16
|
/** 滚动条属性 */
|
|
17
17
|
scrollbarProps?: ScrollbarProps;
|
|
18
|
+
/** 背景颜色 */
|
|
19
|
+
bgColor?: string;
|
|
20
|
+
/** 文本颜色 */
|
|
21
|
+
textColor?: string;
|
|
22
|
+
/** 选中文本颜色 */
|
|
23
|
+
activeTextColor?: string;
|
|
24
|
+
/** 选中背景颜色 */
|
|
25
|
+
activeBgColor?: string;
|
|
26
|
+
/** 鼠标悬停背景颜色 */
|
|
27
|
+
hoverBgColor?: string;
|
|
18
28
|
}
|
|
19
29
|
export interface MenuSlots {
|
|
20
30
|
/** 默认 */
|
|
@@ -2,6 +2,7 @@ import { useModal } from './method';
|
|
|
2
2
|
import { ModalSlots } from './types';
|
|
3
3
|
import { PublicProps, VNode, ShallowUnwrapRef, Plugin } from 'vue';
|
|
4
4
|
import { ScrollbarProps } from '../scrollbar';
|
|
5
|
+
import { ButtonProps } from '../button';
|
|
5
6
|
export declare const SModal: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
|
|
6
7
|
attrs: any;
|
|
7
8
|
slots: ModalSlots;
|
|
@@ -26,6 +27,7 @@ export declare const SModal: ((__VLS_props: NonNullable<Awaited<typeof __VLS_set
|
|
|
26
27
|
mask?: boolean | undefined;
|
|
27
28
|
to?: (string | HTMLElement) | undefined;
|
|
28
29
|
draggable?: boolean | undefined;
|
|
30
|
+
type?: "default" | "warning" | "primary" | "info" | "success" | "danger" | undefined;
|
|
29
31
|
className?: string | undefined;
|
|
30
32
|
modalStyle?: Record<string, string> | undefined;
|
|
31
33
|
maskStyle?: Record<string, string> | undefined;
|
|
@@ -34,6 +36,10 @@ export declare const SModal: ((__VLS_props: NonNullable<Awaited<typeof __VLS_set
|
|
|
34
36
|
offset?: number | undefined;
|
|
35
37
|
scrollContent?: boolean | undefined;
|
|
36
38
|
scrollbarProps?: ScrollbarProps | undefined;
|
|
39
|
+
confirmBtn?: boolean | undefined;
|
|
40
|
+
confirmProps?: ButtonProps | undefined;
|
|
41
|
+
cancelBtn?: boolean | undefined;
|
|
42
|
+
cancelProps?: ButtonProps | undefined;
|
|
37
43
|
confirm?: ((done: (status: boolean) => void) => void) | undefined;
|
|
38
44
|
close?: (() => void) | undefined;
|
|
39
45
|
closed?: (() => void) | undefined;
|
package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -6,21 +6,25 @@ import { useResizeObserver as r } from "../../../hooks/src/use-resize-observer.m
|
|
|
6
6
|
import { useScrollHidden as ee } from "../../../hooks/src/use-scroll-hidden.mjs";
|
|
7
7
|
import { useZIndex as te } from "../../../hooks/src/use-zIndex.mjs";
|
|
8
8
|
import "../../../hooks/index.mjs";
|
|
9
|
-
import ne from "../../../icons/src/
|
|
10
|
-
import re from "../../../icons/src/
|
|
11
|
-
import ie from "../../../icons/src/
|
|
9
|
+
import ne from "../../../icons/src/check-circle-fill.vue.mjs";
|
|
10
|
+
import re from "../../../icons/src/close-circle-fill.vue.mjs";
|
|
11
|
+
import ie from "../../../icons/src/close.vue.mjs";
|
|
12
|
+
import ae from "../../../icons/src/fullscreen-exit.vue.mjs";
|
|
13
|
+
import oe from "../../../icons/src/fullscreen.vue.mjs";
|
|
14
|
+
import i from "../../../icons/src/info-circle-fill.vue.mjs";
|
|
15
|
+
import se from "../../../icons/src/warning-circle-fill.vue.mjs";
|
|
12
16
|
import "../../../icons/index.mjs";
|
|
13
|
-
import { SScrollbar as
|
|
14
|
-
import { SButton as
|
|
15
|
-
import { STransition as
|
|
16
|
-
import { VaporTeleport as
|
|
17
|
+
import { SScrollbar as ce } from "../scrollbar/index.mjs";
|
|
18
|
+
import { SButton as a } from "../button/index.mjs";
|
|
19
|
+
import { STransition as o } from "../transition/index.mjs";
|
|
20
|
+
import { VaporTeleport as le, applyVShow as s, child as c, computed as l, createComponent as u, createIf as d, createInvoker as ue, createSlot as f, createTemplateRefSetter as de, defineVaporComponent as p, delegateEvents as m, mergeModels as h, next as fe, nextTick as g, onUnmounted as pe, ref as _, renderEffect as v, setClass as y, setInsertionState as b, setStyle as x, setText as S, template as C, toDisplayString as w, unref as T, useModel as me, useTemplateRef as E, watch as D, watchEffect as he } from "vue";
|
|
17
21
|
//#region ../components/src/modal/modal.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var
|
|
22
|
+
var O = C("<div>"), k = C(" "), ge = C("<div><div></div><div></div>"), A = C("<div style=\"flex: 1; overflow: hidden; display: flex; flex-direction: column\">"), _e = C("<div><div>");
|
|
23
|
+
m("click");
|
|
24
|
+
var j = /*@__PURE__*/ p({
|
|
21
25
|
name: "SModal",
|
|
22
26
|
__name: "modal",
|
|
23
|
-
props: /*@__PURE__*/
|
|
27
|
+
props: /*@__PURE__*/ h({
|
|
24
28
|
modalValue: { type: Boolean },
|
|
25
29
|
width: { default: "0px" },
|
|
26
30
|
height: {},
|
|
@@ -60,6 +64,7 @@ var M = /*@__PURE__*/ f({
|
|
|
60
64
|
},
|
|
61
65
|
to: { default: "body" },
|
|
62
66
|
draggable: { type: Boolean },
|
|
67
|
+
type: { default: "default" },
|
|
63
68
|
className: {},
|
|
64
69
|
modalStyle: {},
|
|
65
70
|
maskStyle: {},
|
|
@@ -71,6 +76,16 @@ var M = /*@__PURE__*/ f({
|
|
|
71
76
|
offset: { default: 120 },
|
|
72
77
|
scrollContent: { type: Boolean },
|
|
73
78
|
scrollbarProps: {},
|
|
79
|
+
confirmBtn: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: !0
|
|
82
|
+
},
|
|
83
|
+
confirmProps: {},
|
|
84
|
+
cancelBtn: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: !0
|
|
87
|
+
},
|
|
88
|
+
cancelProps: {},
|
|
74
89
|
confirm: {},
|
|
75
90
|
close: {},
|
|
76
91
|
closed: {},
|
|
@@ -82,45 +97,45 @@ var M = /*@__PURE__*/ f({
|
|
|
82
97
|
},
|
|
83
98
|
modelModifiers: {}
|
|
84
99
|
}),
|
|
85
|
-
emits: /*@__PURE__*/
|
|
100
|
+
emits: /*@__PURE__*/ h([
|
|
86
101
|
"close",
|
|
87
102
|
"closed",
|
|
88
103
|
"opened",
|
|
89
104
|
"confirm"
|
|
90
105
|
], ["update:modelValue"]),
|
|
91
|
-
setup(
|
|
92
|
-
let C =
|
|
106
|
+
setup(p, { expose: m, emit: h }) {
|
|
107
|
+
let C = p, j = h, M = n("modal"), { lockScroll: ve, unlockScroll: N } = ee(), { nextZIndex: P } = te(), F = _(0), I = E("modalRef"), L = E("headerRef"), R = me(p, "modelValue"), z = _(!1), B = _(!1), V = _(!1), H = _(!1), U = _(0), W = _(0), G = _(!1), K = _(0), q = _(0), J = l(() => typeof C.to == "string" ? document.querySelector(C.to) || document.body : C.to);
|
|
93
108
|
r(J, () => {
|
|
94
109
|
let e = J.value;
|
|
95
110
|
K.value = e.clientHeight, q.value = e.clientWidth, Q();
|
|
96
111
|
}), r(I, () => {
|
|
97
112
|
z.value && Q();
|
|
98
113
|
});
|
|
99
|
-
let
|
|
114
|
+
let ye = l(() => ({
|
|
100
115
|
zIndex: F.value,
|
|
101
116
|
position: C.to === "body" ? "fixed" : "absolute"
|
|
102
|
-
})),
|
|
117
|
+
})), be = l(() => V.value ? {} : {
|
|
103
118
|
width: e(C.width),
|
|
104
119
|
height: e(C.height),
|
|
105
120
|
top: `${U.value}px`,
|
|
106
121
|
left: `${W.value}px`,
|
|
107
122
|
...C.modalStyle
|
|
108
|
-
}),
|
|
109
|
-
|
|
110
|
-
},
|
|
111
|
-
B.value = !1, H.value = !1, G.value = !1,
|
|
112
|
-
},
|
|
123
|
+
}), xe = () => {
|
|
124
|
+
j("opened");
|
|
125
|
+
}, Se = () => {
|
|
126
|
+
B.value = !1, H.value = !1, G.value = !1, j("closed"), g(N);
|
|
127
|
+
}, Ce = () => {
|
|
113
128
|
C.closeOnOverlayClick && X();
|
|
114
|
-
},
|
|
129
|
+
}, we = (e) => {
|
|
115
130
|
e ? R.value = !1 : H.value = !1;
|
|
116
131
|
}, Y = () => {
|
|
117
|
-
H.value = !0,
|
|
132
|
+
H.value = !0, j("confirm", we);
|
|
118
133
|
}, X = () => {
|
|
119
|
-
R.value = !1,
|
|
120
|
-
},
|
|
134
|
+
R.value = !1, j("close");
|
|
135
|
+
}, Te = () => {
|
|
121
136
|
V.value = !V.value;
|
|
122
137
|
};
|
|
123
|
-
|
|
138
|
+
D(() => C.fullscreen, (e) => V.value = e, { immediate: !0 });
|
|
124
139
|
let Z = (e) => {
|
|
125
140
|
e.key === "Escape" && C.closeOnEsc && z.value && X();
|
|
126
141
|
}, Q = async () => {
|
|
@@ -128,111 +143,112 @@ var M = /*@__PURE__*/ f({
|
|
|
128
143
|
let e = I.value;
|
|
129
144
|
C.center ? U.value = Math.max(0, (K.value - e.offsetHeight) / 2) : U.value = C.offset, W.value = Math.max(0, (q.value - e.offsetWidth) / 2);
|
|
130
145
|
};
|
|
131
|
-
|
|
132
|
-
e ? (F.value =
|
|
133
|
-
}, { immediate: !0 }),
|
|
146
|
+
D(() => R.value, async (e) => {
|
|
147
|
+
e ? (F.value = P(), ve(), B.value = !0, await g(), z.value = !0, Q()) : z.value = !1;
|
|
148
|
+
}, { immediate: !0 }), he((e) => {
|
|
134
149
|
z.value && (document.addEventListener("keydown", Z), e(() => document.removeEventListener("keydown", Z)));
|
|
135
150
|
}), t({
|
|
136
151
|
container: I,
|
|
137
152
|
target: L,
|
|
138
153
|
parent: J,
|
|
139
|
-
enable:
|
|
154
|
+
enable: l(() => C.draggable && !V.value),
|
|
140
155
|
divLeft: W,
|
|
141
156
|
divTop: U,
|
|
142
157
|
hasDragged: G
|
|
143
|
-
}),
|
|
144
|
-
|
|
145
|
-
}),
|
|
146
|
-
let $ =
|
|
147
|
-
return
|
|
148
|
-
to: () =>
|
|
158
|
+
}), pe(() => {
|
|
159
|
+
N();
|
|
160
|
+
}), m({ handleClose: X });
|
|
161
|
+
let $ = de();
|
|
162
|
+
return u(le, {
|
|
163
|
+
to: () => p.to,
|
|
149
164
|
defer: ""
|
|
150
165
|
}, () => {
|
|
151
|
-
let e =
|
|
166
|
+
let e = _e(), t = c(e, 1);
|
|
152
167
|
return v(() => {
|
|
153
|
-
y(e, [T(
|
|
154
|
-
}), b(e, 0, 0),
|
|
155
|
-
let e =
|
|
156
|
-
return
|
|
157
|
-
x(e,
|
|
168
|
+
y(e, [T(M).e("container")]), x(e, ye.value);
|
|
169
|
+
}), b(e, 0, 0), u(T(o), { type: "opacity" }, () => d(() => p.mask, () => {
|
|
170
|
+
let e = O();
|
|
171
|
+
return s(e, () => z.value), e.$evtclick = ue(Ce), v(() => {
|
|
172
|
+
x(e, p.maskStyle), y(e, [T(M).e("mask")]);
|
|
158
173
|
}), e;
|
|
159
|
-
}, null, 129)), v(() => y(t, [T(
|
|
174
|
+
}, null, 129)), v(() => y(t, [T(M).e("wrapper")])), b(t, null, 0), u(T(o), {
|
|
160
175
|
type: "scale",
|
|
161
|
-
onAfterLeave: () =>
|
|
162
|
-
onAfterEnter: () =>
|
|
176
|
+
onAfterLeave: () => Se,
|
|
177
|
+
onAfterEnter: () => xe
|
|
163
178
|
}, () => {
|
|
164
|
-
let e =
|
|
179
|
+
let e = O();
|
|
165
180
|
return v(() => {
|
|
166
|
-
let t = T(
|
|
181
|
+
let t = T(M);
|
|
167
182
|
y(e, [
|
|
168
183
|
t.b(),
|
|
169
|
-
t.is("drag",
|
|
184
|
+
t.is("drag", p.draggable),
|
|
170
185
|
t.is("fullscreen", V.value),
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
t.m(p.type),
|
|
187
|
+
p.className
|
|
188
|
+
]), x(e, be.value);
|
|
189
|
+
}), b(e, null, 0), d(() => p.header, () => {
|
|
190
|
+
let e = ge(), t = c(e, 1), n = fe(t, 2);
|
|
191
|
+
return v(() => y(e, [T(M).e("header")])), b(e, 0, 0), d(() => p.type !== "default", () => {
|
|
192
|
+
let e = O();
|
|
193
|
+
return v(() => y(e, [T(M).e("icon")])), b(e, null, 0), d(() => p.type === "warning", () => u(T(se)), () => d(() => p.type === "primary", () => u(T(i)), () => d(() => p.type === "info", () => u(T(i)), () => d(() => p.type === "success", () => u(T(ne)), () => d(() => p.type === "danger", () => u(T(re))), 1285), 1029), 773), 517), e;
|
|
194
|
+
}), v(() => y(t, [T(M).e("title")])), b(t, null, 0), f("header", null, () => {
|
|
195
|
+
let e = k();
|
|
196
|
+
return v(() => S(e, w(p.title))), e;
|
|
197
|
+
}), v(() => y(n, [T(M).e("header-icon")])), b(n, null, 0), d(() => p.fullable, () => u(T(a), {
|
|
182
198
|
text: "",
|
|
183
199
|
size: "small",
|
|
184
|
-
onClick: () =>
|
|
185
|
-
}, { icon: () =>
|
|
200
|
+
onClick: () => Te
|
|
201
|
+
}, { icon: () => d(() => V.value, () => u(T(ae)), () => u(T(oe)), 2181) })), b(n, null, 1), d(() => p.closable, () => u(T(a), {
|
|
186
202
|
text: "",
|
|
187
203
|
size: "small",
|
|
188
204
|
circle: "",
|
|
189
205
|
onClick: () => X
|
|
190
|
-
}, { icon: () =>
|
|
191
|
-
}), b(e, null, 1),
|
|
192
|
-
let e =
|
|
206
|
+
}, { icon: () => u(T(ie)) })), $(e, L, null, "headerRef"), e;
|
|
207
|
+
}), b(e, null, 1), d(() => !p.scrollContent, () => {
|
|
208
|
+
let e = O();
|
|
193
209
|
return v(() => {
|
|
194
|
-
y(e, [T(
|
|
210
|
+
y(e, [T(M).e("body")]), x(e, {
|
|
195
211
|
padding: "16px",
|
|
196
|
-
...
|
|
212
|
+
...p.bodyStyle
|
|
197
213
|
});
|
|
198
|
-
}), b(e, null, 0),
|
|
199
|
-
let e =
|
|
200
|
-
return v(() => S(e, w(
|
|
214
|
+
}), b(e, null, 0), f("default", null, () => {
|
|
215
|
+
let e = k();
|
|
216
|
+
return v(() => S(e, w(p.content))), e;
|
|
201
217
|
}), e;
|
|
202
218
|
}, () => {
|
|
203
|
-
let e =
|
|
204
|
-
return b(e, null, 0),
|
|
219
|
+
let e = A();
|
|
220
|
+
return b(e, null, 0), u(T(ce), { $: [() => ({
|
|
205
221
|
padding: "16px",
|
|
206
|
-
...
|
|
207
|
-
})] }, () =>
|
|
208
|
-
let e =
|
|
209
|
-
return v(() => S(e, w(
|
|
222
|
+
...p.scrollbarProps
|
|
223
|
+
})] }, () => f("default", null, () => {
|
|
224
|
+
let e = k();
|
|
225
|
+
return v(() => S(e, w(p.content))), e;
|
|
210
226
|
}, 4)), e;
|
|
211
|
-
},
|
|
212
|
-
let e =
|
|
213
|
-
return v(() => y(e, [T(
|
|
227
|
+
}, 3077), b(e, null, 2), d(() => p.footer, () => {
|
|
228
|
+
let e = O();
|
|
229
|
+
return v(() => y(e, [T(M).e("footer")])), b(e, null, 0), f("footer", null, () => d(() => p.btnReverse, () => [d(() => p.confirmBtn, () => u(T(a), { $: [() => ({
|
|
214
230
|
label: "确定",
|
|
215
|
-
loading:
|
|
231
|
+
loading: H.value,
|
|
216
232
|
type: "primary",
|
|
217
|
-
|
|
218
|
-
}),
|
|
233
|
+
...p.confirmProps
|
|
234
|
+
}), { onClick: () => Y }] }), null, 129), d(() => p.cancelBtn, () => u(T(a), { $: [() => ({
|
|
219
235
|
label: "取消",
|
|
220
|
-
secondary:
|
|
221
|
-
|
|
222
|
-
})], () => [
|
|
236
|
+
secondary: !0,
|
|
237
|
+
...p.cancelProps
|
|
238
|
+
}), { onClick: () => X }] }), null, 129)], () => [d(() => p.cancelBtn, () => u(T(a), { $: [() => ({
|
|
223
239
|
label: "取消",
|
|
224
|
-
secondary:
|
|
225
|
-
|
|
226
|
-
}),
|
|
240
|
+
secondary: !0,
|
|
241
|
+
...p.cancelProps
|
|
242
|
+
}), { onClick: () => X }] }), null, 129), d(() => p.confirmBtn, () => u(T(a), { $: [() => ({
|
|
227
243
|
label: "确定",
|
|
228
|
-
loading:
|
|
244
|
+
loading: H.value,
|
|
229
245
|
type: "primary",
|
|
230
|
-
|
|
231
|
-
})],
|
|
232
|
-
}),
|
|
233
|
-
}),
|
|
246
|
+
...p.confirmProps
|
|
247
|
+
}), { onClick: () => Y }] }), null, 129)], 3978)), e;
|
|
248
|
+
}), s(e, () => z.value), $(e, I, null, "modalRef"), e;
|
|
249
|
+
}), s(e, () => B.value), e;
|
|
234
250
|
}, !0);
|
|
235
251
|
}
|
|
236
252
|
});
|
|
237
253
|
//#endregion
|
|
238
|
-
export {
|
|
254
|
+
export { j as default };
|