lovelymaid 1.0.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/dist/App.vue.d.ts +3 -0
- package/dist/components/MyActionButton.vue.d.ts +18 -0
- package/dist/components/MyContentBar.vue.d.ts +19 -0
- package/dist/components/MyFoldList.vue.d.ts +29 -0
- package/dist/components/MySearch.vue.d.ts +9 -0
- package/dist/components/MySideBar.vue.d.ts +17 -0
- package/dist/index.d.ts +6 -0
- package/dist/lovelymaid.es.js +258 -0
- package/dist/lovelymaid.umd.js +1 -0
- package/dist/maid.css +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/utils/getSlideCount.d.ts +3 -0
- package/package.json +25 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
onItemClick?: (index: number) => void;
|
|
3
|
+
}
|
|
4
|
+
declare var __VLS_2: `item-${number}`, __VLS_3: {
|
|
5
|
+
index: number;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
[K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** 是否打开 */
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
/** 点击关闭按钮事件 */
|
|
5
|
+
onCloseClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare var __VLS_1: {};
|
|
8
|
+
type __VLS_Slots = {} & {
|
|
9
|
+
default?: (props: typeof __VLS_1) => any;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** 要渲染的列表 */
|
|
3
|
+
list: {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
}[];
|
|
7
|
+
/** 激活项索引 */
|
|
8
|
+
activeIndex: number;
|
|
9
|
+
/** 头部点击事件 */
|
|
10
|
+
onHeaderClick?: () => void;
|
|
11
|
+
/** 列表项点击事件 */
|
|
12
|
+
onItemClick?: (item: {
|
|
13
|
+
id: number;
|
|
14
|
+
name: string;
|
|
15
|
+
}, index: number) => void;
|
|
16
|
+
}
|
|
17
|
+
declare var __VLS_1: {};
|
|
18
|
+
type __VLS_Slots = {} & {
|
|
19
|
+
title?: (props: typeof __VLS_1) => any;
|
|
20
|
+
};
|
|
21
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
26
|
+
new (): {
|
|
27
|
+
$slots: S;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** 输入框提示词 */
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
/** 回车搜索事件 */
|
|
5
|
+
onSearch?: (inputValue: string) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** 点击切换按钮事件 */
|
|
3
|
+
onSwitch?: (value: boolean) => void;
|
|
4
|
+
}
|
|
5
|
+
declare var __VLS_1: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_1) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import MyActionButton from './components/MyActionButton.vue';
|
|
2
|
+
import MyContentBar from './components/MyContentBar.vue';
|
|
3
|
+
import MyFoldList from './components/MyFoldList.vue';
|
|
4
|
+
import MySearch from './components/MySearch.vue';
|
|
5
|
+
import MySideBar from './components/MySideBar.vue';
|
|
6
|
+
export { MyActionButton, MyContentBar, MyFoldList, MySearch, MySideBar };
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { defineComponent as g, ref as c, useSlots as B, computed as F, createElementBlock as p, openBlock as m, withModifiers as C, createCommentVNode as M, normalizeStyle as k, Fragment as x, renderList as z, createElementVNode as f, renderSlot as S, onMounted as b, onUnmounted as E, normalizeClass as $, createTextVNode as T, watch as I, toDisplayString as L, nextTick as X, withDirectives as O, withKeys as A, vModelText as H } from "vue";
|
|
2
|
+
const R = ["onClick"], P = /* @__PURE__ */ g({
|
|
3
|
+
__name: "MyActionButton",
|
|
4
|
+
props: {
|
|
5
|
+
onItemClick: { type: Function }
|
|
6
|
+
},
|
|
7
|
+
setup(l) {
|
|
8
|
+
const i = l, n = c(!1), a = c(0), r = c(0), u = (e) => {
|
|
9
|
+
n.value || (n.value = !0, a.value = e.offsetX, r.value = e.offsetY, setTimeout(() => {
|
|
10
|
+
const t = () => {
|
|
11
|
+
n.value = !1, e.target.removeEventListener("click", t), document.removeEventListener("click", t);
|
|
12
|
+
};
|
|
13
|
+
e.target.addEventListener("click", t), document.addEventListener("click", t);
|
|
14
|
+
}, 0));
|
|
15
|
+
}, d = B(), o = F(() => {
|
|
16
|
+
const e = [];
|
|
17
|
+
let t = 0;
|
|
18
|
+
for (; d[`item-${t}`]; )
|
|
19
|
+
e.push(t), t++;
|
|
20
|
+
return e;
|
|
21
|
+
});
|
|
22
|
+
return (e, t) => (m(), p("span", {
|
|
23
|
+
class: "iconfont icon-info",
|
|
24
|
+
onClick: C(u, ["stop"]),
|
|
25
|
+
style: { "user-select": "none", "--z-index": "10" }
|
|
26
|
+
}, [
|
|
27
|
+
n.value ? (m(), p("ul", {
|
|
28
|
+
key: 0,
|
|
29
|
+
style: k({ left: `${a.value}px`, top: `${r.value}px` })
|
|
30
|
+
}, [
|
|
31
|
+
(m(!0), p(x, null, z(o.value, (s) => (m(), p("li", { key: s }, [
|
|
32
|
+
f("div", {
|
|
33
|
+
class: "inner",
|
|
34
|
+
onClick: (v) => i.onItemClick?.(s)
|
|
35
|
+
}, [
|
|
36
|
+
S(e.$slots, `item-${s}`, { index: s }, void 0, !0)
|
|
37
|
+
], 8, R)
|
|
38
|
+
]))), 128))
|
|
39
|
+
], 4)) : M("", !0)
|
|
40
|
+
]));
|
|
41
|
+
}
|
|
42
|
+
}), _ = (l, i) => {
|
|
43
|
+
const n = l.__vccOpts || l;
|
|
44
|
+
for (const [a, r] of i)
|
|
45
|
+
n[a] = r;
|
|
46
|
+
return n;
|
|
47
|
+
}, ee = /* @__PURE__ */ _(P, [["__scopeId", "data-v-cd43f472"]]), V = /* @__PURE__ */ g({
|
|
48
|
+
__name: "MyContentBar",
|
|
49
|
+
props: {
|
|
50
|
+
isOpen: { type: Boolean },
|
|
51
|
+
onCloseClick: { type: Function }
|
|
52
|
+
},
|
|
53
|
+
setup(l) {
|
|
54
|
+
const i = l, n = c(null), a = c(0), r = c(!1), u = () => {
|
|
55
|
+
const e = n.value;
|
|
56
|
+
if (!e) return;
|
|
57
|
+
let t = 0, s = e;
|
|
58
|
+
for (; s; )
|
|
59
|
+
t += s.offsetLeft, s = s.offsetParent;
|
|
60
|
+
const v = e.offsetWidth;
|
|
61
|
+
a.value = t + v + 10, setTimeout(() => r.value = !0, 100);
|
|
62
|
+
};
|
|
63
|
+
let d;
|
|
64
|
+
const o = () => {
|
|
65
|
+
clearTimeout(d), d = setTimeout(() => u(), 100);
|
|
66
|
+
};
|
|
67
|
+
return b(() => {
|
|
68
|
+
u(), window.addEventListener("resize", o);
|
|
69
|
+
}), E(() => {
|
|
70
|
+
window.removeEventListener("resize", o);
|
|
71
|
+
}), (e, t) => (m(), p("div", {
|
|
72
|
+
class: "container",
|
|
73
|
+
ref_key: "containerRef",
|
|
74
|
+
ref: n,
|
|
75
|
+
style: k({ transition: r.value ? "transform .5s ease" : "none", transform: i.isOpen ? "translateX(0)" : `translateX(-${a.value}px)`, userSelect: "none" })
|
|
76
|
+
}, [
|
|
77
|
+
f("div", {
|
|
78
|
+
class: $(["icon", { close: !l.isOpen }]),
|
|
79
|
+
onClick: t[0] || (t[0] = //@ts-ignore
|
|
80
|
+
(...s) => l.onCloseClick && l.onCloseClick(...s)),
|
|
81
|
+
title: "收起内容栏"
|
|
82
|
+
}, [...t[1] || (t[1] = [
|
|
83
|
+
f("span", { class: "iconfont icon-iconguanbi" }, null, -1)
|
|
84
|
+
])], 2),
|
|
85
|
+
S(e.$slots, "default", {}, () => [
|
|
86
|
+
t[2] || (t[2] = T("这是内容", -1))
|
|
87
|
+
], !0)
|
|
88
|
+
], 4));
|
|
89
|
+
}
|
|
90
|
+
}), te = /* @__PURE__ */ _(V, [["__scopeId", "data-v-1b0264e6"]]), D = (l, i) => {
|
|
91
|
+
const n = new Array(l.length), a = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
|
|
92
|
+
for (let o = 0; o < i.length; o++) {
|
|
93
|
+
const e = i[o].id;
|
|
94
|
+
a.add(e), r.set(e, o);
|
|
95
|
+
}
|
|
96
|
+
const u = new Array(i.length).fill(!1);
|
|
97
|
+
let d = 0;
|
|
98
|
+
for (let o = 0; o < l.length; o++) {
|
|
99
|
+
const e = l[o].id;
|
|
100
|
+
if (!a.has(e))
|
|
101
|
+
d++, n[o] = -d;
|
|
102
|
+
else {
|
|
103
|
+
const t = r.get(e);
|
|
104
|
+
u[t] = !0;
|
|
105
|
+
let s = 0;
|
|
106
|
+
for (let v = 0; v < t; v++)
|
|
107
|
+
u[v] || s++;
|
|
108
|
+
n[o] = s - d;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return n;
|
|
112
|
+
}, N = { style: { "user-select": "none" } }, W = { class: "title" }, Y = ["title"], K = ["onClick"], U = /* @__PURE__ */ g({
|
|
113
|
+
__name: "MyFoldList",
|
|
114
|
+
props: {
|
|
115
|
+
list: {},
|
|
116
|
+
activeIndex: {},
|
|
117
|
+
onHeaderClick: { type: Function },
|
|
118
|
+
onItemClick: { type: Function }
|
|
119
|
+
},
|
|
120
|
+
setup(l) {
|
|
121
|
+
const i = l, n = c(!0), a = c(0), r = c(null), u = c(!1), d = async () => {
|
|
122
|
+
await X(), r.value && (a.value = r.value.offsetHeight);
|
|
123
|
+
}, o = async () => {
|
|
124
|
+
u.value = !1, await d(), setTimeout(() => u.value = !0, 100);
|
|
125
|
+
};
|
|
126
|
+
b(() => {
|
|
127
|
+
o();
|
|
128
|
+
}), I(() => i.list.length, d);
|
|
129
|
+
const e = c([]), t = c(!1), s = c([...i.list]);
|
|
130
|
+
return I(() => i.list, (v) => {
|
|
131
|
+
e.value = D(v, s.value), t.value = !0, s.value = [...v];
|
|
132
|
+
}, { deep: !0 }), (v, y) => (m(), p("div", N, [
|
|
133
|
+
f("div", {
|
|
134
|
+
class: "header",
|
|
135
|
+
onClick: y[1] || (y[1] = C(
|
|
136
|
+
//@ts-ignore
|
|
137
|
+
(...w) => l.onHeaderClick && l.onHeaderClick(...w),
|
|
138
|
+
["stop"]
|
|
139
|
+
))
|
|
140
|
+
}, [
|
|
141
|
+
f("div", W, [
|
|
142
|
+
S(v.$slots, "title", {}, () => [
|
|
143
|
+
y[3] || (y[3] = T("标题", -1))
|
|
144
|
+
], !0)
|
|
145
|
+
]),
|
|
146
|
+
f("span", {
|
|
147
|
+
class: "iconfont icon-right-arrow",
|
|
148
|
+
style: k({ transform: n.value ? "rotate(90deg)" : "rotate(0deg)" }),
|
|
149
|
+
title: n.value ? "收起列表" : "展开列表",
|
|
150
|
+
onClick: y[0] || (y[0] = C((w) => n.value = !n.value, ["stop"]))
|
|
151
|
+
}, null, 12, Y)
|
|
152
|
+
]),
|
|
153
|
+
f("div", {
|
|
154
|
+
class: $(["body-container", { "enable-transition": u.value }]),
|
|
155
|
+
style: k({ height: n.value ? `calc(0px + ${a.value}px)` : "0px" })
|
|
156
|
+
}, [
|
|
157
|
+
f("ul", {
|
|
158
|
+
ref_key: "bodyRef",
|
|
159
|
+
ref: r,
|
|
160
|
+
class: $(["body", { close: !n.value }])
|
|
161
|
+
}, [
|
|
162
|
+
(m(!0), p(x, null, z(i.list, (w, h) => (m(), p("li", {
|
|
163
|
+
key: h,
|
|
164
|
+
onClick: C(() => l.onItemClick?.(w, h), ["stop"]),
|
|
165
|
+
style: k({ "--z-index": i.list.length - h, "--translateY": `${e.value[h] * 100}%` }),
|
|
166
|
+
onAnimationend: y[2] || (y[2] = () => t.value = !1),
|
|
167
|
+
class: $({ active: h === i.activeIndex, slide: t.value })
|
|
168
|
+
}, L(w.name), 47, K))), 128))
|
|
169
|
+
], 2)
|
|
170
|
+
], 6)
|
|
171
|
+
]));
|
|
172
|
+
}
|
|
173
|
+
}), ne = /* @__PURE__ */ _(U, [["__scopeId", "data-v-bb2a236c"]]), j = { class: "container" }, q = ["placeholder"], G = /* @__PURE__ */ g({
|
|
174
|
+
__name: "MySearch",
|
|
175
|
+
props: {
|
|
176
|
+
placeholder: {},
|
|
177
|
+
onSearch: { type: Function }
|
|
178
|
+
},
|
|
179
|
+
setup(l) {
|
|
180
|
+
const i = l, n = c("");
|
|
181
|
+
let a = !1;
|
|
182
|
+
const r = async () => {
|
|
183
|
+
await new Promise((o) => setTimeout(o, 100)), a = !1;
|
|
184
|
+
}, u = () => {
|
|
185
|
+
a = !0;
|
|
186
|
+
}, d = async (o) => {
|
|
187
|
+
a || i.onSearch?.(o);
|
|
188
|
+
};
|
|
189
|
+
return (o, e) => (m(), p("div", j, [
|
|
190
|
+
e[3] || (e[3] = f("span", { class: "iconfont icon-search" }, null, -1)),
|
|
191
|
+
O(f("input", {
|
|
192
|
+
"onUpdate:modelValue": e[0] || (e[0] = (t) => n.value = t),
|
|
193
|
+
class: "input",
|
|
194
|
+
onKeyup: e[1] || (e[1] = A(C((t) => d(n.value.trim()), ["prevent"]), ["enter"])),
|
|
195
|
+
onCompositionend: r,
|
|
196
|
+
onCompositionstart: u,
|
|
197
|
+
type: "text",
|
|
198
|
+
placeholder: i.placeholder || "搜索..."
|
|
199
|
+
}, null, 40, q), [
|
|
200
|
+
[H, n.value]
|
|
201
|
+
]),
|
|
202
|
+
n.value ? (m(), p("span", {
|
|
203
|
+
key: 0,
|
|
204
|
+
class: "iconfont icon-clear",
|
|
205
|
+
onClick: e[2] || (e[2] = C((t) => n.value = "", ["stop"]))
|
|
206
|
+
})) : M("", !0)
|
|
207
|
+
]));
|
|
208
|
+
}
|
|
209
|
+
}), oe = /* @__PURE__ */ _(G, [["__scopeId", "data-v-ff947bde"]]), J = ["title"], Q = /* @__PURE__ */ g({
|
|
210
|
+
__name: "MySideBar",
|
|
211
|
+
props: {
|
|
212
|
+
onSwitch: { type: Function }
|
|
213
|
+
},
|
|
214
|
+
setup(l) {
|
|
215
|
+
const i = l, n = c(!0), a = () => {
|
|
216
|
+
n.value = !n.value, i.onSwitch?.(n.value);
|
|
217
|
+
}, r = c(null), u = c(0), d = c(0);
|
|
218
|
+
let o;
|
|
219
|
+
const e = () => {
|
|
220
|
+
const t = r.value;
|
|
221
|
+
t && (clearTimeout(o), o = window.setTimeout(() => {
|
|
222
|
+
let s = 0, v = t;
|
|
223
|
+
for (; v; )
|
|
224
|
+
s += v.offsetLeft, v = v.offsetParent;
|
|
225
|
+
u.value = t.offsetWidth, d.value = s + u.value + 10;
|
|
226
|
+
}, 100));
|
|
227
|
+
};
|
|
228
|
+
return b(() => {
|
|
229
|
+
e(), window.addEventListener("resize", e);
|
|
230
|
+
}), E(() => {
|
|
231
|
+
window.removeEventListener("resize", e);
|
|
232
|
+
}), (t, s) => (m(), p("div", {
|
|
233
|
+
class: "container",
|
|
234
|
+
ref_key: "containerRef",
|
|
235
|
+
ref: r,
|
|
236
|
+
style: k({ transform: n.value ? "translateX(0)" : `translateX(-${d.value}px)`, userSelect: "none" })
|
|
237
|
+
}, [
|
|
238
|
+
f("div", {
|
|
239
|
+
class: $(["icon", { close: !n.value }]),
|
|
240
|
+
onClick: a,
|
|
241
|
+
style: k({ transform: n.value ? "translateX(0)" : `translateX(${d.value - u.value + 45}px)` }),
|
|
242
|
+
title: n.value ? "收起侧边栏" : "展开侧边栏"
|
|
243
|
+
}, [...s[0] || (s[0] = [
|
|
244
|
+
f("span", { class: "iconfont icon-sidebar_left" }, null, -1)
|
|
245
|
+
])], 14, J),
|
|
246
|
+
S(t.$slots, "default", {}, () => [
|
|
247
|
+
s[1] || (s[1] = T("这是内容", -1))
|
|
248
|
+
], !0)
|
|
249
|
+
], 4));
|
|
250
|
+
}
|
|
251
|
+
}), se = /* @__PURE__ */ _(Q, [["__scopeId", "data-v-4b7d6fb5"]]);
|
|
252
|
+
export {
|
|
253
|
+
ee as MyActionButton,
|
|
254
|
+
te as MyContentBar,
|
|
255
|
+
ne as MyFoldList,
|
|
256
|
+
oe as MySearch,
|
|
257
|
+
se as MySideBar
|
|
258
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(p,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(p=typeof globalThis<"u"?globalThis:p||self,e(p.maid={},p.Vue))})(this,(function(p,e){"use strict";const h=["onClick"],w=e.defineComponent({__name:"MyActionButton",props:{onItemClick:{type:Function}},setup(i){const a=i,o=e.ref(!1),r=e.ref(0),c=e.ref(0),d=t=>{o.value||(o.value=!0,r.value=t.offsetX,c.value=t.offsetY,setTimeout(()=>{const n=()=>{o.value=!1,t.target.removeEventListener("click",n),document.removeEventListener("click",n)};t.target.addEventListener("click",n),document.addEventListener("click",n)},0))},f=e.useSlots(),l=e.computed(()=>{const t=[];let n=0;for(;f[`item-${n}`];)t.push(n),n++;return t});return(t,n)=>(e.openBlock(),e.createElementBlock("span",{class:"iconfont icon-info",onClick:e.withModifiers(d,["stop"]),style:{"user-select":"none","--z-index":"10"}},[o.value?(e.openBlock(),e.createElementBlock("ul",{key:0,style:e.normalizeStyle({left:`${r.value}px`,top:`${c.value}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,s=>(e.openBlock(),e.createElementBlock("li",{key:s},[e.createElementVNode("div",{class:"inner",onClick:m=>a.onItemClick?.(s)},[e.renderSlot(t.$slots,`item-${s}`,{index:s},void 0,!0)],8,h)]))),128))],4)):e.createCommentVNode("",!0)]))}}),y=(i,a)=>{const o=i.__vccOpts||i;for(const[r,c]of a)o[r]=c;return o},B=y(w,[["__scopeId","data-v-cd43f472"]]),S=y(e.defineComponent({__name:"MyContentBar",props:{isOpen:{type:Boolean},onCloseClick:{type:Function}},setup(i){const a=i,o=e.ref(null),r=e.ref(0),c=e.ref(!1),d=()=>{const t=o.value;if(!t)return;let n=0,s=t;for(;s;)n+=s.offsetLeft,s=s.offsetParent;const m=t.offsetWidth;r.value=n+m+10,setTimeout(()=>c.value=!0,100)};let f;const l=()=>{clearTimeout(f),f=setTimeout(()=>d(),100)};return e.onMounted(()=>{d(),window.addEventListener("resize",l)}),e.onUnmounted(()=>{window.removeEventListener("resize",l)}),(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:"container",ref_key:"containerRef",ref:o,style:e.normalizeStyle({transition:c.value?"transform .5s ease":"none",transform:a.isOpen?"translateX(0)":`translateX(-${r.value}px)`,userSelect:"none"})},[e.createElementVNode("div",{class:e.normalizeClass(["icon",{close:!i.isOpen}]),onClick:n[0]||(n[0]=(...s)=>i.onCloseClick&&i.onCloseClick(...s)),title:"收起内容栏"},[...n[1]||(n[1]=[e.createElementVNode("span",{class:"iconfont icon-iconguanbi"},null,-1)])],2),e.renderSlot(t.$slots,"default",{},()=>[n[2]||(n[2]=e.createTextVNode("这是内容",-1))],!0)],4))}}),[["__scopeId","data-v-1b0264e6"]]),E=(i,a)=>{const o=new Array(i.length),r=new Set,c=new Map;for(let l=0;l<a.length;l++){const t=a[l].id;r.add(t),c.set(t,l)}const d=new Array(a.length).fill(!1);let f=0;for(let l=0;l<i.length;l++){const t=i[l].id;if(!r.has(t))f++,o[l]=-f;else{const n=c.get(t);d[n]=!0;let s=0;for(let m=0;m<n;m++)d[m]||s++;o[l]=s-f}}return o},_={style:{"user-select":"none"}},M={class:"title"},$=["title"],g=["onClick"],T=y(e.defineComponent({__name:"MyFoldList",props:{list:{},activeIndex:{},onHeaderClick:{type:Function},onItemClick:{type:Function}},setup(i){const a=i,o=e.ref(!0),r=e.ref(0),c=e.ref(null),d=e.ref(!1),f=async()=>{await e.nextTick(),c.value&&(r.value=c.value.offsetHeight)},l=async()=>{d.value=!1,await f(),setTimeout(()=>d.value=!0,100)};e.onMounted(()=>{l()}),e.watch(()=>a.list.length,f);const t=e.ref([]),n=e.ref(!1),s=e.ref([...a.list]);return e.watch(()=>a.list,m=>{t.value=E(m,s.value),n.value=!0,s.value=[...m]},{deep:!0}),(m,u)=>(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("div",{class:"header",onClick:u[1]||(u[1]=e.withModifiers((...k)=>i.onHeaderClick&&i.onHeaderClick(...k),["stop"]))},[e.createElementVNode("div",M,[e.renderSlot(m.$slots,"title",{},()=>[u[3]||(u[3]=e.createTextVNode("标题",-1))],!0)]),e.createElementVNode("span",{class:"iconfont icon-right-arrow",style:e.normalizeStyle({transform:o.value?"rotate(90deg)":"rotate(0deg)"}),title:o.value?"收起列表":"展开列表",onClick:u[0]||(u[0]=e.withModifiers(k=>o.value=!o.value,["stop"]))},null,12,$)]),e.createElementVNode("div",{class:e.normalizeClass(["body-container",{"enable-transition":d.value}]),style:e.normalizeStyle({height:o.value?`calc(0px + ${r.value}px)`:"0px"})},[e.createElementVNode("ul",{ref_key:"bodyRef",ref:c,class:e.normalizeClass(["body",{close:!o.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.list,(k,C)=>(e.openBlock(),e.createElementBlock("li",{key:C,onClick:e.withModifiers(()=>i.onItemClick?.(k,C),["stop"]),style:e.normalizeStyle({"--z-index":a.list.length-C,"--translateY":`${t.value[C]*100}%`}),onAnimationend:u[2]||(u[2]=()=>n.value=!1),class:e.normalizeClass({active:C===a.activeIndex,slide:n.value})},e.toDisplayString(k.name),47,g))),128))],2)],6)]))}}),[["__scopeId","data-v-bb2a236c"]]),z={class:"container"},V=["placeholder"],b=y(e.defineComponent({__name:"MySearch",props:{placeholder:{},onSearch:{type:Function}},setup(i){const a=i,o=e.ref("");let r=!1;const c=async()=>{await new Promise(l=>setTimeout(l,100)),r=!1},d=()=>{r=!0},f=async l=>{r||a.onSearch?.(l)};return(l,t)=>(e.openBlock(),e.createElementBlock("div",z,[t[3]||(t[3]=e.createElementVNode("span",{class:"iconfont icon-search"},null,-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=n=>o.value=n),class:"input",onKeyup:t[1]||(t[1]=e.withKeys(e.withModifiers(n=>f(o.value.trim()),["prevent"]),["enter"])),onCompositionend:c,onCompositionstart:d,type:"text",placeholder:a.placeholder||"搜索..."},null,40,V),[[e.vModelText,o.value]]),o.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon-clear",onClick:t[2]||(t[2]=e.withModifiers(n=>o.value="",["stop"]))})):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-ff947bde"]]),N=["title"],I=y(e.defineComponent({__name:"MySideBar",props:{onSwitch:{type:Function}},setup(i){const a=i,o=e.ref(!0),r=()=>{o.value=!o.value,a.onSwitch?.(o.value)},c=e.ref(null),d=e.ref(0),f=e.ref(0);let l;const t=()=>{const n=c.value;n&&(clearTimeout(l),l=window.setTimeout(()=>{let s=0,m=n;for(;m;)s+=m.offsetLeft,m=m.offsetParent;d.value=n.offsetWidth,f.value=s+d.value+10},100))};return e.onMounted(()=>{t(),window.addEventListener("resize",t)}),e.onUnmounted(()=>{window.removeEventListener("resize",t)}),(n,s)=>(e.openBlock(),e.createElementBlock("div",{class:"container",ref_key:"containerRef",ref:c,style:e.normalizeStyle({transform:o.value?"translateX(0)":`translateX(-${f.value}px)`,userSelect:"none"})},[e.createElementVNode("div",{class:e.normalizeClass(["icon",{close:!o.value}]),onClick:r,style:e.normalizeStyle({transform:o.value?"translateX(0)":`translateX(${f.value-d.value+45}px)`}),title:o.value?"收起侧边栏":"展开侧边栏"},[...s[0]||(s[0]=[e.createElementVNode("span",{class:"iconfont icon-sidebar_left"},null,-1)])],14,N),e.renderSlot(n.$slots,"default",{},()=>[s[1]||(s[1]=e.createTextVNode("这是内容",-1))],!0)],4))}}),[["__scopeId","data-v-4b7d6fb5"]]);p.MyActionButton=B,p.MyContentBar=S,p.MyFoldList=T,p.MySearch=b,p.MySideBar=I,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/maid.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.icon-info[data-v-cd43f472]{position:relative;font-size:18px;color:#3b86f7;cursor:pointer}ul[data-v-cd43f472]{position:absolute;z-index:var(--z-index);width:60px;background-color:#f3f6f6;border-radius:10px;box-shadow:0 0 5px 2px #0000001a}li[data-v-cd43f472]{height:30px;padding:2px;cursor:pointer}.inner[data-v-cd43f472]{display:flex;justify-content:center;border-radius:9px;font-size:12px;color:#000;line-height:26px}.inner .iconfont[data-v-cd43f472]{font-size:14px}.inner[data-v-cd43f472]:hover{background-color:#3b86f7;color:#fff}.container[data-v-1b0264e6]{position:relative;padding-top:40px;background-color:#f2f2f2e6;-webkit-backdrop-filter:blur(10px) saturate(1.5);backdrop-filter:blur(10px) saturate(1.5);border:1px solid rgba(255,255,255,1);border-radius:20px;box-shadow:0 0 5px 2px #0000001a}.icon[data-v-1b0264e6]{display:flex;justify-content:center;align-items:center;position:absolute;top:5px;right:5px;width:35px;height:30px;border-radius:15px;background-color:#f2f2f200;transition:background-color .1s ease 0s;cursor:pointer}.icon[data-v-1b0264e6]:hover{background-color:#e4e4e4}.iconfont[data-v-1b0264e6]{font-size:20px;color:#262626}.header[data-v-bb2a236c]{display:flex;justify-content:space-between;align-items:center;height:30px}.header .title[data-v-bb2a236c]{font-size:12px;color:#767676;font-weight:500}.header .iconfont[data-v-bb2a236c]{font-size:16px;color:#767676;font-weight:700;transition:transform .3s;cursor:pointer}.body-container[data-v-bb2a236c]{overflow:hidden}.body-container.enable-transition[data-v-bb2a236c]{transition:height .5s ease}.body[data-v-bb2a236c]{transform:translateY(0);transition:transform .5s ease;transition-delay:32ms}.body.close[data-v-bb2a236c]{transform:translateY(-100%)}.body li[data-v-bb2a236c]{position:relative;z-index:var(--z-index);height:30px;padding:0 10px;border-radius:6px;font-size:14px;line-height:30px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:all .2s}.body li.active[data-v-bb2a236c]{background-color:#e4e4e4;color:#3b86f7}@keyframes slide-bb2a236c{0%{transform:translateY(var(--translateY))}to{transform:translateY(0)}}.slide[data-v-bb2a236c]{animation:slide-bb2a236c .5s ease}.container[data-v-ff947bde]{display:flex;align-items:center;position:relative;height:35px;border-radius:18px;font-size:14px}.iconfont[data-v-ff947bde]{position:absolute;font-size:14px;line-height:35px;color:#767676}.icon-search[data-v-ff947bde]{left:14px}.icon-clear[data-v-ff947bde]{text-align:center;right:0;width:35px;height:35px;cursor:pointer}.input[data-v-ff947bde]{background-color:#e8e8e8;width:100%;height:100%;border-radius:20px;padding:0 35px;font-size:inherit;font-weight:inherit;color:inherit;caret-color:#3c86f6;transition:outline .2s ease}.input[data-v-ff947bde]::placeholder{font-weight:500;color:#767676}.input[data-v-ff947bde]:focus{outline:3px solid #94bbf0}.container[data-v-4b7d6fb5]{position:relative;padding:40px 15px 15px;background-color:#f2f2f2e6;-webkit-backdrop-filter:blur(10px) saturate(1.5);backdrop-filter:blur(10px) saturate(1.5);border:1px solid rgba(255,255,255,1);border-radius:20px;box-shadow:0 0 5px 2px #0000001a;transition:transform .5s ease}.icon[data-v-4b7d6fb5]{display:flex;justify-content:center;align-items:center;position:absolute;top:5px;right:5px;width:35px;height:30px;border-radius:15px;background-color:#f2f2f200;transition:background-color .1s ease 0s,transform .5s ease 0s,border 0s ease .5s,box-shadow .5s ease 0s;cursor:pointer}.icon.close[data-v-4b7d6fb5]{background-color:#f2f2f2e6;border:1px solid rgba(255,255,255,1);box-shadow:2px 2px 5px #0000001a}.icon[data-v-4b7d6fb5]:hover{background-color:#e4e4e4}.iconfont[data-v-4b7d6fb5]{font-size:20px;color:#262626}
|
package/dist/main.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lovelymaid",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/lovelymaid.umd.js",
|
|
5
|
+
"module": "dist/lovelymaid.es.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "vite build && npm run build:types",
|
|
14
|
+
"build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
15
|
+
"preview": "vite preview"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"vue": "^3.5.22"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
22
|
+
"vite": "^7.1.11",
|
|
23
|
+
"vue-tsc": "^3.2.4"
|
|
24
|
+
}
|
|
25
|
+
}
|