@me-framework/me-ui-antdv-next 0.0.28 → 0.0.29
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/chunks/modal-D4Tl-Qzk.js +166 -0
- package/dist/chunks/skeleton-D1-aYUPf.js +135 -0
- package/dist/index.d.ts +3 -1
- package/dist/input-gps/index.js +1 -1
- package/dist/input-gps/index.vue.d.ts +1 -1
- package/dist/input-icon-selector/index.vue.d.ts +1 -1
- package/dist/input-property/index.css +1 -0
- package/dist/input-property/index.d.ts +5 -0
- package/dist/input-property/index.js +269 -0
- package/dist/input-property/index.vue.d.ts +18 -0
- package/dist/input-property/types.d.ts +38 -0
- package/dist/input-property/validate.d.ts +18 -0
- package/dist/load-json/index.css +1 -1
- package/dist/load-json/index.js +89 -123
- package/dist/load-json/index.vue.d.ts +3 -3
- package/dist/me-ui-antdv-next.js +1758 -1532
- package/dist/me-ui-antdv-next.umd.cjs +2 -2
- package/dist/message/index.vue.d.ts +1 -1
- package/dist/modal/index.css +1 -1
- package/dist/modal/index.js +7 -1
- package/dist/modal/index.vue.d.ts +26 -5
- package/dist/modal/types.d.ts +47 -7
- package/dist/nav/index.vue.d.ts +3 -3
- package/dist/resolver/index.js +2 -1
- package/dist/skeleton/index.js +5 -138
- package/dist/style.css +1 -1
- package/dist/tree-menu/TreeMenuEdit.vue.d.ts +1 -1
- package/dist/tree-menu/index.vue.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/modal-KBZYtIHD.js +0 -178
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { t as e } from "./skeleton-D1-aYUPf.js";
|
|
2
|
+
import { Teleport as t, Transition as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, useSlots as y, watch as b, withCtx as x, withModifiers as S } from "vue";
|
|
3
|
+
import { Maximize as C, Minimize as w, X as T } from "@lucide/vue";
|
|
4
|
+
//#region src/components/modal/index.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var E = { class: "me-modal__header" }, D = { class: "me-modal__title-row" }, O = { class: "me-modal__title-text" }, k = { class: "me-modal__actions" }, A = ["title"], j = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "me-modal__footer"
|
|
8
|
+
}, M = /* @__PURE__ */ u({
|
|
9
|
+
name: "MeModal",
|
|
10
|
+
__name: "index",
|
|
11
|
+
props: {
|
|
12
|
+
open: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: !1
|
|
15
|
+
},
|
|
16
|
+
width: { default: 520 },
|
|
17
|
+
height: {},
|
|
18
|
+
position: { default: "top" },
|
|
19
|
+
offsetTop: { default: 100 },
|
|
20
|
+
offsetBottom: { default: 48 },
|
|
21
|
+
offsetLeft: { default: 16 },
|
|
22
|
+
offsetRight: { default: 16 },
|
|
23
|
+
title: {},
|
|
24
|
+
mask: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !0
|
|
27
|
+
},
|
|
28
|
+
maskClosable: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !0
|
|
31
|
+
},
|
|
32
|
+
maskStyle: {},
|
|
33
|
+
closable: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !0
|
|
36
|
+
},
|
|
37
|
+
keyboard: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: !0
|
|
40
|
+
},
|
|
41
|
+
fullscreen: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !0
|
|
44
|
+
},
|
|
45
|
+
defaultFullscreen: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
loading: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: !1
|
|
52
|
+
},
|
|
53
|
+
okText: { default: "确定" },
|
|
54
|
+
cancelText: { default: "取消" },
|
|
55
|
+
footer: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: !0
|
|
58
|
+
},
|
|
59
|
+
dividers: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: !1
|
|
62
|
+
},
|
|
63
|
+
zIndex: { default: 1e3 },
|
|
64
|
+
bodyStyle: {}
|
|
65
|
+
},
|
|
66
|
+
emits: [
|
|
67
|
+
"update:open",
|
|
68
|
+
"fullscreen-change",
|
|
69
|
+
"ok",
|
|
70
|
+
"cancel"
|
|
71
|
+
],
|
|
72
|
+
setup(u, { expose: M, emit: N }) {
|
|
73
|
+
let P = u, F = N, I = y(), L = r(() => !!I.loading), R = h(P.defaultFullscreen), z = r(() => {
|
|
74
|
+
let e = {};
|
|
75
|
+
return R.value ? (e.width = "100vw", e.height = "100vh") : (e.width = typeof P.width == "number" ? `${P.width}px` : P.width, P.height != null && (e.height = typeof P.height == "number" ? `${P.height}px` : P.height)), e;
|
|
76
|
+
}), B = r(() => {
|
|
77
|
+
if (R.value) return {
|
|
78
|
+
padding: 0,
|
|
79
|
+
alignItems: "stretch"
|
|
80
|
+
};
|
|
81
|
+
let e = P.position === "bottom" ? "flex-end" : P.position === "center" ? "center" : "flex-start";
|
|
82
|
+
return {
|
|
83
|
+
padding: `${P.offsetTop}px ${P.offsetRight}px ${P.offsetBottom}px ${P.offsetLeft}px`,
|
|
84
|
+
alignItems: e
|
|
85
|
+
};
|
|
86
|
+
}), V = () => {
|
|
87
|
+
R.value = !R.value, F("fullscreen-change", R.value);
|
|
88
|
+
}, H = (e) => {
|
|
89
|
+
F("cancel", e ?? new Event("cancel")), F("update:open", !1);
|
|
90
|
+
}, U = (e) => {
|
|
91
|
+
F("ok", e);
|
|
92
|
+
}, W = (e) => {
|
|
93
|
+
P.mask && P.maskClosable && H(e);
|
|
94
|
+
}, G = (e) => {
|
|
95
|
+
e.key === "Escape" && P.open && P.keyboard && H(e);
|
|
96
|
+
};
|
|
97
|
+
return b(() => P.open, (e) => {
|
|
98
|
+
e ? (document.body.style.overflow = "hidden", P.keyboard && window.addEventListener("keydown", G)) : (document.body.style.overflow = "", window.removeEventListener("keydown", G));
|
|
99
|
+
}), p(() => {
|
|
100
|
+
document.body.style.overflow = "", window.removeEventListener("keydown", G);
|
|
101
|
+
}), M({
|
|
102
|
+
toggleFullscreen: V,
|
|
103
|
+
isFullscreen: R
|
|
104
|
+
}), (r, p) => (m(), i(t, { to: "body" }, [l(n, { name: "me-modal" }, {
|
|
105
|
+
default: x(() => [u.open ? (m(), o("div", {
|
|
106
|
+
key: 0,
|
|
107
|
+
class: d(["me-modal", [`me-modal--${u.position}`, {
|
|
108
|
+
"me-modal--fullscreen": R.value,
|
|
109
|
+
"me-modal--dividers": u.dividers
|
|
110
|
+
}]]),
|
|
111
|
+
style: f({ "--me-modal-z": String(u.zIndex) })
|
|
112
|
+
}, [u.mask ? (m(), o("div", {
|
|
113
|
+
key: 0,
|
|
114
|
+
class: "me-modal__mask",
|
|
115
|
+
style: f(u.maskStyle),
|
|
116
|
+
onClick: W
|
|
117
|
+
}, null, 4)) : a("", !0), s("div", {
|
|
118
|
+
class: "me-modal__wrap",
|
|
119
|
+
style: f(B.value)
|
|
120
|
+
}, [s("div", {
|
|
121
|
+
class: "me-modal__panel",
|
|
122
|
+
style: f(z.value)
|
|
123
|
+
}, [
|
|
124
|
+
s("div", E, [g(r.$slots, "header", {}, () => [s("div", D, [s("span", O, [g(r.$slots, "title", {}, () => [c(_(u.title), 1)])])])]), s("div", k, [u.fullscreen ? (m(), o("button", {
|
|
125
|
+
key: 0,
|
|
126
|
+
class: "me-modal__action-btn",
|
|
127
|
+
type: "button",
|
|
128
|
+
title: R.value ? "退出全屏" : "全屏",
|
|
129
|
+
onClick: S(V, ["stop"])
|
|
130
|
+
}, [R.value ? (m(), i(v(w), {
|
|
131
|
+
key: 1,
|
|
132
|
+
size: 16
|
|
133
|
+
})) : (m(), i(v(C), {
|
|
134
|
+
key: 0,
|
|
135
|
+
size: 16
|
|
136
|
+
}))], 8, A)) : a("", !0), u.closable ? (m(), o("button", {
|
|
137
|
+
key: 1,
|
|
138
|
+
class: "me-modal__action-btn",
|
|
139
|
+
type: "button",
|
|
140
|
+
title: "关闭",
|
|
141
|
+
onClick: S(H, ["stop"])
|
|
142
|
+
}, [l(v(T), { size: 16 })])) : a("", !0)])]),
|
|
143
|
+
s("div", {
|
|
144
|
+
class: "me-modal__body",
|
|
145
|
+
style: f(u.bodyStyle)
|
|
146
|
+
}, [u.loading && L.value ? g(r.$slots, "loading", {}, void 0, void 0, 0) : u.loading ? (m(), i(e, {
|
|
147
|
+
key: 1,
|
|
148
|
+
animated: "",
|
|
149
|
+
preset: "text",
|
|
150
|
+
rows: 4,
|
|
151
|
+
class: "me-modal__skeleton"
|
|
152
|
+
})) : g(r.$slots, "default", {}, void 0, void 0, 2)], 4),
|
|
153
|
+
u.footer ? (m(), o("div", j, [g(r.$slots, "footer", {}, () => [s("span", {
|
|
154
|
+
class: "me-modal__btn me-modal__btn--default",
|
|
155
|
+
onClick: H
|
|
156
|
+
}, _(u.cancelText), 1), s("span", {
|
|
157
|
+
class: "me-modal__btn me-modal__btn--primary",
|
|
158
|
+
onClick: U
|
|
159
|
+
}, _(u.okText), 1)])])) : a("", !0)
|
|
160
|
+
], 4)], 4)], 6)) : a("", !0)]),
|
|
161
|
+
_: 3
|
|
162
|
+
})]));
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
//#endregion
|
|
166
|
+
export { M as t };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, mergeProps as o, normalizeClass as s, normalizeStyle as c, openBlock as l, renderList as u, renderSlot as d } from "vue";
|
|
2
|
+
//#region src/components/skeleton/index.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var f = { class: "me-skeleton__card-body" }, p = { class: "me-skeleton__avatar-content" }, m = { class: "me-skeleton__list-content" }, h = /* @__PURE__ */ a({
|
|
4
|
+
name: "MeSkeleton",
|
|
5
|
+
__name: "index",
|
|
6
|
+
props: {
|
|
7
|
+
preset: { default: "text" },
|
|
8
|
+
loading: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: !0
|
|
11
|
+
},
|
|
12
|
+
animated: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: !0
|
|
15
|
+
},
|
|
16
|
+
rows: { default: void 0 },
|
|
17
|
+
height: { default: void 0 },
|
|
18
|
+
rowHeight: { default: 16 },
|
|
19
|
+
rowGap: { default: 12 },
|
|
20
|
+
avatar: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: !0
|
|
23
|
+
},
|
|
24
|
+
avatarSize: { default: 36 },
|
|
25
|
+
avatarShape: { default: "circle" },
|
|
26
|
+
titleWidth: { default: .5 },
|
|
27
|
+
lastRowWidth: { default: .7 },
|
|
28
|
+
cardImage: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !0
|
|
31
|
+
},
|
|
32
|
+
cardImageHeight: { default: 120 }
|
|
33
|
+
},
|
|
34
|
+
setup(a) {
|
|
35
|
+
let h = a, g = t(() => {
|
|
36
|
+
if (h.rows !== void 0 && h.rows > 0) return h.rows;
|
|
37
|
+
if (h.height) {
|
|
38
|
+
let e = typeof h.height == "number" ? h.height : parseFloat(h.height);
|
|
39
|
+
if (!isNaN(e) && e > 0) return Math.max(1, Math.floor((e + h.rowGap) / (h.rowHeight + h.rowGap)));
|
|
40
|
+
}
|
|
41
|
+
return h.preset === "article" ? 5 : (h.preset === "text" || h.preset, 3);
|
|
42
|
+
}), _ = t(() => h.rows !== void 0 && h.rows > 0 ? h.rows : 2), v = t(() => {
|
|
43
|
+
if (h.rows !== void 0 && h.rows > 0) return h.rows;
|
|
44
|
+
if (h.height) {
|
|
45
|
+
let e = typeof h.height == "number" ? h.height : parseFloat(h.height);
|
|
46
|
+
if (!isNaN(e) && e > 0) {
|
|
47
|
+
let t = h.avatarSize + 8;
|
|
48
|
+
return Math.max(1, Math.floor(e / t));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return 3;
|
|
52
|
+
}), y = t(() => Math.min(1, Math.max(.1, h.titleWidth))), b = t(() => Math.min(1, Math.max(.1, h.lastRowWidth))), x = (e, t) => t <= 1 ? .6 : e === t ? b.value : .85 + (Math.sin(e * 1.7 + .5) * .5 + .5) * .15000000000000002, S = (e, t) => {
|
|
53
|
+
let n = {
|
|
54
|
+
height: `${h.rowHeight}px`,
|
|
55
|
+
width: `${x(e, t) * 100}%`
|
|
56
|
+
};
|
|
57
|
+
return e > 1 && (n.marginTop = `${h.rowGap}px`), n;
|
|
58
|
+
}, C = t(() => {
|
|
59
|
+
let e = {};
|
|
60
|
+
return h.height && h.preset !== "card" && h.preset !== "avatar" && (e.height = typeof h.height == "number" ? `${h.height}px` : h.height), e;
|
|
61
|
+
});
|
|
62
|
+
return (t, b) => h.loading ? (l(), r("div", o({
|
|
63
|
+
key: 0,
|
|
64
|
+
class: ["me-skeleton", [`me-skeleton--${h.preset}`, { "me-skeleton--animated": h.animated }]],
|
|
65
|
+
style: C.value
|
|
66
|
+
}, t.$attrs), [h.preset === "card" ? (l(), r(e, { key: 0 }, [h.cardImage ? (l(), r("div", {
|
|
67
|
+
key: 0,
|
|
68
|
+
class: "me-skeleton__card-image me-skeleton__block",
|
|
69
|
+
style: c({ height: `${h.cardImageHeight}px` })
|
|
70
|
+
}, null, 4)) : n("", !0), i("div", f, [i("div", {
|
|
71
|
+
class: "me-skeleton__row me-skeleton__block me-skeleton__row--title",
|
|
72
|
+
style: c({
|
|
73
|
+
height: `${a.rowHeight}px`,
|
|
74
|
+
width: `${y.value * 100}%`
|
|
75
|
+
})
|
|
76
|
+
}, null, 4), (l(!0), r(e, null, u(_.value, (e) => (l(), r("div", {
|
|
77
|
+
key: e,
|
|
78
|
+
class: "me-skeleton__row me-skeleton__block",
|
|
79
|
+
style: c(S(e, _.value))
|
|
80
|
+
}, null, 4))), 128))])], 64)) : h.preset === "avatar" ? (l(), r(e, { key: 1 }, [h.avatar ? (l(), r("div", {
|
|
81
|
+
key: 0,
|
|
82
|
+
class: s(["me-skeleton__avatar me-skeleton__block", [h.avatarShape === "circle" ? "me-skeleton__avatar--circle" : "me-skeleton__avatar--square"]]),
|
|
83
|
+
style: c({
|
|
84
|
+
width: `${h.avatarSize}px`,
|
|
85
|
+
height: `${h.avatarSize}px`
|
|
86
|
+
})
|
|
87
|
+
}, null, 6)) : n("", !0), i("div", p, [i("div", {
|
|
88
|
+
class: "me-skeleton__row me-skeleton__block me-skeleton__row--title",
|
|
89
|
+
style: c({
|
|
90
|
+
height: `${a.rowHeight}px`,
|
|
91
|
+
width: `${y.value * 100}%`
|
|
92
|
+
})
|
|
93
|
+
}, null, 4), i("div", {
|
|
94
|
+
class: "me-skeleton__row me-skeleton__block",
|
|
95
|
+
style: c({
|
|
96
|
+
height: `${a.rowHeight}px`,
|
|
97
|
+
marginTop: `${a.rowGap}px`,
|
|
98
|
+
width: "85%"
|
|
99
|
+
})
|
|
100
|
+
}, null, 4)])], 64)) : h.preset === "article" ? (l(), r(e, { key: 2 }, [i("div", {
|
|
101
|
+
class: "me-skeleton__row me-skeleton__block me-skeleton__row--title",
|
|
102
|
+
style: c({
|
|
103
|
+
height: `${a.rowHeight}px`,
|
|
104
|
+
width: `${y.value * 100}%`,
|
|
105
|
+
marginBottom: `${a.rowGap + 8}px`
|
|
106
|
+
})
|
|
107
|
+
}, null, 4), (l(!0), r(e, null, u(g.value, (e) => (l(), r("div", {
|
|
108
|
+
key: e,
|
|
109
|
+
class: "me-skeleton__row me-skeleton__block",
|
|
110
|
+
style: c(S(e, g.value))
|
|
111
|
+
}, null, 4))), 128))], 64)) : h.preset === "list" ? (l(!0), r(e, { key: 3 }, u(v.value, (e) => (l(), r("div", {
|
|
112
|
+
key: e,
|
|
113
|
+
class: "me-skeleton__list-item"
|
|
114
|
+
}, [b[0] ||= i("div", { class: "me-skeleton__list-avatar me-skeleton__block" }, null, -1), i("div", m, [i("div", {
|
|
115
|
+
class: "me-skeleton__row me-skeleton__block",
|
|
116
|
+
style: c({
|
|
117
|
+
height: `${a.rowHeight}px`,
|
|
118
|
+
width: `${e % 2 == 0 ? 50 : 40}%`
|
|
119
|
+
})
|
|
120
|
+
}, null, 4), i("div", {
|
|
121
|
+
class: "me-skeleton__row me-skeleton__block",
|
|
122
|
+
style: c({
|
|
123
|
+
height: `${a.rowHeight}px`,
|
|
124
|
+
marginTop: `${a.rowGap}px`,
|
|
125
|
+
width: `${e % 3 == 0 ? 90 : 75}%`
|
|
126
|
+
})
|
|
127
|
+
}, null, 4)])]))), 128)) : (l(!0), r(e, { key: 4 }, u(g.value, (e) => (l(), r("div", {
|
|
128
|
+
key: e,
|
|
129
|
+
class: "me-skeleton__row me-skeleton__block",
|
|
130
|
+
style: c(S(e, g.value))
|
|
131
|
+
}, null, 4))), 128))], 16)) : d(t.$slots, "default", {}, void 0, void 0, 1);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
//#endregion
|
|
135
|
+
export { h as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,8 +15,9 @@ import { default as MeLoadJson } from './load-json';
|
|
|
15
15
|
import { default as MeLoginPage } from './login-page';
|
|
16
16
|
import { default as MeCard } from './card';
|
|
17
17
|
import { default as MeSkeleton } from './skeleton';
|
|
18
|
+
import { default as MeInputProperty } from './input-property';
|
|
18
19
|
declare const install: (app: App) => void;
|
|
19
|
-
export { MeMessage, MeMessageComponent, MeIcon, MeBox, MeBreadcrumb, MeBody, MeMenu, MeNav, MeModal, MeTreeMenu, MeInputGps, MeInputIconSelector, MeInputRadio, MeLoadJson, MeLoginPage, MeCard, MeSkeleton, install };
|
|
20
|
+
export { MeMessage, MeMessageComponent, MeIcon, MeBox, MeBreadcrumb, MeBody, MeMenu, MeNav, MeModal, MeTreeMenu, MeInputGps, MeInputIconSelector, MeInputRadio, MeLoadJson, MeLoginPage, MeCard, MeSkeleton, MeInputProperty, install };
|
|
20
21
|
export { MeMessage as $message } from './message';
|
|
21
22
|
export { loadIconfont } from './icon';
|
|
22
23
|
declare const _default: {
|
|
@@ -41,3 +42,4 @@ export * from './load-json';
|
|
|
41
42
|
export * from './login-page';
|
|
42
43
|
export * from './card';
|
|
43
44
|
export * from './skeleton';
|
|
45
|
+
export * from './input-property';
|
package/dist/input-gps/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e from "../icon/index.js";
|
|
2
|
-
import
|
|
2
|
+
import t from "../modal/index.js";
|
|
3
3
|
import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, nextTick as d, normalizeStyle as f, onMounted as p, openBlock as m, ref as h, resolveComponent as g, shallowRef as _, toDisplayString as v, unref as y, watch as b, withCtx as x } from "vue";
|
|
4
4
|
import S from "@amap/amap-jsapi-loader";
|
|
5
5
|
//#region src/components/input-gps/map.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -14,8 +14,8 @@ declare const __VLS_export: import('vue').DefineComponent<MeInputGpsProps, {}, {
|
|
|
14
14
|
address: string;
|
|
15
15
|
}) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
|
-
placeholder: string;
|
|
18
17
|
disabled: boolean;
|
|
18
|
+
placeholder: string;
|
|
19
19
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const _default: typeof __VLS_export;
|
|
21
21
|
export default _default;
|
|
@@ -13,9 +13,9 @@ declare const __VLS_base: import('vue').DefineComponent<MeInputIconSelectorProps
|
|
|
13
13
|
size: "large" | "middle" | "small";
|
|
14
14
|
iconfontPrefix: string;
|
|
15
15
|
iconfontMode: "class" | "symbol";
|
|
16
|
+
disabled: boolean;
|
|
16
17
|
modelValue: string;
|
|
17
18
|
placeholder: string;
|
|
18
|
-
disabled: boolean;
|
|
19
19
|
sources: MeInputIconSelectorSource[];
|
|
20
20
|
iconfontData: string[];
|
|
21
21
|
searchPlaceholder: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.me-input-property{width:100%;position:relative}.me-input-property__toolbar{justify-content:flex-end;margin-bottom:8px;display:flex}.me-input-property__add-btn{font-size:13px}.me-input-property__table{width:100%}.me-input-property__table .ant-table-row.me-input-property__row--ghost td{opacity:.4;background:#1677ff0a}.me-input-property__drop-line{background:var(--me-primary,#1677ff);pointer-events:none;z-index:9;border-radius:2px;height:2px;display:none;position:absolute;left:0;box-shadow:0 0 0 1px #fffc}.me-input-property__drag-fallback{opacity:.9;background:#fff;border:1px solid #d9d9d9;border-radius:6px;width:320px;display:table;box-shadow:0 4px 12px #00000026}.me-input-property__drag-fallback td{background:0 0;padding:8px 12px}.me-input-property__actions{align-items:center;gap:2px;display:inline-flex}.me-input-property__drag{cursor:grab;color:#999;border-radius:4px;justify-content:center;align-items:center;padding:2px;display:inline-flex}.me-input-property__drag:active{cursor:grabbing;color:var(--me-primary,#1677ff)}.me-input-property__drag:hover{color:var(--me-primary,#1677ff);background:#0000000a}.me-input-property__del{color:#999}.me-input-property__del:hover{color:#ff4d4f}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import e from "../icon/index.js";
|
|
2
|
+
import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, nextTick as l, onMounted as u, openBlock as d, reactive as f, ref as p, resolveComponent as m, unref as h, watch as g, withCtx as _ } from "vue";
|
|
3
|
+
import { useDraggable as v } from "vue-draggable-plus";
|
|
4
|
+
//#region src/components/input-property/validate.ts
|
|
5
|
+
function y() {
|
|
6
|
+
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
7
|
+
}
|
|
8
|
+
function b(e) {
|
|
9
|
+
return e.trim().toLowerCase();
|
|
10
|
+
}
|
|
11
|
+
function x(e) {
|
|
12
|
+
let t = /* @__PURE__ */ new Map(), n = [];
|
|
13
|
+
for (let r of e) {
|
|
14
|
+
let e = b(r.key);
|
|
15
|
+
if (e) {
|
|
16
|
+
if (t.has(e)) {
|
|
17
|
+
let i = t.get(e);
|
|
18
|
+
n.includes(i) || n.push(i);
|
|
19
|
+
let a = r.key.trim();
|
|
20
|
+
n.includes(a) || n.push(a);
|
|
21
|
+
} else t.set(e, r.key.trim());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
function S(e, t) {
|
|
27
|
+
if (!e) return !1;
|
|
28
|
+
let n = b(e);
|
|
29
|
+
return t.some((e) => b(e) === n);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/components/input-property/index.vue?vue&type=script&setup=true&lang.ts
|
|
33
|
+
var C = { class: "me-input-property__toolbar" }, w = {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "me-input-property__actions"
|
|
36
|
+
}, T = {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: "me-input-property__drag",
|
|
39
|
+
title: "拖拽排序"
|
|
40
|
+
}, E = /* @__PURE__ */ c({
|
|
41
|
+
name: "MeInputProperty",
|
|
42
|
+
__name: "index",
|
|
43
|
+
props: {
|
|
44
|
+
modelValue: { default: () => ({}) },
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
size: { default: "middle" },
|
|
50
|
+
draggable: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: !0
|
|
53
|
+
},
|
|
54
|
+
keyPlaceholder: { default: "请输入 key" },
|
|
55
|
+
valuePlaceholder: { default: "请输入 value" },
|
|
56
|
+
emptyText: { default: "暂无属性,点击「新增属性」添加" }
|
|
57
|
+
},
|
|
58
|
+
emits: ["update:modelValue", "change"],
|
|
59
|
+
setup(c, { emit: b }) {
|
|
60
|
+
let E = c, D = b, O = p([]), k = p([]), A = !1, j = t(() => [
|
|
61
|
+
{
|
|
62
|
+
title: "Key",
|
|
63
|
+
key: "key",
|
|
64
|
+
dataIndex: "key",
|
|
65
|
+
width: 180
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: "Value",
|
|
69
|
+
key: "value",
|
|
70
|
+
dataIndex: "value"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: "操作",
|
|
74
|
+
key: "action",
|
|
75
|
+
dataIndex: "action",
|
|
76
|
+
width: 72,
|
|
77
|
+
align: "center"
|
|
78
|
+
}
|
|
79
|
+
]), M = t(() => E.draggable && !E.disabled);
|
|
80
|
+
function N(e) {
|
|
81
|
+
O.value = Object.entries(e).map(([e, t]) => ({
|
|
82
|
+
id: y(),
|
|
83
|
+
key: e,
|
|
84
|
+
value: t
|
|
85
|
+
})), z();
|
|
86
|
+
}
|
|
87
|
+
function P() {
|
|
88
|
+
let e = {};
|
|
89
|
+
for (let t of O.value) {
|
|
90
|
+
let n = t.key.trim();
|
|
91
|
+
n && (e[n] = t.value);
|
|
92
|
+
}
|
|
93
|
+
A = !0, D("update:modelValue", e), D("change", e);
|
|
94
|
+
}
|
|
95
|
+
g(() => E.modelValue, (e) => {
|
|
96
|
+
if (e) {
|
|
97
|
+
if (A) {
|
|
98
|
+
A = !1;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
N(e);
|
|
102
|
+
}
|
|
103
|
+
}, { immediate: !0 });
|
|
104
|
+
function F(e) {
|
|
105
|
+
z(), P();
|
|
106
|
+
}
|
|
107
|
+
function I(e) {
|
|
108
|
+
z(), P();
|
|
109
|
+
}
|
|
110
|
+
function L() {
|
|
111
|
+
O.value = [...O.value, {
|
|
112
|
+
id: y(),
|
|
113
|
+
key: "",
|
|
114
|
+
value: ""
|
|
115
|
+
}], z(), P();
|
|
116
|
+
}
|
|
117
|
+
function R(e) {
|
|
118
|
+
let t = O.value.indexOf(e);
|
|
119
|
+
t !== -1 && (O.value.splice(t, 1), z(), P());
|
|
120
|
+
}
|
|
121
|
+
function z() {
|
|
122
|
+
k.value = x(O.value);
|
|
123
|
+
}
|
|
124
|
+
function B(e) {
|
|
125
|
+
return S(e, k.value);
|
|
126
|
+
}
|
|
127
|
+
function V(e) {
|
|
128
|
+
return B(e) ? "Key 不能重复(忽略大小写)" : "";
|
|
129
|
+
}
|
|
130
|
+
let H = p(null), U = p(null);
|
|
131
|
+
function W() {
|
|
132
|
+
U.value ||= H.value?.querySelector("tbody") ?? null;
|
|
133
|
+
}
|
|
134
|
+
u(async () => {
|
|
135
|
+
await l(), W(), U.value && Y.start(U.value);
|
|
136
|
+
});
|
|
137
|
+
let G = p(null);
|
|
138
|
+
function K() {
|
|
139
|
+
G.value && (G.value.style.display = "none");
|
|
140
|
+
}
|
|
141
|
+
function q(e) {
|
|
142
|
+
let t = U.value, n = H.value, r = G.value, i = e?.related, a = i instanceof Element ? i.closest("tr") : null;
|
|
143
|
+
if (!t || !n || !r || !a || !t.contains(a)) {
|
|
144
|
+
K();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
let o = a.getBoundingClientRect(), s = n.getBoundingClientRect(), c = e.willInsertAfter ? o.bottom : o.top;
|
|
148
|
+
r.style.top = `${c - s.top - 1}px`, r.style.left = "0px", r.style.width = `${n.clientWidth}px`, r.style.display = "block";
|
|
149
|
+
}
|
|
150
|
+
let J = f({
|
|
151
|
+
handle: ".me-input-property__drag",
|
|
152
|
+
animation: 150,
|
|
153
|
+
forceFallback: !0,
|
|
154
|
+
fallbackOnBody: !0,
|
|
155
|
+
fallbackClass: "me-input-property__drag-fallback",
|
|
156
|
+
ghostClass: "me-input-property__row--ghost",
|
|
157
|
+
disabled: t(() => !M.value),
|
|
158
|
+
onStart: () => K(),
|
|
159
|
+
onMove: ((e) => (q(e), !0)),
|
|
160
|
+
onEnd: () => {
|
|
161
|
+
K(), z(), P();
|
|
162
|
+
}
|
|
163
|
+
}), Y = v(U, O, {
|
|
164
|
+
...J,
|
|
165
|
+
immediate: !1
|
|
166
|
+
});
|
|
167
|
+
return g(M, (e) => {
|
|
168
|
+
Y.option("disabled", !e);
|
|
169
|
+
}), (t, l) => {
|
|
170
|
+
let u = m("a-button"), f = m("a-input"), p = m("a-tooltip"), g = m("a-table");
|
|
171
|
+
return d(), i("div", {
|
|
172
|
+
ref_key: "rootEl",
|
|
173
|
+
ref: H,
|
|
174
|
+
class: "me-input-property"
|
|
175
|
+
}, [
|
|
176
|
+
a("div", C, [s(u, {
|
|
177
|
+
size: "small",
|
|
178
|
+
class: "me-input-property__add-btn",
|
|
179
|
+
disabled: c.disabled,
|
|
180
|
+
onClick: L
|
|
181
|
+
}, {
|
|
182
|
+
icon: _(() => [s(h(e), {
|
|
183
|
+
name: "Plus",
|
|
184
|
+
size: 14
|
|
185
|
+
})]),
|
|
186
|
+
default: _(() => [l[0] ||= o(" 新增属性 ", -1)]),
|
|
187
|
+
_: 1
|
|
188
|
+
}, 8, ["disabled"])]),
|
|
189
|
+
s(g, {
|
|
190
|
+
columns: j.value,
|
|
191
|
+
"data-source": O.value,
|
|
192
|
+
"row-key": (e) => e.id,
|
|
193
|
+
pagination: !1,
|
|
194
|
+
size: c.size,
|
|
195
|
+
locale: { emptyText: c.emptyText },
|
|
196
|
+
class: "me-input-property__table"
|
|
197
|
+
}, {
|
|
198
|
+
bodyCell: _(({ column: t, record: a }) => [t.key === "action" ? (d(), i("div", w, [M.value ? (d(), i("span", T, [s(h(e), {
|
|
199
|
+
name: "GripVertical",
|
|
200
|
+
size: 14
|
|
201
|
+
})])) : r("", !0), s(u, {
|
|
202
|
+
type: "text",
|
|
203
|
+
size: "small",
|
|
204
|
+
class: "me-input-property__del",
|
|
205
|
+
disabled: c.disabled,
|
|
206
|
+
title: "删除该属性",
|
|
207
|
+
onClick: (e) => R(a)
|
|
208
|
+
}, {
|
|
209
|
+
default: _(() => [s(h(e), {
|
|
210
|
+
name: "Trash2",
|
|
211
|
+
size: 14
|
|
212
|
+
})]),
|
|
213
|
+
_: 1
|
|
214
|
+
}, 8, ["disabled", "onClick"])])) : t.key === "key" ? (d(), n(p, {
|
|
215
|
+
key: 1,
|
|
216
|
+
title: c.disabled ? "" : V(a.key),
|
|
217
|
+
visible: !c.disabled && B(a.key)
|
|
218
|
+
}, {
|
|
219
|
+
default: _(() => [s(f, {
|
|
220
|
+
value: a.key,
|
|
221
|
+
"onUpdate:value": [(e) => a.key = e, (e) => F(a)],
|
|
222
|
+
disabled: c.disabled,
|
|
223
|
+
placeholder: c.keyPlaceholder,
|
|
224
|
+
status: !c.disabled && B(a.key) ? "error" : ""
|
|
225
|
+
}, null, 8, [
|
|
226
|
+
"value",
|
|
227
|
+
"onUpdate:value",
|
|
228
|
+
"disabled",
|
|
229
|
+
"placeholder",
|
|
230
|
+
"status"
|
|
231
|
+
])]),
|
|
232
|
+
_: 2
|
|
233
|
+
}, 1032, ["title", "visible"])) : t.key === "value" ? (d(), n(f, {
|
|
234
|
+
key: 2,
|
|
235
|
+
value: a.value,
|
|
236
|
+
"onUpdate:value": [(e) => a.value = e, (e) => I(a)],
|
|
237
|
+
disabled: c.disabled,
|
|
238
|
+
placeholder: c.valuePlaceholder
|
|
239
|
+
}, null, 8, [
|
|
240
|
+
"value",
|
|
241
|
+
"onUpdate:value",
|
|
242
|
+
"disabled",
|
|
243
|
+
"placeholder"
|
|
244
|
+
])) : r("", !0)]),
|
|
245
|
+
_: 1
|
|
246
|
+
}, 8, [
|
|
247
|
+
"columns",
|
|
248
|
+
"data-source",
|
|
249
|
+
"row-key",
|
|
250
|
+
"size",
|
|
251
|
+
"locale"
|
|
252
|
+
]),
|
|
253
|
+
a("div", {
|
|
254
|
+
ref_key: "dropLineEl",
|
|
255
|
+
ref: G,
|
|
256
|
+
class: "me-input-property__drop-line"
|
|
257
|
+
}, null, 512)
|
|
258
|
+
], 512);
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/components/input-property/index.ts
|
|
264
|
+
E.install = (e) => {
|
|
265
|
+
e.component("MeInputProperty", E);
|
|
266
|
+
};
|
|
267
|
+
var D = E;
|
|
268
|
+
//#endregion
|
|
269
|
+
export { E as MeInputProperty, x as checkDuplicateKeys, D as default, y as genId, S as isDuplicateKey, b as normalizeKey };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MeInputPropertyProps } from './types';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<MeInputPropertyProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
3
|
+
change: (value: Record<string, any>) => any;
|
|
4
|
+
"update:modelValue": (value: Record<string, any>) => any;
|
|
5
|
+
}, string, import('vue').PublicProps, Readonly<MeInputPropertyProps> & Readonly<{
|
|
6
|
+
onChange?: ((value: Record<string, any>) => any) | undefined;
|
|
7
|
+
"onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
size: "small" | "middle" | "large";
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
modelValue: Record<string, any>;
|
|
12
|
+
draggable: boolean;
|
|
13
|
+
keyPlaceholder: string;
|
|
14
|
+
valuePlaceholder: string;
|
|
15
|
+
emptyText: string;
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MeInputProperty 属性编辑器组件类型定义
|
|
3
|
+
*/
|
|
4
|
+
/** 内部行数据(一维属性项) */
|
|
5
|
+
export interface PropertyKV {
|
|
6
|
+
/** 行唯一 id(组件内部生成,用于定位编辑行,避免 key 变更导致表格重建) */
|
|
7
|
+
id: string | number;
|
|
8
|
+
/** 属性键 */
|
|
9
|
+
key: string;
|
|
10
|
+
/** 属性值(原始值,统一按 string 编辑) */
|
|
11
|
+
value: any;
|
|
12
|
+
}
|
|
13
|
+
/** MeInputProperty Props */
|
|
14
|
+
export interface MeInputPropertyProps {
|
|
15
|
+
/** v-model 绑定的一维 JSON 对象 */
|
|
16
|
+
modelValue?: Record<string, any>;
|
|
17
|
+
/** 是否禁用编辑(只读展示) */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** 表格尺寸 */
|
|
20
|
+
size?: 'small' | 'middle' | 'large';
|
|
21
|
+
/** 是否允许拖拽排序,默认 true */
|
|
22
|
+
draggable?: boolean;
|
|
23
|
+
/** key 列占位符 */
|
|
24
|
+
keyPlaceholder?: string;
|
|
25
|
+
/** value 列占位符 */
|
|
26
|
+
valuePlaceholder?: string;
|
|
27
|
+
/** 空数据提示 */
|
|
28
|
+
emptyText?: string;
|
|
29
|
+
}
|
|
30
|
+
/** MeInputProperty Events */
|
|
31
|
+
export interface MeInputPropertyEmits {
|
|
32
|
+
/** 更新 v-model 绑定对象 */
|
|
33
|
+
(e: 'update:modelValue', value: Record<string, any>): void;
|
|
34
|
+
/** 数据变更(新增/删除/编辑/排序) */
|
|
35
|
+
(e: 'change', value: Record<string, any>): void;
|
|
36
|
+
}
|
|
37
|
+
/** MeInputProperty 组件实例类型 */
|
|
38
|
+
export type MeInputPropertyInstance = InstanceType<typeof import('./index.vue').default>;
|