ling-yun-custom-components 0.0.74 → 0.0.76
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/es/PaginationTable.mjs +90 -86
- package/es/TreeSelect.mjs +406 -0
- package/es/TreeShowSelect.mjs +82 -0
- package/es/assets/PaginationTable.css +1 -1
- package/es/assets/TreeSelect.css +1 -0
- package/es/assets/TreeShowSelect.css +1 -0
- package/es/chunks/layout.Bhd1JJol.js +99 -0
- package/lib/PaginationTable.js +1 -1
- package/lib/TreeSelect.js +1 -0
- package/lib/TreeShowSelect.js +1 -0
- package/lib/assets/PaginationTable.css +1 -1
- package/lib/assets/TreeSelect.css +1 -0
- package/lib/assets/TreeShowSelect.css +1 -0
- package/lib/chunks/layout.pjXXSBch.js +1 -0
- package/package.json +9 -9
package/es/PaginationTable.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { w as
|
|
2
|
-
import { useSlots as
|
|
3
|
-
import { ElButton as ce, ElAutoResizer as
|
|
4
|
-
import { emitsMap as fe, paginationConfig as
|
|
5
|
-
import { _ as
|
|
6
|
-
import { cloneDeep as
|
|
7
|
-
import { _ as
|
|
8
|
-
import './assets/PaginationTable.css';const
|
|
1
|
+
import { w as Ee } from "./chunks/index.bCzIhWFw.js";
|
|
2
|
+
import { useSlots as ke, computed as m, ref as v, watch as oe, onMounted as ze, nextTick as Ne, createElementBlock as E, openBlock as S, createElementVNode as y, createCommentVNode as k, unref as p, renderSlot as j, Fragment as Pe, createBlock as de, withCtx as O, createTextVNode as re, toDisplayString as Ae, createVNode as U, createSlots as We, renderList as De, normalizeProps as Ie, guardReactiveProps as je, h as H } from "vue";
|
|
3
|
+
import { ElButton as ce, ElAutoResizer as Oe, ElTableV2 as qe, ElCheckbox as Ke } from "element-plus";
|
|
4
|
+
import { emitsMap as fe, paginationConfig as Fe, calculateScale as Ve } from "color-star-custom-methods";
|
|
5
|
+
import { _ as _e } from "./chunks/layout.BOupEsmd.js";
|
|
6
|
+
import { cloneDeep as $e } from "lodash";
|
|
7
|
+
import { _ as Le } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
8
|
+
import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col" }, Ue = {
|
|
9
9
|
class: "w-full flex justify-between overflow-hidden",
|
|
10
10
|
style: { height: "auto" }
|
|
11
|
-
},
|
|
11
|
+
}, He = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "flex-1 overflow-hidden"
|
|
14
|
-
},
|
|
14
|
+
}, Ge = {
|
|
15
15
|
class: "flex",
|
|
16
16
|
style: { width: "auto", gap: "10px" }
|
|
17
|
-
},
|
|
17
|
+
}, Je = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "flex items-center mg-b-18"
|
|
20
|
-
},
|
|
20
|
+
}, Qe = { class: "fz-12 text-74798c" }, Xe = { class: "btn-group mg-l-12" }, Ye = { class: "w-full flex-1 overflow-hidden flex flex-col" }, Ze = { class: "flex-1 overflow-hidden TABLE-AREA" }, et = {
|
|
21
21
|
key: 0,
|
|
22
22
|
class: "flex justify-end mg-t-20",
|
|
23
23
|
style: { height: "auto" }
|
|
24
|
-
},
|
|
24
|
+
}, tt = /* @__PURE__ */ Object.assign({
|
|
25
25
|
name: "PaginationTable"
|
|
26
26
|
}, {
|
|
27
27
|
__name: "layout",
|
|
@@ -52,7 +52,7 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
52
52
|
// 分页配置
|
|
53
53
|
pagination: {
|
|
54
54
|
type: Object,
|
|
55
|
-
default: () =>
|
|
55
|
+
default: () => Fe
|
|
56
56
|
},
|
|
57
57
|
// 查询参数
|
|
58
58
|
params: {
|
|
@@ -108,28 +108,31 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
108
108
|
"updateTableData",
|
|
109
109
|
"handleTableSelect",
|
|
110
110
|
"handleBatchDelete",
|
|
111
|
-
"updateSortState"
|
|
111
|
+
"updateSortState",
|
|
112
|
+
"endReached"
|
|
112
113
|
],
|
|
113
114
|
setup(c, { expose: he, emit: ve }) {
|
|
114
|
-
const
|
|
115
|
-
get: () => z.value ?
|
|
115
|
+
const b = ve, u = c, q = ke(), z = m(() => typeof u.requestFn == "function"), r = m({
|
|
116
|
+
get: () => z.value ? x.value : u.tableData,
|
|
116
117
|
set: (e) => {
|
|
117
|
-
z.value ?
|
|
118
|
+
z.value ? x.value = e : b("updateTableData", e);
|
|
118
119
|
}
|
|
119
120
|
}), K = v(0), G = m(() => z.value ? K.value : u.total), w = m({
|
|
120
121
|
get: () => u.sortState,
|
|
121
122
|
set: (e) => {
|
|
122
|
-
|
|
123
|
+
b("updateSortState", e);
|
|
123
124
|
}
|
|
124
125
|
}), pe = ({ key: e, order: t }) => {
|
|
125
126
|
w.value[e] = t, r.value = r.value.reverse();
|
|
126
|
-
},
|
|
127
|
+
}, ge = (e) => {
|
|
128
|
+
b("endReached", e);
|
|
129
|
+
}, x = v([]), h = m(() => u.pageMapping.pageNum), N = m(() => u.pageMapping.pageSize), F = {
|
|
127
130
|
[h.value]: 1,
|
|
128
131
|
[N.value]: 20
|
|
129
132
|
}, d = v({
|
|
130
133
|
...F
|
|
131
|
-
}), g = v([]), i = v([]), J = v([]),
|
|
132
|
-
function
|
|
134
|
+
}), g = v([]), i = v([]), J = v([]), C = v({}), Q = m(() => me(C.value));
|
|
135
|
+
function me(e) {
|
|
133
136
|
const t = /* @__PURE__ */ new Set();
|
|
134
137
|
for (const l in e)
|
|
135
138
|
e.hasOwnProperty(l) && e[l].forEach((a) => {
|
|
@@ -137,11 +140,11 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
137
140
|
});
|
|
138
141
|
return t;
|
|
139
142
|
}
|
|
140
|
-
const X = ({ value: e, intermediate: t = !1, onChange: l }) => H(
|
|
143
|
+
const X = ({ value: e, intermediate: t = !1, onChange: l }) => H(Ke, {
|
|
141
144
|
onChange: l,
|
|
142
145
|
modelValue: e,
|
|
143
146
|
indeterminate: t
|
|
144
|
-
}),
|
|
147
|
+
}), Se = (e, t) => {
|
|
145
148
|
if (e.selected = t, t ? i.value.some((l) => l.id === e.id) || i.value.push(e) : i.value = i.value.filter(({ id: l }) => l !== e.id), e.children && e.children.length > 0) {
|
|
146
149
|
const l = (a) => {
|
|
147
150
|
a.forEach((s) => {
|
|
@@ -150,7 +153,7 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
150
153
|
};
|
|
151
154
|
l(e.children);
|
|
152
155
|
}
|
|
153
|
-
e.parentId && Y(e.parentId), ee(),
|
|
156
|
+
e.parentId && Y(e.parentId), ee(), R();
|
|
154
157
|
}, Y = (e) => {
|
|
155
158
|
const t = Z(r.value, e);
|
|
156
159
|
if (!t) return;
|
|
@@ -167,7 +170,7 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
167
170
|
return null;
|
|
168
171
|
};
|
|
169
172
|
function ee() {
|
|
170
|
-
|
|
173
|
+
C.value[d.value[h.value]] = te(
|
|
171
174
|
r.value
|
|
172
175
|
);
|
|
173
176
|
}
|
|
@@ -180,19 +183,19 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
180
183
|
function V(e, t) {
|
|
181
184
|
e.selected = t, e.children && e.children.length > 0 && e.children.forEach((l) => V(l, t));
|
|
182
185
|
}
|
|
183
|
-
const
|
|
186
|
+
const ye = (e) => {
|
|
184
187
|
const t = r.value.map((l) => (V(l, e), l));
|
|
185
|
-
return r.value = [...t], ee(), i.value = e ? [...Object.values(
|
|
186
|
-
},
|
|
188
|
+
return r.value = [...t], ee(), i.value = e ? [...Object.values(C.value).flat()] : [], R(), [...i.value];
|
|
189
|
+
}, be = () => {
|
|
187
190
|
g.value.unshift({
|
|
188
191
|
key: "selection",
|
|
189
192
|
width: 50,
|
|
190
193
|
cellRenderer: (e) => {
|
|
191
|
-
const { rowData: t } = e, a = t.children && t.children.length > 0 ?
|
|
194
|
+
const { rowData: t } = e, a = t.children && t.children.length > 0 ? xe(t) : !1;
|
|
192
195
|
return H(X, {
|
|
193
196
|
value: t.selected,
|
|
194
197
|
intermediate: a,
|
|
195
|
-
onChange: (s) =>
|
|
198
|
+
onChange: (s) => Se(t, s)
|
|
196
199
|
});
|
|
197
200
|
},
|
|
198
201
|
headerCellRenderer: () => {
|
|
@@ -204,11 +207,11 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
204
207
|
value: t,
|
|
205
208
|
intermediate: l && !t,
|
|
206
209
|
// 目前是当前页全选就是全选状态,也就是每页的全选状态单独的
|
|
207
|
-
onChange:
|
|
210
|
+
onChange: ye
|
|
208
211
|
});
|
|
209
212
|
}
|
|
210
213
|
});
|
|
211
|
-
},
|
|
214
|
+
}, xe = (e) => {
|
|
212
215
|
if (!e.children || e.children.length === 0)
|
|
213
216
|
return !1;
|
|
214
217
|
const t = e.children.filter((l) => l.selected).length;
|
|
@@ -226,24 +229,24 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
226
229
|
return l.children && (l.children = ne(l.children)), l;
|
|
227
230
|
});
|
|
228
231
|
}
|
|
229
|
-
const B = v(!1),
|
|
230
|
-
B.value = !0,
|
|
232
|
+
const B = v(!1), Ce = () => {
|
|
233
|
+
B.value = !0, be();
|
|
231
234
|
}, _ = () => {
|
|
232
|
-
B.value = !1, i.value = [], r.value = r.value.map((e) => (V(e, !1), e)),
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
selectedRows: Object.values(
|
|
235
|
+
B.value = !1, i.value = [], r.value = r.value.map((e) => (V(e, !1), e)), C.value = {}, x.value = ne(x.value), g.value.shift(), R();
|
|
236
|
+
}, we = () => {
|
|
237
|
+
b("handleBatchDelete", {
|
|
238
|
+
selectedRows: Object.values(C.value).flat(),
|
|
236
239
|
// getAllSelectedNodes(finalTableData.value)
|
|
237
240
|
cb: () => {
|
|
238
|
-
_(),
|
|
241
|
+
_(), R();
|
|
239
242
|
}
|
|
240
243
|
});
|
|
241
|
-
},
|
|
242
|
-
i.value = [],
|
|
244
|
+
}, Be = () => {
|
|
245
|
+
i.value = [], R();
|
|
243
246
|
};
|
|
244
|
-
function
|
|
245
|
-
const e = Object.values(
|
|
246
|
-
|
|
247
|
+
function R() {
|
|
248
|
+
const e = Object.values(C.value).flat();
|
|
249
|
+
b("handleTableSelect", {
|
|
247
250
|
originNodeData: i.value,
|
|
248
251
|
allSelectedNodes: e,
|
|
249
252
|
// 所有选中的节点包含父节点
|
|
@@ -251,17 +254,17 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
251
254
|
// 所有选中的子节点
|
|
252
255
|
});
|
|
253
256
|
}
|
|
254
|
-
const
|
|
257
|
+
const T = () => {
|
|
255
258
|
z.value ? u.requestFn({
|
|
256
259
|
...u.params,
|
|
257
260
|
...d.value
|
|
258
261
|
}).then((e) => {
|
|
259
|
-
|
|
262
|
+
x.value = $(
|
|
260
263
|
e?.data[u.tableDataKey],
|
|
261
264
|
d.value[h.value],
|
|
262
265
|
Q.value
|
|
263
266
|
) || [], K.value = e?.data?.total;
|
|
264
|
-
}) : (
|
|
267
|
+
}) : (x.value = $(
|
|
265
268
|
u.tableData,
|
|
266
269
|
d.value[h.value],
|
|
267
270
|
Q.value
|
|
@@ -282,15 +285,15 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
282
285
|
)), f;
|
|
283
286
|
});
|
|
284
287
|
}
|
|
285
|
-
const
|
|
286
|
-
d.value[h.value] = F[h.value],
|
|
288
|
+
const Re = () => {
|
|
289
|
+
d.value[h.value] = F[h.value], T();
|
|
287
290
|
}, Te = () => {
|
|
288
|
-
d.value = { ...F },
|
|
291
|
+
d.value = { ...F }, T();
|
|
289
292
|
}, se = (e) => {
|
|
290
|
-
e === "size" && (d.value[h.value] = 1),
|
|
293
|
+
e === "size" && (d.value[h.value] = 1), T(), b(fe.paginationChange, d.value);
|
|
291
294
|
}, P = v(0), A = () => {
|
|
292
|
-
let e = P.value, t =
|
|
293
|
-
const l = 1 /
|
|
295
|
+
let e = P.value, t = $e(u.columns);
|
|
296
|
+
const l = 1 / Ve(), a = t.filter((n) => n.fixedWidth), s = t.filter((n) => !n.fixedWidth);
|
|
294
297
|
let o = 0;
|
|
295
298
|
a.forEach((n) => {
|
|
296
299
|
n.width && (o += n.width);
|
|
@@ -332,35 +335,35 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
332
335
|
const ie = () => {
|
|
333
336
|
P.value = document.querySelector(".TABLE-AREA").getBoundingClientRect().width, A();
|
|
334
337
|
};
|
|
335
|
-
return
|
|
336
|
-
|
|
338
|
+
return ze(() => {
|
|
339
|
+
T(), g.value = u.columns, P.value = document.querySelector(".TABLE-AREA").getBoundingClientRect().width, Ne(() => {
|
|
337
340
|
A();
|
|
338
341
|
}), window.addEventListener("resize", ie);
|
|
339
342
|
}), he({
|
|
340
|
-
getTableList:
|
|
341
|
-
search:
|
|
343
|
+
getTableList: T,
|
|
344
|
+
search: Re,
|
|
342
345
|
reset: Te,
|
|
343
|
-
initBatchSelect:
|
|
346
|
+
initBatchSelect: Be,
|
|
344
347
|
handleCancelSelect: _,
|
|
345
348
|
handleResize: ie
|
|
346
|
-
}), (e, t) => (S(), E("div",
|
|
347
|
-
y("div",
|
|
348
|
-
p(q)["filter-left"] ? (S(), E("div",
|
|
349
|
+
}), (e, t) => (S(), E("div", Me, [
|
|
350
|
+
y("div", Ue, [
|
|
351
|
+
p(q)["filter-left"] ? (S(), E("div", He, [
|
|
349
352
|
j(e.$slots, "filter-left", {}, void 0, !0)
|
|
350
|
-
])) :
|
|
351
|
-
y("div",
|
|
352
|
-
c.hasBatchSelect && r.value.length ? (S(), E(
|
|
353
|
-
B.value ? (S(), E("div",
|
|
354
|
-
y("div",
|
|
353
|
+
])) : k("", !0),
|
|
354
|
+
y("div", Ge, [
|
|
355
|
+
c.hasBatchSelect && r.value.length ? (S(), E(Pe, { key: 0 }, [
|
|
356
|
+
B.value ? (S(), E("div", Je, [
|
|
357
|
+
y("div", Qe, "已选" + Ae(i.value.length) + "条数据", 1),
|
|
355
358
|
y("div", {
|
|
356
359
|
class: "fz-12 text-3b64ff mg-l-4 pointer",
|
|
357
360
|
onClick: _
|
|
358
361
|
}, "取消选择"),
|
|
359
362
|
j(e.$slots, "btn-group", {}, () => [
|
|
360
|
-
y("div",
|
|
363
|
+
y("div", Xe, [
|
|
361
364
|
U(p(ce), {
|
|
362
365
|
type: "danger",
|
|
363
|
-
onClick:
|
|
366
|
+
onClick: we,
|
|
364
367
|
disabled: !i.value.length
|
|
365
368
|
}, {
|
|
366
369
|
default: O(() => [...t[6] || (t[6] = [
|
|
@@ -375,22 +378,22 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
375
378
|
disabled: c.disableBatchSelect,
|
|
376
379
|
title: c.disableBatchSelect ? c.disableBatchSelectText : "",
|
|
377
380
|
type: "default",
|
|
378
|
-
onClick:
|
|
381
|
+
onClick: Ce
|
|
379
382
|
}, {
|
|
380
383
|
default: O(() => [...t[5] || (t[5] = [
|
|
381
384
|
re(" 批量选择 ", -1)
|
|
382
385
|
])]),
|
|
383
386
|
_: 1
|
|
384
387
|
}, 8, ["disabled", "title"]))
|
|
385
|
-
], 64)) :
|
|
386
|
-
p(q)["filter-right"] ? j(e.$slots, "filter-right", { key: 1 }, void 0, !0) :
|
|
388
|
+
], 64)) : k("", !0),
|
|
389
|
+
p(q)["filter-right"] ? j(e.$slots, "filter-right", { key: 1 }, void 0, !0) : k("", !0)
|
|
387
390
|
])
|
|
388
391
|
]),
|
|
389
|
-
y("div",
|
|
390
|
-
y("div",
|
|
391
|
-
U(p(
|
|
392
|
+
y("div", Ye, [
|
|
393
|
+
y("div", Ze, [
|
|
394
|
+
U(p(Oe), null, {
|
|
392
395
|
default: O(({ width: l, height: a }) => [
|
|
393
|
-
U(p(
|
|
396
|
+
U(p(qe), {
|
|
394
397
|
"expanded-row-keys": J.value,
|
|
395
398
|
"onUpdate:expandedRowKeys": t[0] || (t[0] = (s) => J.value = s),
|
|
396
399
|
"expand-column-key": c.expandColumnKey,
|
|
@@ -400,12 +403,13 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
400
403
|
height: a,
|
|
401
404
|
fixed: "",
|
|
402
405
|
"sort-state": w.value,
|
|
406
|
+
onEndReached: ge,
|
|
403
407
|
onColumnSort: pe
|
|
404
|
-
},
|
|
405
|
-
|
|
408
|
+
}, We({ _: 2 }, [
|
|
409
|
+
De(p(q), (s, o) => ({
|
|
406
410
|
name: o,
|
|
407
411
|
fn: O((f) => [
|
|
408
|
-
j(e.$slots, o,
|
|
412
|
+
j(e.$slots, o, Ie(je(f)), void 0, !0)
|
|
409
413
|
])
|
|
410
414
|
}))
|
|
411
415
|
]), 1032, ["expanded-row-keys", "expand-column-key", "columns", "data", "width", "height", "sort-state"])
|
|
@@ -413,8 +417,8 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
413
417
|
_: 3
|
|
414
418
|
})
|
|
415
419
|
]),
|
|
416
|
-
c.isPagination && G.value > d.value[N.value] ? (S(), E("div",
|
|
417
|
-
c.isPagination ? (S(), de(
|
|
420
|
+
c.isPagination && G.value > d.value[N.value] ? (S(), E("div", et, [
|
|
421
|
+
c.isPagination ? (S(), de(_e, {
|
|
418
422
|
key: 0,
|
|
419
423
|
"current-page": d.value[h.value],
|
|
420
424
|
"onUpdate:currentPage": t[1] || (t[1] = (l) => d.value[h.value] = l),
|
|
@@ -425,13 +429,13 @@ import './assets/PaginationTable.css';const Le = { class: "flex h-full flex-col"
|
|
|
425
429
|
total: G.value,
|
|
426
430
|
onSizeChange: t[3] || (t[3] = (l) => se("size")),
|
|
427
431
|
onCurrentChange: t[4] || (t[4] = (l) => se("page"))
|
|
428
|
-
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])) :
|
|
429
|
-
])) :
|
|
432
|
+
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])) : k("", !0)
|
|
433
|
+
])) : k("", !0)
|
|
430
434
|
])
|
|
431
435
|
]));
|
|
432
436
|
}
|
|
433
|
-
}),
|
|
437
|
+
}), lt = /* @__PURE__ */ Le(tt, [["__scopeId", "data-v-8b1b65e5"]]), rt = Ee(lt);
|
|
434
438
|
export {
|
|
435
|
-
|
|
436
|
-
|
|
439
|
+
rt as PaginationTable,
|
|
440
|
+
rt as default
|
|
437
441
|
};
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { w as ie } from "./chunks/index.bCzIhWFw.js";
|
|
2
|
+
import { useAttrs as re, ref as x, computed as S, watch as O, nextTick as K, onMounted as de, createBlock as R, openBlock as N, unref as f, withCtx as b, createElementVNode as D, normalizeStyle as ce, createElementBlock as P, createCommentVNode as ue, createVNode as g, normalizeClass as he, mergeProps as fe, toDisplayString as $, withModifiers as pe, Fragment as me, h as H } from "vue";
|
|
3
|
+
import { ElAutoResizer as ye, ElInput as ve, ElIcon as Q, ElTreeV2 as ge } from "element-plus";
|
|
4
|
+
import { IconSearch as ke, IconDelete as Se, IconRighttop as Ne } from "color-message-lingyun-vue";
|
|
5
|
+
import { IconEmpty as be } from "color-star-custom-components";
|
|
6
|
+
import { _ as Ce } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
7
|
+
import './assets/TreeSelect.css';function Le(o) {
|
|
8
|
+
return {
|
|
9
|
+
name: "element-tree-line",
|
|
10
|
+
props: {
|
|
11
|
+
node: {
|
|
12
|
+
type: Object,
|
|
13
|
+
required: !0
|
|
14
|
+
},
|
|
15
|
+
data: {
|
|
16
|
+
type: Object
|
|
17
|
+
},
|
|
18
|
+
treeData: {
|
|
19
|
+
type: Array
|
|
20
|
+
},
|
|
21
|
+
indent: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default() {
|
|
24
|
+
return 16;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
showLabelLine: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: !0
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
render(r) {
|
|
33
|
+
const d = o || r, s = this.getScopedSlot("default"), t = this.getScopedSlot("node-label"), c = this.getScopedSlot("after-node-label"), p = s ? this.getScopedSlotValue(s, {
|
|
34
|
+
node: this.node,
|
|
35
|
+
data: this.data
|
|
36
|
+
}) : [
|
|
37
|
+
t ? this.getScopedSlotValue(t, {
|
|
38
|
+
node: this.node,
|
|
39
|
+
data: this.data
|
|
40
|
+
}) : d(
|
|
41
|
+
"span",
|
|
42
|
+
{ class: "element-tree-node-label" },
|
|
43
|
+
this.node.label
|
|
44
|
+
),
|
|
45
|
+
this.showLabelLine ? d("span", {
|
|
46
|
+
class: "element-tree-node-label-line"
|
|
47
|
+
}) : null,
|
|
48
|
+
this.getScopedSlotValue(c, {
|
|
49
|
+
node: this.node,
|
|
50
|
+
data: this.data
|
|
51
|
+
})
|
|
52
|
+
], y = [];
|
|
53
|
+
let u = this.node;
|
|
54
|
+
for (; u; ) {
|
|
55
|
+
let n = u.parent;
|
|
56
|
+
if (u.level === 1 && !u.parent) {
|
|
57
|
+
if (!this.treeData || !Array.isArray(this.treeData))
|
|
58
|
+
throw Error(
|
|
59
|
+
"if you using el-tree-v2 (Virtualized Tree) of element-plus,element-tree-line required data."
|
|
60
|
+
);
|
|
61
|
+
n = {
|
|
62
|
+
children: Array.isArray(this.treeData) ? this.treeData.map((m) => ({ ...m, key: m.id })) : [],
|
|
63
|
+
level: 0,
|
|
64
|
+
key: "node-0",
|
|
65
|
+
parent: null
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (n) {
|
|
69
|
+
const m = (n.children || n.childNodes).findIndex(
|
|
70
|
+
(C) => (C.key || C.id) === (u.key || u.id)
|
|
71
|
+
);
|
|
72
|
+
y.unshift(
|
|
73
|
+
m === (n.children || n.childNodes).length - 1
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
u = n;
|
|
77
|
+
}
|
|
78
|
+
const V = [];
|
|
79
|
+
for (let n = 0; n < this.node.level; n++)
|
|
80
|
+
y[n] && this.node.level - 1 !== n || V.push(
|
|
81
|
+
d("span", {
|
|
82
|
+
class: {
|
|
83
|
+
"element-tree-node-line-ver": !0,
|
|
84
|
+
"last-node-isLeaf-line": y[n] && this.node.level - 1 === n
|
|
85
|
+
},
|
|
86
|
+
style: { left: this.indent * n + "px" }
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
return d(
|
|
90
|
+
"span",
|
|
91
|
+
{
|
|
92
|
+
class: "element-tree-node-label-wrapper"
|
|
93
|
+
},
|
|
94
|
+
[p].concat(V).concat([
|
|
95
|
+
d("span", {
|
|
96
|
+
class: "element-tree-node-line-hor",
|
|
97
|
+
style: {
|
|
98
|
+
width: (this.node.isLeaf ? 24 : 8) + "px",
|
|
99
|
+
left: (this.node.level - 1) * this.indent + "px"
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
])
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
methods: {
|
|
106
|
+
getScopedSlot(r) {
|
|
107
|
+
if (!r)
|
|
108
|
+
return null;
|
|
109
|
+
const d = r.split("||");
|
|
110
|
+
let s = null;
|
|
111
|
+
for (let t = 0; t < d.length; t++) {
|
|
112
|
+
const c = d[t], p = (this.$slots || {})[c];
|
|
113
|
+
if (p) {
|
|
114
|
+
s = p;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (s = (this.$scopedSlots || {})[c], s)
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
return s;
|
|
121
|
+
},
|
|
122
|
+
getScopedSlotValue(r, d, s = null) {
|
|
123
|
+
return typeof r == "function" ? r(d) || s : r || s;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function U(o) {
|
|
129
|
+
const r = Le(o);
|
|
130
|
+
return o && (r.methods.getScopedSlot = function(s) {
|
|
131
|
+
if (!s)
|
|
132
|
+
return null;
|
|
133
|
+
const t = s.split("||");
|
|
134
|
+
let c = null;
|
|
135
|
+
for (let p = 0; p < t.length; p++) {
|
|
136
|
+
const y = t[p], u = (this.$slots || {})[y];
|
|
137
|
+
if (u) {
|
|
138
|
+
c = u;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return c;
|
|
143
|
+
}), r;
|
|
144
|
+
}
|
|
145
|
+
U();
|
|
146
|
+
const xe = {
|
|
147
|
+
key: 0,
|
|
148
|
+
class: "mg-b-16"
|
|
149
|
+
}, Ve = {
|
|
150
|
+
key: 0,
|
|
151
|
+
class: "list-item flex justify-between pd-l-6 pd-r-6 radius-8 items-center w-full"
|
|
152
|
+
}, Me = ["onClick"], De = { key: 1 }, Pe = /* @__PURE__ */ Object.assign({
|
|
153
|
+
name: "TreeSelect"
|
|
154
|
+
}, {
|
|
155
|
+
__name: "layout",
|
|
156
|
+
props: {
|
|
157
|
+
// 初始值
|
|
158
|
+
modelValue: {
|
|
159
|
+
type: Object,
|
|
160
|
+
default: () => []
|
|
161
|
+
},
|
|
162
|
+
// 树形节点对象结构
|
|
163
|
+
treeProps: {
|
|
164
|
+
type: Object,
|
|
165
|
+
default: () => ({
|
|
166
|
+
value: "id",
|
|
167
|
+
label: "label",
|
|
168
|
+
children: "children"
|
|
169
|
+
})
|
|
170
|
+
},
|
|
171
|
+
// 接口配置
|
|
172
|
+
apiConfig: {
|
|
173
|
+
type: Function
|
|
174
|
+
},
|
|
175
|
+
// 请求参数
|
|
176
|
+
reqParams: {
|
|
177
|
+
type: Object,
|
|
178
|
+
default: () => ({})
|
|
179
|
+
},
|
|
180
|
+
// 是否在组件挂载时自动加载数据
|
|
181
|
+
autoLoad: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
default: !0
|
|
184
|
+
},
|
|
185
|
+
// 是否多选
|
|
186
|
+
isMultiple: {
|
|
187
|
+
type: Boolean,
|
|
188
|
+
default: !0
|
|
189
|
+
},
|
|
190
|
+
// 是否有过滤
|
|
191
|
+
hasFilter: {
|
|
192
|
+
type: Boolean,
|
|
193
|
+
default: !1
|
|
194
|
+
},
|
|
195
|
+
// 是否是列表模式
|
|
196
|
+
isListMode: {
|
|
197
|
+
type: Boolean,
|
|
198
|
+
default: !1
|
|
199
|
+
},
|
|
200
|
+
treeList: {
|
|
201
|
+
type: Array,
|
|
202
|
+
default: () => []
|
|
203
|
+
},
|
|
204
|
+
// 是否有线条样式
|
|
205
|
+
hasTreeLine: {
|
|
206
|
+
type: Boolean,
|
|
207
|
+
default: !0
|
|
208
|
+
},
|
|
209
|
+
// 选中的节点是否包含父节点
|
|
210
|
+
includeParentSelected: {
|
|
211
|
+
type: Boolean,
|
|
212
|
+
default: !1
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
emits: ["handleCheck", "handleDeleteNode", "initFinish"],
|
|
216
|
+
setup(o, { expose: r, emit: d }) {
|
|
217
|
+
const s = U(H), t = o, c = d, p = re(), y = () => H(Ne, {
|
|
218
|
+
style: { color: "var(--text-color-2)", fontSize: "16px" }
|
|
219
|
+
}), u = t.isMultiple ? 20 : 10, V = t.isMultiple ? 15 : 11, n = x([]), m = x(null), C = x(null), w = S(() => t.treeProps.value), I = S(() => t.treeProps.label), v = S(() => t.treeProps.children), T = x(!1), G = S(() => !t.isMultiple && T.value), J = S(() => typeof t.apiConfig == "function"), _ = (e) => String(e).includes("%") ? e : e + "px", W = () => {
|
|
220
|
+
let e = m.value?.getCheckedNodes(), l = e.map((i) => i[w.value]), a = [];
|
|
221
|
+
return e.length && !t.includeParentSelected && (e = e.filter((i) => !i[v.value]), l = e.map((i) => i[w.value])), t.includeParentSelected && (a = X(n.value, l)), {
|
|
222
|
+
selectedNodeValues: l,
|
|
223
|
+
// 选中节点的值的集合
|
|
224
|
+
selectedNodes: e,
|
|
225
|
+
// 选中节点的集合
|
|
226
|
+
selectedParentNodes: a
|
|
227
|
+
// 选中节点的所有父节点
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
function X(e, l) {
|
|
231
|
+
const a = /* @__PURE__ */ new Map();
|
|
232
|
+
function i(h, k = []) {
|
|
233
|
+
for (const L of h) {
|
|
234
|
+
const ae = [...k, L];
|
|
235
|
+
L.children && L.children.length > 0 ? i(L.children, ae) : l.includes(L.id) && k.forEach((B) => {
|
|
236
|
+
a.has(B.id) || a.set(B.id, { ...B });
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return i(e), Array.from(a.values());
|
|
241
|
+
}
|
|
242
|
+
const Y = (e) => {
|
|
243
|
+
!t.isMultiple || t.isListMode || E();
|
|
244
|
+
}, Z = (e, l) => {
|
|
245
|
+
t.isMultiple || t.isListMode || (T.value = !0, C.value = l.key, c("handleCheck", {
|
|
246
|
+
selectedValue: [C.value],
|
|
247
|
+
// 选中节点的值
|
|
248
|
+
selectedNode: [l.data]
|
|
249
|
+
// // 选中节点
|
|
250
|
+
}));
|
|
251
|
+
}, z = x(""), ee = (e) => {
|
|
252
|
+
m.value.filter(e);
|
|
253
|
+
}, te = (e, l) => l[I.value].includes(e), le = (e) => {
|
|
254
|
+
let l = 0;
|
|
255
|
+
function a(i) {
|
|
256
|
+
for (const h of i) {
|
|
257
|
+
const k = h[v.value] && h[v.value].length > 0;
|
|
258
|
+
t.includeParentSelected ? l++ : k || l++, k && a(h[v.value]);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return a(e), l;
|
|
262
|
+
}, ne = S(() => le(n.value));
|
|
263
|
+
function E() {
|
|
264
|
+
const { selectedNodeValues: e, selectedNodes: l, selectedParentNodes: a } = W();
|
|
265
|
+
c("handleCheck", {
|
|
266
|
+
selectedValue: e,
|
|
267
|
+
// 选中节点的值的集合
|
|
268
|
+
selectedNode: l,
|
|
269
|
+
// 选中节点的集合
|
|
270
|
+
selectedParentNodes: a
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
const oe = (e, l) => {
|
|
274
|
+
m.value?.setChecked(e, l), E();
|
|
275
|
+
}, F = () => {
|
|
276
|
+
p["default-checked-keys"] && K(() => {
|
|
277
|
+
E();
|
|
278
|
+
});
|
|
279
|
+
}, se = (e) => {
|
|
280
|
+
c("handleDeleteNode", e);
|
|
281
|
+
}, M = (e) => e?.map((l) => ({
|
|
282
|
+
...l,
|
|
283
|
+
[v.value]: l[v.value]?.length ? M(l[v.value]) : void 0
|
|
284
|
+
})), j = async () => {
|
|
285
|
+
J.value ? t.apiConfig(t.reqParams)?.then((e) => {
|
|
286
|
+
n.value = M(e?.data || []), F(), A(t.modelValue), c("initFinish", n.value);
|
|
287
|
+
}) : q();
|
|
288
|
+
}, q = () => {
|
|
289
|
+
t.isListMode ? n.value = M(t.treeList || []) : (n.value = M(t.treeList || []), n.value.length && (F(), A(t.modelValue)));
|
|
290
|
+
}, A = (e) => {
|
|
291
|
+
const l = e && e.length && e.map((a) => a[t.treeProps.value]);
|
|
292
|
+
m.value?.setCheckedKeys(l);
|
|
293
|
+
};
|
|
294
|
+
return O(
|
|
295
|
+
() => t.treeList,
|
|
296
|
+
() => {
|
|
297
|
+
q();
|
|
298
|
+
},
|
|
299
|
+
{ deep: !0 }
|
|
300
|
+
), O(
|
|
301
|
+
() => t.modelValue,
|
|
302
|
+
(e) => {
|
|
303
|
+
K(() => {
|
|
304
|
+
A(e);
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
{ deep: !0 }
|
|
308
|
+
), de(() => {
|
|
309
|
+
j();
|
|
310
|
+
}), r({
|
|
311
|
+
allNodeNumbers: ne,
|
|
312
|
+
loadData: j,
|
|
313
|
+
setNodeCheckStatus: oe
|
|
314
|
+
}), (e, l) => (N(), R(f(ye), null, {
|
|
315
|
+
default: b(({ width: a, height: i }) => [
|
|
316
|
+
D("div", {
|
|
317
|
+
style: ce({
|
|
318
|
+
width: _(a),
|
|
319
|
+
height: _(i)
|
|
320
|
+
})
|
|
321
|
+
}, [
|
|
322
|
+
o.hasFilter ? (N(), P("div", xe, [
|
|
323
|
+
g(f(ve), {
|
|
324
|
+
modelValue: z.value,
|
|
325
|
+
"onUpdate:modelValue": l[0] || (l[0] = (h) => z.value = h),
|
|
326
|
+
placeholder: "请输入",
|
|
327
|
+
onInput: ee
|
|
328
|
+
}, {
|
|
329
|
+
prefix: b(() => [
|
|
330
|
+
g(f(Q), {
|
|
331
|
+
size: 16,
|
|
332
|
+
color: "var(--neutral-color-12)",
|
|
333
|
+
class: "mg-r-4"
|
|
334
|
+
}, {
|
|
335
|
+
default: b(() => [
|
|
336
|
+
g(f(ke))
|
|
337
|
+
]),
|
|
338
|
+
_: 1
|
|
339
|
+
})
|
|
340
|
+
]),
|
|
341
|
+
_: 1
|
|
342
|
+
}, 8, ["modelValue"])
|
|
343
|
+
])) : ue("", !0),
|
|
344
|
+
D("div", {
|
|
345
|
+
class: he(o.hasFilter ? "pd-l-8 pd-r-8" : "")
|
|
346
|
+
}, [
|
|
347
|
+
g(f(ge), fe({
|
|
348
|
+
ref_key: "treeRef",
|
|
349
|
+
ref: m,
|
|
350
|
+
height: o.hasFilter ? i - 48 : i,
|
|
351
|
+
data: n.value,
|
|
352
|
+
props: o.treeProps,
|
|
353
|
+
"node-key": w.value,
|
|
354
|
+
"show-checkbox": o.isMultiple && !o.isListMode,
|
|
355
|
+
"item-size": 34,
|
|
356
|
+
indent: f(u),
|
|
357
|
+
"highlight-current": G.value,
|
|
358
|
+
icon: o.isListMode ? "" : y,
|
|
359
|
+
"filter-method": te
|
|
360
|
+
}, f(p), {
|
|
361
|
+
onNodeClick: Z,
|
|
362
|
+
onCheck: Y
|
|
363
|
+
}), {
|
|
364
|
+
default: b(({ node: h }) => [
|
|
365
|
+
o.isListMode ? (N(), P("div", Ve, [
|
|
366
|
+
D("span", null, $(h.data[I.value]), 1),
|
|
367
|
+
D("div", {
|
|
368
|
+
class: "flex items-center",
|
|
369
|
+
onClick: pe((k) => se(h.data), ["stop"])
|
|
370
|
+
}, [
|
|
371
|
+
g(f(Q), {
|
|
372
|
+
size: 14,
|
|
373
|
+
color: "var(--neutral-color-5)"
|
|
374
|
+
}, {
|
|
375
|
+
default: b(() => [
|
|
376
|
+
g(f(Se))
|
|
377
|
+
]),
|
|
378
|
+
_: 1
|
|
379
|
+
})
|
|
380
|
+
], 8, Me)
|
|
381
|
+
])) : (N(), P(me, { key: 1 }, [
|
|
382
|
+
o.hasTreeLine ? (N(), R(f(s), {
|
|
383
|
+
key: 0,
|
|
384
|
+
node: h,
|
|
385
|
+
treeData: n.value,
|
|
386
|
+
showLabelLine: !1,
|
|
387
|
+
indent: f(V)
|
|
388
|
+
}, null, 8, ["node", "treeData", "indent"])) : (N(), P("span", De, $(h.data[I.value]), 1))
|
|
389
|
+
], 64))
|
|
390
|
+
]),
|
|
391
|
+
empty: b(() => [
|
|
392
|
+
g(f(be))
|
|
393
|
+
]),
|
|
394
|
+
_: 1
|
|
395
|
+
}, 16, ["height", "data", "props", "node-key", "show-checkbox", "indent", "highlight-current", "icon"])
|
|
396
|
+
], 2)
|
|
397
|
+
], 4)
|
|
398
|
+
]),
|
|
399
|
+
_: 1
|
|
400
|
+
}));
|
|
401
|
+
}
|
|
402
|
+
}), we = /* @__PURE__ */ Ce(Pe, [["__scopeId", "data-v-2357d4fe"]]), ze = ie(we);
|
|
403
|
+
export {
|
|
404
|
+
ze as TreeSelect,
|
|
405
|
+
ze as default
|
|
406
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { w as g } from "./chunks/index.bCzIhWFw.js";
|
|
2
|
+
import { useAttrs as w, ref as u, computed as y, watch as k, createBlock as P, openBlock as C, unref as s, withCtx as z, createElementVNode as o, normalizeStyle as T, toDisplayString as p, createVNode as m, mergeProps as D } from "vue";
|
|
3
|
+
import { ElAutoResizer as L } from "element-plus";
|
|
4
|
+
import { TreeSelect as f } from "./TreeSelect.mjs";
|
|
5
|
+
import { _ as R } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
6
|
+
import './assets/TreeShowSelect.css';const j = { class: "left-box w-50-percent flex flex-col" }, A = { class: "head-box fz-14 pd-t-8 pd-b-8 pd-l-12 pd-r-12 mg-b-8 text-202434" }, B = { class: "pd-r-12 pd-l-12 flex-1" }, E = { class: "right-box w-50-percent flex flex-col" }, H = { class: "head-box fz-14 pd-t-8 pd-b-8 pd-l-12 pd-r-12 mg-b-8 text-202434" }, I = { class: "pd-r-12 pd-l-12 flex-1 selected-list overflow-y-auto pd-t-8" }, O = /* @__PURE__ */ Object.assign({
|
|
7
|
+
name: "TreeShowSelect"
|
|
8
|
+
}, {
|
|
9
|
+
__name: "layout",
|
|
10
|
+
props: {
|
|
11
|
+
// 初始值
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: () => []
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
emits: ["getCheckedNode"],
|
|
18
|
+
setup(h, { emit: _ }) {
|
|
19
|
+
const v = h, x = _, d = w(), r = u(), b = y(() => d.treeProps ? d.treeProps : { value: "id", label: "label", children: "children" }), i = (e) => String(e).includes("%") ? e : e + "px", t = u([]), N = (e) => {
|
|
20
|
+
const { selectedNode: l, selectedValue: a, selectedParentNodes: c } = e;
|
|
21
|
+
t.value = l, x("getCheckedNode", {
|
|
22
|
+
selectedValue: a,
|
|
23
|
+
// 选中节点的值的集合
|
|
24
|
+
selectedNode: l,
|
|
25
|
+
// // 选中节点的集合
|
|
26
|
+
selectedParentNodes: c
|
|
27
|
+
});
|
|
28
|
+
}, S = (e) => {
|
|
29
|
+
r.value?.setNodeCheckStatus(e[b.value.value], !1);
|
|
30
|
+
}, V = (e) => {
|
|
31
|
+
t.value = e || [];
|
|
32
|
+
};
|
|
33
|
+
return k(
|
|
34
|
+
() => v.modelValue,
|
|
35
|
+
(e) => {
|
|
36
|
+
V(e);
|
|
37
|
+
},
|
|
38
|
+
{ immediate: !0, deep: !0 }
|
|
39
|
+
), (e, l) => (C(), P(s(L), null, {
|
|
40
|
+
default: z(({ width: a, height: c }) => [
|
|
41
|
+
o("div", {
|
|
42
|
+
class: "out-box flex radius-8 text-202434",
|
|
43
|
+
style: T({
|
|
44
|
+
width: i(a),
|
|
45
|
+
height: i(c)
|
|
46
|
+
})
|
|
47
|
+
}, [
|
|
48
|
+
o("div", j, [
|
|
49
|
+
o("div", A, p(r.value && r.value.allNodeNumbers || 0) + "项 ", 1),
|
|
50
|
+
o("div", B, [
|
|
51
|
+
m(s(f), D({
|
|
52
|
+
modelValue: t.value,
|
|
53
|
+
"onUpdate:modelValue": l[0] || (l[0] = (n) => t.value = n),
|
|
54
|
+
ref_key: "treeRef",
|
|
55
|
+
ref: r
|
|
56
|
+
}, s(d), { onHandleCheck: N }), null, 16, ["modelValue"])
|
|
57
|
+
])
|
|
58
|
+
]),
|
|
59
|
+
o("div", E, [
|
|
60
|
+
o("div", H, p(t.value.length) + "项 ", 1),
|
|
61
|
+
o("div", I, [
|
|
62
|
+
m(s(f), {
|
|
63
|
+
modelValue: t.value,
|
|
64
|
+
"onUpdate:modelValue": l[1] || (l[1] = (n) => t.value = n),
|
|
65
|
+
class: "tree-select-list",
|
|
66
|
+
treeProps: s(d).treeProps,
|
|
67
|
+
treeList: t.value,
|
|
68
|
+
isListMode: !0,
|
|
69
|
+
onHandleDeleteNode: S
|
|
70
|
+
}, null, 8, ["modelValue", "treeProps", "treeList"])
|
|
71
|
+
])
|
|
72
|
+
])
|
|
73
|
+
], 4)
|
|
74
|
+
]),
|
|
75
|
+
_: 1
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
}), U = /* @__PURE__ */ R(O, [["__scopeId", "data-v-506e7300"]]), J = g(U);
|
|
79
|
+
export {
|
|
80
|
+
J as TreeShowSelect,
|
|
81
|
+
J as default
|
|
82
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[data-v-
|
|
1
|
+
[data-v-8b1b65e5] .el-table-v2__header-cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.el-tree .el-tree-node__content{position:relative}.element-tree-node-label-wrapper{flex:1;display:flex;align-items:center}.element-tree-node-label{font-size:12px}.element-tree-node-line-ver{display:block;position:absolute;top:0;left:0;height:100%;border-left:1px dashed #dcdfe6}.element-tree-node-line-ver.last-node-isLeaf-line{height:50%}.element-tree-node-line-hor{display:block;position:absolute;top:50%;left:0;height:0;border-bottom:1px dashed #dcdfe6}.element-tree-node-label-line{flex:1;border-top:1px dashed #dcdfe6;align-self:center;margin:0 10px}[data-v-2357d4fe] .el-tree-node__label{line-height:22px}[data-v-2357d4fe] .el-tree-node:focus>.el-tree-node__content{background-color:transparent}[data-v-2357d4fe] .el-tree-node__content{border-radius:8px}[data-v-2357d4fe] .el-tree-node__content:hover{background-color:var(--primary-color-5)}[data-v-2357d4fe] .element-tree-node-label{font-size:14px}.list-item[data-v-2357d4fe]{height:32px}.list-item[data-v-2357d4fe]:hover{background:var(--primary-color-5)}[data-v-2357d4fe] .element-tree-node-line-ver,[data-v-2357d4fe] .element-tree-node-line-hor{border-color:var(--neutral-color-19)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.w-50-percent[data-v-506e7300]{width:50%}.out-box[data-v-506e7300]{border:1px solid var(--parting-line)}.out-box .head-box[data-v-506e7300]{border-bottom:1px solid var(--parting-line)}.out-box .left-box[data-v-506e7300]{border-right:1px solid var(--parting-line)}.out-box .selected-list .selected-item[data-v-506e7300]{height:32px}.out-box .selected-list .selected-item[data-v-506e7300]:hover{background:var(--primary-color-5)}.out-box .virtual-scroller[data-v-506e7300]{height:100%}.tree-select-list[data-v-506e7300] .el-tree-node__content{margin-bottom:8px;padding:4px 0;height:32px;border-radius:8px}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { computed as l, createBlock as z, openBlock as f, unref as y, mergeProps as C } from "vue";
|
|
2
|
+
import { ElPagination as P } from "element-plus";
|
|
3
|
+
import { IconRight as S, IconLeft as h } from "color-message-lingyun-vue";
|
|
4
|
+
import { emitsMap as t, paginationConfig as p, pageParams as c } from "color-star-custom-methods";
|
|
5
|
+
const x = /* @__PURE__ */ Object.assign({
|
|
6
|
+
name: "CustomPagination"
|
|
7
|
+
}, {
|
|
8
|
+
__name: "layout",
|
|
9
|
+
props: {
|
|
10
|
+
// 当前页码
|
|
11
|
+
currentPage: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: c.pageNum
|
|
14
|
+
},
|
|
15
|
+
// 每页显示条目个数
|
|
16
|
+
pageSize: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: c.pageSize
|
|
19
|
+
},
|
|
20
|
+
// 每页显示个数选择器的选项设置
|
|
21
|
+
pageSizes: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => p.pageSizes
|
|
24
|
+
},
|
|
25
|
+
// 是否为分页按钮添加背景色
|
|
26
|
+
background: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !0
|
|
29
|
+
},
|
|
30
|
+
// 分页组件的布局,子组件名用逗号分隔
|
|
31
|
+
layout: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: p.layout
|
|
34
|
+
},
|
|
35
|
+
// 上一页的图标
|
|
36
|
+
prevIcon: {
|
|
37
|
+
type: Object,
|
|
38
|
+
default: h
|
|
39
|
+
},
|
|
40
|
+
// 下一页的图标
|
|
41
|
+
nextIcon: {
|
|
42
|
+
type: Object,
|
|
43
|
+
default: S
|
|
44
|
+
},
|
|
45
|
+
// 只有一页时是否隐藏
|
|
46
|
+
hideOnSinglePage: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !0
|
|
49
|
+
},
|
|
50
|
+
// 总数
|
|
51
|
+
total: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: 0
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
emits: [
|
|
57
|
+
t.sizeChange,
|
|
58
|
+
t.currentChange,
|
|
59
|
+
t.updateCurrentPage,
|
|
60
|
+
t.updatePageSize
|
|
61
|
+
],
|
|
62
|
+
setup(a, { emit: d }) {
|
|
63
|
+
alert(1);
|
|
64
|
+
const n = d, g = a, u = l({
|
|
65
|
+
get: () => g.currentPage,
|
|
66
|
+
set: (e) => {
|
|
67
|
+
n(t.updateCurrentPage, e);
|
|
68
|
+
}
|
|
69
|
+
}), i = l({
|
|
70
|
+
get: () => g.pageSize,
|
|
71
|
+
set: (e) => {
|
|
72
|
+
n(t.updatePageSize, e);
|
|
73
|
+
}
|
|
74
|
+
}), s = (e) => {
|
|
75
|
+
n(t.sizeChange, e), n(t.updatePageSize, e);
|
|
76
|
+
}, m = (e) => {
|
|
77
|
+
n(t.currentChange, e), n(t.updateCurrentPage, e);
|
|
78
|
+
};
|
|
79
|
+
return (e, o) => (f(), z(y(P), C({
|
|
80
|
+
"current-page": u.value,
|
|
81
|
+
"onUpdate:currentPage": o[0] || (o[0] = (r) => u.value = r),
|
|
82
|
+
"page-size": i.value,
|
|
83
|
+
"onUpdate:pageSize": o[1] || (o[1] = (r) => i.value = r),
|
|
84
|
+
"page-sizes": a.pageSizes,
|
|
85
|
+
background: a.background,
|
|
86
|
+
layout: a.layout,
|
|
87
|
+
total: a.total,
|
|
88
|
+
"prev-icon": a.prevIcon,
|
|
89
|
+
"next-icon": a.nextIcon,
|
|
90
|
+
"hide-on-single-page": a.hideOnSinglePage
|
|
91
|
+
}, e.$attrs, {
|
|
92
|
+
onSizeChange: s,
|
|
93
|
+
onCurrentChange: m
|
|
94
|
+
}), null, 16, ["current-page", "page-size", "page-sizes", "background", "layout", "total", "prev-icon", "next-icon", "hide-on-single-page"]));
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
export {
|
|
98
|
+
x as _
|
|
99
|
+
};
|
package/lib/PaginationTable.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/PaginationTable.css');const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/PaginationTable.css');const pe=require("./chunks/index.CkihWzK6.js"),l=require("vue"),B=require("element-plus"),V=require("color-star-custom-methods"),ge=require("./chunks/layout.DbtiD7D3.js"),me=require("lodash"),Se=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),ye={class:"flex h-full flex-col"},be={class:"w-full flex justify-between overflow-hidden",style:{height:"auto"}},Ce={key:0,class:"flex-1 overflow-hidden"},xe={class:"flex",style:{width:"auto",gap:"10px"}},Be={key:1,class:"flex items-center mg-b-18"},Ee={class:"fz-12 text-74798c"},ke={class:"btn-group mg-l-12"},we={class:"w-full flex-1 overflow-hidden flex flex-col"},Ne={class:"flex-1 overflow-hidden TABLE-AREA"},Te={key:0,class:"flex justify-end mg-t-20",style:{height:"auto"}},Re=Object.assign({name:"PaginationTable"},{__name:"layout",props:{isPagination:{type:Boolean,default:!0},disableBatchSelect:{type:Boolean,default:!1},disableBatchSelectText:{type:String,default:""},total:{type:Number,default:0},tableData:{type:Array,default:()=>[]},pagination:{type:Object,default:()=>V.paginationConfig},params:{type:Object,default:()=>{}},requestFn:{type:Function},columns:{type:Array,default:()=>[]},hasBatchSelect:{type:Boolean,default:!1},expandColumnKey:{type:String,default:""},tableDataKey:{type:String,default:"list"},tableDomWidth:{type:Number,default:0},pageMapping:{type:Object,default:()=>({pageSize:"pageSize",pageNum:"pageNum"})},sortState:{type:Object,default:()=>{}}},emits:[V.emitsMap.paginationChange,"updateTableData","handleTableSelect","handleBatchDelete","updateSortState","endReached"],setup(f,{expose:te,emit:le}){const g=le,i=f,z=l.useSlots(),E=l.computed(()=>typeof i.requestFn=="function"),d=l.computed({get:()=>E.value?m.value:i.tableData,set:e=>{E.value?m.value=e:g("updateTableData",e)}}),A=l.ref(0),M=l.computed(()=>E.value?A.value:i.total),y=l.computed({get:()=>i.sortState,set:e=>{g("updateSortState",e)}}),ae=({key:e,order:t})=>{y.value[e]=t,d.value=d.value.reverse()},ne=e=>{g("endReached",e)},m=l.ref([]),v=l.computed(()=>i.pageMapping.pageNum),k=l.computed(()=>i.pageMapping.pageSize),q={[v.value]:1,[k.value]:20},c=l.ref({...q}),p=l.ref([]),s=l.ref([]),_=l.ref([]),S=l.ref({}),K=l.computed(()=>oe(S.value));function oe(e){const t=new Set;for(const a in e)e.hasOwnProperty(a)&&e[a].forEach(n=>{t.add(n.id)});return t}const F=({value:e,intermediate:t=!1,onChange:a})=>l.h(B.ElCheckbox,{onChange:a,modelValue:e,indeterminate:t}),ue=(e,t)=>{if(e.selected=t,t?s.value.some(a=>a.id===e.id)||s.value.push(e):s.value=s.value.filter(({id:a})=>a!==e.id),e.children&&e.children.length>0){const a=n=>{n.forEach(u=>{u.selected=t,t?s.value.some(r=>r.id===u.id)||s.value.push(u):s.value=s.value.filter(({id:r})=>r!==u.id),u.children&&u.children.length>0&&a(u.children)})};a(e.children)}e.parentId&&L(e.parentId),U(),C()},L=e=>{const t=$(d.value,e);if(!t)return;const a=t.children.every(n=>n.selected);a&&!t.selected?(t.selected=!0,s.value.some(n=>n.id===t.id)||s.value.push(t)):!a&&t.selected&&(t.selected=!1,s.value=s.value.filter(({id:n})=>n!==t.id)),t.parentId&&L(t.parentId)},$=(e,t)=>{for(const a of e){if(a.id===t)return a;if(a.children){const n=$(a.children,t);if(n)return n}}return null};function U(){S.value[c.value[v.value]]=H(d.value)}function H(e){let t=[];return e.forEach(a=>{a.selected&&t.push(a),a.children&&a.children.length>0&&(t=t.concat(H(a.children)))}),t}function W(e,t){e.selected=t,e.children&&e.children.length>0&&e.children.forEach(a=>W(a,t))}const se=e=>{const t=d.value.map(a=>(W(a,e),a));return d.value=[...t],U(),s.value=e?[...Object.values(S.value).flat()]:[],C(),[...s.value]},ie=()=>{p.value.unshift({key:"selection",width:50,cellRenderer:e=>{const{rowData:t}=e,n=t.children&&t.children.length>0?re(t):!1;return l.h(F,{value:t.selected,intermediate:n,onChange:u=>ue(t,u)})},headerCellRenderer:()=>{const e=l.unref(d),t=e.every(n=>{const u=n.selected,r=G(n);return u&&r}),a=e.some(n=>n.selected||J(n));return l.h(F,{value:t,intermediate:a&&!t,onChange:se})}})},re=e=>{if(!e.children||e.children.length===0)return!1;const t=e.children.filter(a=>a.selected).length;return t>0&&t<e.children.length};function G(e){return e.children?.length?!!e.selected&&e.children.every(G):!!e.selected}function J(e){return e.selected?!0:e.children?.some(J)||!1}function Q(e){return e.map(t=>{const a={...t,selected:!1};return a.children&&(a.children=Q(a.children)),a})}const b=l.ref(!1),ce=()=>{b.value=!0,ie()},D=()=>{b.value=!1,s.value=[],d.value=d.value.map(e=>(W(e,!1),e)),S.value={},m.value=Q(m.value),p.value.shift(),C()},de=()=>{g("handleBatchDelete",{selectedRows:Object.values(S.value).flat(),cb:()=>{D(),C()}})},fe=()=>{s.value=[],C()};function C(){const e=Object.values(S.value).flat();g("handleTableSelect",{originNodeData:s.value,allSelectedNodes:e,selectedSubNodes:e.filter(t=>!t.children)})}const x=()=>{E.value?i.requestFn({...i.params,...c.value}).then(e=>{m.value=j(e?.data[i.tableDataKey],c.value[v.value],K.value)||[],A.value=e?.data?.total}):(m.value=j(i.tableData,c.value[v.value],K.value),A.value=i.total)};function j(e,t,a,n=!1){return e.map(u=>{const r=a.has(u.id)||n,h={...u,selected:r};return h.children&&(h.children=j(h.children,t,a,r)),h})}const he=()=>{c.value[v.value]=q[v.value],x()},ve=()=>{c.value={...q},x()},X=e=>{e==="size"&&(c.value[v.value]=1),x(),g(V.emitsMap.paginationChange,c.value)},w=l.ref(0),N=()=>{let e=w.value,t=me.cloneDeep(i.columns);const a=1/V.calculateScale(),n=t.filter(o=>o.fixedWidth),u=t.filter(o=>!o.fixedWidth);let r=0;n.forEach(o=>{o.width&&(r+=o.width)});let h=e-r,I=0;u.forEach(o=>{o.width&&(I+=o.width)});const Z=[];if(t.forEach((o,T)=>{let R;if(o.fixedWidth)R=o.width||100;else if(o.width&&I>0){const P=o.width/I,O=h*P;R=Math.max(O,o.width)}else{const P=u.filter(O=>!O.width);R=P.length>0?h/P.length:h/u.length}Z.push(R)}),t=t.map((o,T)=>(o.width=Z[T]*a,y.value&&Object.keys(y.value).length&&y.value[o.key]&&(o.sortable=!0),o)),b.value){const o=p.value.find(T=>T.key==="selection");o&&(p.value=[o,...t])}else p.value=[...t]};l.watch(()=>b.value,()=>{N()}),l.watch(()=>i.tableDomWidth,e=>{e&&(w.value=e,N())});const Y=()=>{w.value=document.querySelector(".TABLE-AREA").getBoundingClientRect().width,N()};return l.onMounted(()=>{x(),p.value=i.columns,w.value=document.querySelector(".TABLE-AREA").getBoundingClientRect().width,l.nextTick(()=>{N()}),window.addEventListener("resize",Y)}),te({getTableList:x,search:he,reset:ve,initBatchSelect:fe,handleCancelSelect:D,handleResize:Y}),(e,t)=>(l.openBlock(),l.createElementBlock("div",ye,[l.createElementVNode("div",be,[l.unref(z)["filter-left"]?(l.openBlock(),l.createElementBlock("div",Ce,[l.renderSlot(e.$slots,"filter-left",{},void 0,!0)])):l.createCommentVNode("",!0),l.createElementVNode("div",xe,[f.hasBatchSelect&&d.value.length?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[b.value?(l.openBlock(),l.createElementBlock("div",Be,[l.createElementVNode("div",Ee,"已选"+l.toDisplayString(s.value.length)+"条数据",1),l.createElementVNode("div",{class:"fz-12 text-3b64ff mg-l-4 pointer",onClick:D},"取消选择"),l.renderSlot(e.$slots,"btn-group",{},()=>[l.createElementVNode("div",ke,[l.createVNode(l.unref(B.ElButton),{type:"danger",onClick:de,disabled:!s.value.length},{default:l.withCtx(()=>[...t[6]||(t[6]=[l.createTextVNode(" 删除 ",-1)])]),_:1},8,["disabled"])])],!0)])):(l.openBlock(),l.createBlock(l.unref(B.ElButton),{key:0,disabled:f.disableBatchSelect,title:f.disableBatchSelect?f.disableBatchSelectText:"",type:"default",onClick:ce},{default:l.withCtx(()=>[...t[5]||(t[5]=[l.createTextVNode(" 批量选择 ",-1)])]),_:1},8,["disabled","title"]))],64)):l.createCommentVNode("",!0),l.unref(z)["filter-right"]?l.renderSlot(e.$slots,"filter-right",{key:1},void 0,!0):l.createCommentVNode("",!0)])]),l.createElementVNode("div",we,[l.createElementVNode("div",Ne,[l.createVNode(l.unref(B.ElAutoResizer),null,{default:l.withCtx(({width:a,height:n})=>[l.createVNode(l.unref(B.ElTableV2),{"expanded-row-keys":_.value,"onUpdate:expandedRowKeys":t[0]||(t[0]=u=>_.value=u),"expand-column-key":f.expandColumnKey,columns:p.value,data:d.value,width:a,height:n,fixed:"","sort-state":y.value,onEndReached:ne,onColumnSort:ae},l.createSlots({_:2},[l.renderList(l.unref(z),(u,r)=>({name:r,fn:l.withCtx(h=>[l.renderSlot(e.$slots,r,l.normalizeProps(l.guardReactiveProps(h)),void 0,!0)])}))]),1032,["expanded-row-keys","expand-column-key","columns","data","width","height","sort-state"])]),_:3})]),f.isPagination&&M.value>c.value[k.value]?(l.openBlock(),l.createElementBlock("div",Te,[f.isPagination?(l.openBlock(),l.createBlock(ge._sfc_main,{key:0,"current-page":c.value[v.value],"onUpdate:currentPage":t[1]||(t[1]=a=>c.value[v.value]=a),"page-size":c.value[k.value],"onUpdate:pageSize":t[2]||(t[2]=a=>c.value[k.value]=a),"page-sizes":f.pagination.pageSizes,layout:f.pagination.layout,total:M.value,onSizeChange:t[3]||(t[3]=a=>X("size")),onCurrentChange:t[4]||(t[4]=a=>X("page"))},null,8,["current-page","page-size","page-sizes","layout","total"])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)])]))}}),Pe=Se._export_sfc(Re,[["__scopeId","data-v-8b1b65e5"]]),ee=pe.withInstall(Pe);exports.PaginationTable=ee;exports.default=ee;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/TreeSelect.css');const X=require("./chunks/index.CkihWzK6.js"),e=require("vue"),N=require("element-plus"),B=require("color-message-lingyun-vue"),Y=require("color-star-custom-components"),Z=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js");function ee(s){return{name:"element-tree-line",props:{node:{type:Object,required:!0},data:{type:Object},treeData:{type:Array},indent:{type:Number,default(){return 16}},showLabelLine:{type:Boolean,default:!0}},render(d){const c=s||d,a=this.getScopedSlot("default"),l=this.getScopedSlot("node-label"),u=this.getScopedSlot("after-node-label"),p=a?this.getScopedSlotValue(a,{node:this.node,data:this.data}):[l?this.getScopedSlotValue(l,{node:this.node,data:this.data}):c("span",{class:"element-tree-node-label"},this.node.label),this.showLabelLine?c("span",{class:"element-tree-node-label-line"}):null,this.getScopedSlotValue(u,{node:this.node,data:this.data})],y=[];let h=this.node;for(;h;){let o=h.parent;if(h.level===1&&!h.parent){if(!this.treeData||!Array.isArray(this.treeData))throw Error("if you using el-tree-v2 (Virtualized Tree) of element-plus,element-tree-line required data.");o={children:Array.isArray(this.treeData)?this.treeData.map(m=>({...m,key:m.id})):[],level:0,key:"node-0",parent:null}}if(o){const m=(o.children||o.childNodes).findIndex(k=>(k.key||k.id)===(h.key||h.id));y.unshift(m===(o.children||o.childNodes).length-1)}h=o}const C=[];for(let o=0;o<this.node.level;o++)y[o]&&this.node.level-1!==o||C.push(c("span",{class:{"element-tree-node-line-ver":!0,"last-node-isLeaf-line":y[o]&&this.node.level-1===o},style:{left:this.indent*o+"px"}}));return c("span",{class:"element-tree-node-label-wrapper"},[p].concat(C).concat([c("span",{class:"element-tree-node-line-hor",style:{width:(this.node.isLeaf?24:8)+"px",left:(this.node.level-1)*this.indent+"px"}})]))},methods:{getScopedSlot(d){if(!d)return null;const c=d.split("||");let a=null;for(let l=0;l<c.length;l++){const u=c[l],p=(this.$slots||{})[u];if(p){a=p;break}if(a=(this.$scopedSlots||{})[u],a)break}return a},getScopedSlotValue(d,c,a=null){return typeof d=="function"?d(c)||a:d||a}}}}function q(s){const d=ee(s);return s&&(d.methods.getScopedSlot=function(a){if(!a)return null;const l=a.split("||");let u=null;for(let p=0;p<l.length;p++){const y=l[p],h=(this.$slots||{})[y];if(h){u=h;break}}return u}),d}q();const te={key:0,class:"mg-b-16"},le={key:0,class:"list-item flex justify-between pd-l-6 pd-r-6 radius-8 items-center w-full"},ne=["onClick"],oe={key:1},se=Object.assign({name:"TreeSelect"},{__name:"layout",props:{modelValue:{type:Object,default:()=>[]},treeProps:{type:Object,default:()=>({value:"id",label:"label",children:"children"})},apiConfig:{type:Function},reqParams:{type:Object,default:()=>({})},autoLoad:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!0},hasFilter:{type:Boolean,default:!1},isListMode:{type:Boolean,default:!1},treeList:{type:Array,default:()=>[]},hasTreeLine:{type:Boolean,default:!0},includeParentSelected:{type:Boolean,default:!1}},emits:["handleCheck","handleDeleteNode","initFinish"],setup(s,{expose:d,emit:c}){const a=q(e.h),l=s,u=c,p=e.useAttrs(),y=()=>e.h(B.IconRighttop,{style:{color:"var(--text-color-2)",fontSize:"16px"}}),h=l.isMultiple?20:10,C=l.isMultiple?15:11,o=e.ref([]),m=e.ref(null),k=e.ref(null),V=e.computed(()=>l.treeProps.value),x=e.computed(()=>l.treeProps.label),v=e.computed(()=>l.treeProps.children),E=e.ref(!1),z=e.computed(()=>!l.isMultiple&&E.value),F=e.computed(()=>typeof l.apiConfig=="function"),P=t=>String(t).includes("%")?t:t+"px",j=()=>{let t=m.value?.getCheckedNodes(),n=t.map(i=>i[V.value]),r=[];return t.length&&!l.includeParentSelected&&(t=t.filter(i=>!i[v.value]),n=t.map(i=>i[V.value])),l.includeParentSelected&&(r=O(o.value,n)),{selectedNodeValues:n,selectedNodes:t,selectedParentNodes:r}};function O(t,n){const r=new Map;function i(f,g=[]){for(const S of f){const W=[...g,S];S.children&&S.children.length>0?i(S.children,W):n.includes(S.id)&&g.forEach(M=>{r.has(M.id)||r.set(M.id,{...M})})}}return i(t),Array.from(r.values())}const K=t=>{!l.isMultiple||l.isListMode||L()},R=(t,n)=>{l.isMultiple||l.isListMode||(E.value=!0,k.value=n.key,u("handleCheck",{selectedValue:[k.value],selectedNode:[n.data]}))},D=e.ref(""),$=t=>{m.value.filter(t)},H=(t,n)=>n[x.value].includes(t),Q=t=>{let n=0;function r(i){for(const f of i){const g=f[v.value]&&f[v.value].length>0;l.includeParentSelected?n++:g||n++,g&&r(f[v.value])}}return r(t),n},U=e.computed(()=>Q(o.value));function L(){const{selectedNodeValues:t,selectedNodes:n,selectedParentNodes:r}=j();u("handleCheck",{selectedValue:t,selectedNode:n,selectedParentNodes:r})}const G=(t,n)=>{m.value?.setChecked(t,n),L()},I=()=>{p["default-checked-keys"]&&e.nextTick(()=>{L()})},J=t=>{u("handleDeleteNode",t)},b=t=>t?.map(n=>({...n,[v.value]:n[v.value]?.length?b(n[v.value]):void 0})),T=async()=>{F.value?l.apiConfig(l.reqParams)?.then(t=>{o.value=b(t?.data||[]),I(),w(l.modelValue),u("initFinish",o.value)}):_()},_=()=>{l.isListMode?o.value=b(l.treeList||[]):(o.value=b(l.treeList||[]),o.value.length&&(I(),w(l.modelValue)))},w=t=>{const n=t&&t.length&&t.map(r=>r[l.treeProps.value]);m.value?.setCheckedKeys(n)};return e.watch(()=>l.treeList,()=>{_()},{deep:!0}),e.watch(()=>l.modelValue,t=>{e.nextTick(()=>{w(t)})},{deep:!0}),e.onMounted(()=>{T()}),d({allNodeNumbers:U,loadData:T,setNodeCheckStatus:G}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(N.ElAutoResizer),null,{default:e.withCtx(({width:r,height:i})=>[e.createElementVNode("div",{style:e.normalizeStyle({width:P(r),height:P(i)})},[s.hasFilter?(e.openBlock(),e.createElementBlock("div",te,[e.createVNode(e.unref(N.ElInput),{modelValue:D.value,"onUpdate:modelValue":n[0]||(n[0]=f=>D.value=f),placeholder:"请输入",onInput:$},{prefix:e.withCtx(()=>[e.createVNode(e.unref(N.ElIcon),{size:16,color:"var(--neutral-color-12)",class:"mg-r-4"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.IconSearch))]),_:1})]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(s.hasFilter?"pd-l-8 pd-r-8":"")},[e.createVNode(e.unref(N.ElTreeV2),e.mergeProps({ref_key:"treeRef",ref:m,height:s.hasFilter?i-48:i,data:o.value,props:s.treeProps,"node-key":V.value,"show-checkbox":s.isMultiple&&!s.isListMode,"item-size":34,indent:e.unref(h),"highlight-current":z.value,icon:s.isListMode?"":y,"filter-method":H},e.unref(p),{onNodeClick:R,onCheck:K}),{default:e.withCtx(({node:f})=>[s.isListMode?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("span",null,e.toDisplayString(f.data[x.value]),1),e.createElementVNode("div",{class:"flex items-center",onClick:e.withModifiers(g=>J(f.data),["stop"])},[e.createVNode(e.unref(N.ElIcon),{size:14,color:"var(--neutral-color-5)"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.IconDelete))]),_:1})],8,ne)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[s.hasTreeLine?(e.openBlock(),e.createBlock(e.unref(a),{key:0,node:f,treeData:o.value,showLabelLine:!1,indent:e.unref(C)},null,8,["node","treeData","indent"])):(e.openBlock(),e.createElementBlock("span",oe,e.toDisplayString(f.data[x.value]),1))],64))]),empty:e.withCtx(()=>[e.createVNode(e.unref(Y.IconEmpty))]),_:1},16,["height","data","props","node-key","show-checkbox","indent","highlight-current","icon"])],2)],4)]),_:1}))}}),ae=Z._export_sfc(se,[["__scopeId","data-v-2357d4fe"]]),A=X.withInstall(ae);exports.TreeSelect=A;exports.default=A;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/TreeShowSelect.css');const V=require("./chunks/index.CkihWzK6.js"),e=require("vue"),S=require("element-plus"),u=require("./TreeSelect.js"),b=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),g={class:"left-box w-50-percent flex flex-col"},y={class:"head-box fz-14 pd-t-8 pd-b-8 pd-l-12 pd-r-12 mg-b-8 text-202434"},w={class:"pd-r-12 pd-l-12 flex-1"},P={class:"right-box w-50-percent flex flex-col"},k={class:"head-box fz-14 pd-t-8 pd-b-8 pd-l-12 pd-r-12 mg-b-8 text-202434"},T={class:"pd-r-12 pd-l-12 flex-1 selected-list overflow-y-auto pd-t-8"},E=Object.assign({name:"TreeShowSelect"},{__name:"layout",props:{modelValue:{type:Object,default:()=>[]}},emits:["getCheckedNode"],setup(p,{emit:m}){const f=p,h=m,s=e.useAttrs(),r=e.ref(),_=e.computed(()=>s.treeProps?s.treeProps:{value:"id",label:"label",children:"children"}),n=t=>String(t).includes("%")?t:t+"px",l=e.ref([]),v=t=>{const{selectedNode:o,selectedValue:d,selectedParentNodes:a}=t;l.value=o,h("getCheckedNode",{selectedValue:d,selectedNode:o,selectedParentNodes:a})},x=t=>{r.value?.setNodeCheckStatus(t[_.value.value],!1)},N=t=>{l.value=t||[]};return e.watch(()=>f.modelValue,t=>{N(t)},{immediate:!0,deep:!0}),(t,o)=>(e.openBlock(),e.createBlock(e.unref(S.ElAutoResizer),null,{default:e.withCtx(({width:d,height:a})=>[e.createElementVNode("div",{class:"out-box flex radius-8 text-202434",style:e.normalizeStyle({width:n(d),height:n(a)})},[e.createElementVNode("div",g,[e.createElementVNode("div",y,e.toDisplayString(r.value&&r.value.allNodeNumbers||0)+"项 ",1),e.createElementVNode("div",w,[e.createVNode(e.unref(u.TreeSelect),e.mergeProps({modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=c=>l.value=c),ref_key:"treeRef",ref:r},e.unref(s),{onHandleCheck:v}),null,16,["modelValue"])])]),e.createElementVNode("div",P,[e.createElementVNode("div",k,e.toDisplayString(l.value.length)+"项 ",1),e.createElementVNode("div",T,[e.createVNode(e.unref(u.TreeSelect),{modelValue:l.value,"onUpdate:modelValue":o[1]||(o[1]=c=>l.value=c),class:"tree-select-list",treeProps:e.unref(s).treeProps,treeList:l.value,isListMode:!0,onHandleDeleteNode:x},null,8,["modelValue","treeProps","treeList"])])])],4)]),_:1}))}}),C=b._export_sfc(E,[["__scopeId","data-v-506e7300"]]),i=V.withInstall(C);exports.TreeShowSelect=i;exports.default=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[data-v-
|
|
1
|
+
[data-v-8b1b65e5] .el-table-v2__header-cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.el-tree .el-tree-node__content{position:relative}.element-tree-node-label-wrapper{flex:1;display:flex;align-items:center}.element-tree-node-label{font-size:12px}.element-tree-node-line-ver{display:block;position:absolute;top:0;left:0;height:100%;border-left:1px dashed #dcdfe6}.element-tree-node-line-ver.last-node-isLeaf-line{height:50%}.element-tree-node-line-hor{display:block;position:absolute;top:50%;left:0;height:0;border-bottom:1px dashed #dcdfe6}.element-tree-node-label-line{flex:1;border-top:1px dashed #dcdfe6;align-self:center;margin:0 10px}[data-v-2357d4fe] .el-tree-node__label{line-height:22px}[data-v-2357d4fe] .el-tree-node:focus>.el-tree-node__content{background-color:transparent}[data-v-2357d4fe] .el-tree-node__content{border-radius:8px}[data-v-2357d4fe] .el-tree-node__content:hover{background-color:var(--primary-color-5)}[data-v-2357d4fe] .element-tree-node-label{font-size:14px}.list-item[data-v-2357d4fe]{height:32px}.list-item[data-v-2357d4fe]:hover{background:var(--primary-color-5)}[data-v-2357d4fe] .element-tree-node-line-ver,[data-v-2357d4fe] .element-tree-node-line-hor{border-color:var(--neutral-color-19)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.w-50-percent[data-v-506e7300]{width:50%}.out-box[data-v-506e7300]{border:1px solid var(--parting-line)}.out-box .head-box[data-v-506e7300]{border-bottom:1px solid var(--parting-line)}.out-box .left-box[data-v-506e7300]{border-right:1px solid var(--parting-line)}.out-box .selected-list .selected-item[data-v-506e7300]{height:32px}.out-box .selected-list .selected-item[data-v-506e7300]:hover{background:var(--primary-color-5)}.out-box .virtual-scroller[data-v-506e7300]{height:100%}.tree-select-list[data-v-506e7300] .el-tree-node__content{margin-bottom:8px;padding:4px 0;height:32px;border-radius:8px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const u=require("vue"),m=require("element-plus"),p=require("color-message-lingyun-vue"),e=require("color-star-custom-methods"),z=Object.assign({name:"CustomPagination"},{__name:"layout",props:{currentPage:{type:Number,default:e.pageParams.pageNum},pageSize:{type:Number,default:e.pageParams.pageSize},pageSizes:{type:Array,default:()=>e.paginationConfig.pageSizes},background:{type:Boolean,default:!0},layout:{type:String,default:e.paginationConfig.layout},prevIcon:{type:Object,default:p.IconLeft},nextIcon:{type:Object,default:p.IconRight},hideOnSinglePage:{type:Boolean,default:!0},total:{type:Number,default:0}},emits:[e.emitsMap.sizeChange,e.emitsMap.currentChange,e.emitsMap.updateCurrentPage,e.emitsMap.updatePageSize],setup(a,{emit:l}){alert(1);const n=l,g=a,r=u.computed({get:()=>g.currentPage,set:t=>{n(e.emitsMap.updateCurrentPage,t)}}),s=u.computed({get:()=>g.pageSize,set:t=>{n(e.emitsMap.updatePageSize,t)}}),c=t=>{n(e.emitsMap.sizeChange,t),n(e.emitsMap.updatePageSize,t)},d=t=>{n(e.emitsMap.currentChange,t),n(e.emitsMap.updateCurrentPage,t)};return(t,i)=>(u.openBlock(),u.createBlock(u.unref(m.ElPagination),u.mergeProps({"current-page":r.value,"onUpdate:currentPage":i[0]||(i[0]=o=>r.value=o),"page-size":s.value,"onUpdate:pageSize":i[1]||(i[1]=o=>s.value=o),"page-sizes":a.pageSizes,background:a.background,layout:a.layout,total:a.total,"prev-icon":a.prevIcon,"next-icon":a.nextIcon,"hide-on-single-page":a.hideOnSinglePage},t.$attrs,{onSizeChange:c,onCurrentChange:d}),null,16,["current-page","page-size","page-sizes","background","layout","total","prev-icon","next-icon","hide-on-single-page"]))}});exports._sfc_main=z;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ling-yun-custom-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"component library",
|
|
6
6
|
"ui framework",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"dependencies": {
|
|
138
138
|
"@vueuse/core": "^14.0.0",
|
|
139
139
|
"dayjs": "^1.11.18",
|
|
140
|
-
"element-plus": "^2.13.
|
|
140
|
+
"element-plus": "^2.13.2",
|
|
141
141
|
"element-tree-line": "^0.2.1",
|
|
142
142
|
"js-cookie": "^3.0.5",
|
|
143
143
|
"lodash.debounce": "^4.0.8",
|
|
@@ -178,18 +178,18 @@
|
|
|
178
178
|
"typescript": "~5.9.3",
|
|
179
179
|
"vite": "^7.3.0",
|
|
180
180
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
181
|
-
"vue": "^3.5.
|
|
181
|
+
"vue": "^3.5.27",
|
|
182
182
|
"lodash": "^4.17.21"
|
|
183
183
|
},
|
|
184
184
|
"peerDependencies": {
|
|
185
185
|
"axios": "^1.8.2",
|
|
186
|
-
"vue": "^3.5.
|
|
186
|
+
"vue": "^3.5.27",
|
|
187
187
|
"color-message-lingyun-vue": "0.0.30",
|
|
188
|
-
"color-
|
|
189
|
-
"color-star-atom-style": "0.0.
|
|
190
|
-
"
|
|
191
|
-
"color-
|
|
192
|
-
"
|
|
188
|
+
"color-message-aibox-vue": "0.1.4",
|
|
189
|
+
"color-star-atom-style": "0.0.4",
|
|
190
|
+
"color-star-custom-components": "0.0.43",
|
|
191
|
+
"color-star-custom-methods": "0.0.27",
|
|
192
|
+
"ling-yun-methods": "0.0.53"
|
|
193
193
|
},
|
|
194
194
|
"optionalDependencies": {
|
|
195
195
|
"@ast-grep/napi-linux-x64-musl": "^0.39.6",
|