geekin-devtoys 0.2.21 → 0.3.1
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/GDialog/index.js +1 -1
- package/lib/GDialog/index.mjs +2 -2
- package/lib/GDialog/style.css +1 -1
- package/lib/GInputTreeTag/index.js +1 -1
- package/lib/GInputTreeTag/index.mjs +205 -199
- 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/GInputTreeTag/index.d.ts +2017 -5
- package/lib/components/GScreen/index.d.ts +55 -3
- package/lib/components/GTable/index.d.ts +7 -0
- package/lib/{index-il5JtS6o.js → index-B1MYKy3L.js} +1 -1
- package/lib/{index-CzamRrBC.mjs → index-Dxw2pU4z.mjs} +12 -27
- package/package.json +1 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ElMessage as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const Ee = {
|
|
1
|
+
import { defineComponent as ve, computed as u, ref as s, watch as me, nextTick as D, onMounted as ge, onBeforeUnmount as be, createElementBlock as V, openBlock as v, normalizeClass as I, createElementVNode as F, createBlock as Z, createCommentVNode as G, normalizeStyle as L, createVNode as W, unref as T, withKeys as he, Teleport as we, withDirectives as ye, withModifiers as ke, withCtx as J, renderSlot as M, createTextVNode as Q, toDisplayString as X, vShow as Ee, Fragment as Ve, renderList as Fe } from "vue";
|
|
2
|
+
import { ElInput as Me, ElTree as xe, ElTag as Be, ElMessage as Y } from "element-plus";
|
|
3
|
+
import { _ as _e } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
4
|
+
const Se = {
|
|
6
5
|
key: 0,
|
|
7
6
|
class: "g-input-tree-tag__tags"
|
|
8
|
-
},
|
|
7
|
+
}, Ce = /* @__PURE__ */ ve({
|
|
9
8
|
__name: "index",
|
|
10
9
|
props: {
|
|
11
10
|
modelValue: { default: () => [] },
|
|
@@ -25,7 +24,6 @@ const Ee = {
|
|
|
25
24
|
tagEffect: { default: "light" },
|
|
26
25
|
clearInputAfterSelect: { type: Boolean, default: !0 },
|
|
27
26
|
enterToAdd: { type: Boolean, default: !0 },
|
|
28
|
-
showLeafIcon: { type: Boolean, default: !0 },
|
|
29
27
|
valueFormat: { default: "value" },
|
|
30
28
|
selectable: {},
|
|
31
29
|
filterMethod: {},
|
|
@@ -33,243 +31,251 @@ const Ee = {
|
|
|
33
31
|
notFoundMessage: { default: "未找到匹配项" }
|
|
34
32
|
},
|
|
35
33
|
emits: ["update:modelValue", "change", "add", "remove", "node-click", "duplicate", "not-found"],
|
|
36
|
-
setup(
|
|
37
|
-
const
|
|
38
|
-
label:
|
|
39
|
-
children:
|
|
40
|
-
disabled:
|
|
41
|
-
})),
|
|
34
|
+
setup(x, { expose: P, emit: ee }) {
|
|
35
|
+
const l = x, o = ee, te = u(() => ({
|
|
36
|
+
label: l.props.label || "label",
|
|
37
|
+
children: l.props.children || "children",
|
|
38
|
+
disabled: l.props.disabled
|
|
39
|
+
})), ae = u(() => l.props.value || l.nodeKey || "id"), le = u(() => l.props.label || "label"), ne = u(() => l.props.children || "children"), B = u(() => l.props.isLeaf), m = (e) => e ? e[ae.value] : void 0, p = (e) => e ? e[le.value] : "", A = (e) => e ? e[ne.value] : void 0, c = (e) => {
|
|
42
40
|
if (!e) return !1;
|
|
43
|
-
if (typeof
|
|
41
|
+
if (typeof l.selectable == "function") return l.selectable(e);
|
|
44
42
|
if (B.value && e[B.value] !== void 0) return !!e[B.value];
|
|
45
|
-
const t =
|
|
43
|
+
const t = A(e);
|
|
46
44
|
return !t || !t.length;
|
|
47
|
-
},
|
|
48
|
-
const e = /* @__PURE__ */ new Map(), t = (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
45
|
+
}, _ = u(() => {
|
|
46
|
+
const e = /* @__PURE__ */ new Map(), t = (a = []) => {
|
|
47
|
+
a.forEach((n) => {
|
|
48
|
+
c(n) && e.set(m(n), n);
|
|
49
|
+
const d = A(n);
|
|
50
|
+
d?.length && t(d);
|
|
53
51
|
});
|
|
54
52
|
};
|
|
55
|
-
return t(
|
|
56
|
-
}),
|
|
57
|
-
const
|
|
53
|
+
return t(l.data || []), e;
|
|
54
|
+
}), i = u(() => (l.modelValue || []).map((t) => {
|
|
55
|
+
const a = l.valueFormat === "object" ? t?.value : t, n = _.value.get(a), d = l.valueFormat === "object" ? t?.label : void 0;
|
|
58
56
|
return {
|
|
59
|
-
value:
|
|
60
|
-
label:
|
|
61
|
-
raw:
|
|
57
|
+
value: a,
|
|
58
|
+
label: n ? p(n) : d ?? String(a ?? ""),
|
|
59
|
+
raw: n
|
|
62
60
|
};
|
|
63
|
-
})),
|
|
64
|
-
() => typeof
|
|
65
|
-
),
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
if (!
|
|
69
|
-
const e =
|
|
61
|
+
})), w = (e) => i.value.some((t) => t.value === e), y = s(""), r = s(!1), z = s(null), $ = s(null), H = s(null), g = s(null), N = s({}), O = s("bottom"), oe = u(
|
|
62
|
+
() => typeof l.width == "number" ? `${l.width}px` : l.width
|
|
63
|
+
), S = () => {
|
|
64
|
+
l.disabled || (r.value = !0);
|
|
65
|
+
}, k = () => {
|
|
66
|
+
if (!r.value) return;
|
|
67
|
+
const e = H.value, t = g.value;
|
|
70
68
|
if (!e || !t) return;
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
const a = e.getBoundingClientRect(), n = t.offsetHeight || l.popperMaxHeight, E = window.innerHeight - a.bottom - l.popperOffset, ce = a.top, q = E >= n || E >= ce ? "bottom" : "top";
|
|
70
|
+
O.value = q;
|
|
71
|
+
const fe = q === "bottom" ? a.bottom + l.popperOffset : a.top - n;
|
|
72
|
+
N.value = {
|
|
74
73
|
position: "fixed",
|
|
75
|
-
top: `${
|
|
76
|
-
left: `${
|
|
77
|
-
width: `${
|
|
78
|
-
zIndex: String(
|
|
74
|
+
top: `${fe}px`,
|
|
75
|
+
left: `${a.left}px`,
|
|
76
|
+
width: `${a.width}px`,
|
|
77
|
+
zIndex: String(l.popperZIndex)
|
|
79
78
|
};
|
|
80
79
|
};
|
|
81
|
-
let
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
let f = null;
|
|
81
|
+
const b = () => {
|
|
82
|
+
r.value && (f && cancelAnimationFrame(f), f = requestAnimationFrame(() => {
|
|
83
|
+
f = null, k();
|
|
85
84
|
}));
|
|
86
85
|
};
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
let h = null;
|
|
87
|
+
const re = () => {
|
|
88
|
+
typeof ResizeObserver > "u" || !g.value || (h?.disconnect(), h = new ResizeObserver(() => b()), h.observe(g.value));
|
|
89
|
+
}, K = () => {
|
|
90
|
+
h?.disconnect(), h = null;
|
|
91
|
+
};
|
|
92
|
+
me(r, async (e) => {
|
|
93
|
+
if (!e) {
|
|
94
|
+
K();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
await D(), k(), requestAnimationFrame(k), re();
|
|
89
98
|
});
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
99
|
+
const j = (e) => {
|
|
100
|
+
if (!r.value) return;
|
|
92
101
|
const t = e.target;
|
|
93
|
-
|
|
102
|
+
$.value?.contains(t) || g.value?.contains(t) || (r.value = !1);
|
|
94
103
|
};
|
|
95
|
-
|
|
96
|
-
document.addEventListener("mousedown",
|
|
97
|
-
}),
|
|
98
|
-
document.removeEventListener("mousedown",
|
|
104
|
+
ge(() => {
|
|
105
|
+
document.addEventListener("mousedown", j, !0), window.addEventListener("scroll", b, !0), window.addEventListener("resize", b);
|
|
106
|
+
}), be(() => {
|
|
107
|
+
document.removeEventListener("mousedown", j, !0), window.removeEventListener("scroll", b, !0), window.removeEventListener("resize", b), f && cancelAnimationFrame(f), K();
|
|
99
108
|
});
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
const de = (e) => {
|
|
110
|
+
r.value = !0, z.value?.filter(e), D(k);
|
|
111
|
+
}, ue = (e, t) => e ? typeof l.filterMethod == "function" ? l.filterMethod(e, t) : String(p(t) ?? "").toLowerCase().includes(String(e).toLowerCase()) : !0, se = (e, t) => {
|
|
112
|
+
if (o("node-click", e), !c(e)) {
|
|
113
|
+
t && (t.expanded = !t.expanded);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
C(e), r.value = !1;
|
|
117
|
+
}, ie = (e) => l.valueFormat === "object" ? { value: e.value, label: e.label, raw: e.raw } : e.value, C = (e) => {
|
|
118
|
+
const t = m(e);
|
|
106
119
|
if (t == null || t === "") return;
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
|
|
120
|
+
if (w(t)) {
|
|
121
|
+
const d = { value: t, label: p(e), raw: e };
|
|
122
|
+
o("duplicate", d), l.duplicateMessage && Y.warning(l.duplicateMessage);
|
|
110
123
|
return;
|
|
111
124
|
}
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
},
|
|
115
|
-
if (!
|
|
116
|
-
const e = (
|
|
125
|
+
const a = { value: t, label: p(e), raw: e }, n = [...l.modelValue || [], ie(a)];
|
|
126
|
+
o("update:modelValue", n), o("add", a), o("change", n, [...i.value, a]), l.clearInputAfterSelect && (y.value = "");
|
|
127
|
+
}, pe = () => {
|
|
128
|
+
if (!l.enterToAdd) return;
|
|
129
|
+
const e = (y.value || "").trim();
|
|
117
130
|
if (!e) return;
|
|
118
131
|
let t = null;
|
|
119
|
-
for (const
|
|
120
|
-
if (
|
|
121
|
-
t =
|
|
132
|
+
for (const a of _.value.values())
|
|
133
|
+
if (p(a) === e) {
|
|
134
|
+
t = a;
|
|
122
135
|
break;
|
|
123
136
|
}
|
|
124
137
|
if (!t) {
|
|
125
|
-
|
|
138
|
+
o("not-found", e), l.notFoundMessage && Y.warning(l.notFoundMessage);
|
|
126
139
|
return;
|
|
127
140
|
}
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
const t =
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
141
|
+
C(t);
|
|
142
|
+
}, U = (e) => {
|
|
143
|
+
const t = i.value[e], a = [...l.modelValue || []];
|
|
144
|
+
a.splice(e, 1), o("update:modelValue", a), t && o("remove", t, e);
|
|
145
|
+
const n = i.value.filter((d, E) => E !== e);
|
|
146
|
+
o("change", a, n);
|
|
134
147
|
};
|
|
135
|
-
return
|
|
148
|
+
return P({
|
|
136
149
|
/** 主动打开下拉面板 */
|
|
137
|
-
open:
|
|
150
|
+
open: S,
|
|
138
151
|
/** 主动关闭下拉面板 */
|
|
139
|
-
close: () =>
|
|
152
|
+
close: () => r.value = !1,
|
|
140
153
|
/** 清空已选 */
|
|
141
154
|
clear: () => {
|
|
142
|
-
|
|
155
|
+
o("update:modelValue", []), o("change", [], []);
|
|
143
156
|
},
|
|
144
157
|
/** 根据 value 直接添加 */
|
|
145
158
|
addByValue: (e) => {
|
|
146
|
-
const t =
|
|
147
|
-
t &&
|
|
159
|
+
const t = _.value.get(e);
|
|
160
|
+
t && C(t);
|
|
148
161
|
}
|
|
149
|
-
}), (e, t) => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
}), (e, t) => (v(), V("div", {
|
|
163
|
+
class: I(["g-input-tree-tag", { "is-disabled": e.disabled }])
|
|
164
|
+
}, [
|
|
165
|
+
F("div", {
|
|
166
|
+
class: "g-input-tree-tag__wrap",
|
|
167
|
+
ref_key: "wrapRef",
|
|
168
|
+
ref: $
|
|
153
169
|
}, [
|
|
154
|
-
|
|
155
|
-
class: "g-input-tree-
|
|
156
|
-
ref_key: "
|
|
157
|
-
ref:
|
|
170
|
+
F("div", {
|
|
171
|
+
class: "g-input-tree-tag__input-box",
|
|
172
|
+
ref_key: "inputBoxRef",
|
|
173
|
+
ref: H,
|
|
174
|
+
style: L({ width: oe.value })
|
|
158
175
|
}, [
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
176
|
+
W(T(Me), {
|
|
177
|
+
modelValue: y.value,
|
|
178
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => y.value = a),
|
|
179
|
+
placeholder: e.placeholder,
|
|
180
|
+
clearable: e.clearable,
|
|
181
|
+
disabled: e.disabled,
|
|
182
|
+
class: "g-input-tree-tag__input",
|
|
183
|
+
onFocus: S,
|
|
184
|
+
onClick: S,
|
|
185
|
+
onInput: de,
|
|
186
|
+
onKeyup: he(pe, ["enter"])
|
|
187
|
+
}, null, 8, ["modelValue", "placeholder", "clearable", "disabled"])
|
|
188
|
+
], 4),
|
|
189
|
+
(v(), Z(we, { to: "body" }, [
|
|
190
|
+
ye(F("div", {
|
|
191
|
+
ref_key: "popperRef",
|
|
192
|
+
ref: g,
|
|
193
|
+
class: I(["g-input-tree-tag__popover", `is-${O.value}`]),
|
|
194
|
+
style: L(N.value),
|
|
195
|
+
onMousedown: t[1] || (t[1] = ke(() => {
|
|
196
|
+
}, ["prevent"]))
|
|
164
197
|
}, [
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
placeholder: e.placeholder,
|
|
169
|
-
clearable: e.clearable,
|
|
170
|
-
disabled: e.disabled,
|
|
171
|
-
class: "g-input-tree-tag__input",
|
|
172
|
-
onFocus: x,
|
|
173
|
-
onClick: x,
|
|
174
|
-
onInput: ne,
|
|
175
|
-
onKeyup: ve(de, ["enter"])
|
|
176
|
-
}, null, 8, ["modelValue", "placeholder", "clearable", "disabled"])
|
|
177
|
-
], 4),
|
|
178
|
-
(c(), N(me, { to: "body" }, [
|
|
179
|
-
ge(E("div", {
|
|
180
|
-
ref_key: "popperRef",
|
|
181
|
-
ref: I,
|
|
182
|
-
class: A(["g-input-tree-tag__popover", `is-${L.value}`]),
|
|
183
|
-
style: R(D.value),
|
|
184
|
-
onMousedown: t[1] || (t[1] = be(() => {
|
|
185
|
-
}, ["prevent"]))
|
|
198
|
+
F("div", {
|
|
199
|
+
class: "g-input-tree-tag__tree-wrap",
|
|
200
|
+
style: L({ maxHeight: e.popperMaxHeight + "px" })
|
|
186
201
|
}, [
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
"filter-node-method": re,
|
|
198
|
-
"expand-on-click-node": !1,
|
|
199
|
-
"default-expand-all": e.defaultExpandAll,
|
|
200
|
-
onNodeClick: ue
|
|
201
|
-
}, {
|
|
202
|
-
default: $((n) => [
|
|
203
|
-
z(e.$slots, "tree-node", {
|
|
204
|
-
data: n?.data,
|
|
205
|
-
node: n?.node,
|
|
206
|
-
selectable: v(n?.data),
|
|
207
|
-
selected: C(h(n?.data))
|
|
208
|
-
}, () => [
|
|
209
|
-
n?.data ? (c(), V("span", {
|
|
210
|
-
key: 0,
|
|
211
|
-
class: A([
|
|
212
|
-
"g-input-tree-tag__node",
|
|
213
|
-
{
|
|
214
|
-
"is-selectable": v(n.data),
|
|
215
|
-
"is-selected": v(n.data) && C(h(n.data))
|
|
216
|
-
}
|
|
217
|
-
])
|
|
218
|
-
}, [
|
|
219
|
-
v(n.data) && e.showLeafIcon ? (c(), N(o, {
|
|
220
|
-
key: 0,
|
|
221
|
-
class: "g-input-tree-tag__node-icon"
|
|
222
|
-
}, {
|
|
223
|
-
default: $(() => [
|
|
224
|
-
H(he(ke))
|
|
225
|
-
]),
|
|
226
|
-
_: 1
|
|
227
|
-
})) : T("", !0),
|
|
228
|
-
J(" " + Q(f(n.data)), 1)
|
|
229
|
-
], 2)) : T("", !0)
|
|
230
|
-
], !0)
|
|
231
|
-
]),
|
|
232
|
-
_: 3
|
|
233
|
-
}, 8, ["data", "props", "node-key", "default-expand-all"])
|
|
234
|
-
], 4)
|
|
235
|
-
], 38), [
|
|
236
|
-
[we, u.value]
|
|
237
|
-
])
|
|
238
|
-
])),
|
|
239
|
-
p.value.length ? (c(), V("div", Ee, [
|
|
240
|
-
z(e.$slots, "tags", {
|
|
241
|
-
items: p.value,
|
|
242
|
-
remove: G
|
|
243
|
-
}, () => [
|
|
244
|
-
(c(!0), V(ye, null, _e(p.value, (n, b) => (c(), N(g, {
|
|
245
|
-
key: n.value,
|
|
246
|
-
class: "g-input-tree-tag__tag",
|
|
247
|
-
type: e.tagType,
|
|
248
|
-
effect: e.tagEffect,
|
|
249
|
-
closable: e.closable && !e.disabled,
|
|
250
|
-
onClose: (Be) => G(b)
|
|
202
|
+
W(T(xe), {
|
|
203
|
+
ref_key: "treeRef",
|
|
204
|
+
ref: z,
|
|
205
|
+
data: e.data,
|
|
206
|
+
props: te.value,
|
|
207
|
+
"node-key": e.nodeKey,
|
|
208
|
+
"filter-node-method": ue,
|
|
209
|
+
"expand-on-click-node": !1,
|
|
210
|
+
"default-expand-all": e.defaultExpandAll,
|
|
211
|
+
onNodeClick: se
|
|
251
212
|
}, {
|
|
252
|
-
default:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
213
|
+
default: J((a) => [
|
|
214
|
+
M(e.$slots, "tree-node", {
|
|
215
|
+
data: a?.data,
|
|
216
|
+
node: a?.node,
|
|
217
|
+
selectable: c(a?.data),
|
|
218
|
+
selected: w(m(a?.data))
|
|
256
219
|
}, () => [
|
|
257
|
-
|
|
220
|
+
a?.data ? (v(), V("span", {
|
|
221
|
+
key: 0,
|
|
222
|
+
class: I([
|
|
223
|
+
"g-input-tree-tag__node",
|
|
224
|
+
{
|
|
225
|
+
"is-selectable": c(a.data),
|
|
226
|
+
"is-selected": c(a.data) && w(m(a.data))
|
|
227
|
+
}
|
|
228
|
+
])
|
|
229
|
+
}, [
|
|
230
|
+
M(e.$slots, "leaf-icon", {
|
|
231
|
+
data: a.data,
|
|
232
|
+
selectable: c(a.data),
|
|
233
|
+
selected: w(m(a.data))
|
|
234
|
+
}, void 0, !0),
|
|
235
|
+
Q(" " + X(p(a.data)), 1)
|
|
236
|
+
], 2)) : G("", !0)
|
|
258
237
|
], !0)
|
|
259
238
|
]),
|
|
260
|
-
_:
|
|
261
|
-
},
|
|
262
|
-
],
|
|
263
|
-
])
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
239
|
+
_: 3
|
|
240
|
+
}, 8, ["data", "props", "node-key", "default-expand-all"])
|
|
241
|
+
], 4)
|
|
242
|
+
], 38), [
|
|
243
|
+
[Ee, r.value]
|
|
244
|
+
])
|
|
245
|
+
])),
|
|
246
|
+
i.value.length ? (v(), V("div", Se, [
|
|
247
|
+
M(e.$slots, "tags", {
|
|
248
|
+
items: i.value,
|
|
249
|
+
remove: U
|
|
250
|
+
}, () => [
|
|
251
|
+
(v(!0), V(Ve, null, Fe(i.value, (a, n) => (v(), Z(T(Be), {
|
|
252
|
+
key: a.value,
|
|
253
|
+
class: "g-input-tree-tag__tag",
|
|
254
|
+
type: e.tagType,
|
|
255
|
+
effect: e.tagEffect,
|
|
256
|
+
closable: e.closable && !e.disabled,
|
|
257
|
+
onClose: (d) => U(n)
|
|
258
|
+
}, {
|
|
259
|
+
default: J(() => [
|
|
260
|
+
M(e.$slots, "tag", {
|
|
261
|
+
item: a,
|
|
262
|
+
index: n
|
|
263
|
+
}, () => [
|
|
264
|
+
Q(X(a.label), 1)
|
|
265
|
+
], !0)
|
|
266
|
+
]),
|
|
267
|
+
_: 2
|
|
268
|
+
}, 1032, ["type", "effect", "closable", "onClose"]))), 128))
|
|
269
|
+
], !0)
|
|
270
|
+
])) : G("", !0)
|
|
271
|
+
], 512)
|
|
272
|
+
], 2));
|
|
267
273
|
}
|
|
268
|
-
}),
|
|
269
|
-
|
|
270
|
-
|
|
274
|
+
}), R = /* @__PURE__ */ _e(Ce, [["__scopeId", "data-v-274fd860"]]);
|
|
275
|
+
R.install = (x) => {
|
|
276
|
+
x.component(R.name, R);
|
|
271
277
|
};
|
|
272
278
|
export {
|
|
273
|
-
|
|
274
|
-
|
|
279
|
+
R as GInputTreeTag,
|
|
280
|
+
R as default
|
|
275
281
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.g-input-tree-tag[data-v-
|
|
1
|
+
@charset "UTF-8";.g-input-tree-tag[data-v-274fd860]{width:100%}.g-input-tree-tag__wrap[data-v-274fd860]{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.g-input-tree-tag__tags[data-v-274fd860]{display:flex;flex-wrap:wrap;gap:8px;width:100%}.g-input-tree-tag__tag[data-v-274fd860]{margin:0}.g-input-tree-tag.is-disabled[data-v-274fd860]{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
|
};
|