color-star-custom-components 0.0.5 → 0.0.8

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.
Files changed (52) hide show
  1. package/es/BatchImport.mjs +1 -1
  2. package/es/FileList.mjs +1 -1
  3. package/es/IconRenderer.mjs +1 -1
  4. package/es/IconSelect.mjs +1 -1
  5. package/es/SearchBar.mjs +154 -131
  6. package/es/TreeSelect.mjs +7 -0
  7. package/es/TreeShowSelect.mjs +82 -0
  8. package/es/UploadFile.mjs +1 -1
  9. package/es/assets/SearchBar.css +1 -1
  10. package/es/assets/TreeShowSelect.css +1 -0
  11. package/es/assets/layout2.css +1 -1
  12. package/es/assets/layout3.css +1 -1
  13. package/es/assets/layout4.css +1 -0
  14. package/es/chunks/{config.DH2xMnlY.js → config.ERg0IgVD.js} +1 -1
  15. package/es/chunks/{global.DV6e9_12.js → global.BZl4v5js.js} +1182 -1158
  16. package/es/chunks/{layout.CyhEs923.js → layout.8QJjTbpS.js} +2 -2
  17. package/es/chunks/layout.8gJfLTP4.js +404 -0
  18. package/es/chunks/{layout.sb1tpZ1W.js → layout.CI0rHTkg.js} +1 -1
  19. package/es/chunks/layout.DQ1xjWEm.js +406 -0
  20. package/es/index.mjs +36 -30
  21. package/lib/BatchImport.js +1 -1
  22. package/lib/FileList.js +1 -1
  23. package/lib/IconRenderer.js +1 -1
  24. package/lib/IconSelect.js +1 -1
  25. package/lib/SearchBar.js +1 -1
  26. package/lib/TreeSelect.js +1 -0
  27. package/lib/TreeShowSelect.js +1 -0
  28. package/lib/UploadFile.js +1 -1
  29. package/lib/assets/SearchBar.css +1 -1
  30. package/lib/assets/TreeShowSelect.css +1 -0
  31. package/lib/assets/layout2.css +1 -1
  32. package/lib/assets/layout3.css +1 -1
  33. package/lib/assets/layout4.css +1 -0
  34. package/lib/chunks/{config.DPp4ti8p.js → config.B0eqERf5.js} +1 -1
  35. package/lib/chunks/global.BeZ3Ue5-.js +1 -0
  36. package/lib/chunks/{layout.CacUgLUZ.js → layout.BaKyR150.js} +1 -1
  37. package/lib/chunks/layout.BhOA_UzD.js +1 -0
  38. package/lib/chunks/layout.C_5ri7PW.js +1 -0
  39. package/lib/chunks/{layout.C8IKkahl.js → layout.whToBh0O.js} +1 -1
  40. package/lib/index.js +1 -1
  41. package/package.json +10 -9
  42. package/es/chunks/layout.BLCGmWdA.js +0 -149
  43. package/es/chunks/layout.BaKXshGh.js +0 -149
  44. package/es/chunks/layout.BqkEUrff.js +0 -230
  45. package/es/chunks/layout.D5DtDgGV.js +0 -230
  46. package/es/chunks/layout.wck_IDgd.js +0 -121
  47. package/lib/chunks/global.BwF3T7mN.js +0 -1
  48. package/lib/chunks/layout.BQdjwrgQ.js +0 -1
  49. package/lib/chunks/layout.ChIHPtyu.js +0 -1
  50. package/lib/chunks/layout.DTs74_a_.js +0 -1
  51. package/lib/chunks/layout.sSLT3tUN.js +0 -1
  52. package/lib/chunks/layout.ttM1z00z.js +0 -1
@@ -1,9 +1,9 @@
1
1
  import { ref as z, computed as s, watch as M, createElementBlock as c, openBlock as p, createVNode as R, createBlock as k, createCommentVNode as U, unref as h, mergeProps as B, withCtx as D, renderSlot as O, Fragment as E, createElementVNode as m, toDisplayString as x } from "vue";
2
2
  import { ElUpload as N, ElImage as Y } from "element-plus";
