geekin-devtoys 0.2.22 → 0.3.2
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/lib/GCard/index.js +1 -0
- package/lib/GCard/index.mjs +227 -0
- package/lib/GCard/style.css +1 -0
- package/lib/GCard.d.ts +1 -0
- package/lib/GDialog/index.js +1 -1
- package/lib/GDialog/index.mjs +2 -2
- package/lib/GDialog/style.css +1 -1
- package/lib/GFuzzyText/index.js +1 -0
- package/lib/GFuzzyText/index.mjs +171 -0
- package/lib/GFuzzyText.d.ts +1 -0
- package/lib/GInputTreeTag/index.js +1 -1
- package/lib/GInputTreeTag/index.mjs +152 -130
- package/lib/GInputTreeTag/style.css +1 -1
- package/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +13 -11
- package/lib/GTable/style.css +1 -1
- package/lib/components/GCard/index.d.ts +46 -0
- package/lib/components/GDialog/index.d.ts +24 -8
- package/lib/components/GFuzzyText/index.d.ts +61 -0
- package/lib/components/GInputTreeTag/index.d.ts +25 -11
- package/lib/components/GTable/index.d.ts +3 -119
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +20 -14
- package/lib/{index-il5JtS6o.js → index-B1MYKy3L.js} +1 -1
- package/lib/{index-CzamRrBC.mjs → index-Dxw2pU4z.mjs} +12 -27
- package/lib/index.d.ts +3 -1
- package/package.json +17 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ElInput as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const Ie = {
|
|
1
|
+
import { defineComponent as he, computed as d, ref as i, watch as we, nextTick as D, onMounted as ye, onBeforeUnmount as ke, createElementBlock as F, openBlock as v, normalizeClass as C, createElementVNode as B, createBlock as Z, createCommentVNode as G, normalizeStyle as T, createVNode as W, unref as R, withKeys as Ee, Teleport as Ve, withDirectives as Fe, withModifiers as Be, withCtx as J, renderSlot as x, createTextVNode as P, toDisplayString as Q, vShow as xe, Fragment as Ie, renderList as Me } from "vue";
|
|
2
|
+
import { ElInput as Se, ElTree as _e, ElTag as Le, ElMessage as X } from "element-plus";
|
|
3
|
+
import { _ as Ce } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
4
|
+
const Te = {
|
|
6
5
|
key: 0,
|
|
7
6
|
class: "g-input-tree-tag__tags"
|
|
8
|
-
},
|
|
7
|
+
}, Re = /* @__PURE__ */ he({
|
|
9
8
|
__name: "index",
|
|
10
9
|
props: {
|
|
11
10
|
modelValue: { default: () => [] },
|
|
12
11
|
data: { default: () => [] },
|
|
13
12
|
props: { default: () => ({}) },
|
|
13
|
+
echoProps: {},
|
|
14
14
|
nodeKey: { default: "id" },
|
|
15
15
|
placeholder: { default: "请输入关键字搜索" },
|
|
16
16
|
width: { default: 320 },
|
|
@@ -25,7 +25,6 @@ const Ie = {
|
|
|
25
25
|
tagEffect: { default: "light" },
|
|
26
26
|
clearInputAfterSelect: { type: Boolean, default: !0 },
|
|
27
27
|
enterToAdd: { type: Boolean, default: !0 },
|
|
28
|
-
showLeafIcon: { type: Boolean, default: !0 },
|
|
29
28
|
valueFormat: { default: "value" },
|
|
30
29
|
selectable: {},
|
|
31
30
|
filterMethod: {},
|
|
@@ -33,240 +32,263 @@ const Ie = {
|
|
|
33
32
|
notFoundMessage: { default: "未找到匹配项" }
|
|
34
33
|
},
|
|
35
34
|
emits: ["update:modelValue", "change", "add", "remove", "node-click", "duplicate", "not-found"],
|
|
36
|
-
setup(
|
|
37
|
-
const l =
|
|
35
|
+
setup(I, { expose: Y, emit: ee }) {
|
|
36
|
+
const l = I, n = ee, te = d(() => ({
|
|
38
37
|
label: l.props.label || "label",
|
|
39
38
|
children: l.props.children || "children",
|
|
40
39
|
disabled: l.props.disabled
|
|
41
|
-
})),
|
|
40
|
+
})), ae = d(() => l.props.value || l.nodeKey || "id"), le = d(() => l.props.label || "label"), oe = d(() => l.props.children || "children"), M = d(() => l.props.isLeaf), ne = d(() => l.echoProps?.value || "value"), re = d(() => l.echoProps?.label || "label"), m = (e) => e ? e[ae.value] : void 0, c = (e) => e ? e[le.value] : "", z = (e) => e ? e[oe.value] : void 0, ue = (e) => e?.[ne.value] ?? e?.value, de = (e) => e?.[re.value] ?? e?.label, p = (e) => {
|
|
42
41
|
if (!e) return !1;
|
|
43
42
|
if (typeof l.selectable == "function") return l.selectable(e);
|
|
44
|
-
if (
|
|
45
|
-
const t =
|
|
43
|
+
if (M.value && e[M.value] !== void 0) return !!e[M.value];
|
|
44
|
+
const t = z(e);
|
|
46
45
|
return !t || !t.length;
|
|
47
|
-
},
|
|
46
|
+
}, S = d(() => {
|
|
48
47
|
const e = /* @__PURE__ */ new Map(), t = (a = []) => {
|
|
49
48
|
a.forEach((o) => {
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
49
|
+
p(o) && e.set(m(o), o);
|
|
50
|
+
const s = z(o);
|
|
51
|
+
s?.length && t(s);
|
|
53
52
|
});
|
|
54
53
|
};
|
|
55
54
|
return t(l.data || []), e;
|
|
56
|
-
}),
|
|
57
|
-
const a = l.valueFormat === "object" ? t
|
|
55
|
+
}), r = d(() => (l.modelValue || []).map((t) => {
|
|
56
|
+
const a = l.valueFormat === "object" ? ue(t) : t, o = S.value.get(a), s = l.valueFormat === "object" ? de(t) : void 0;
|
|
58
57
|
return {
|
|
59
58
|
value: a,
|
|
60
|
-
label: o ? c(o) :
|
|
61
|
-
raw: o
|
|
59
|
+
label: o ? c(o) : s ?? String(a ?? ""),
|
|
60
|
+
raw: o ?? (l.valueFormat === "object" ? t : void 0)
|
|
62
61
|
};
|
|
63
|
-
})),
|
|
62
|
+
})), w = (e) => r.value.some((t) => t.value === e), y = i(""), u = i(!1), $ = i(null), H = i(null), N = i(null), g = i(null), O = i({}), K = i("bottom"), se = d(
|
|
64
63
|
() => typeof l.width == "number" ? `${l.width}px` : l.width
|
|
65
|
-
),
|
|
66
|
-
l.disabled || (
|
|
67
|
-
},
|
|
68
|
-
if (!
|
|
69
|
-
const e =
|
|
64
|
+
), _ = () => {
|
|
65
|
+
l.disabled || (u.value = !0);
|
|
66
|
+
}, k = () => {
|
|
67
|
+
if (!u.value) return;
|
|
68
|
+
const e = N.value, t = g.value;
|
|
70
69
|
if (!e || !t) return;
|
|
71
|
-
const a = e.getBoundingClientRect(), o = t.offsetHeight || l.popperMaxHeight,
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const a = e.getBoundingClientRect(), o = t.offsetHeight || l.popperMaxHeight, V = window.innerHeight - a.bottom - l.popperOffset, ge = a.top, q = V >= o || V >= ge ? "bottom" : "top";
|
|
71
|
+
K.value = q;
|
|
72
|
+
const be = q === "bottom" ? a.bottom + l.popperOffset : a.top - o;
|
|
73
|
+
O.value = {
|
|
74
74
|
position: "fixed",
|
|
75
|
-
top: `${
|
|
75
|
+
top: `${be}px`,
|
|
76
76
|
left: `${a.left}px`,
|
|
77
77
|
width: `${a.width}px`,
|
|
78
78
|
zIndex: String(l.popperZIndex)
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
let
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
let f = null;
|
|
82
|
+
const b = () => {
|
|
83
|
+
u.value && (f && cancelAnimationFrame(f), f = requestAnimationFrame(() => {
|
|
84
|
+
f = null, k();
|
|
85
85
|
}));
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
let h = null;
|
|
88
|
+
const ie = () => {
|
|
89
|
+
typeof ResizeObserver > "u" || !g.value || (h?.disconnect(), h = new ResizeObserver(() => b()), h.observe(g.value));
|
|
90
|
+
}, j = () => {
|
|
91
|
+
h?.disconnect(), h = null;
|
|
92
|
+
};
|
|
93
|
+
we(u, async (e) => {
|
|
94
|
+
if (!e) {
|
|
95
|
+
j();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
await D(), k(), requestAnimationFrame(k), ie();
|
|
89
99
|
});
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
100
|
+
const U = (e) => {
|
|
101
|
+
if (!u.value) return;
|
|
92
102
|
const t = e.target;
|
|
93
|
-
|
|
103
|
+
H.value?.contains(t) || g.value?.contains(t) || (u.value = !1);
|
|
94
104
|
};
|
|
95
|
-
|
|
96
|
-
document.addEventListener("mousedown",
|
|
97
|
-
}),
|
|
98
|
-
document.removeEventListener("mousedown",
|
|
105
|
+
ye(() => {
|
|
106
|
+
document.addEventListener("mousedown", U, !0), window.addEventListener("scroll", b, !0), window.addEventListener("resize", b);
|
|
107
|
+
}), ke(() => {
|
|
108
|
+
document.removeEventListener("mousedown", U, !0), window.removeEventListener("scroll", b, !0), window.removeEventListener("resize", b), f && cancelAnimationFrame(f), j();
|
|
99
109
|
});
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
n("node-click", e),
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
const ce = (e) => {
|
|
111
|
+
u.value = !0, $.value?.filter(e), D(k);
|
|
112
|
+
}, pe = (e, t) => e ? typeof l.filterMethod == "function" ? l.filterMethod(e, t) : String(c(t) ?? "").toLowerCase().includes(String(e).toLowerCase()) : !0, fe = (e, t) => {
|
|
113
|
+
if (n("node-click", e), !p(e)) {
|
|
114
|
+
t && (t.expanded = !t.expanded);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
L(e), u.value = !1;
|
|
118
|
+
}, ve = (e) => l.valueFormat === "object" ? { value: e.value, label: e.label, raw: e.raw } : e.value, L = (e) => {
|
|
119
|
+
const t = m(e);
|
|
106
120
|
if (t == null || t === "") return;
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
n("duplicate",
|
|
121
|
+
if (w(t)) {
|
|
122
|
+
const s = { value: t, label: c(e), raw: e };
|
|
123
|
+
n("duplicate", s), l.duplicateMessage && X.warning(l.duplicateMessage);
|
|
110
124
|
return;
|
|
111
125
|
}
|
|
112
|
-
const a = { value: t, label: c(e), raw: e }, o = [...l.modelValue || [],
|
|
113
|
-
n("update:modelValue", o), n("add", a), n("change", o, [...
|
|
114
|
-
},
|
|
126
|
+
const a = { value: t, label: c(e), raw: e }, o = [...l.modelValue || [], ve(a)];
|
|
127
|
+
n("update:modelValue", o), n("add", a), n("change", o, [...r.value, a]), l.clearInputAfterSelect && (y.value = "");
|
|
128
|
+
}, me = () => {
|
|
115
129
|
if (!l.enterToAdd) return;
|
|
116
|
-
const e = (
|
|
130
|
+
const e = (y.value || "").trim();
|
|
117
131
|
if (!e) return;
|
|
118
132
|
let t = null;
|
|
119
|
-
for (const a of
|
|
133
|
+
for (const a of S.value.values())
|
|
120
134
|
if (c(a) === e) {
|
|
121
135
|
t = a;
|
|
122
136
|
break;
|
|
123
137
|
}
|
|
124
138
|
if (!t) {
|
|
125
|
-
n("not-found", e), l.notFoundMessage &&
|
|
139
|
+
n("not-found", e), l.notFoundMessage && X.warning(l.notFoundMessage);
|
|
126
140
|
return;
|
|
127
141
|
}
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
142
|
+
L(t);
|
|
143
|
+
}, E = (e) => {
|
|
144
|
+
if (e < 0 || e >= r.value.length) return;
|
|
145
|
+
const t = r.value[e], a = [...l.modelValue || []];
|
|
131
146
|
a.splice(e, 1), n("update:modelValue", a), t && n("remove", t, e);
|
|
132
|
-
const o =
|
|
147
|
+
const o = r.value.filter((s, V) => V !== e);
|
|
133
148
|
n("change", a, o);
|
|
134
149
|
};
|
|
135
|
-
return
|
|
150
|
+
return Y({
|
|
136
151
|
/** 主动打开下拉面板 */
|
|
137
|
-
open:
|
|
152
|
+
open: _,
|
|
138
153
|
/** 主动关闭下拉面板 */
|
|
139
|
-
close: () =>
|
|
154
|
+
close: () => u.value = !1,
|
|
140
155
|
/** 清空已选 */
|
|
141
156
|
clear: () => {
|
|
142
157
|
n("update:modelValue", []), n("change", [], []);
|
|
143
158
|
},
|
|
144
159
|
/** 根据 value 直接添加 */
|
|
145
160
|
addByValue: (e) => {
|
|
146
|
-
const t =
|
|
147
|
-
t &&
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
161
|
+
const t = S.value.get(e);
|
|
162
|
+
t && L(t);
|
|
163
|
+
},
|
|
164
|
+
/** 根据索引移除,触发与关闭 tag 一致的事件 */
|
|
165
|
+
removeByIndex: (e) => {
|
|
166
|
+
E(e);
|
|
167
|
+
},
|
|
168
|
+
/** 根据 value 移除,触发与关闭 tag 一致的事件 */
|
|
169
|
+
removeByValue: (e) => {
|
|
170
|
+
const t = r.value.findIndex((a) => a.value === e);
|
|
171
|
+
t > -1 && E(t);
|
|
172
|
+
},
|
|
173
|
+
/** 获取当前归一化后的已选项 */
|
|
174
|
+
getSelectedItems: () => r.value
|
|
175
|
+
}), (e, t) => (v(), F("div", {
|
|
176
|
+
class: C(["g-input-tree-tag", { "is-disabled": e.disabled }])
|
|
151
177
|
}, [
|
|
152
|
-
|
|
178
|
+
B("div", {
|
|
153
179
|
class: "g-input-tree-tag__wrap",
|
|
154
180
|
ref_key: "wrapRef",
|
|
155
|
-
ref:
|
|
181
|
+
ref: H
|
|
156
182
|
}, [
|
|
157
|
-
|
|
183
|
+
B("div", {
|
|
158
184
|
class: "g-input-tree-tag__input-box",
|
|
159
185
|
ref_key: "inputBoxRef",
|
|
160
|
-
ref:
|
|
161
|
-
style:
|
|
186
|
+
ref: N,
|
|
187
|
+
style: T({ width: se.value })
|
|
162
188
|
}, [
|
|
163
|
-
R(
|
|
164
|
-
modelValue:
|
|
165
|
-
"onUpdate:modelValue": t[0] || (t[0] = (a) =>
|
|
189
|
+
W(R(Se), {
|
|
190
|
+
modelValue: y.value,
|
|
191
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => y.value = a),
|
|
166
192
|
placeholder: e.placeholder,
|
|
167
193
|
clearable: e.clearable,
|
|
168
194
|
disabled: e.disabled,
|
|
169
195
|
class: "g-input-tree-tag__input",
|
|
170
|
-
onFocus:
|
|
171
|
-
onClick:
|
|
172
|
-
onInput:
|
|
173
|
-
onKeyup:
|
|
196
|
+
onFocus: _,
|
|
197
|
+
onClick: _,
|
|
198
|
+
onInput: ce,
|
|
199
|
+
onKeyup: Ee(me, ["enter"])
|
|
174
200
|
}, null, 8, ["modelValue", "placeholder", "clearable", "disabled"])
|
|
175
201
|
], 4),
|
|
176
|
-
(
|
|
177
|
-
|
|
202
|
+
(v(), Z(Ve, { to: "body" }, [
|
|
203
|
+
Fe(B("div", {
|
|
178
204
|
ref_key: "popperRef",
|
|
179
|
-
ref:
|
|
180
|
-
class:
|
|
181
|
-
style:
|
|
182
|
-
onMousedown: t[1] || (t[1] =
|
|
205
|
+
ref: g,
|
|
206
|
+
class: C(["g-input-tree-tag__popover", `is-${K.value}`]),
|
|
207
|
+
style: T(O.value),
|
|
208
|
+
onMousedown: t[1] || (t[1] = Be(() => {
|
|
183
209
|
}, ["prevent"]))
|
|
184
210
|
}, [
|
|
185
|
-
|
|
211
|
+
B("div", {
|
|
186
212
|
class: "g-input-tree-tag__tree-wrap",
|
|
187
|
-
style:
|
|
213
|
+
style: T({ maxHeight: e.popperMaxHeight + "px" })
|
|
188
214
|
}, [
|
|
189
|
-
R(
|
|
215
|
+
W(R(_e), {
|
|
190
216
|
ref_key: "treeRef",
|
|
191
|
-
ref:
|
|
217
|
+
ref: $,
|
|
192
218
|
data: e.data,
|
|
193
|
-
props:
|
|
219
|
+
props: te.value,
|
|
194
220
|
"node-key": e.nodeKey,
|
|
195
|
-
"filter-node-method":
|
|
221
|
+
"filter-node-method": pe,
|
|
196
222
|
"expand-on-click-node": !1,
|
|
197
223
|
"default-expand-all": e.defaultExpandAll,
|
|
198
|
-
onNodeClick:
|
|
224
|
+
onNodeClick: fe
|
|
199
225
|
}, {
|
|
200
|
-
default:
|
|
201
|
-
|
|
226
|
+
default: J((a) => [
|
|
227
|
+
x(e.$slots, "tree-node", {
|
|
202
228
|
data: a?.data,
|
|
203
229
|
node: a?.node,
|
|
204
|
-
selectable:
|
|
205
|
-
selected:
|
|
230
|
+
selectable: p(a?.data),
|
|
231
|
+
selected: w(m(a?.data))
|
|
206
232
|
}, () => [
|
|
207
|
-
a?.data ? (
|
|
233
|
+
a?.data ? (v(), F("span", {
|
|
208
234
|
key: 0,
|
|
209
|
-
class:
|
|
235
|
+
class: C([
|
|
210
236
|
"g-input-tree-tag__node",
|
|
211
237
|
{
|
|
212
|
-
"is-selectable":
|
|
213
|
-
"is-selected":
|
|
238
|
+
"is-selectable": p(a.data),
|
|
239
|
+
"is-selected": p(a.data) && w(m(a.data))
|
|
214
240
|
}
|
|
215
241
|
])
|
|
216
242
|
}, [
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
_: 1
|
|
225
|
-
})) : A("", !0),
|
|
226
|
-
W(" " + J(c(a.data)), 1)
|
|
227
|
-
], 2)) : A("", !0)
|
|
243
|
+
x(e.$slots, "leaf-icon", {
|
|
244
|
+
data: a.data,
|
|
245
|
+
selectable: p(a.data),
|
|
246
|
+
selected: w(m(a.data))
|
|
247
|
+
}, void 0, !0),
|
|
248
|
+
P(" " + Q(c(a.data)), 1)
|
|
249
|
+
], 2)) : G("", !0)
|
|
228
250
|
], !0)
|
|
229
251
|
]),
|
|
230
252
|
_: 3
|
|
231
253
|
}, 8, ["data", "props", "node-key", "default-expand-all"])
|
|
232
254
|
], 4)
|
|
233
255
|
], 38), [
|
|
234
|
-
[
|
|
256
|
+
[xe, u.value]
|
|
235
257
|
])
|
|
236
258
|
])),
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
items:
|
|
240
|
-
remove:
|
|
259
|
+
r.value.length ? (v(), F("div", Te, [
|
|
260
|
+
x(e.$slots, "tags", {
|
|
261
|
+
items: r.value,
|
|
262
|
+
remove: E
|
|
241
263
|
}, () => [
|
|
242
|
-
(
|
|
264
|
+
(v(!0), F(Ie, null, Me(r.value, (a, o) => (v(), Z(R(Le), {
|
|
243
265
|
key: a.value,
|
|
244
266
|
class: "g-input-tree-tag__tag",
|
|
245
267
|
type: e.tagType,
|
|
246
268
|
effect: e.tagEffect,
|
|
247
269
|
closable: e.closable && !e.disabled,
|
|
248
|
-
onClose: (
|
|
270
|
+
onClose: (s) => E(o)
|
|
249
271
|
}, {
|
|
250
|
-
default:
|
|
251
|
-
|
|
272
|
+
default: J(() => [
|
|
273
|
+
x(e.$slots, "tag", {
|
|
252
274
|
item: a,
|
|
253
275
|
index: o
|
|
254
276
|
}, () => [
|
|
255
|
-
|
|
277
|
+
P(Q(a.label), 1)
|
|
256
278
|
], !0)
|
|
257
279
|
]),
|
|
258
280
|
_: 2
|
|
259
281
|
}, 1032, ["type", "effect", "closable", "onClose"]))), 128))
|
|
260
282
|
], !0)
|
|
261
|
-
])) :
|
|
283
|
+
])) : G("", !0)
|
|
262
284
|
], 512)
|
|
263
285
|
], 2));
|
|
264
286
|
}
|
|
265
|
-
}),
|
|
266
|
-
|
|
267
|
-
|
|
287
|
+
}), A = /* @__PURE__ */ Ce(Re, [["__scopeId", "data-v-1fe6c294"]]);
|
|
288
|
+
A.install = (I) => {
|
|
289
|
+
I.component(A.name, A);
|
|
268
290
|
};
|
|
269
291
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
292
|
+
A as GInputTreeTag,
|
|
293
|
+
A as default
|
|
272
294
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.g-input-tree-tag[data-v-
|
|
1
|
+
@charset "UTF-8";.g-input-tree-tag[data-v-1fe6c294]{width:100%}.g-input-tree-tag__wrap[data-v-1fe6c294]{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.g-input-tree-tag__tags[data-v-1fe6c294]{display:flex;flex-wrap:wrap;gap:8px;width:100%}.g-input-tree-tag__tag[data-v-1fe6c294]{margin:0}.g-input-tree-tag.is-disabled[data-v-1fe6c294]{cursor:not-allowed}.g-input-tree-tag__popover{box-sizing:border-box;background:var(--el-bg-color-overlay, #fff);border:1px solid var(--el-border-color-light);border-radius:4px;box-shadow:var(--el-box-shadow-light);padding:8px 0}.g-input-tree-tag__popover .g-input-tree-tag__tree-wrap{overflow:auto}.g-input-tree-tag__popover .g-input-tree-tag__node{display:inline-flex;align-items:center;gap:4px;font-size:13px}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selectable{cursor:pointer;color:var(--el-text-color-primary)}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selected{color:var(--el-color-primary)}
|
package/lib/GTable/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),h=require("../index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),h=require("../index-B1MYKy3L.js"),_=require("sortablejs"),S=require("../_plugin-vue_export-helper-BHFhmbuH.js");var k={name:"zh-cn",el:{breadcrumb:{label:"面包屑"},colorpicker:{confirm:"确定",clear:"清空",defaultLabel:"颜色选择器",description:"当前颜色 {color},按 Enter 键选择新颜色",alphaLabel:"选择透明度的值",alphaDescription:"透明度 {alpha}, 当前颜色 {color}",hueLabel:"选择色相值",hueDescription:"色相 {hue}, 当前颜色 {color}",svLabel:"选择饱和度与明度的值",svDescription:"饱和度 {saturation}, 明度 {brightness}, 当前颜色 {color}",predefineDescription:"选择 {value} 作为颜色"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",dateTablePrompt:"使用方向键与 Enter 键可选择日期",monthTablePrompt:"使用方向键与 Enter 键可选择月份",yearTablePrompt:"使用方向键与 Enter 键可选择年份",selectedDate:"已选日期",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},weeksFull:{sun:"星期日",mon:"星期一",tue:"星期二",wed:"星期三",thu:"星期四",fri:"星期五",sat:"星期六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},inputNumber:{decrease:"减少数值",increase:"增加数值"},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},mention:{loading:"加载中"},dropdown:{toggleDropdown:"切换下拉选项"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",page:"页",prev:"上一页",next:"下一页",currentPage:"第 {pager} 页",prevPages:"向前 {pager} 页",nextPages:"向后 {pager} 页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},dialog:{close:"关闭此对话框"},drawer:{close:"关闭此对话框"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!",close:"关闭此对话框"},upload:{deleteTip:"按 Delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},slider:{defaultLabel:"滑块介于 {min} 至 {max}",defaultRangeStartLabel:"选择起始值",defaultRangeEndLabel:"选择结束值"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计",selectAllLabel:"选择所有行",selectRowLabel:"选择当前行",expandRowLabel:"展开当前行",collapseRowLabel:"收起当前行",sortLabel:"按 {column} 排序",filterLabel:"按 {column} 过滤"},tag:{close:"关闭此标签"},tour:{next:"下一步",previous:"上一步",finish:"结束导览",close:"关闭此对话框"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},carousel:{leftArrow:"上一张幻灯片",rightArrow:"下一张幻灯片",indicator:"幻灯片切换至索引 {index}"}}};const z={class:"g-table"},T={key:0,class:"g-table-action"},P={key:1},x={class:"g-dropdown-link"},N=u.defineComponent({name:"GTable",inheritAttrs:!1,__name:"index",props:{data:{default:()=>[]},pagination:{type:Boolean,default:!1},operationLabel:{default:"操作"},operaWidth:{default:160},dragSort:{type:Boolean,default:!1},dragSortProps:{default:()=>[]},currentPage:{default:1},pageSize:{default:10},total:{default:0},pageSizes:{default:()=>[10,20,50,100]},layout:{default:"total, sizes, prev, pager, next"},size:{default:"default"}},emits:["update:currentPage","update:pageSize","sorted:data"],setup(g,{emit:B}){const s=g,d=B,b=e=>{d("update:pageSize",e)},w=e=>{d("update:currentPage",e)},v=u.useSlots(),f=e=>!!v[e],c=u.useAttrs(),A=e=>{const t=!!c["page-size"],n=!!c["current-page"];if(t&&n){const a=Number(c["page-size"]||10),o=Number(c["current-page"]||1);return e+1+a*(o-1)}return e},E=u.ref(null),p=u.shallowRef(null),y=(e=20)=>new Promise(t=>{let n=0;const a=()=>{if(!E.value){t(null);return}const o=E.value.$el.querySelectorAll("tbody");for(let l=0;l<o.length;l++)if(o[l].querySelectorAll("tr").length>0){t(o[l]);return}if(++n>=e){t(null);return}setTimeout(a,500)};a()}),C=async()=>{if(E.value)try{const e=await y();if(!e){console.error("未找到包含数据行的 tbody 元素");return}p.value?.destroy?.(),p.value=new _(e,{draggable:"tr",handle:".g-drag-icon",animation:200,ghostClass:"g-sortable-ghost",forceFallback:!0,onStart:function(t){t.item.classList.add("dragging")},onEnd:async function(t){t.item.classList.remove("dragging");const{oldIndex:n,newIndex:a}=t;if(n===void 0||a===void 0){console.error("无效的索引值");return}const o=[...s.data],[l]=o.splice(n,1);if(o.splice(a,0,l),s.dragSortProps.length===0){d("sorted:data",o);return}if(s.dragSortProps.length>0){const F=o.map(D=>{const m={};return s.dragSortProps.forEach(r=>{m[r]=D[r]}),m});d("sorted:data",F)}}})}catch(e){console.error("初始化拖拽排序失败:",e)}};return u.onMounted(()=>{s.dragSort&&C()}),u.watch(()=>s.data,()=>{s.dragSort&&C()}),u.onBeforeUnmount(()=>{p.value?.destroy?.(),p.value=null}),(e,t)=>{const n=u.resolveComponent("el-icon"),a=u.resolveComponent("el-table-column"),o=u.resolveComponent("el-dropdown-menu"),l=u.resolveComponent("el-dropdown"),F=u.resolveComponent("el-table"),D=u.resolveComponent("el-pagination"),m=u.resolveComponent("el-config-provider");return u.openBlock(),u.createElementBlock("div",z,[e.$slots.action?(u.openBlock(),u.createElementBlock("div",T,[u.renderSlot(e.$slots,"action",{},void 0,!0)])):u.createCommentVNode("",!0),u.createVNode(F,u.mergeProps({data:e.data||[]},e.$attrs,{size:e.size,stripe:"",ref_key:"tableRef",ref:E,class:["g-table-main",`g-table-main--${e.size}`]}),{empty:u.withCtx(()=>[e.$slots.empty?u.renderSlot(e.$slots,"empty",{key:0},void 0,!0):(u.openBlock(),u.createElementBlock("span",P,"暂无数据"))]),default:u.withCtx(()=>[e.dragSort?(u.openBlock(),u.createBlock(a,{key:0,label:"序号",width:"65"},{default:u.withCtx(r=>[u.createElementVNode("div",null,[u.createTextVNode(u.toDisplayString(A(r.$index))+" ",1),u.createVNode(n,{class:"g-drag-icon"},{default:u.withCtx(()=>[u.createVNode(u.unref(h.operation_default))]),_:1})])]),_:1})):u.createCommentVNode("",!0),u.renderSlot(e.$slots,"default",{},void 0,!0),f("operations")?(u.openBlock(),u.createBlock(a,{key:1,fixed:"right",label:e.operationLabel||"操作",width:e.operaWidth},{default:u.withCtx(r=>[u.renderSlot(e.$slots,"operations",{row:r.row,index:r.$index},void 0,!0),f("more")?(u.openBlock(),u.createBlock(l,{key:0,size:"small",style:{"vertical-align":"baseline"}},{dropdown:u.withCtx(()=>[u.createVNode(o,null,{default:u.withCtx(()=>[u.renderSlot(e.$slots,"more",{row:r.row,index:r.$index},void 0,!0)]),_:2},1024)]),default:u.withCtx(()=>[u.createElementVNode("span",x,[t[0]||(t[0]=u.createTextVNode(" 更多 ")),u.createVNode(n,null,{default:u.withCtx(()=>[u.createVNode(u.unref(h.arrow_down_default))]),_:1})])]),_:2},1024)):u.createCommentVNode("",!0)]),_:3},8,["label","width"])):u.createCommentVNode("",!0)]),_:3},16,["data","size","class"]),e.pagination?(u.openBlock(),u.createBlock(m,{key:1,locale:u.unref(k)},{default:u.withCtx(()=>[u.createVNode(D,{class:"g-pagination-contianer",size:"small","current-page":e.currentPage,"page-size":e.pageSize,total:e.total,"page-sizes":e.pageSizes,layout:e.layout,onSizeChange:b,onCurrentChange:w},null,8,["current-page","page-size","total","page-sizes","layout"])]),_:1},8,["locale"])):u.createCommentVNode("",!0)])}}}),i=S._export_sfc(N,[["__scopeId","data-v-90ad3ecc"]]);i.install=g=>{g.component(i.name,i)};exports.GTable=i;exports.default=i;
|
package/lib/GTable/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as R, useSlots as N, useAttrs as I, ref as M, shallowRef as V, onMounted as W, watch as j, onBeforeUnmount as q, resolveComponent as i, createElementBlock as A, openBlock as E, createCommentVNode as c, createVNode as d, createBlock as h, renderSlot as p, mergeProps as G, withCtx as o, createElementVNode as S, createTextVNode as z, toDisplayString as Y, unref as w } from "vue";
|
|
2
|
-
import { o as H, d as U } from "../index-
|
|
2
|
+
import { o as H, d as U } from "../index-Dxw2pU4z.mjs";
|
|
3
3
|
import J from "sortablejs";
|
|
4
4
|
import { _ as K } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
5
5
|
var O = {
|
|
@@ -214,7 +214,8 @@ const Q = { class: "g-table" }, X = {
|
|
|
214
214
|
pageSize: { default: 10 },
|
|
215
215
|
total: { default: 0 },
|
|
216
216
|
pageSizes: { default: () => [10, 20, 50, 100] },
|
|
217
|
-
layout: { default: "total, sizes, prev, pager, next" }
|
|
217
|
+
layout: { default: "total, sizes, prev, pager, next" },
|
|
218
|
+
size: { default: "default" }
|
|
218
219
|
},
|
|
219
220
|
emits: ["update:currentPage", "update:pageSize", "sorted:data"],
|
|
220
221
|
setup(B, { emit: k }) {
|
|
@@ -222,7 +223,7 @@ const Q = { class: "g-table" }, X = {
|
|
|
222
223
|
F("update:pageSize", u);
|
|
223
224
|
}, T = (u) => {
|
|
224
225
|
F("update:currentPage", u);
|
|
225
|
-
}, L = N(),
|
|
226
|
+
}, L = N(), v = (u) => !!L[u], g = I(), $ = (u) => {
|
|
226
227
|
const e = !!g["page-size"], n = !!g["current-page"];
|
|
227
228
|
if (e && n) {
|
|
228
229
|
const a = Number(g["page-size"] || 10), t = Number(g["current-page"] || 1);
|
|
@@ -249,7 +250,7 @@ const Q = { class: "g-table" }, X = {
|
|
|
249
250
|
setTimeout(a, 500);
|
|
250
251
|
};
|
|
251
252
|
a();
|
|
252
|
-
}),
|
|
253
|
+
}), _ = async () => {
|
|
253
254
|
if (m.value)
|
|
254
255
|
try {
|
|
255
256
|
const u = await x();
|
|
@@ -299,9 +300,9 @@ const Q = { class: "g-table" }, X = {
|
|
|
299
300
|
}
|
|
300
301
|
};
|
|
301
302
|
return W(() => {
|
|
302
|
-
s.dragSort &&
|
|
303
|
+
s.dragSort && _();
|
|
303
304
|
}), j(() => s.data, () => {
|
|
304
|
-
s.dragSort &&
|
|
305
|
+
s.dragSort && _();
|
|
305
306
|
}), q(() => {
|
|
306
307
|
D.value?.destroy?.(), D.value = null;
|
|
307
308
|
}), (u, e) => {
|
|
@@ -313,10 +314,11 @@ const Q = { class: "g-table" }, X = {
|
|
|
313
314
|
d(C, G({
|
|
314
315
|
data: u.data || []
|
|
315
316
|
}, u.$attrs, {
|
|
317
|
+
size: u.size,
|
|
316
318
|
stripe: "",
|
|
317
319
|
ref_key: "tableRef",
|
|
318
320
|
ref: m,
|
|
319
|
-
class: "g-table-main"
|
|
321
|
+
class: ["g-table-main", `g-table-main--${u.size}`]
|
|
320
322
|
}), {
|
|
321
323
|
empty: o(() => [
|
|
322
324
|
u.$slots.empty ? p(u.$slots, "empty", { key: 0 }, void 0, !0) : (E(), A("span", Z, "暂无数据"))
|
|
@@ -341,7 +343,7 @@ const Q = { class: "g-table" }, X = {
|
|
|
341
343
|
_: 1
|
|
342
344
|
})) : c("", !0),
|
|
343
345
|
p(u.$slots, "default", {}, void 0, !0),
|
|
344
|
-
|
|
346
|
+
v("operations") ? (E(), h(a, {
|
|
345
347
|
key: 1,
|
|
346
348
|
fixed: "right",
|
|
347
349
|
label: u.operationLabel || "操作",
|
|
@@ -352,7 +354,7 @@ const Q = { class: "g-table" }, X = {
|
|
|
352
354
|
row: r.row,
|
|
353
355
|
index: r.$index
|
|
354
356
|
}, void 0, !0),
|
|
355
|
-
|
|
357
|
+
v("more") ? (E(), h(l, {
|
|
356
358
|
key: 0,
|
|
357
359
|
size: "small",
|
|
358
360
|
style: { "vertical-align": "baseline" }
|
|
@@ -386,7 +388,7 @@ const Q = { class: "g-table" }, X = {
|
|
|
386
388
|
}, 8, ["label", "width"])) : c("", !0)
|
|
387
389
|
]),
|
|
388
390
|
_: 3
|
|
389
|
-
}, 16, ["data"]),
|
|
391
|
+
}, 16, ["data", "size", "class"]),
|
|
390
392
|
u.pagination ? (E(), h(f, {
|
|
391
393
|
key: 1,
|
|
392
394
|
locale: w(O)
|
|
@@ -409,7 +411,7 @@ const Q = { class: "g-table" }, X = {
|
|
|
409
411
|
]);
|
|
410
412
|
};
|
|
411
413
|
}
|
|
412
|
-
}), y = /* @__PURE__ */ K(eu, [["__scopeId", "data-v-
|
|
414
|
+
}), y = /* @__PURE__ */ K(eu, [["__scopeId", "data-v-90ad3ecc"]]);
|
|
413
415
|
y.install = (B) => {
|
|
414
416
|
B.component(y.name, y);
|
|
415
417
|
};
|