@lingshugroup/web-plus 1.7.9 → 1.7.11
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/index.css +1 -1
- package/lib/index.css.br +0 -0
- package/lib/index.css.gz +0 -0
- package/lib/packages/ls-components/components/chart/config/template/bar/index.cjs +1 -1
- package/lib/packages/ls-components/components/chart/config/template/bar/index.js +89 -65
- package/lib/packages/ls-components/components/chart/config/template/bar/index.js.br +0 -0
- package/lib/packages/ls-components/components/chart/config/template/bar/index.js.gz +0 -0
- package/lib/packages/ls-components/components/chart/config/template/line/index.cjs +1 -1
- package/lib/packages/ls-components/components/chart/config/template/line/index.js +102 -85
- package/lib/packages/ls-components/components/chart/config/template/line/index.js.br +0 -0
- package/lib/packages/ls-components/components/chart/config/template/line/index.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index.js +2 -2
- package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index2.js +64 -63
- package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/preview_pdf/Pdf.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_pdf/composable/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/composable/index.js +68 -66
- package/lib/packages/ls-components/components/preview_pdf/composable/index.js.br +0 -0
- package/lib/packages/ls-components/components/preview_pdf/composable/index.js.gz +0 -0
- package/lib/packages/ls-components/components/tooltip/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/tooltip/Index.vue/index.js +2 -2
- package/lib/packages/ls-components/components/tooltip/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/tooltip/Index.vue/index2.js +25 -25
- package/lib/packages/ls-components/components/tooltip/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/tooltip/Index.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/tree/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/tree/Index.vue/index.js +2 -2
- package/lib/packages/ls-components/components/tree/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/tree/Index.vue/index2.js +35 -31
- package/lib/packages/ls-components/components/tree/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/tree/Index.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/upload/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/upload/Index.vue/index.js +2 -2
- package/lib/packages/ls-components/components/upload/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/upload/Index.vue/index2.js +2 -2
- package/lib/packages/ls-components/components/upload/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/upload/Index.vue/index2.js.gz +0 -0
- package/lib/types/components/chart/types.d.ts +2 -0
- package/lib/types/components/preview_pdf/Pdf.vue.d.ts +1 -0
- package/lib/types/components/preview_pdf/composable.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,112 +1,114 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
import { GlobalWorkerOptions as
|
|
4
|
-
import
|
|
5
|
-
import { shallowRef as
|
|
6
|
-
import { getDestinationArray as
|
|
7
|
-
import { createIframe as
|
|
8
|
-
function
|
|
9
|
-
|
|
1
|
+
var F = Object.defineProperty;
|
|
2
|
+
var d = (r, w) => F(r, "name", { value: w, configurable: !0 });
|
|
3
|
+
import { GlobalWorkerOptions as T, getDocument as S } from "pdfjs-dist";
|
|
4
|
+
import N from "../../../../../node_modules/.pnpm/pdfjs-dist@4.8.69/node_modules/pdfjs-dist/build/pdf.worker.min/index.js";
|
|
5
|
+
import { shallowRef as h, isRef as A, watch as O } from "vue";
|
|
6
|
+
import { getDestinationArray as j, getDestinationRef as B, isSpecLike as M, getLocation as _ } from "../pdfs/destination/index.js";
|
|
7
|
+
import { createIframe as G, addStylesToIframe as J } from "../pdfs/miscellaneous/index.js";
|
|
8
|
+
function V(r) {
|
|
9
|
+
T.workerSrc = r;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
function
|
|
11
|
+
d(V, "configWorker");
|
|
12
|
+
function Y(r, w, i = {
|
|
13
13
|
onProgress: void 0,
|
|
14
14
|
onPassword: void 0,
|
|
15
15
|
onError: void 0,
|
|
16
16
|
password: ""
|
|
17
17
|
}) {
|
|
18
|
-
var
|
|
19
|
-
(
|
|
20
|
-
const
|
|
21
|
-
function
|
|
18
|
+
var k;
|
|
19
|
+
(k = T) != null && k.workerSrc || V(N);
|
|
20
|
+
const P = h(), l = h(), b = h(0), D = h({});
|
|
21
|
+
function g(c) {
|
|
22
22
|
l.value && l.value.destroy();
|
|
23
|
-
const o =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
const o = S(
|
|
24
|
+
w ? {
|
|
25
|
+
url: c,
|
|
26
|
+
cMapUrl: w,
|
|
27
|
+
cMapPacked: !0
|
|
28
|
+
} : c
|
|
29
|
+
);
|
|
30
|
+
if (i.onProgress && (o.onProgress = i.onProgress), i.onPassword)
|
|
31
|
+
o.onPassword = i.onPassword;
|
|
32
|
+
else if (i.password) {
|
|
33
|
+
const e = /* @__PURE__ */ d((s) => {
|
|
34
|
+
s(i.password ?? "");
|
|
33
35
|
}, "onPassword");
|
|
34
36
|
o.onPassword = e;
|
|
35
37
|
}
|
|
36
38
|
return o.promise.then(
|
|
37
39
|
async (e) => {
|
|
38
|
-
l.value = e,
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
metadata:
|
|
40
|
+
l.value = e, P.value = e.loadingTask, b.value = e.numPages;
|
|
41
|
+
const s = await e.getMetadata(), a = await e.getAttachments(), n = await e.getJSActions(), u = await e.getOutline();
|
|
42
|
+
D.value = {
|
|
43
|
+
metadata: s,
|
|
42
44
|
attachments: a,
|
|
43
45
|
javascript: n,
|
|
44
46
|
outline: u
|
|
45
47
|
};
|
|
46
48
|
},
|
|
47
49
|
(e) => {
|
|
48
|
-
typeof
|
|
50
|
+
typeof i.onError == "function" && i.onError(e);
|
|
49
51
|
}
|
|
50
52
|
);
|
|
51
53
|
}
|
|
52
|
-
|
|
53
|
-
async function
|
|
54
|
+
d(g, "processLoadingTask");
|
|
55
|
+
async function x(c) {
|
|
54
56
|
var t;
|
|
55
|
-
const o = await ((t =
|
|
57
|
+
const o = await ((t = P.value) == null ? void 0 : t.promise);
|
|
56
58
|
if (!o) return null;
|
|
57
|
-
const e = await
|
|
58
|
-
if (!
|
|
59
|
-
const a = await o.getPageIndex(
|
|
60
|
-
return { pageIndex: a, location:
|
|
59
|
+
const e = await j(o, c), s = await B(o, e);
|
|
60
|
+
if (!s || !e) return null;
|
|
61
|
+
const a = await o.getPageIndex(s), n = e[1].name, u = e.slice(2), v = M(u) ? _(n, u) : null;
|
|
62
|
+
return { pageIndex: a, location: v ?? { type: "Fit", spec: [] } };
|
|
61
63
|
}
|
|
62
|
-
|
|
63
|
-
async function
|
|
64
|
+
d(x, "getPDFDestination");
|
|
65
|
+
async function I(c = "filename") {
|
|
64
66
|
var n;
|
|
65
67
|
if (!l.value) throw new Error("Current PDFDocumentProxy have not loaded yet");
|
|
66
|
-
const o = await ((n = l.value) == null ? void 0 : n.saveDocument()), e = new Blob([o], { type: "application/pdf" }),
|
|
67
|
-
document.body.appendChild(a), a.href =
|
|
68
|
-
URL.revokeObjectURL(
|
|
68
|
+
const o = await ((n = l.value) == null ? void 0 : n.saveDocument()), e = new Blob([o], { type: "application/pdf" }), s = URL.createObjectURL(e), a = document.createElement("a");
|
|
69
|
+
document.body.appendChild(a), a.href = s, a.download = c, a.style.display = "none", a.click(), setTimeout(() => {
|
|
70
|
+
URL.revokeObjectURL(s), document.body.removeChild(a);
|
|
69
71
|
}, 10);
|
|
70
72
|
}
|
|
71
|
-
|
|
72
|
-
async function
|
|
73
|
-
var
|
|
73
|
+
d(I, "download");
|
|
74
|
+
async function E(c = 150, o = "filename") {
|
|
75
|
+
var C, L;
|
|
74
76
|
if (!l.value) throw new Error("Current PDFDocumentProxy have not loaded yet");
|
|
75
|
-
const e = await ((
|
|
77
|
+
const e = await ((C = l.value) == null ? void 0 : C.saveDocument()), a = await S(e.buffer).promise, n = c / 72, u = 96 / 72, v = await G(), t = v.contentWindow;
|
|
76
78
|
t.document.title = o;
|
|
77
|
-
const U = [...Array(a.numPages).keys()].map((
|
|
78
|
-
for (const
|
|
79
|
-
const
|
|
80
|
-
|
|
79
|
+
const U = [...Array(a.numPages).keys()].map((p) => p + 1);
|
|
80
|
+
for (const p of U) {
|
|
81
|
+
const y = await a.getPage(p), m = y.getViewport({ scale: 1 });
|
|
82
|
+
p === 1 && J(
|
|
81
83
|
t,
|
|
82
84
|
m.width * n / u,
|
|
83
85
|
m.height * n / u
|
|
84
86
|
);
|
|
85
87
|
const f = document.createElement("canvas");
|
|
86
88
|
f.width = m.width * n, f.height = m.height * n;
|
|
87
|
-
const
|
|
88
|
-
t == null || t.document.body.appendChild(
|
|
89
|
+
const R = f.cloneNode();
|
|
90
|
+
t == null || t.document.body.appendChild(R), await (y == null ? void 0 : y.render({
|
|
89
91
|
canvasContext: f.getContext("2d"),
|
|
90
92
|
intent: "print",
|
|
91
93
|
transform: [n, 0, 0, n, 0, 0],
|
|
92
94
|
viewport: m
|
|
93
|
-
}).promise), (
|
|
95
|
+
}).promise), (L = R.getContext("2d")) == null || L.drawImage(f, 0, 0);
|
|
94
96
|
}
|
|
95
|
-
t == null || t.focus(), t == null || t.print(), document.body.removeChild(
|
|
97
|
+
t == null || t.focus(), t == null || t.print(), document.body.removeChild(v);
|
|
96
98
|
}
|
|
97
|
-
return
|
|
98
|
-
r.value &&
|
|
99
|
-
})) : r &&
|
|
100
|
-
pdf:
|
|
101
|
-
pages:
|
|
102
|
-
info:
|
|
103
|
-
print:
|
|
104
|
-
download:
|
|
105
|
-
getPDFDestination:
|
|
106
|
-
processLoadingTask:
|
|
99
|
+
return d(E, "print"), A(r) ? (r.value && g(r.value), O(r, () => {
|
|
100
|
+
r.value && g(r.value);
|
|
101
|
+
})) : r && g(r), {
|
|
102
|
+
pdf: P,
|
|
103
|
+
pages: b,
|
|
104
|
+
info: D,
|
|
105
|
+
print: E,
|
|
106
|
+
download: I,
|
|
107
|
+
getPDFDestination: x,
|
|
108
|
+
processLoadingTask: g
|
|
107
109
|
};
|
|
108
110
|
}
|
|
109
|
-
|
|
111
|
+
d(Y, "usePDF");
|
|
110
112
|
export {
|
|
111
|
-
|
|
113
|
+
Y as usePDF
|
|
112
114
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-11f81900"]]);exports.default=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
|
|
4
|
-
const
|
|
4
|
+
const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-11f81900"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
f as default
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var y=Object.defineProperty;var u=(l,o)=>y(l,"name",{value:o,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */;/* empty css */;/* empty css */const e=require("vue"),S=,/* empty css */v=,/* empty css */a=,/* empty css */w=,/* empty css */_=e.defineComponent({name:"LSTooltip"}),C=e.defineComponent({..._,props:v.lsTooltipProps,setup(l){const o=l,p=S.useNamespace("tooltip").b(),r=e.ref(!1),s=e.ref(),d=e.useAttrs(),c=e.computed(()=>{const t=o.width.toString();let n="100%";return(t.endsWith("%")||t.endsWith("px"))&&!a.isEmpty(parseInt(t))?n=t:a.isEmpty(Number(t))||(n=`${t}px`),{width:n}}),f=e.computed(()=>d.content||""),m=e.computed(()=>{const t=o.lineClamp>1?Object.assign({height:"auto"},c.value):{width:"auto",height:0},n=o.fontSize;n&&(t.fontSize=`${n}px`);const i=o.lineHeight;return i&&(t.lineHeight=`${i}px`),t});function h(){g()}u(h,"onMouseEnter");async function g(){if(await e.nextTick(),s.value){const t=s.value.getBoundingClientRect(),n=s.value.querySelector(".temp-content").getBoundingClientRect();o.lineClamp<=1?r.value=n.width>t.width:r.value=n.height>t.height}}return u(g,"updateTooltip"),(t,n)=>{const i=w.ElTooltip;return e.openBlock(),e.createElementBlock("div",{ref_key:"lsTooltipRef",ref:s,class:e.normalizeClass(e.unref(p)),style:e.normalizeStyle(e.unref(c)),onMouseenter:h},[e.createElementVNode("div",{class:"temp-content",style:e.normalizeStyle(e.unref(m))},e.toDisplayString(e.unref(f)),5),e.createVNode(i,e.mergeProps({disabled:!e.unref(r)},t.$attrs),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},void 0,!0)]),content:e.withCtx(()=>[e.renderSlot(t.$slots,"content",{},void 0,!0)]),_:3},16,["disabled"])],38)}}});exports.default=C;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var T = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var c = (l, o) => T(l, "name", { value: o, configurable: !0 });
|
|
3
3
|
/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { defineComponent as g, ref as
|
|
6
|
+
import { defineComponent as g, ref as m, useAttrs as B, computed as p, openBlock as $, createElementBlock as b, normalizeClass as x, unref as n, normalizeStyle as u, createElementVNode as z, toDisplayString as E, createVNode as k, mergeProps as N, withCtx as f, renderSlot as d, nextTick as R } from "vue";
|
|
7
7
|
import { useNamespace as W } from "../../_hooks/useNamespace/index.js";
|
|
8
8
|
import { lsTooltipProps as H } from "../types/index.js";
|
|
9
9
|
import { isEmpty as h } from "../../_utils/utils/index.js";
|
|
@@ -13,52 +13,52 @@ const P = g({
|
|
|
13
13
|
}), J = /* @__PURE__ */ g({
|
|
14
14
|
...P,
|
|
15
15
|
props: H,
|
|
16
|
-
setup(
|
|
17
|
-
const o =
|
|
18
|
-
const t = o.width;
|
|
16
|
+
setup(l) {
|
|
17
|
+
const o = l, w = W("tooltip").b(), r = m(!1), i = m(), y = B(), a = p(() => {
|
|
18
|
+
const t = o.width.toString();
|
|
19
19
|
let e = "100%";
|
|
20
20
|
return (t.endsWith("%") || t.endsWith("px")) && !h(parseInt(t)) ? e = t : h(Number(t)) || (e = `${t}px`), {
|
|
21
21
|
width: e
|
|
22
22
|
};
|
|
23
|
-
}),
|
|
23
|
+
}), v = p(() => y.content || ""), S = p(() => {
|
|
24
24
|
const t = o.lineClamp > 1 ? Object.assign(
|
|
25
25
|
{
|
|
26
26
|
height: "auto"
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
a.value
|
|
29
29
|
) : {
|
|
30
30
|
width: "auto",
|
|
31
31
|
height: 0
|
|
32
32
|
}, e = o.fontSize;
|
|
33
33
|
e && (t.fontSize = `${e}px`);
|
|
34
|
-
const
|
|
35
|
-
return
|
|
34
|
+
const s = o.lineHeight;
|
|
35
|
+
return s && (t.lineHeight = `${s}px`), t;
|
|
36
36
|
});
|
|
37
|
-
function
|
|
38
|
-
|
|
37
|
+
function _() {
|
|
38
|
+
C();
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
async function
|
|
40
|
+
c(_, "onMouseEnter");
|
|
41
|
+
async function C() {
|
|
42
42
|
if (await R(), i.value) {
|
|
43
43
|
const t = i.value.getBoundingClientRect(), e = i.value.querySelector(".temp-content").getBoundingClientRect();
|
|
44
|
-
o.lineClamp <= 1 ? e.width > t.width
|
|
44
|
+
o.lineClamp <= 1 ? r.value = e.width > t.width : r.value = e.height > t.height;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
return
|
|
48
|
-
const
|
|
49
|
-
return
|
|
47
|
+
return c(C, "updateTooltip"), (t, e) => {
|
|
48
|
+
const s = M;
|
|
49
|
+
return $(), b("div", {
|
|
50
50
|
ref_key: "lsTooltipRef",
|
|
51
51
|
ref: i,
|
|
52
|
-
class:
|
|
53
|
-
style:
|
|
54
|
-
onMouseenter:
|
|
52
|
+
class: x(n(w)),
|
|
53
|
+
style: u(n(a)),
|
|
54
|
+
onMouseenter: _
|
|
55
55
|
}, [
|
|
56
|
-
|
|
56
|
+
z("div", {
|
|
57
57
|
class: "temp-content",
|
|
58
|
-
style:
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
disabled: !
|
|
58
|
+
style: u(n(S))
|
|
59
|
+
}, E(n(v)), 5),
|
|
60
|
+
k(s, N({
|
|
61
|
+
disabled: !n(r)
|
|
62
62
|
}, t.$attrs), {
|
|
63
63
|
default: f(() => [
|
|
64
64
|
d(t.$slots, "default", {}, void 0, !0)
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-96110588"]]);exports.default=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
|
|
4
|
-
const
|
|
4
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-96110588"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var D=Object.defineProperty;var a=(f,p)=>D(f,"name",{value:p,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */;/* empty css */;/* empty css */const t=require("vue"),_=,/* empty css */b=,/* empty css */z=,/* empty css */H=,/* empty css */I=,/* empty css */R=t.defineComponent({name:"LSTree"}),M=t.defineComponent({...R,props:b.lsTreeProps,emits:b.emitNames,setup(f,{expose:p,emit:x}){const k=x,c=f,
|
|
1
|
+
"use strict";var D=Object.defineProperty;var a=(f,p)=>D(f,"name",{value:p,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */;/* empty css */;/* empty css */const t=require("vue"),_=,/* empty css */b=,/* empty css */z=,/* empty css */H=,/* empty css */I=,/* empty css */R=t.defineComponent({name:"LSTree"}),M=t.defineComponent({...R,props:b.lsTreeProps,emits:b.emitNames,setup(f,{expose:p,emit:x}){const k=x,c=f,N=_.useNamespace("tree"),S=N.b(),E=N.b("box"),s=t.ref(),i=t.ref(!1),u=t.ref(!1),m=t.ref([]),q=t.computed(()=>c.height?{maxHeight:c.height}:{}),y=t.computed(()=>c.treeData);t.watch(()=>y.value,async e=>{e&&e.length>0&&(i.value=!1,u.value=!1,m.value=w(),await t.nextTick(),s.value.filter(),v(),K(),await A())},{immediate:!0,deep:!0});function w(){return y.value.reduce((e,n)=>(e.push(n.id),n.children&&e.push(...g(n.children)),e),[])}a(w,"getAllNodeKeys");function g(e){return e.reduce((n,l)=>(n.push(l.id),l.children&&n.push(...g(l.children)),n),[])}a(g,"getAllChildKeys");async function A(){var n,l;await t.nextTick();const e=document.getElementsByClassName("hide-child-node");for(let r=0;r<e.length;r++){const o=e[r].parentNode;o.style.opacity=0,o.style.width=0,o.style.height=0;const d=o.parentNode.parentNode.querySelectorAll(".el-tree-node");let h=!0;for(let C=0;C<d.length;C++)if(d[C].style.display!=="none"){h=!1;break}(l=(n=o==null?void 0:o.parentNode)==null?void 0:n.parentNode)!=null&&l.previousElementSibling&&h&&(o.parentNode.parentNode.previousElementSibling.querySelector(".el-icon").style.opacity=0,o.parentNode.parentNode.previousElementSibling.querySelector(".el-icon").style.visibility="hidden")}}a(A,"updateHideStyle");function T(){u.value=!1,s.value&&s.value.setCheckedKeys(i.value?m.value:[])}a(T,"handleCheckAllChange");function P(e,n){const{permission:l}=n||{};if(l!=null&&l.startsWith(c.hideNodePrefix))return!1;if(!e)return!0;const{label:r}=c.dataProps||{};return r?n[r].indexOf(e)!==-1:!0}a(P,"filterNode");function B(e,n){s.value.setCheckedNodes(z.excutePowerTree(y.value,e,n)),k("handleCheck",e,n)}a(B,"handleCheck");function V(e,n){v(),k("handleChekChange",e,n)}a(V,"handleChekChange");function v(){const e=s.value.getCheckedNodes(!1,!0);let n=[];if(e.forEach(l=>{const{id:r,parentId:o}=l;n.push(r||o)}),n.length>0){const l=n.length===m.value.length;i.value=l,u.value=!l}else i.value=!1,u.value=!1}a(v,"updateAllCheckStatus");function K(){var e,n;if(c.direction=="h"){const l=(n=(e=s.value)==null?void 0:e.el$)==null?void 0:n.getElementsByClassName("el-tree-node");for(let r=0;r<l.length;r++){const o=l[r];if(o){const d=o.querySelector(".el-tree-node__content .el-icon");d&&getComputedStyle(d).visibility==="hidden"&&(o.style.display="inline-block",o.style.verticalAlign="middle")}}}}return a(K,"updateStyle"),p({lsTreeRef:s}),(e,n)=>{const l=H.ElCheckbox,r=I.ElTree;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(S))},[e.isCheckAll?(t.openBlock(),t.createBlock(l,{key:0,modelValue:t.unref(i),"onUpdate:modelValue":n[0]||(n[0]=o=>t.isRef(i)?i.value=o:null),indeterminate:t.unref(u),onChange:T},{default:t.withCtx(()=>n[1]||(n[1]=[t.createTextVNode(" 全选 ")])),_:1},8,["modelValue","indeterminate"])):t.createCommentVNode("",!0),t.createVNode(r,{ref_key:"lsTreeRef",ref:s,"show-checkbox":e.showCheckbox,"default-expand-all":e.defaultExpandAll,"node-key":e.nodeKey,"check-strictly":e.isCheckStrictly,style:t.normalizeStyle(t.unref(q)),class:t.normalizeClass([t.unref(E),!e.isExpand&&"expand-disabled"]),data:e.treeData,props:e.dataProps,"default-checked-keys":e.defaultCheckedKeys,"expand-on-click-node":e.isExpand,"filter-node-method":P,onCheck:B,onCheckChange:V},{default:t.withCtx(({node:o,data:d})=>{var h;return[t.createElementVNode("span",{class:t.normalizeClass(["custom-tree-node",{"hide-child-node":e.hideNodePrefix&&((h=d.permission)==null?void 0:h.startsWith(e.hideNodePrefix))}])},[t.createElementVNode("span",null,t.toDisplayString(o.label),1)],2)]}),_:1},8,["show-checkbox","default-expand-all","node-key","check-strictly","style","class","data","props","default-checked-keys","expand-on-click-node"])],2)}}});exports.default=M;
|
|
@@ -3,7 +3,7 @@ var a = (p, m) => L(p, "name", { value: m, configurable: !0 });
|
|
|
3
3
|
/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { defineComponent as P, ref as f, computed as x, watch as O, nextTick as E, openBlock as A, createElementBlock as U, normalizeClass as
|
|
6
|
+
import { defineComponent as P, ref as f, computed as x, watch as O, nextTick as E, openBlock as A, createElementBlock as U, normalizeClass as N, unref as h, createBlock as $, isRef as j, withCtx as w, createTextVNode as F, createCommentVNode as G, createVNode as J, normalizeStyle as M, createElementVNode as T, toDisplayString as Q } from "vue";
|
|
7
7
|
import { useNamespace as X } from "../../_hooks/useNamespace/index.js";
|
|
8
8
|
import { lsTreeProps as Y, emitNames as Z } from "../types/index.js";
|
|
9
9
|
import { excutePowerTree as ee } from "../../_utils/power/index.js";
|
|
@@ -15,8 +15,8 @@ const ne = P({
|
|
|
15
15
|
...ne,
|
|
16
16
|
props: Y,
|
|
17
17
|
emits: Z,
|
|
18
|
-
setup(p, { expose: m, emit:
|
|
19
|
-
const
|
|
18
|
+
setup(p, { expose: m, emit: B }) {
|
|
19
|
+
const g = B, d = p, v = X("tree"), K = v.b(), V = v.b("box"), i = f(), r = f(!1), c = f(!1), y = f([]), D = x(() => d.height ? {
|
|
20
20
|
maxHeight: d.height
|
|
21
21
|
} : {}), k = x(() => d.treeData);
|
|
22
22
|
O(
|
|
@@ -34,24 +34,24 @@ const ne = P({
|
|
|
34
34
|
}
|
|
35
35
|
a(q, "getAllNodeKeys");
|
|
36
36
|
function b(e) {
|
|
37
|
-
return e.reduce((t,
|
|
37
|
+
return e.reduce((t, l) => (t.push(l.id), l.children && t.push(...b(l.children)), t), []);
|
|
38
38
|
}
|
|
39
39
|
a(b, "getAllChildKeys");
|
|
40
40
|
async function H() {
|
|
41
|
-
var t,
|
|
41
|
+
var t, l;
|
|
42
42
|
await E();
|
|
43
43
|
const e = document.getElementsByClassName("hide-child-node");
|
|
44
44
|
for (let o = 0; o < e.length; o++) {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const s =
|
|
45
|
+
const n = e[o].parentNode;
|
|
46
|
+
n.style.opacity = 0, n.style.width = 0, n.style.height = 0;
|
|
47
|
+
const s = n.parentNode.parentNode.querySelectorAll(".el-tree-node");
|
|
48
48
|
let u = !0;
|
|
49
49
|
for (let C = 0; C < s.length; C++)
|
|
50
50
|
if (s[C].style.display !== "none") {
|
|
51
51
|
u = !1;
|
|
52
52
|
break;
|
|
53
53
|
}
|
|
54
|
-
(
|
|
54
|
+
(l = (t = n == null ? void 0 : n.parentNode) == null ? void 0 : t.parentNode) != null && l.previousElementSibling && u && (n.parentNode.parentNode.previousElementSibling.querySelector(".el-icon").style.opacity = 0, n.parentNode.parentNode.previousElementSibling.querySelector(".el-icon").style.visibility = "hidden");
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
a(H, "updateHideStyle");
|
|
@@ -60,8 +60,8 @@ const ne = P({
|
|
|
60
60
|
}
|
|
61
61
|
a(I, "handleCheckAllChange");
|
|
62
62
|
function R(e, t) {
|
|
63
|
-
const { permission:
|
|
64
|
-
if (
|
|
63
|
+
const { permission: l } = t || {};
|
|
64
|
+
if (l != null && l.startsWith(d.hideNodePrefix))
|
|
65
65
|
return !1;
|
|
66
66
|
if (!e) return !0;
|
|
67
67
|
const { label: o } = d.dataProps || {};
|
|
@@ -69,31 +69,35 @@ const ne = P({
|
|
|
69
69
|
}
|
|
70
70
|
a(R, "filterNode");
|
|
71
71
|
function _(e, t) {
|
|
72
|
-
i.value.setCheckedNodes(ee(k.value, e, t)),
|
|
72
|
+
i.value.setCheckedNodes(ee(k.value, e, t)), g("handleCheck", e, t);
|
|
73
73
|
}
|
|
74
74
|
a(_, "handleCheck");
|
|
75
75
|
function z(e, t) {
|
|
76
|
-
S(),
|
|
76
|
+
S(), g("handleChekChange", e, t);
|
|
77
77
|
}
|
|
78
78
|
a(z, "handleChekChange");
|
|
79
79
|
function S() {
|
|
80
80
|
const e = i.value.getCheckedNodes(!1, !0);
|
|
81
81
|
let t = [];
|
|
82
|
-
e.forEach((
|
|
83
|
-
const { id: o, parentId:
|
|
84
|
-
t.push(o ||
|
|
85
|
-
}), t.length > 0
|
|
82
|
+
if (e.forEach((l) => {
|
|
83
|
+
const { id: o, parentId: n } = l;
|
|
84
|
+
t.push(o || n);
|
|
85
|
+
}), t.length > 0) {
|
|
86
|
+
const l = t.length === y.value.length;
|
|
87
|
+
r.value = l, c.value = !l;
|
|
88
|
+
} else
|
|
89
|
+
r.value = !1, c.value = !1;
|
|
86
90
|
}
|
|
87
91
|
a(S, "updateAllCheckStatus");
|
|
88
92
|
function W() {
|
|
89
93
|
var e, t;
|
|
90
94
|
if (d.direction == "h") {
|
|
91
|
-
const
|
|
92
|
-
for (let o = 0; o <
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
const s =
|
|
96
|
-
s && getComputedStyle(s).visibility === "hidden" && (
|
|
95
|
+
const l = (t = (e = i.value) == null ? void 0 : e.el$) == null ? void 0 : t.getElementsByClassName("el-tree-node");
|
|
96
|
+
for (let o = 0; o < l.length; o++) {
|
|
97
|
+
const n = l[o];
|
|
98
|
+
if (n) {
|
|
99
|
+
const s = n.querySelector(".el-tree-node__content .el-icon");
|
|
100
|
+
s && getComputedStyle(s).visibility === "hidden" && (n.style.display = "inline-block", n.style.verticalAlign = "middle");
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
}
|
|
@@ -101,14 +105,14 @@ const ne = P({
|
|
|
101
105
|
return a(W, "updateStyle"), m({
|
|
102
106
|
lsTreeRef: i
|
|
103
107
|
}), (e, t) => {
|
|
104
|
-
const
|
|
108
|
+
const l = te, o = le;
|
|
105
109
|
return A(), U("div", {
|
|
106
|
-
class:
|
|
110
|
+
class: N(h(K))
|
|
107
111
|
}, [
|
|
108
|
-
e.isCheckAll ? (A(), $(
|
|
112
|
+
e.isCheckAll ? (A(), $(l, {
|
|
109
113
|
key: 0,
|
|
110
114
|
modelValue: h(r),
|
|
111
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
115
|
+
"onUpdate:modelValue": t[0] || (t[0] = (n) => j(r) ? r.value = n : null),
|
|
112
116
|
indeterminate: h(c),
|
|
113
117
|
onChange: I
|
|
114
118
|
}, {
|
|
@@ -125,7 +129,7 @@ const ne = P({
|
|
|
125
129
|
"node-key": e.nodeKey,
|
|
126
130
|
"check-strictly": e.isCheckStrictly,
|
|
127
131
|
style: M(h(D)),
|
|
128
|
-
class:
|
|
132
|
+
class: N([h(V), !e.isExpand && "expand-disabled"]),
|
|
129
133
|
data: e.treeData,
|
|
130
134
|
props: e.dataProps,
|
|
131
135
|
"default-checked-keys": e.defaultCheckedKeys,
|
|
@@ -134,15 +138,15 @@ const ne = P({
|
|
|
134
138
|
onCheck: _,
|
|
135
139
|
onCheckChange: z
|
|
136
140
|
}, {
|
|
137
|
-
default: w(({ node:
|
|
141
|
+
default: w(({ node: n, data: s }) => {
|
|
138
142
|
var u;
|
|
139
143
|
return [
|
|
140
144
|
T("span", {
|
|
141
|
-
class:
|
|
145
|
+
class: N(["custom-tree-node", {
|
|
142
146
|
"hide-child-node": e.hideNodePrefix && ((u = s.permission) == null ? void 0 : u.startsWith(e.hideNodePrefix))
|
|
143
147
|
}])
|
|
144
148
|
}, [
|
|
145
|
-
T("span", null, Q(
|
|
149
|
+
T("span", null, Q(n.label), 1)
|
|
146
150
|
], 2)
|
|
147
151
|
];
|
|
148
152
|
}),
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-5cc748b0"]]);exports.default=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
|
|
4
|
-
const
|
|
4
|
+
const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5cc748b0"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Fe=Object.defineProperty;var a=(T,q)=>Fe(T,"name",{value:q,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */;/* empty css */;/* empty css */;/* empty css */const e=require("vue"),E=,/* empty css */he=,/* empty css */ye=,/* empty css */F=,/* empty css */j=,/* empty css */be=;/* empty css */;/* empty css */;/* empty css */const S=,/* empty css */Be=,/* empty css */Ce=,/* empty css */we={class:"ls-drag"},Ee={class:"drag-txt ls-color-brand6"},Se={key:0,class:"btn-picture-card"},xe={key:0,class:"ls-tip"},Le=e.defineComponent({name:"LSUpload",inheritAttrs:!1,__name:"Index",props:E.lsUploadProps,emits:["uploadErrorFunc","onChangeFunc","httpResponseFunc"],setup(T,{expose:q,emit:H}){const x=e.useSlots(),d=e.useAttrs(),G=ye.useNamespace("upload").b(),c=e.ref(),s=e.ref(!1),v=e.reactive({isCover:!0,accept:"",disabled:!1}),i=e.reactive({uploadFileList:[],initUploadStatus:!0,showPreview:!1,sourcePreview:"",iconColor:he.getVariable("colorText1")}),o=T,L=H;e.watch(()=>d["file-list"],t=>{i.uploadFileList=t||[]},{immediate:!0,deep:!0});const h=e.computed(()=>{var t,n;return!!((t=o==null?void 0:o.item)!=null&&t.isToast||typeof((n=o==null?void 0:o.item)==null?void 0:n.isToast)>"u")}),f=e.computed(()=>{var n;const t=(n=o==null?void 0:o.item)==null?void 0:n.isCover;return typeof t>"u"?!0:t}),g=e.computed(()=>d.multiple),p=e.computed(()=>{const t=d["auto-upload"];return typeof t>"u"?!0:t}),K=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.emptyFileMsg)||""}),A=e.computed(()=>d["list-type"]),y=e.computed(()=>A.value===E.UPLOAD_TYPE_MAP.picCard),W=e.computed(()=>!A.value||A.value=="text"),b=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitFile)||[]}),X=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitFileMsg)||""}),B=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitSize)||2}),Y=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitSizeMsg)||""}),M=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitUnit)||"MB"}),J=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitNumMsg)||""}),Q=e.computed(()=>{var t;return(t=o==null?void 0:o.item)==null?void 0:t.limitAllFail}),R=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.profile)||!1}),C=e.computed(()=>d.drag),Z=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.hideCoverBtn)&&f.value&&i.uploadFileList.length>0}),k=e.computed(()=>d.disabled),V=e.computed(()=>{const t=y.value?"图片":"文件";let n=`选择${t}`;return s.value?n="正在上传...":f.value&&!g.value?p.value?i.initUploadStatus?n="点击上传":n="重新上传":i.initUploadStatus?n=`选择${t}`:n="重新上传":p.value&&(n="点击上传"),n}),ee=e.computed(()=>{let t="不限制上传格式,";return y.value&&(t="文件须为图片格式,"),`${t}文件大小不超过${B.value}${M.value}`}),te=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.tipContent)||""}),$=e.computed(()=>{var t;return(t=o==null?void 0:o.item)==null?void 0:t.httpRequestFunc}),ne=e.computed(()=>{var n;const t=Number(d.limit||0);return t?((n=o==null?void 0:o.item)==null?void 0:n.hideBtnReachLimit)&&i.uploadFileList.length>=t:!1});e.watch([f,$],([t,n])=>{v.isCover=t,n&&n instanceof Function&&(v["http-request"]=ce)},{immediate:!0,deep:!0}),e.watch(()=>b.value,t=>{t&&t.length>0&&oe(t)},{immediate:!0,deep:!0});function oe(t){v.accept="",t.forEach(n=>{const l=E.fileTypeMap[n]||"";l&&(v.accept&&(v.accept+=","),v.accept+=l)})}a(oe,"updateFileAccept");function w(t){const{formRuleFunc:n,formValidateFunc:l}=e.toRefs(o==null?void 0:o.item);if(n&&n.value instanceof Function&&l&&l.value instanceof Function){const r=n.value(),{message:u}=r;r.message=t,l.value(),r.message=u}L("uploadErrorFunc",t)}a(w,"validateForm");async function le(t,n){if(s.value=!1,o.onExceed)return o.onExceed(t,n);const l=Number(d.limit||0);let r=0;Q.value||(r=l-i.uploadFileList.length,r>0&&(de(t.slice(0,r)),p.value&&z()));const u=J.value||`当前限制选择 ${l} 个文件,本次选择了 ${t.length} 个文件,已成功上传 ${r} 个文件`;h.value?setTimeout(()=>{S.ElMessage.warning(u)},200):w(u)}a(le,"onExceedAction");function ie(t){if(o.beforeUpload){const l=o.beforeUpload(t);return l&&f.value&&!g.value&&P(),l}const n=_(t,!0);return n&&p.value&&f.value&&!g.value&&P(),n}a(ie,"beforeUploadAction");function _(t,n){let l=!0;const{size:r,name:u}=t,N=b.value.length>0&&!D(u);let U=!1;switch(M.value){case"KB":U=r/1024>B.value;break;case"MB":U=r/1024/1024>B.value;break;default:U=r/1024/1024/1024>B.value;break}if(N){const m=X.value||`上传文件 ${t.name} 只能是 ${b.value.filter(ke=>ke).join(",").toLocaleLowerCase()} 格式!`;h.value&&n?setTimeout(()=>{S.ElMessage.error(m)},200):w(m),l=!1}if(U){const m=Y.value||`上传文件 ${t.name} 大小不能超过 ${B.value}${M.value}!`;h.value&&n?setTimeout(()=>{S.ElMessage.error(m)},200):w(m),l=!1}if(!N&&y.value&&!D(u,E.IMG_SUFFIX_LIST)){const m=`上传文件 ${t.name} 不是图片格式的文件!`;h.value&&n?setTimeout(()=>{S.ElMessage.error(m)},200):w(m),l=!1}return l}a(_,"validateUploadFile");function D(t,n){let l=[];if(b.value.length>0?l=b.value:n&&(l=n),l.length<=0)return!0;for(let r=0;r<l.length;r++){const u=(l[r]||"").toLowerCase();if(t.toLowerCase().endsWith(u))return!0}return!1}a(D,"fileTypeMatch");function P(t,n){i.uploadFileList.splice(t||0,n||i.uploadFileList.length-1)}a(P,"updateCoverFileList");function re(t,n){i.uploadFileList=n;const l=t.raw&&_(t.raw,!p.value);if(l&&f.value&&!g.value&&P(),o.onChange)return o.onChange(t,n);const{size:r=0}=t;if(r<=0){I();const u=K.value||"禁止上传空文件,请检查后重新上传!";h.value?S.ElMessage.error(u):w(u);return}t.raw&&(!p.value&&!l?I():(t.blob=URL.createObjectURL(t.raw)||"",L("onChangeFunc",t)))}a(re,"onChangeAction");function I(){let t=0;i.uploadFileList.length>1&&(t=i.uploadFileList.length-1),P(t,1),L("onChangeFunc",{})}a(I,"setChangeRes");function ue(t,n,l){s.value=!1,i.initUploadStatus=!1;const{formRuleFunc:r,formValidateFunc:u}=e.toRefs(o==null?void 0:o.item);if(r&&r.value instanceof Function&&u&&u.value instanceof Function&&u.value(),o.onSuccess)return o.onSuccess(t,n,l)}a(ue,"onSuccessAction");function ae(t,n,l){if(s.value=!1,o.onError)return o.onError(t,n,l)}a(ae,"onErrorAction");function se(t,n){if(i.initUploadStatus=!n.length,i.uploadFileList=i.uploadFileList.filter(l=>l.uid===t.uid||l.name===t.name?null:l),o.onRemove)return o.onRemove(t,n)}a(se,"onRemoveAction");async function ce(t){const{file:n}=t;if(!n)return;const{size:l}=n;if(l<=0||!_(n,!1))return;if(o.httpRequest)return o.httpRequest(t);const r=new FormData;if(r.append("file",n),$.value instanceof Function){s.value=!0;let u={};try{u=await $.value(r)}catch(N){u=N}finally{s.value=!1,L("httpResponseFunc",u)}}}a(ce,"httpRequestAction");function O(){let t=!1;for(let n=0;n<i.uploadFileList.length;n++)if(i.uploadFileList[n].status===E.UPLOAD_STATUS_MAP.ready){t=!0;break}return t}a(O,"hasReadyFile");function z(){var t;(t=c==null?void 0:c.value)==null||t.submit()}a(z,"comfirmUpload");function de(t){(t||[]).forEach(n=>{var l;(l=c==null?void 0:c.value)==null||l.handleStart(n)})}a(de,"comHandleStart");function fe(t){c==null||c.value.handleRemove(t)}a(fe,"removeFile");function me(){i.uploadFileList.forEach(t=>{var n;if(t)try{(n=c==null?void 0:c.value)==null||n.abort(t),fe(t)}catch{}})}a(me,"cancelUpload");function ve(t,n,l){if(s.value=!0,o.onProgress)return o.onProgress(t,n,l)}a(ve,"onProgressAction");function pe(t){if(o.onPreview)return o.onPreview(t);if(y.value){const{url:n}=t;i.sourcePreview=n,i.showPreview=!0}}a(pe,"onPreviewAction");function ge(){i.showPreview=!1,i.sourcePreview=""}return a(ge,"closePreview"),q({uploadRef:c}),(t,n)=>{const l=Be.ElAvatar,r=Ce.ElUpload;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(G),e.unref(C)?"ls-upload-drag":"",e.unref(R)?"ls-profile":"",e.unref(Z)?"hide-cover-btn":"",e.unref(ne)?"hide-btn":""])},[e.createVNode(r,e.mergeProps({ref_key:"uploadRef",ref:c},Object.assign(e.unref(v),t.$attrs),{"on-exceed":le,"before-upload":ie,"on-change":re,"on-success":ue,"on-error":ae,"on-remove":se,"on-progress":ve,"on-preview":pe}),e.createSlots({trigger:e.withCtx(()=>[e.unref(R)?t.item.defProfile&&e.unref(i).uploadFileList.length<1?(e.openBlock(),e.createBlock(l,{key:1,size:60,src:t.item.defProfile,fit:"contain"},null,8,["src"])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(x).trigger?e.renderSlot(t.$slots,"trigger",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(C)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(s)?(e.openBlock(),e.createBlock(F.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(k)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(j.default,{key:1,class:"upload-icon",name:"UploadFilled",size:"56",color:"#E7E7E7"})),e.createElementVNode("div",we,[e.createElementVNode("div",Ee,e.toDisplayString(e.unref(V)),1),e.unref(s)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[1]||(n[1]=e.createTextVNode(" / ")),n[2]||(n[2]=e.createElementVNode("div",{class:"drag-txt ls-color-text2"},"拖拽到此区域",-1))],64))])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(y)?(e.openBlock(),e.createElementBlock("div",Se,[e.unref(s)?(e.openBlock(),e.createBlock(F.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(k)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(j.default,{key:1,class:"upload-btn-plus",name:"Plus",size:28,color:e.unref(i).iconColor},null,8,["color"])),e.createElementVNode("div",null,e.toDisplayString(e.unref(V)),1)])):(e.openBlock(),e.createBlock(F.default,{key:1,plain:"",icon:"upload",loading:e.unref(s),disabled:e.unref(k)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(V)),1)]),_:1},8,["loading","disabled"]))],64))],64))],64))]),default:e.withCtx(()=>[e.unref(x).default?e.renderSlot(t.$slots,"default",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[!e.unref(p)&&(e.unref(W)||e.unref(C))?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["upload-btn-handle",[e.unref(C)?"drag-css":"nor-css",!e.unref(f)||e.unref(g)?"multi-css":""]])},[e.unref(C)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[!e.unref(f)||e.unref(g)?(e.openBlock(),e.createBlock(F.default,{key:0,type:"primary",loading:e.unref(s),disabled:e.unref(k),onClick:me,class:"ls-upload-btn-com ls-upload-btn-cancel"},{default:e.withCtx(()=>n[4]||(n[4]=[e.createTextVNode("取消上传")])),_:1},8,["loading","disabled"])):e.createCommentVNode("",!0),e.createVNode(F.default,{class:e.normalizeClass(["start-upload ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":O()}]),type:"primary",loading:e.unref(s),disabled:e.unref(k),onClick:z},{default:e.withCtx(()=>n[5]||(n[5]=[e.createTextVNode("开始上传")])),_:1},8,["class","loading","disabled"])],64)):(e.openBlock(),e.createBlock(F.default,{key:0,type:"primary",class:e.normalizeClass(["ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":O()}]),loading:e.unref(s),disabled:e.unref(k),onClick:z},{default:e.withCtx(()=>n[3]||(n[3]=[e.createTextVNode("开始上传 ")])),_:1},8,["class","loading","disabled"]))],2)):e.createCommentVNode("",!0)],64))]),tip:e.withCtx(()=>[e.unref(x).tip?e.renderSlot(t.$slots,"tip",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock("div",xe,e.toDisplayString(e.unref(te)||e.unref(ee)),1))]),_:2},[e.unref(x).file?{name:"file",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"file",{},void 0,!0)]),key:"0"}:void 0]),1040),e.createVNode(e.unref(be.default),{modelValue:e.unref(i).showPreview,"onUpdate:modelValue":n[0]||(n[0]=u=>e.unref(i).showPreview=u),source:e.unref(i).sourcePreview,"on-close":ge},null,8,["modelValue","source"])],2)}}});exports.default=Le;
|
|
1
|
+
"use strict";var Fe=Object.defineProperty;var a=(T,q)=>Fe(T,"name",{value:q,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */;/* empty css */;/* empty css */;/* empty css */const e=require("vue"),E=,/* empty css */he=,/* empty css */ye=,/* empty css */F=,/* empty css */j=,/* empty css */be=;/* empty css */;/* empty css */;/* empty css */const S=,/* empty css */Be=,/* empty css */Ce=,/* empty css */we={class:"ls-drag"},Ee={class:"drag-txt ls-color-brand6"},Se={key:0,class:"btn-picture-card"},xe={key:0,class:"ls-tip"},Le=e.defineComponent({name:"LSUpload",inheritAttrs:!1,__name:"Index",props:E.lsUploadProps,emits:["uploadErrorFunc","onChangeFunc","httpResponseFunc"],setup(T,{expose:q,emit:H}){const x=e.useSlots(),d=e.useAttrs(),G=ye.useNamespace("upload").b(),c=e.ref(),s=e.ref(!1),v=e.reactive({isCover:!0,accept:"",disabled:!1}),i=e.reactive({uploadFileList:[],initUploadStatus:!0,showPreview:!1,sourcePreview:"",iconColor:he.getVariable("colorText1")}),o=T,L=H;e.watch(()=>d["file-list"],t=>{i.uploadFileList=t||[]},{immediate:!0,deep:!0});const h=e.computed(()=>{var t,n;return!!((t=o==null?void 0:o.item)!=null&&t.isToast||typeof((n=o==null?void 0:o.item)==null?void 0:n.isToast)>"u")}),f=e.computed(()=>{var n;const t=(n=o==null?void 0:o.item)==null?void 0:n.isCover;return typeof t>"u"?!0:t}),g=e.computed(()=>d.multiple),p=e.computed(()=>{const t=d["auto-upload"];return typeof t>"u"?!0:t}),K=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.emptyFileMsg)||""}),A=e.computed(()=>d["list-type"]),y=e.computed(()=>A.value===E.UPLOAD_TYPE_MAP.picCard),W=e.computed(()=>!A.value||A.value=="text"),b=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitFile)||[]}),X=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitFileMsg)||""}),B=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitSize)||2}),Y=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitSizeMsg)||""}),M=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitUnit)||"MB"}),J=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitNumMsg)||""}),Q=e.computed(()=>{var t;return(t=o==null?void 0:o.item)==null?void 0:t.limitAllFail}),R=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.profile)||!1}),C=e.computed(()=>d.drag),Z=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.hideCoverBtn)&&f.value&&i.uploadFileList.length>0}),k=e.computed(()=>d.disabled),V=e.computed(()=>{const t=y.value?"图片":"文件";let n=`选择${t}`;return s.value?n="正在上传...":f.value&&!g.value?p.value?i.initUploadStatus?n="点击上传":n="重新上传":i.initUploadStatus?n=`选择${t}`:n="重新上传":p.value&&(n="点击上传"),n}),ee=e.computed(()=>{let t="不限制上传格式,";return y.value&&(t="文件须为图片格式,"),`${t}文件大小不超过${B.value}${M.value}`}),te=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.tipContent)||""}),$=e.computed(()=>{var t;return(t=o==null?void 0:o.item)==null?void 0:t.httpRequestFunc}),ne=e.computed(()=>{var n;const t=Number(d.limit||0);return t?((n=o==null?void 0:o.item)==null?void 0:n.hideBtnReachLimit)&&i.uploadFileList.length>=t:!1});e.watch([f,$],([t,n])=>{v.isCover=t,n&&n instanceof Function&&(v["http-request"]=ce)},{immediate:!0,deep:!0}),e.watch(()=>b.value,t=>{t&&t.length>0&&oe(t)},{immediate:!0,deep:!0});function oe(t){v.accept="",t.forEach(n=>{const l=E.fileTypeMap[n]||"";l&&(v.accept&&(v.accept+=","),v.accept+=l)})}a(oe,"updateFileAccept");function w(t){const{formRuleFunc:n,formValidateFunc:l}=e.toRefs(o==null?void 0:o.item);if(n&&n.value instanceof Function&&l&&l.value instanceof Function){const r=n.value(),{message:u}=r;r.message=t,l.value(),r.message=u}L("uploadErrorFunc",t)}a(w,"validateForm");async function le(t,n){if(s.value=!1,o.onExceed)return o.onExceed(t,n);const l=Number(d.limit||0);let r=0;Q.value||(r=l-i.uploadFileList.length,r>0&&(de(t.slice(0,r)),p.value&&z()));const u=J.value||`当前限制选择 ${l} 个文件,本次选择了 ${t.length} 个文件,已成功上传 ${r} 个文件`;h.value?setTimeout(()=>{S.ElMessage.warning(u)},200):w(u)}a(le,"onExceedAction");function ie(t){if(o.beforeUpload){const l=o.beforeUpload(t);return l&&f.value&&!g.value&&P(),l}const n=_(t,!0);return n&&p.value&&f.value&&!g.value&&P(),n}a(ie,"beforeUploadAction");function _(t,n){let l=!0;const{size:r,name:u}=t,N=b.value.length>0&&!D(u);let U=!1;switch(M.value){case"KB":U=r/1024>B.value;break;case"MB":U=r/1024/1024>B.value;break;default:U=r/1024/1024/1024>B.value;break}if(N){const m=X.value||`上传文件 ${t.name} 只能是 ${b.value.filter(ke=>ke).join(",").toLocaleLowerCase()} 格式!`;h.value&&n?setTimeout(()=>{S.ElMessage.error(m)},200):w(m),l=!1}if(U){const m=Y.value||`上传文件 ${t.name} 大小不能超过 ${B.value}${M.value}!`;h.value&&n?setTimeout(()=>{S.ElMessage.error(m)},200):w(m),l=!1}if(!N&&y.value&&!D(u,E.IMG_SUFFIX_LIST)){const m=`上传文件 ${t.name} 不是图片格式的文件!`;h.value&&n?setTimeout(()=>{S.ElMessage.error(m)},200):w(m),l=!1}return l}a(_,"validateUploadFile");function D(t,n){let l=[];if(b.value.length>0?l=b.value:n&&(l=n),l.length<=0)return!0;for(let r=0;r<l.length;r++){const u=(l[r]||"").toLowerCase();if(t.toLowerCase().endsWith(u))return!0}return!1}a(D,"fileTypeMatch");function P(t,n){i.uploadFileList.splice(t||0,n||i.uploadFileList.length-1)}a(P,"updateCoverFileList");function re(t,n){i.uploadFileList=n;const l=t.raw&&_(t.raw,!p.value);if(l&&f.value&&!g.value&&P(),o.onChange)return o.onChange(t,n);const{size:r=0}=t;if(r<=0){I();const u=K.value||"禁止上传空文件,请检查后重新上传!";h.value?S.ElMessage.error(u):w(u);return}t.raw&&(!p.value&&!l?I():(t.blob=URL.createObjectURL(t.raw)||"",L("onChangeFunc",t)))}a(re,"onChangeAction");function I(){let t=0;i.uploadFileList.length>1&&(t=i.uploadFileList.length-1),P(t,1),L("onChangeFunc",{})}a(I,"setChangeRes");function ue(t,n,l){s.value=!1,i.initUploadStatus=!1;const{formRuleFunc:r,formValidateFunc:u}=e.toRefs(o==null?void 0:o.item);if(r&&r.value instanceof Function&&u&&u.value instanceof Function&&u.value(),o.onSuccess)return o.onSuccess(t,n,l)}a(ue,"onSuccessAction");function ae(t,n,l){if(s.value=!1,o.onError)return o.onError(t,n,l)}a(ae,"onErrorAction");function se(t,n){if(i.initUploadStatus=!n.length,i.uploadFileList=i.uploadFileList.filter(l=>l.uid===t.uid||l.name===t.name?null:l),o.onRemove)return o.onRemove(t,n)}a(se,"onRemoveAction");async function ce(t){const{file:n}=t;if(!n)return;const{size:l}=n;if(l<=0||!_(n,!1))return;if(o.httpRequest)return o.httpRequest(t);const r=new FormData;if(r.append("file",n),$.value instanceof Function){s.value=!0;let u={};try{u=await $.value(r)}catch(N){u=N}finally{s.value=!1,L("httpResponseFunc",u)}}}a(ce,"httpRequestAction");function O(){let t=!1;for(let n=0;n<i.uploadFileList.length;n++)if(i.uploadFileList[n].status===E.UPLOAD_STATUS_MAP.ready){t=!0;break}return t}a(O,"hasReadyFile");function z(){var t;(t=c==null?void 0:c.value)==null||t.submit()}a(z,"comfirmUpload");function de(t){(t||[]).forEach(n=>{var l;(l=c==null?void 0:c.value)==null||l.handleStart(n)})}a(de,"comHandleStart");function fe(t){c==null||c.value.handleRemove(t)}a(fe,"removeFile");function me(){i.uploadFileList.forEach(t=>{var n;if(t)try{(n=c==null?void 0:c.value)==null||n.abort(t),fe(t)}catch{}})}a(me,"cancelUpload");function ve(t,n,l){if(s.value=!0,o.onProgress)return o.onProgress(t,n,l)}a(ve,"onProgressAction");function pe(t){if(o.onPreview)return o.onPreview(t);if(y.value){const{url:n}=t||{};n&&(i.sourcePreview=n,i.showPreview=!0)}}a(pe,"onPreviewAction");function ge(){i.showPreview=!1,i.sourcePreview=""}return a(ge,"closePreview"),q({uploadRef:c}),(t,n)=>{const l=Be.ElAvatar,r=Ce.ElUpload;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(G),e.unref(C)?"ls-upload-drag":"",e.unref(R)?"ls-profile":"",e.unref(Z)?"hide-cover-btn":"",e.unref(ne)?"hide-btn":""])},[e.createVNode(r,e.mergeProps({ref_key:"uploadRef",ref:c},Object.assign(e.unref(v),t.$attrs),{"on-exceed":le,"before-upload":ie,"on-change":re,"on-success":ue,"on-error":ae,"on-remove":se,"on-progress":ve,"on-preview":pe}),e.createSlots({trigger:e.withCtx(()=>[e.unref(R)?t.item.defProfile&&e.unref(i).uploadFileList.length<1?(e.openBlock(),e.createBlock(l,{key:1,size:60,src:t.item.defProfile,fit:"contain"},null,8,["src"])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(x).trigger?e.renderSlot(t.$slots,"trigger",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(C)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(s)?(e.openBlock(),e.createBlock(F.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(k)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(j.default,{key:1,class:"upload-icon",name:"UploadFilled",size:"56",color:"#E7E7E7"})),e.createElementVNode("div",we,[e.createElementVNode("div",Ee,e.toDisplayString(e.unref(V)),1),e.unref(s)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[1]||(n[1]=e.createTextVNode(" / ")),n[2]||(n[2]=e.createElementVNode("div",{class:"drag-txt ls-color-text2"},"拖拽到此区域",-1))],64))])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(y)?(e.openBlock(),e.createElementBlock("div",Se,[e.unref(s)?(e.openBlock(),e.createBlock(F.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(k)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(j.default,{key:1,class:"upload-btn-plus",name:"Plus",size:28,color:e.unref(i).iconColor},null,8,["color"])),e.createElementVNode("div",null,e.toDisplayString(e.unref(V)),1)])):(e.openBlock(),e.createBlock(F.default,{key:1,plain:"",icon:"upload",loading:e.unref(s),disabled:e.unref(k)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(V)),1)]),_:1},8,["loading","disabled"]))],64))],64))],64))]),default:e.withCtx(()=>[e.unref(x).default?e.renderSlot(t.$slots,"default",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[!e.unref(p)&&(e.unref(W)||e.unref(C))?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["upload-btn-handle",[e.unref(C)?"drag-css":"nor-css",!e.unref(f)||e.unref(g)?"multi-css":""]])},[e.unref(C)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[!e.unref(f)||e.unref(g)?(e.openBlock(),e.createBlock(F.default,{key:0,type:"primary",loading:e.unref(s),disabled:e.unref(k),onClick:me,class:"ls-upload-btn-com ls-upload-btn-cancel"},{default:e.withCtx(()=>n[4]||(n[4]=[e.createTextVNode("取消上传")])),_:1},8,["loading","disabled"])):e.createCommentVNode("",!0),e.createVNode(F.default,{class:e.normalizeClass(["start-upload ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":O()}]),type:"primary",loading:e.unref(s),disabled:e.unref(k),onClick:z},{default:e.withCtx(()=>n[5]||(n[5]=[e.createTextVNode("开始上传")])),_:1},8,["class","loading","disabled"])],64)):(e.openBlock(),e.createBlock(F.default,{key:0,type:"primary",class:e.normalizeClass(["ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":O()}]),loading:e.unref(s),disabled:e.unref(k),onClick:z},{default:e.withCtx(()=>n[3]||(n[3]=[e.createTextVNode("开始上传 ")])),_:1},8,["class","loading","disabled"]))],2)):e.createCommentVNode("",!0)],64))]),tip:e.withCtx(()=>[e.unref(x).tip?e.renderSlot(t.$slots,"tip",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock("div",xe,e.toDisplayString(e.unref(te)||e.unref(ee)),1))]),_:2},[e.unref(x).file?{name:"file",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"file",{},void 0,!0)]),key:"0"}:void 0]),1040),e.createVNode(e.unref(be.default),{modelValue:e.unref(i).showPreview,"onUpdate:modelValue":n[0]||(n[0]=u=>e.unref(i).showPreview=u),source:e.unref(i).sourcePreview,"on-close":ge},null,8,["modelValue","source"])],2)}}});exports.default=Le;
|