3
3
  import { emitsMap as d, uploadFileTypeMap as L, messageError as Q, messageWarning as F } from "color-star-custom-methods";
4
- import { _ as J, u as v } from "./layout.sb1tpZ1W.js";
4
+ import { _ as J, u as v } from "./layout.CI0rHTkg.js";
5
5
  import { _ as K } from "./_plugin-vue_export-helper.CHgC5LLL.js";
6
- import '../assets/layout2.css';const u = [];
6
+ import '../assets/layout3.css';const u = [];
7
7
  for (let A = 0; A < 256; ++A)
8
8
  u.push((A + 256).toString(16).slice(1));
9
9
  function G(A, a = 0) {
@@ -0,0 +1,404 @@
1
+ import { useAttrs as ie, ref as x, computed as S, watch as O, nextTick as K, onMounted as re, createBlock as R, openBlock as b, unref as f, withCtx as N, createElementVNode as D, normalizeStyle as de, createElementBlock as P, createCommentVNode as ce, createVNode as g, normalizeClass as ue, mergeProps as he, toDisplayString as $, withModifiers as fe, Fragment as pe, h as H } from "vue";
2
+ import { ElAutoResizer as me, ElInput as ye, ElIcon as Q, ElTreeV2 as ve } from "element-plus";
3
+ import { IconSearch as ge, IconDelete as ke, IconRighttop as Se } from "color-message-lingyun-vue";
4
+ import { IconEmpty as be } from "../IconEmpty.mjs";
5
+ import { _ as Ne } from "./_plugin-vue_export-helper.CHgC5LLL.js";
6
+ import '../assets/layout2.css';function Ce(o) {
7
+ return {
8
+ name: "element-tree-line",
9
+ props: {
10
+ node: {
11
+ type: Object,
12
+ required: !0
13
+ },
14
+ data: {
15
+ type: Object
16
+ },
17
+ treeData: {
18
+ type: Array
19
+ },
20
+ indent: {
21
+ type: Number,
22
+ default() {
23
+ return 16;
24
+ }
25
+ },
26
+ showLabelLine: {
27
+ type: Boolean,
28
+ default: !0
29
+ }
30
+ },
31
+ render(r) {
32
+ const d = o || r, s = this.getScopedSlot("default"), t = this.getScopedSlot("node-label"), c = this.getScopedSlot("after-node-label"), p = s ? this.getScopedSlotValue(s, {
33
+ node: this.node,
34
+ data: this.data
35
+ }) : [
36
+ t ? this.getScopedSlotValue(t, {
37
+ node: this.node,
38
+ data: this.data
39
+ }) : d(
40
+ "span",
41
+ { class: "element-tree-node-label" },
42
+ this.node.label
43
+ ),
44
+ this.showLabelLine ? d("span", {
45
+ class: "element-tree-node-label-line"
46
+ }) : null,
47
+ this.getScopedSlotValue(c, {
48
+ node: this.node,
49
+ data: this.data
50
+ })
51
+ ], y = [];
52
+ let u = this.node;
53
+ for (; u; ) {
54
+ let n = u.parent;
55
+ if (u.level === 1 && !u.parent) {
56
+ if (!this.treeData || !Array.isArray(this.treeData))
57
+ throw Error(
58
+ "if you using el-tree-v2 (Virtualized Tree) of element-plus,element-tree-line required data."
59
+ );
60
+ n = {
61
+ children: Array.isArray(this.treeData) ? this.treeData.map((m) => ({ ...m, key: m.id })) : [],
62
+ level: 0,
63
+ key: "node-0",
64
+ parent: null
65
+ };
66
+ }
67
+ if (n) {
68
+ const m = (n.children || n.childNodes).findIndex(
69
+ (C) => (C.key || C.id) === (u.key || u.id)
70
+ );
71
+ y.unshift(
72
+ m === (n.children || n.childNodes).length - 1
73
+ );
74
+ }
75
+ u = n;
76
+ }
77
+ const V = [];
78
+ for (let n = 0; n < this.node.level; n++)
79
+ y[n] && this.node.level - 1 !== n || V.push(
80
+ d("span", {
81
+ class: {
82
+ "element-tree-node-line-ver": !0,
83
+ "last-node-isLeaf-line": y[n] && this.node.level - 1 === n
84
+ },
85
+ style: { left: this.indent * n + "px" }
86
+ })
87
+ );
88
+ return d(
89
+ "span",
90
+ {
91
+ class: "element-tree-node-label-wrapper"
92
+ },
93
+ [p].concat(V).concat([
94
+ d("span", {
95
+ class: "element-tree-node-line-hor",
96
+ style: {
97
+ width: (this.node.isLeaf ? 24 : 8) + "px",
98
+ left: (this.node.level - 1) * this.indent + "px"
99
+ }
100
+ })
101
+ ])
102
+ );
103
+ },
104
+ methods: {
105
+ getScopedSlot(r) {
106
+ if (!r)
107
+ return null;
108
+ const d = r.split("||");
109
+ let s = null;
110
+ for (let t = 0; t < d.length; t++) {
111
+ const c = d[t], p = (this.$slots || {})[c];
112
+ if (p) {
113
+ s = p;
114
+ break;
115
+ }
116
+ if (s = (this.$scopedSlots || {})[c], s)
117
+ break;
118
+ }
119
+ return s;
120
+ },
121
+ getScopedSlotValue(r, d, s = null) {
122
+ return typeof r == "function" ? r(d) || s : r || s;
123
+ }
124
+ }
125
+ };
126
+ }
127
+ function U(o) {
128
+ const r = Ce(o);
129
+ return o && (r.methods.getScopedSlot = function(s) {
130
+ if (!s)
131
+ return null;
132
+ const t = s.split("||");
133
+ let c = null;
134
+ for (let p = 0; p < t.length; p++) {
135
+ const y = t[p], u = (this.$slots || {})[y];
136
+ if (u) {
137
+ c = u;
138
+ break;
139
+ }
140
+ }
141
+ return c;
142
+ }), r;
143
+ }
144
+ U();
145
+ const Le = {
146
+ key: 0,
147
+ class: "mg-b-16"
148
+ }, xe = {
149
+ key: 0,
150
+ class: "list-item flex justify-between pd-l-6 pd-r-6 radius-8 items-center w-full"
151
+ }, Ve = ["onClick"], Me = { key: 1 }, De = /* @__PURE__ */ Object.assign({
152
+ name: "TreeSelect"
153
+ }, {
154
+ __name: "layout",
155
+ props: {
156
+ // 初始值
157
+ modelValue: {
158
+ type: Object,
159
+ default: () => []
160
+ },
161
+ // 树形节点对象结构
162
+ treeProps: {
163
+ type: Object,
164
+ default: () => ({
165
+ value: "id",
166
+ label: "label",
167
+ children: "children"
168
+ })
169
+ },
170
+ // 接口配置
171
+ apiConfig: {
172
+ type: Function
173
+ },
174
+ // 请求参数
175
+ reqParams: {
176
+ type: Object,
177
+ default: () => ({})
178
+ },
179
+ // 是否在组件挂载时自动加载数据
180
+ autoLoad: {
181
+ type: Boolean,
182
+ default: !0
183
+ },
184
+ // 是否多选
185
+ isMultiple: {
186
+ type: Boolean,
187
+ default: !0
188
+ },
189
+ // 是否有过滤
190
+ hasFilter: {
191
+ type: Boolean,
192
+ default: !1
193
+ },
194
+ // 是否是列表模式
195
+ isListMode: {
196
+ type: Boolean,
197
+ default: !1
198
+ },
199
+ treeList: {
200
+ type: Array,
201
+ default: () => []
202
+ },
203
+ // 是否有线条样式
204
+ hasTreeLine: {
205
+ type: Boolean,
206
+ default: !0
207
+ },
208
+ // 选中的节点是否包含父节点
209
+ includeParentSelected: {
210
+ type: Boolean,
211
+ default: !1
212
+ }
213
+ },
214
+ emits: ["handleCheck", "handleDeleteNode", "initFinish"],
215
+ setup(o, { expose: r, emit: d }) {
216
+ const s = U(H), t = o, c = d, p = ie(), y = () => H(Se, {
217
+ style: { color: "var(--text-color-2)", fontSize: "16px" }
218
+ }), u = t.isMultiple ? 20 : 10, V = t.isMultiple ? 15 : 11, n = x([]), m = x(null), C = x(null), w = S(() => t.treeProps.value), E = S(() => t.treeProps.label), v = S(() => t.treeProps.children), T = x(!1), G = S(() => !t.isMultiple && T.value), J = S(() => typeof t.apiConfig == "function"), z = (e) => String(e).includes("%") ? e : e + "px", W = () => {
219
+ let e = m.value?.getCheckedNodes(), l = e.map((i) => i[w.value]), a = [];
220
+ 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)), {
221
+ selectedNodeValues: l,
222
+ // 选中节点的值的集合
223
+ selectedNodes: e,
224
+ // 选中节点的集合
225
+ selectedParentNodes: a
226
+ // 选中节点的所有父节点
227
+ };
228
+ };
229
+ function X(e, l) {
230
+ const a = /* @__PURE__ */ new Map();
231
+ function i(h, k = []) {
232
+ for (const L of h) {
233
+ const ae = [...k, L];
234
+ L.children && L.children.length > 0 ? i(L.children, ae) : l.includes(L.id) && k.forEach((B) => {
235
+ a.has(B.id) || a.set(B.id, { ...B });
236
+ });
237
+ }
238
+ }
239
+ return i(e), Array.from(a.values());
240
+ }
241
+ const Y = (e) => {
242
+ !t.isMultiple || t.isListMode || I();
243
+ }, Z = (e, l) => {
244
+ t.isMultiple || t.isListMode || (T.value = !0, C.value = l.key, c("handleCheck", {
245
+ selectedValue: [C.value],
246
+ // 选中节点的值
247
+ selectedNode: [l.data]
248
+ // // 选中节点
249
+ }));
250
+ }, F = x(""), ee = (e) => {
251
+ m.value.filter(e);
252
+ }, te = (e, l) => l[E.value].includes(e), le = (e) => {
253
+ let l = 0;
254
+ function a(i) {
255
+ for (const h of i) {
256
+ const k = h[v.value] && h[v.value].length > 0;
257
+ t.includeParentSelected ? l++ : k || l++, k && a(h[v.value]);
258
+ }
259
+ }
260
+ return a(e), l;
261
+ }, ne = S(() => le(n.value));
262
+ function I() {
263
+ const { selectedNodeValues: e, selectedNodes: l, selectedParentNodes: a } = W();
264
+ c("handleCheck", {
265
+ selectedValue: e,
266
+ // 选中节点的值的集合
267
+ selectedNode: l,
268
+ // 选中节点的集合
269
+ selectedParentNodes: a
270
+ });
271
+ }
272
+ const oe = (e, l) => {
273
+ m.value?.setChecked(e, l), I();
274
+ }, _ = () => {
275
+ p["default-checked-keys"] && K(() => {
276
+ I();
277
+ });
278
+ }, se = (e) => {
279
+ c("handleDeleteNode", e);
280
+ }, M = (e) => e?.map((l) => ({
281
+ ...l,
282
+ [v.value]: l[v.value]?.length ? M(l[v.value]) : void 0
283
+ })), j = async () => {
284
+ J.value ? t.apiConfig(t.reqParams)?.then((e) => {
285
+ n.value = M(e?.data || []), _(), A(t.modelValue), c("initFinish", n.value);
286
+ }) : q();
287
+ }, q = () => {
288
+ t.isListMode ? n.value = M(t.treeList || []) : (n.value = M(t.treeList || []), n.value.length && (_(), A(t.modelValue)));
289
+ }, A = (e) => {
290
+ const l = e && e.length && e.map((a) => a[t.treeProps.value]);
291
+ m.value?.setCheckedKeys(l);
292
+ };
293
+ return O(
294
+ () => t.treeList,
295
+ () => {
296
+ q();
297
+ },
298
+ { deep: !0 }
299
+ ), O(
300
+ () => t.modelValue,
301
+ (e) => {
302
+ K(() => {
303
+ A(e);
304
+ });
305
+ },
306
+ { deep: !0 }
307
+ ), re(() => {
308
+ j();
309
+ }), r({
310
+ allNodeNumbers: ne,
311
+ loadData: j,
312
+ setNodeCheckStatus: oe
313
+ }), (e, l) => (b(), R(f(me), null, {
314
+ default: N(({ width: a, height: i }) => [
315
+ D("div", {
316
+ style: de({
317
+ width: z(a),
318
+ height: z(i)
319
+ })
320
+ }, [
321
+ o.hasFilter ? (b(), P("div", Le, [
322
+ g(f(ye), {
323
+ modelValue: F.value,
324
+ "onUpdate:modelValue": l[0] || (l[0] = (h) => F.value = h),
325
+ placeholder: "请输入",
326
+ onInput: ee
327
+ }, {
328
+ prefix: N(() => [
329
+ g(f(Q), {
330
+ size: 16,
331
+ color: "var(--neutral-color-12)",
332
+ class: "mg-r-4"
333
+ }, {
334
+ default: N(() => [
335
+ g(f(ge))
336
+ ]),
337
+ _: 1
338
+ })
339
+ ]),
340
+ _: 1
341
+ }, 8, ["modelValue"])
342
+ ])) : ce("", !0),
343
+ D("div", {
344
+ class: ue(o.hasFilter ? "pd-l-8 pd-r-8" : "")
345
+ }, [
346
+ g(f(ve), he({
347
+ ref_key: "treeRef",
348
+ ref: m,
349
+ height: o.hasFilter ? i - 48 : i,
350
+ data: n.value,
351
+ props: o.treeProps,
352
+ "node-key": w.value,
353
+ "show-checkbox": o.isMultiple && !o.isListMode,
354
+ "item-size": 34,
355
+ indent: f(u),
356
+ "highlight-current": G.value,
357
+ icon: o.isListMode ? "" : y,
358
+ "filter-method": te
359
+ }, f(p), {
360
+ onNodeClick: Z,
361
+ onCheck: Y
362
+ }), {
363
+ default: N(({ node: h }) => [
364
+ o.isListMode ? (b(), P("div", xe, [
365
+ D("span", null, $(h.data[E.value]), 1),
366
+ D("div", {
367
+ class: "flex items-center",
368
+ onClick: fe((k) => se(h.data), ["stop"])
369
+ }, [
370
+ g(f(Q), {
371
+ size: 14,
372
+ color: "var(--neutral-color-5)"
373
+ }, {
374
+ default: N(() => [
375
+ g(f(ke))
376
+ ]),
377
+ _: 1
378
+ })
379
+ ], 8, Ve)
380
+ ])) : (b(), P(pe, { key: 1 }, [
381
+ o.hasTreeLine ? (b(), R(f(s), {
382
+ key: 0,
383
+ node: h,
384
+ treeData: n.value,
385
+ showLabelLine: !1,
386
+ indent: f(V)
387
+ }, null, 8, ["node", "treeData", "indent"])) : (b(), P("span", Me, $(h.data[E.value]), 1))
388
+ ], 64))
389
+ ]),
390
+ empty: N(() => [
391
+ g(f(be))
392
+ ]),
393
+ _: 1
394
+ }, 16, ["height", "data", "props", "node-key", "show-checkbox", "indent", "highlight-current", "icon"])
395
+ ], 2)
396
+ ], 4)
397
+ ]),
398
+ _: 1
399
+ }));
400
+ }
401
+ }), Be = /* @__PURE__ */ Ne(De, [["__scopeId", "data-v-5d279bc2"]]);
402
+ export {
403
+ Be as T
404
+ };
@@ -3,7 +3,7 @@ import { ElImage as R, ElIcon as w } from "element-plus";
3
3
  import { emitsMap as c, uploadFileTypeMap as P, uploadFileType as a } from "color-star-custom-methods";
4
4
  import { IconTxt as A, IconPpt as F, IconXls as I, IconDoc as b, IconPdf as G, IconDelete as K, IconOtherFile as X } from "color-message-lingyun-vue";
5
5
  import { _ as q } from "./_plugin-vue_export-helper.CHgC5LLL.js";
6
- import '../assets/layout3.css';const i = {
6
+ import '../assets/layout4.css';const i = {
7
7
  uploading: "uploading",
8
8
  success: "success",
9
9
  error: "error"