@aplus-frontend/ui 7.11.0 → 7.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/src/business/ap-attachment/ApAttachment.mjs +12 -12
- package/es/src/business/ap-download/ap-download.vue.d.ts +1 -0
- package/es/src/business/ap-download/ap-download.vue.mjs +86 -45
- package/es/src/business/ap-download/interface.d.ts +4 -0
- package/es/src/business/ap-download/style/index.mjs +8 -4
- package/es/src/business/ap-file-preview/ap-file-preview.vue2.mjs +20 -19
- package/es/src/business/ap-file-preview/interface.d.ts +2 -0
- package/es/src/business/ap-view/ap-view.vue2.mjs +36 -33
- package/es/src/business/ap-view/interface.d.ts +4 -0
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
- package/lib/src/business/ap-download/ap-download.vue.d.ts +1 -0
- package/lib/src/business/ap-download/ap-download.vue.js +1 -1
- package/lib/src/business/ap-download/interface.d.ts +4 -0
- package/lib/src/business/ap-download/style/index.js +1 -1
- package/lib/src/business/ap-file-preview/ap-file-preview.vue2.js +1 -1
- package/lib/src/business/ap-file-preview/interface.d.ts +2 -0
- package/lib/src/business/ap-view/ap-view.vue2.js +1 -1
- package/lib/src/business/ap-view/interface.d.ts +4 -0
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -28,13 +28,13 @@ const Ne = /* @__PURE__ */ j({
|
|
|
28
28
|
} = J(), {
|
|
29
29
|
lang: I,
|
|
30
30
|
t: c
|
|
31
|
-
} = ae(),
|
|
31
|
+
} = ae(), r = g(!1), u = g(""), f = M(), K = i(() => I.value === "zh-cn" ? "zh_CN" : "en_US"), s = i(() => t.needName ?? (d?.value?.needName === !0 ? {
|
|
32
32
|
nameKey: "fileName",
|
|
33
33
|
pathKey: "path"
|
|
34
34
|
} : d?.value?.needName ?? {
|
|
35
35
|
nameKey: "fileName",
|
|
36
36
|
pathKey: "filePath"
|
|
37
|
-
})), p = i(() => t.attachmentList.length === 1), b = i(() =>
|
|
37
|
+
})), p = i(() => t.attachmentList.length === 1), b = i(() => s.value ? t.attachmentList.length > 0 && s.value && s.value?.nameKey ? t.attachmentList[0][s.value.nameKey] : "" : t.attachmentList.length > 0 ? t.attachmentList[0].fileName : ""), S = i(() => p.value ? b.value : c("ap.apAttachment.downloadall")), k = i(() => ({
|
|
38
38
|
"--download-main-color": x.value?.colorLink,
|
|
39
39
|
"--download-main-color-opacity": Y(x.value?.colorLink, 0.6)
|
|
40
40
|
})), U = i(() => t.getOssAccess || d.value?.getOssAccess), V = i(() => {
|
|
@@ -46,27 +46,27 @@ const Ne = /* @__PURE__ */ j({
|
|
|
46
46
|
}) : null;
|
|
47
47
|
}), v = g(!1), h = q(async (a, n) => {
|
|
48
48
|
if (!t.disabled) {
|
|
49
|
-
|
|
49
|
+
r.value = !0, n && (u.value = n);
|
|
50
50
|
try {
|
|
51
51
|
const o = E(w(a)) ? w(a) : [w(a)];
|
|
52
52
|
if (F.value?.trigger) {
|
|
53
|
-
const
|
|
53
|
+
const m = L(s.value, o).map((O) => ({
|
|
54
54
|
objectName: O.path,
|
|
55
55
|
fileName: O.fileName
|
|
56
56
|
}));
|
|
57
|
-
F.value?.trigger(
|
|
57
|
+
F.value?.trigger(m), y("downloadCallback", m);
|
|
58
58
|
} else {
|
|
59
|
-
const
|
|
60
|
-
y("downloadCallback",
|
|
59
|
+
const m = await (await X(U.value, B(K))).downloadFile(L(s.value, o));
|
|
60
|
+
y("downloadCallback", m);
|
|
61
61
|
}
|
|
62
62
|
} catch (o) {
|
|
63
63
|
Q(!1, o);
|
|
64
64
|
} finally {
|
|
65
|
-
|
|
65
|
+
r.value = !1, u.value = "";
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}, 500), z = (a) => {
|
|
69
|
-
const n = L(
|
|
69
|
+
const n = L(s.value, a)?.[0];
|
|
70
70
|
Z.createFilePreviewModal({
|
|
71
71
|
src: n.path,
|
|
72
72
|
fileName: n.fileName
|
|
@@ -77,7 +77,7 @@ const Ne = /* @__PURE__ */ j({
|
|
|
77
77
|
}, [a.map((n, o) => e("li", {
|
|
78
78
|
key: o,
|
|
79
79
|
class: [l("file-item")]
|
|
80
|
-
}, [
|
|
80
|
+
}, [r.value && u.value === o + 1 ? e("span", {
|
|
81
81
|
class: [l("spin")]
|
|
82
82
|
}, [e(N, {
|
|
83
83
|
spin: !0
|
|
@@ -98,7 +98,7 @@ const Ne = /* @__PURE__ */ j({
|
|
|
98
98
|
})])), e("li", {
|
|
99
99
|
class: [l("download-all")],
|
|
100
100
|
onClick: () => h(t.attachmentList, "all")
|
|
101
|
-
}, [
|
|
101
|
+
}, [r.value && u.value === "all" ? e("span", {
|
|
102
102
|
class: [l("spin")]
|
|
103
103
|
}, [e(N, {
|
|
104
104
|
spin: !0
|
|
@@ -114,7 +114,7 @@ const Ne = /* @__PURE__ */ j({
|
|
|
114
114
|
default: () => [e("div", {
|
|
115
115
|
class: [l("content")],
|
|
116
116
|
onClick: () => h(p.value ? t.attachmentList[0] : t.attachmentList, "global")
|
|
117
|
-
}, [
|
|
117
|
+
}, [r.value && u.value === "global" ? e("div", {
|
|
118
118
|
class: [l("spin")]
|
|
119
119
|
}, [e(N, {
|
|
120
120
|
spin: !0
|
|
@@ -19,6 +19,7 @@ declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, Comp
|
|
|
19
19
|
size: "small" | "large" | "middle";
|
|
20
20
|
type: ButtonType;
|
|
21
21
|
disabled: boolean;
|
|
22
|
+
preview: boolean;
|
|
22
23
|
needName: ApDownLoadNeedNameModel;
|
|
23
24
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
24
25
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { LoadingOutlined as
|
|
3
|
-
import { Button as
|
|
4
|
-
import {
|
|
1
|
+
import { defineComponent as I, ref as P, useSlots as T, computed as l, unref as t, createBlock as j, openBlock as n, mergeProps as V, withCtx as s, createElementVNode as C, normalizeClass as D, createElementBlock as p, createCommentVNode as m, createVNode as r, renderSlot as M, createSlots as U, toDisplayString as b, createTextVNode as E, withModifiers as G } from "vue";
|
|
2
|
+
import { LoadingOutlined as R } from "@ant-design/icons-vue";
|
|
3
|
+
import { Button as W, Tooltip as k } from "@aplus-frontend/antdv";
|
|
4
|
+
import { IconApAdLineDownload as $ } from "@aplus-frontend/icon";
|
|
5
|
+
import { isArray as q, omit as H } from "lodash-unified";
|
|
5
6
|
import "../../config-provider/index.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
7
|
+
import { ApFilePreview as J } from "../ap-file-preview/index.mjs";
|
|
8
|
+
import { useOssInit as K } from "./hooks/index.mjs";
|
|
9
|
+
import { useStyle as Q } from "./hooks/useStyle.mjs";
|
|
10
|
+
import { getFileInfo as f } from "./utils/getFileInfo.mjs";
|
|
11
|
+
import { useLocale as X } from "../../config-provider/hooks/use-locale.mjs";
|
|
12
|
+
import { useGlobalConfig as h } from "../../config-provider/hooks/use-global-config.mjs";
|
|
13
|
+
const Y = {
|
|
12
14
|
key: 0,
|
|
13
15
|
class: "spin"
|
|
14
|
-
},
|
|
16
|
+
}, Z = {
|
|
15
17
|
key: 1,
|
|
16
18
|
class: "icon"
|
|
17
|
-
},
|
|
19
|
+
}, ee = { class: "text" }, fe = /* @__PURE__ */ I({
|
|
18
20
|
name: "ApDownload",
|
|
19
21
|
__name: "ap-download",
|
|
20
22
|
props: {
|
|
@@ -41,61 +43,100 @@ const M = {
|
|
|
41
43
|
text: {},
|
|
42
44
|
fileName: {},
|
|
43
45
|
needName: { type: [Boolean, Object], default: void 0 },
|
|
44
|
-
getOssAccess: {}
|
|
46
|
+
getOssAccess: {},
|
|
47
|
+
preview: { type: Boolean, default: !1 }
|
|
45
48
|
},
|
|
46
49
|
emits: ["downloadCallback"],
|
|
47
|
-
setup(
|
|
48
|
-
const
|
|
50
|
+
setup(_, { emit: A }) {
|
|
51
|
+
const u = A, c = P(!1), { lang: B, t: g } = X(), O = T(), z = l(() => B.value === "zh-cn" ? "zh_CN" : "en_US"), e = _, i = h("apUpload"), v = h(
|
|
49
52
|
"downloadCenterTriggerConfig"
|
|
50
|
-
),
|
|
53
|
+
), w = l(() => e.disabled), x = l(() => e.size), d = l(
|
|
54
|
+
() => e.preview && (q(e.fileName) ? e.fileName.length === 1 : !0)
|
|
55
|
+
), { getInnerWrapperClass: F } = Q(x, w), L = l(() => e.getOssAccess || i.value?.getOssAccess), S = () => {
|
|
56
|
+
const o = f(
|
|
57
|
+
e.needName ?? i?.value?.needName,
|
|
58
|
+
e.fileName
|
|
59
|
+
)?.[0];
|
|
60
|
+
J.createFilePreviewModal({
|
|
61
|
+
src: o.path,
|
|
62
|
+
fileName: o.fileName
|
|
63
|
+
});
|
|
64
|
+
}, N = async () => {
|
|
51
65
|
if (!e.disabled) {
|
|
52
|
-
|
|
66
|
+
c.value = !0;
|
|
53
67
|
try {
|
|
54
|
-
if (
|
|
55
|
-
let a =
|
|
56
|
-
e.needName ??
|
|
68
|
+
if (v.value?.trigger) {
|
|
69
|
+
let a = f(
|
|
70
|
+
e.needName ?? i?.value?.needName,
|
|
57
71
|
e.fileName
|
|
58
|
-
).map((
|
|
59
|
-
objectName:
|
|
60
|
-
fileName:
|
|
72
|
+
).map((y) => ({
|
|
73
|
+
objectName: y.path,
|
|
74
|
+
fileName: y.fileName
|
|
61
75
|
}));
|
|
62
|
-
await
|
|
76
|
+
await v.value?.trigger(a), u("downloadCallback", a);
|
|
63
77
|
} else {
|
|
64
|
-
const a = await (await
|
|
65
|
-
|
|
66
|
-
t(
|
|
78
|
+
const a = await (await K(
|
|
79
|
+
L.value,
|
|
80
|
+
t(z)
|
|
67
81
|
)).downloadFile(
|
|
68
|
-
|
|
69
|
-
e.needName ??
|
|
82
|
+
f(
|
|
83
|
+
e.needName ?? i?.value?.needName,
|
|
70
84
|
e.fileName
|
|
71
85
|
)
|
|
72
86
|
);
|
|
73
|
-
|
|
87
|
+
u("downloadCallback", a);
|
|
74
88
|
}
|
|
75
89
|
} catch (o) {
|
|
76
90
|
console.error(o);
|
|
77
91
|
} finally {
|
|
78
|
-
|
|
92
|
+
c.value = !1;
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
95
|
};
|
|
82
|
-
return (o, a) => (
|
|
96
|
+
return (o, a) => (n(), j(t(W), V(t(H)(e, ["getOssAccess", "fileName", "needName"]), {
|
|
83
97
|
type: e.type,
|
|
84
98
|
size: e.size,
|
|
85
|
-
disabled:
|
|
86
|
-
onClick:
|
|
99
|
+
disabled: w.value,
|
|
100
|
+
onClick: a[0] || (a[0] = () => (d.value ? S : N)())
|
|
87
101
|
}), {
|
|
88
|
-
default:
|
|
89
|
-
|
|
90
|
-
class:
|
|
102
|
+
default: s(() => [
|
|
103
|
+
C("div", {
|
|
104
|
+
class: D(t(F))
|
|
91
105
|
}, [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
])) :
|
|
95
|
-
t(
|
|
96
|
-
|
|
97
|
-
])) :
|
|
98
|
-
|
|
106
|
+
c.value ? (n(), p("span", Y, [
|
|
107
|
+
r(t(R), { spin: !0 })
|
|
108
|
+
])) : m("", !0),
|
|
109
|
+
t(O).icon ? (n(), p("span", Z, [
|
|
110
|
+
M(o.$slots, "icon")
|
|
111
|
+
])) : m("", !0),
|
|
112
|
+
r(t(k), null, U({
|
|
113
|
+
default: s(() => [
|
|
114
|
+
C("span", ee, b(o.text), 1)
|
|
115
|
+
]),
|
|
116
|
+
_: 2
|
|
117
|
+
}, [
|
|
118
|
+
d.value ? {
|
|
119
|
+
name: "title",
|
|
120
|
+
fn: s(() => [
|
|
121
|
+
E(b(t(g)("ap.apAppendix.previewFile")), 1)
|
|
122
|
+
]),
|
|
123
|
+
key: "0"
|
|
124
|
+
} : void 0
|
|
125
|
+
]), 1024),
|
|
126
|
+
d.value ? (n(), p("span", {
|
|
127
|
+
key: 2,
|
|
128
|
+
class: "preview-icon",
|
|
129
|
+
onClick: G(N, ["stop"])
|
|
130
|
+
}, [
|
|
131
|
+
r(t(k), {
|
|
132
|
+
title: t(g)("ap.apAppendix.downloadFile")
|
|
133
|
+
}, {
|
|
134
|
+
default: s(() => [
|
|
135
|
+
r(t($))
|
|
136
|
+
]),
|
|
137
|
+
_: 1
|
|
138
|
+
}, 8, ["title"])
|
|
139
|
+
])) : m("", !0)
|
|
99
140
|
], 2)
|
|
100
141
|
]),
|
|
101
142
|
_: 3
|
|
@@ -103,5 +144,5 @@ const M = {
|
|
|
103
144
|
}
|
|
104
145
|
});
|
|
105
146
|
export {
|
|
106
|
-
|
|
147
|
+
fe as default
|
|
107
148
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { genComponentStyleHook as l } from "../../../utils/cssinjs/index.mjs";
|
|
2
2
|
const r = (o) => {
|
|
3
|
-
const { componentCls: e, textColor3:
|
|
3
|
+
const { componentCls: e, textColor3: i } = o, n = `${e}-inner-wrapper`;
|
|
4
4
|
return {
|
|
5
5
|
[e]: {
|
|
6
6
|
"&-wrapper": {
|
|
@@ -8,7 +8,7 @@ const r = (o) => {
|
|
|
8
8
|
display: "inline-block"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
|
-
[
|
|
11
|
+
[n]: {
|
|
12
12
|
display: "flex",
|
|
13
13
|
color: "var(--download-main-color)",
|
|
14
14
|
cursor: "pointer",
|
|
@@ -24,6 +24,10 @@ const r = (o) => {
|
|
|
24
24
|
".text": {
|
|
25
25
|
color: "var(--download-main-color)"
|
|
26
26
|
},
|
|
27
|
+
".preview-icon": {
|
|
28
|
+
fontSize: o.fontSizeXL,
|
|
29
|
+
marginLeft: o.space
|
|
30
|
+
},
|
|
27
31
|
"&:hover": {
|
|
28
32
|
color: "var(--download-main-color-opacity)"
|
|
29
33
|
},
|
|
@@ -40,10 +44,10 @@ const r = (o) => {
|
|
|
40
44
|
fontSize: o.fontSizeSM
|
|
41
45
|
},
|
|
42
46
|
"&--disabled": {
|
|
43
|
-
color:
|
|
47
|
+
color: i,
|
|
44
48
|
cursor: "not-allowed",
|
|
45
49
|
"&:hover": {
|
|
46
|
-
color:
|
|
50
|
+
color: i
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as E, ref as w, computed as
|
|
1
|
+
import { defineComponent as E, ref as w, computed as c, watch as L, createElementBlock as m, openBlock as r, normalizeClass as C, unref as l, createBlock as i, Fragment as p, createCommentVNode as x, resolveDynamicComponent as B, h as R } from "vue";
|
|
2
2
|
import { Spin as W } from "@aplus-frontend/antdv";
|
|
3
3
|
import { createOssInstance as I } from "@aplus-frontend/oss";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
@@ -19,29 +19,29 @@ const ee = /* @__PURE__ */ E({
|
|
|
19
19
|
getOssAccess: { type: Function }
|
|
20
20
|
},
|
|
21
21
|
setup(k) {
|
|
22
|
-
const e = k, P = _("apUpload"), N = _("apFilePreview"), { b: f } = D("ap-file-preview"), O = $("ap-file-preview"), { lang:
|
|
22
|
+
const e = k, P = _("apUpload"), N = _("apFilePreview"), { b: f } = D("ap-file-preview"), O = $("ap-file-preview"), { lang: S } = G(), U = {
|
|
23
23
|
"zh-cn": "zh_CN",
|
|
24
24
|
en: "en_US"
|
|
25
|
-
},
|
|
25
|
+
}, t = w(), o = w(!1), v = c(
|
|
26
26
|
() => e.getOssAccess || P.value?.getOssAccess
|
|
27
|
-
), s =
|
|
27
|
+
), s = c(() => e?.format ?? e?.src?.split(".").pop()), A = c(() => [
|
|
28
28
|
...j,
|
|
29
29
|
...N.value?.parserPlugin ?? [],
|
|
30
30
|
...e?.parserPlugin ?? []
|
|
31
|
-
]), g =
|
|
31
|
+
]), g = c(() => s.value ? A.value?.findLast(
|
|
32
32
|
(a) => s.value && a.format.includes(s.value)
|
|
33
33
|
) : void 0), F = async () => {
|
|
34
34
|
try {
|
|
35
|
-
if (o.value = !0,
|
|
35
|
+
if (o.value = !0, t.value = void 0, !e?.src)
|
|
36
36
|
return;
|
|
37
37
|
if (e.src?.startsWith("http") || e.src?.startsWith("data:") || e.src?.startsWith("blob:")) {
|
|
38
|
-
|
|
38
|
+
t.value = e.src;
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
const a = e.src?.match(/^([^:]+):(.*)$/), u = a?.[1], h = a?.[2] ?? e.src, d = I();
|
|
42
42
|
await d.initOssClient({
|
|
43
43
|
getOssAccess: () => u ? v.value?.(u) : v.value?.(),
|
|
44
|
-
locale: S
|
|
44
|
+
locale: U[S.value] ?? "zh_CN",
|
|
45
45
|
onFailure: (n) => {
|
|
46
46
|
throw new Error(
|
|
47
47
|
typeof n?.message == "string" ? n.message : "oss create error"
|
|
@@ -55,7 +55,7 @@ const ee = /* @__PURE__ */ E({
|
|
|
55
55
|
);
|
|
56
56
|
if (y) {
|
|
57
57
|
const n = await fetch(y).then((z) => z.blob());
|
|
58
|
-
|
|
58
|
+
t.value = URL.createObjectURL(n);
|
|
59
59
|
} else
|
|
60
60
|
throw new Error("oss getSignatureUrl error");
|
|
61
61
|
} finally {
|
|
@@ -70,28 +70,29 @@ const ee = /* @__PURE__ */ E({
|
|
|
70
70
|
{
|
|
71
71
|
immediate: !0
|
|
72
72
|
}
|
|
73
|
-
), (a, u) => (
|
|
74
|
-
class: C([
|
|
73
|
+
), (a, u) => (r(), m("div", {
|
|
74
|
+
class: C([l(f)(), l(O)])
|
|
75
75
|
}, [
|
|
76
|
-
o.value ? (
|
|
76
|
+
o.value ? (r(), i(l(W), {
|
|
77
77
|
key: 0,
|
|
78
|
-
class: C([
|
|
79
|
-
}, null, 8, ["class"])) : !o.value &&
|
|
80
|
-
g.value && s.value ? (
|
|
81
|
-
|
|
78
|
+
class: C([l(f)("spin")])
|
|
79
|
+
}, null, 8, ["class"])) : !o.value && t.value && e.src ? (r(), m(p, { key: 1 }, [
|
|
80
|
+
g.value && s.value ? (r(), m(p, { key: 0 }, [
|
|
81
|
+
t.value ? (r(), i(B(
|
|
82
82
|
R(p, [
|
|
83
83
|
g.value?.parser?.({
|
|
84
|
-
src:
|
|
84
|
+
src: t.value,
|
|
85
|
+
originalSrc: e.src,
|
|
85
86
|
format: s.value,
|
|
86
87
|
fileName: e.fileName
|
|
87
88
|
})
|
|
88
89
|
])
|
|
89
90
|
), { key: 0 })) : x("", !0)
|
|
90
|
-
], 64)) : (
|
|
91
|
+
], 64)) : (r(), i(b, {
|
|
91
92
|
key: 1,
|
|
92
93
|
type: "notPreview"
|
|
93
94
|
}))
|
|
94
|
-
], 64)) : (
|
|
95
|
+
], 64)) : (r(), i(b, {
|
|
95
96
|
key: 2,
|
|
96
97
|
type: "notExist"
|
|
97
98
|
}))
|
|
@@ -9,12 +9,14 @@ export type ApFilePreviewParser = {
|
|
|
9
9
|
/**
|
|
10
10
|
* 文件解析
|
|
11
11
|
* @param option.src 文件地址
|
|
12
|
+
* @param option.originalSrc 原始文件地址
|
|
12
13
|
* @param option.format 文件格式
|
|
13
14
|
* @param option.fileName 文件名
|
|
14
15
|
* @returns
|
|
15
16
|
*/
|
|
16
17
|
parser: (option: {
|
|
17
18
|
src: string;
|
|
19
|
+
originalSrc: string;
|
|
18
20
|
format: string;
|
|
19
21
|
fileName?: string;
|
|
20
22
|
}) => VNodeChild;
|
|
@@ -36,7 +36,8 @@ const De = /* @__PURE__ */ U({
|
|
|
36
36
|
type: Boolean,
|
|
37
37
|
default: !1
|
|
38
38
|
},
|
|
39
|
-
emptyData: {}
|
|
39
|
+
emptyData: {},
|
|
40
|
+
extraParams: {}
|
|
40
41
|
},
|
|
41
42
|
setup(I, {
|
|
42
43
|
expose: N
|
|
@@ -49,15 +50,15 @@ const De = /* @__PURE__ */ U({
|
|
|
49
50
|
viewKey: c,
|
|
50
51
|
viewName: O("ap.apView.systemView")
|
|
51
52
|
})), {
|
|
52
|
-
getSearchFormValues:
|
|
53
|
-
setSearchFormValues:
|
|
53
|
+
getSearchFormValues: x,
|
|
54
|
+
setSearchFormValues: L,
|
|
54
55
|
submit: B,
|
|
55
|
-
reset:
|
|
56
|
-
submitWith:
|
|
57
|
-
getSearchFormSorterItems:
|
|
58
|
-
setSearchFormSorterItems:
|
|
56
|
+
reset: P,
|
|
57
|
+
submitWith: E,
|
|
58
|
+
getSearchFormSorterItems: k,
|
|
59
|
+
setSearchFormSorterItems: A,
|
|
59
60
|
resetSearchFormSorterItems: T
|
|
60
|
-
} = X(), W = y(!1), S = y(!1),
|
|
61
|
+
} = X(), W = y(!1), S = y(!1), p = y("");
|
|
61
62
|
let f = !1, g = !1;
|
|
62
63
|
const j = {
|
|
63
64
|
dropdownType: "dropdown",
|
|
@@ -70,26 +71,28 @@ const De = /* @__PURE__ */ U({
|
|
|
70
71
|
view: t
|
|
71
72
|
}, null)
|
|
72
73
|
}))), r = {
|
|
73
|
-
getSearchFormValues:
|
|
74
|
-
setSearchFormValues:
|
|
74
|
+
getSearchFormValues: x,
|
|
75
|
+
setSearchFormValues: L,
|
|
75
76
|
submit: B,
|
|
76
|
-
reset:
|
|
77
|
-
submitWith:
|
|
78
|
-
getSearchFormSorterItems:
|
|
79
|
-
setSearchFormSorterItems:
|
|
77
|
+
reset: P,
|
|
78
|
+
submitWith: E,
|
|
79
|
+
getSearchFormSorterItems: k,
|
|
80
|
+
setSearchFormSorterItems: A,
|
|
80
81
|
resetSearchFormSorterItems: T,
|
|
81
82
|
...s.saveDataSource
|
|
82
|
-
},
|
|
83
|
+
}, v = {
|
|
83
84
|
..._.value,
|
|
84
85
|
...s.viewCacheOption
|
|
85
|
-
}, D = () => s.isDefaultSystemView ? c : (s.isFirstDefaultSystemView || g) && f ? c : i.value.find((a) => a.isDefault)?.viewKey ?? c,
|
|
86
|
-
|
|
87
|
-
const a = i.value.find((e) => e.viewKey ===
|
|
86
|
+
}, D = () => s.isDefaultSystemView ? c : (s.isFirstDefaultSystemView || g) && f ? c : i.value.find((a) => a.isDefault)?.viewKey ?? c, m = (t) => {
|
|
87
|
+
p.value = t;
|
|
88
|
+
const a = i.value.find((e) => e.viewKey === p.value);
|
|
88
89
|
a && setTimeout(() => {
|
|
89
90
|
a.viewKey === c ? f ? s.manual || r?.submitWith?.() : s.manual || (r?.resetSearchFormSorterItems?.(), r?.reset?.()) : (r?.setSearchFormValues?.({
|
|
90
91
|
...Object.fromEntries(Object.keys(r?.getSearchFormValues?.() ?? {}).map((e) => [e, void 0])) ?? {},
|
|
91
92
|
...s?.emptyData ?? {},
|
|
92
|
-
...r?.getSearchFormSorterItems?.()
|
|
93
|
+
...[...r?.getSearchFormSorterItems?.() ?? [], ...s?.extraParams?.map((e) => ({
|
|
94
|
+
name: e
|
|
95
|
+
})) ?? []].reduce((e, o) => (a.viewConfig?.searchForm?.[o.name] && (e[o.name] = a.viewConfig?.searchForm?.[o.name]), e), {}) ?? {}
|
|
93
96
|
}), r?.setSearchFormSorterItems?.(a.viewConfig?.sorterItems ?? []), f ? s.manual || r?.submitWith?.() : r?.submit?.()), f = !1;
|
|
94
97
|
});
|
|
95
98
|
}, C = {
|
|
@@ -97,12 +100,12 @@ const De = /* @__PURE__ */ U({
|
|
|
97
100
|
try {
|
|
98
101
|
const {
|
|
99
102
|
tableKey: a
|
|
100
|
-
} = t, e = await
|
|
103
|
+
} = t, e = await v?.getViewList?.({
|
|
101
104
|
tableKey: a
|
|
102
105
|
});
|
|
103
|
-
return i.value = [V.value, ...e ?? []],
|
|
106
|
+
return i.value = [V.value, ...e ?? []], m(D()), i.value;
|
|
104
107
|
} catch {
|
|
105
|
-
return i.value = [V.value],
|
|
108
|
+
return i.value = [V.value], m(c), i.value;
|
|
106
109
|
}
|
|
107
110
|
},
|
|
108
111
|
addView: async (t) => {
|
|
@@ -113,21 +116,21 @@ const De = /* @__PURE__ */ U({
|
|
|
113
116
|
isDefault: n,
|
|
114
117
|
viewConfig: w
|
|
115
118
|
} = t;
|
|
116
|
-
await
|
|
119
|
+
await v?.addView?.({
|
|
117
120
|
tableKey: a,
|
|
118
121
|
viewKey: e,
|
|
119
122
|
viewName: o,
|
|
120
123
|
isDefault: n,
|
|
121
124
|
viewConfig: w
|
|
122
|
-
}), n && (i.value = i.value.map((
|
|
123
|
-
...
|
|
125
|
+
}), n && (i.value = i.value.map((l) => ({
|
|
126
|
+
...l,
|
|
124
127
|
isDefault: !1
|
|
125
128
|
}))), i.value = [...i.value, {
|
|
126
129
|
viewKey: e,
|
|
127
130
|
viewName: o,
|
|
128
131
|
isDefault: n,
|
|
129
132
|
viewConfig: w
|
|
130
|
-
}],
|
|
133
|
+
}], m(e);
|
|
131
134
|
},
|
|
132
135
|
changeView: async (t) => {
|
|
133
136
|
const {
|
|
@@ -137,7 +140,7 @@ const De = /* @__PURE__ */ U({
|
|
|
137
140
|
isDefault: n,
|
|
138
141
|
viewConfig: w
|
|
139
142
|
} = t;
|
|
140
|
-
await
|
|
143
|
+
await v?.changeView?.({
|
|
141
144
|
tableKey: a,
|
|
142
145
|
viewKey: e,
|
|
143
146
|
viewName: o,
|
|
@@ -147,23 +150,23 @@ const De = /* @__PURE__ */ U({
|
|
|
147
150
|
...h,
|
|
148
151
|
isDefault: !1
|
|
149
152
|
})));
|
|
150
|
-
const
|
|
151
|
-
|
|
153
|
+
const l = i.value.find((h) => h.viewKey === e);
|
|
154
|
+
l && (l.viewName = o, l.isDefault = n, l.viewConfig = w), m(e);
|
|
152
155
|
},
|
|
153
156
|
removeView: async (t) => {
|
|
154
157
|
const {
|
|
155
158
|
tableKey: a,
|
|
156
159
|
viewKey: e
|
|
157
160
|
} = t;
|
|
158
|
-
await
|
|
161
|
+
await v?.removeView?.({
|
|
159
162
|
tableKey: a,
|
|
160
163
|
viewKey: e
|
|
161
|
-
}), i.value = i.value.filter((o) => o.viewKey !== e), e ===
|
|
164
|
+
}), i.value = i.value.filter((o) => o.viewKey !== e), e === p.value && m(D());
|
|
162
165
|
}
|
|
163
166
|
}, $ = {
|
|
164
167
|
tableKey: s.tableKey,
|
|
165
|
-
currentViewKey:
|
|
166
|
-
changeCurrentViewKey:
|
|
168
|
+
currentViewKey: p,
|
|
169
|
+
changeCurrentViewKey: m,
|
|
167
170
|
popoverOpen: W,
|
|
168
171
|
menuOpen: S,
|
|
169
172
|
viewList: i,
|
|
@@ -86,6 +86,10 @@ export interface ApViewProps {
|
|
|
86
86
|
* 表单项为空时的状态数据,适用于为空时其值不为undefined的情况
|
|
87
87
|
*/
|
|
88
88
|
emptyData?: Recordable;
|
|
89
|
+
/**
|
|
90
|
+
* 视图额外需要被设置的参数Key
|
|
91
|
+
*/
|
|
92
|
+
extraParams?: string[];
|
|
89
93
|
}
|
|
90
94
|
export interface ApViewExpose {
|
|
91
95
|
setFirstDefaultSystemView: (value: boolean) => void;
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.11.
|
|
1
|
+
declare const _default: "7.11.2";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("@ant-design/icons-vue"),d=require("@aplus-frontend/antdv"),_=require("@aplus-frontend/icon"),q=require("lodash-unified"),M=require("../../config-provider/hooks/use-token.js"),R=require("../../utils/warning.js");require("../../config-provider/index.js");const j=require("../ap-download/hooks/index.js"),m=require("../ap-download/utils/getFileInfo.js"),z=require("../ap-file-preview/index.js"),G=require("./constans.js"),W=require("./style/index.js"),$=require("../../config-provider/hooks/use-namespace.js"),b=require("../../config-provider/hooks/use-global-config.js"),B=require("../../config-provider/hooks/use-locale.js"),D=e.defineComponent({name:"ApAttachment",props:G.ApAttachmentProps(),setup(t,{emit:w}){const{b:x,e:l}=$.useNamespace("ap-attachment"),V=W.default("ap-attachment"),f=b.useGlobalConfig("apUpload"),L=b.useGlobalConfig("downloadCenterTriggerConfig"),{token:A}=M.useToken(),{lang:T,t:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("@ant-design/icons-vue"),d=require("@aplus-frontend/antdv"),_=require("@aplus-frontend/icon"),q=require("lodash-unified"),M=require("../../config-provider/hooks/use-token.js"),R=require("../../utils/warning.js");require("../../config-provider/index.js");const j=require("../ap-download/hooks/index.js"),m=require("../ap-download/utils/getFileInfo.js"),z=require("../ap-file-preview/index.js"),G=require("./constans.js"),W=require("./style/index.js"),$=require("../../config-provider/hooks/use-namespace.js"),b=require("../../config-provider/hooks/use-global-config.js"),B=require("../../config-provider/hooks/use-locale.js"),D=e.defineComponent({name:"ApAttachment",props:G.ApAttachmentProps(),setup(t,{emit:w}){const{b:x,e:l}=$.useNamespace("ap-attachment"),V=W.default("ap-attachment"),f=b.useGlobalConfig("apUpload"),L=b.useGlobalConfig("downloadCenterTriggerConfig"),{token:A}=M.useToken(),{lang:T,t:i}=B.useLocale(),s=e.ref(!1),u=e.ref(""),v=e.useSlots(),O=e.computed(()=>T.value==="zh-cn"?"zh_CN":"en_US"),c=e.computed(()=>t.needName??(f?.value?.needName===!0?{nameKey:"fileName",pathKey:"path"}:f?.value?.needName??{nameKey:"fileName",pathKey:"filePath"})),p=e.computed(()=>t.attachmentList.length===1),C=e.computed(()=>c.value?t.attachmentList.length>0&&c.value&&c.value?.nameKey?t.attachmentList[0][c.value.nameKey]:"":t.attachmentList.length>0?t.attachmentList[0].fileName:""),k=e.computed(()=>p.value?C.value:i("ap.apAttachment.downloadall")),y=e.computed(()=>({"--download-main-color":A.value?.colorLink,"--download-main-color-opacity":m.getHexWithOpacity(A.value?.colorLink,.6)})),I=e.computed(()=>t.getOssAccess||f.value?.getOssAccess),P=e.computed(()=>{const a=v.default?v.default()[0]:null;return a?e.cloneVNode(a,{style:{"font-size":"16px"}}):null}),g=e.ref(!1),N=q.debounce(async(a,n)=>{if(!t.disabled){s.value=!0,n&&(u.value=n);try{const o=q.isArray(e.toRaw(a))?e.toRaw(a):[e.toRaw(a)];if(L.value?.trigger){const r=m.getFileInfo(c.value,o).map(F=>({objectName:F.path,fileName:F.fileName}));L.value?.trigger(r),w("downloadCallback",r)}else{const r=await(await j.useOssInit(I.value,e.unref(O))).downloadFile(m.getFileInfo(c.value,o));w("downloadCallback",r)}}catch(o){R.warning(!1,o)}finally{s.value=!1,u.value=""}}},500),K=a=>{const n=m.getFileInfo(c.value,a)?.[0];z.ApFilePreview.createFilePreviewModal({src:n.path,fileName:n.fileName}),g.value=!1},S=a=>a&&a.length>0?e.createVNode("ul",{class:[l("file-list"),V.value],style:y.value},[a.map((n,o)=>e.createVNode("li",{key:o,class:[l("file-item")]},[s.value&&u.value===o+1?e.createVNode("span",{class:[l("spin")]},[e.createVNode(h.LoadingOutlined,{spin:!0},null)]):null,e.createVNode(d.Tooltip,{title:i("ap.apAppendix.previewFile")},{default:()=>[e.createVNode("span",{class:[l("file-item-text")],onClick:()=>K(n)},[n.fileName])]}),e.createVNode(d.Tooltip,{title:i("ap.apAppendix.downloadFile")},{default:()=>[e.createVNode("span",{class:[l("file-item-download")],onClick:()=>N(n,o+1)},[e.createVNode(_.IconApAdLineDownload,null,null)])]})])),e.createVNode("li",{class:[l("download-all")],onClick:()=>N(t.attachmentList,"all")},[s.value&&u.value==="all"?e.createVNode("span",{class:[l("spin")]},[e.createVNode(h.LoadingOutlined,{spin:!0},null)]):null,i("ap.apAttachment.downloadall")])]):null;return()=>t.attachmentList?.length>0&&e.createVNode("div",{class:[x(),V.value],style:[y.value]},[e.createVNode(d.Tooltip,{title:k.value,placement:t.textToolTipPlacement,color:t.toolTipBgColor},{default:()=>[e.createVNode("div",{class:[l("content")],onClick:()=>N(p.value?t.attachmentList[0]:t.attachmentList,"global")},[s.value&&u.value==="global"?e.createVNode("div",{class:[l("spin")]},[e.createVNode(h.LoadingOutlined,{spin:!0},null)]):null,v.default?e.createVNode("div",{class:[l("text-render")]},[P.value,e.createTextVNode(" ")]):null,e.createVNode("div",{class:[l("text-inner")],style:{"max-width":t.maxWidth?t.maxWidth+"px":"auto"}},[C.value])])]}),e.createVNode(d.Popover,{content:S(t.attachmentList),placement:t.fileMorePopoverPlacement,color:"#fff",open:g.value,"onUpdate:open":a=>g.value=a},{default:()=>[!p.value&&e.createVNode("div",{class:[l("more")]},[i("ap.apAttachment.more")])]})])}});exports.default=D;
|
|
@@ -19,6 +19,7 @@ declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, Comp
|
|
|
19
19
|
size: "small" | "large" | "middle";
|
|
20
20
|
type: ButtonType;
|
|
21
21
|
disabled: boolean;
|
|
22
|
+
preview: boolean;
|
|
22
23
|
needName: ApDownLoadNeedNameModel;
|
|
23
24
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
24
25
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),q=require("@ant-design/icons-vue"),s=require("@aplus-frontend/antdv"),x=require("@aplus-frontend/icon"),g=require("lodash-unified");require("../../config-provider/index.js");const A=require("../ap-file-preview/index.js"),O=require("./hooks/index.js"),S=require("./hooks/useStyle.js"),r=require("./utils/getFileInfo.js"),F=require("../../config-provider/hooks/use-locale.js"),v=require("../../config-provider/hooks/use-global-config.js"),I={key:0,class:"spin"},V={key:1,class:"icon"},z={class:"text"},L=e.defineComponent({name:"ApDownload",__name:"ap-download",props:{prefixCls:{},type:{default:"link"},htmlType:{},shape:{},size:{default:"middle"},loading:{type:[Boolean,Object]},disabled:{type:Boolean,default:!1},ghost:{type:Boolean},block:{type:Boolean},danger:{type:Boolean},icon:{},href:{},target:{},title:{},onClick:{},onMousedown:{},autoInsertSpace:{type:Boolean},iconPosition:{},color:{},variant:{},text:{},fileName:{},needName:{type:[Boolean,Object],default:void 0},getOssAccess:{},preview:{type:Boolean,default:!1}},emits:["downloadCallback"],setup(N,{emit:w}){const c=w,a=e.ref(!1),{lang:C,t:d}=F.useLocale(),y=e.useSlots(),k=e.computed(()=>C.value==="zh-cn"?"zh_CN":"en_US"),t=N,l=v.useGlobalConfig("apUpload"),u=v.useGlobalConfig("downloadCenterTriggerConfig"),p=e.computed(()=>t.disabled),b=e.computed(()=>t.size),i=e.computed(()=>t.preview&&(g.isArray(t.fileName)?t.fileName.length===1:!0)),{getInnerWrapperClass:h}=S.useStyle(b,p),B=e.computed(()=>t.getOssAccess||l.value?.getOssAccess),_=()=>{const o=r.getFileInfo(t.needName??l?.value?.needName,t.fileName)?.[0];A.ApFilePreview.createFilePreviewModal({src:o.path,fileName:o.fileName})},f=async()=>{if(!t.disabled){a.value=!0;try{if(u.value?.trigger){let n=r.getFileInfo(t.needName??l?.value?.needName,t.fileName).map(m=>({objectName:m.path,fileName:m.fileName}));await u.value?.trigger(n),c("downloadCallback",n)}else{const n=await(await O.useOssInit(B.value,e.unref(k))).downloadFile(r.getFileInfo(t.needName??l?.value?.needName,t.fileName));c("downloadCallback",n)}}catch(o){console.error(o)}finally{a.value=!1}}};return(o,n)=>(e.openBlock(),e.createBlock(e.unref(s.Button),e.mergeProps(e.unref(g.omit)(t,["getOssAccess","fileName","needName"]),{type:t.type,size:t.size,disabled:p.value,onClick:n[0]||(n[0]=()=>(i.value?_:f)())}),{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(h))},[a.value?(e.openBlock(),e.createElementBlock("span",I,[e.createVNode(e.unref(q.LoadingOutlined),{spin:!0})])):e.createCommentVNode("",!0),e.unref(y).icon?(e.openBlock(),e.createElementBlock("span",V,[e.renderSlot(o.$slots,"icon")])):e.createCommentVNode("",!0),e.createVNode(e.unref(s.Tooltip),null,e.createSlots({default:e.withCtx(()=>[e.createElementVNode("span",z,e.toDisplayString(o.text),1)]),_:2},[i.value?{name:"title",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(d)("ap.apAppendix.previewFile")),1)]),key:"0"}:void 0]),1024),i.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"preview-icon",onClick:e.withModifiers(f,["stop"])},[e.createVNode(e.unref(s.Tooltip),{title:e.unref(d)("ap.apAppendix.downloadFile")},{default:e.withCtx(()=>[e.createVNode(e.unref(x.IconApAdLineDownload))]),_:1},8,["title"])])):e.createCommentVNode("",!0)],2)]),_:3},16,["type","size","disabled"]))}});exports.default=L;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("../../../utils/cssinjs/index.js"),r=e=>{const{componentCls:o,textColor3:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("../../../utils/cssinjs/index.js"),r=e=>{const{componentCls:o,textColor3:i}=e,n=`${o}-inner-wrapper`;return{[o]:{"&-wrapper":{textWrap:"nowrap",display:"inline-block"}},[n]:{display:"flex",color:"var(--download-main-color)",cursor:"pointer",alignItems:"center",".spin":{marginInlineEnd:e.spaceXS},".icon":{position:"relative",fontSize:e.fontSizeXL,marginInlineEnd:e.spaceXS},".text":{color:"var(--download-main-color)"},".preview-icon":{fontSize:e.fontSizeXL,marginLeft:e.space},"&:hover":{color:"var(--download-main-color-opacity)"},"&--large":{lineHeight:e.lineHeightLG,fontSize:e.fontSizeLG},"&--middle":{lineHeight:e.lineHeight,fontSize:e.fontSize},"&--small":{lineHeight:e.lineHeightSM,fontSize:e.fontSizeSM},"&--disabled":{color:i,cursor:"not-allowed","&:hover":{color:i}}}}},t=l.genComponentStyleHook("ApDownload",e=>[r(e)]);exports.default=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),P=require("@aplus-frontend/antdv"),q=require("@aplus-frontend/oss");require("../../config-provider/index.js");require("./components/error-result/index.vue.js");const N=require("./style/index.js"),O=require("./utils/default-parser-plugin.js"),v=require("../../config-provider/hooks/use-global-config.js"),S=require("../../config-provider/hooks/use-namespace.js"),U=require("../../config-provider/hooks/use-locale.js"),g=require("./components/error-result/index.vue2.js"),F=e.defineComponent({__name:"ap-file-preview",props:{src:{},fileName:{},format:{},parserPlugin:{},getOssAccess:{type:Function}},setup(d){const t=d,k=v.useGlobalConfig("apUpload"),h=v.useGlobalConfig("apFilePreview"),{b:l}=S.useNamespace("ap-file-preview"),_=N.default("ap-file-preview"),{lang:C}=U.useLocale(),y={"zh-cn":"zh_CN",en:"en_US"},r=e.ref(),o=e.ref(!1),u=e.computed(()=>t.getOssAccess||k.value?.getOssAccess),s=e.computed(()=>t?.format??t?.src?.split(".").pop()),b=e.computed(()=>[...O.defaultParserPlugins,...h.value?.parserPlugin??[],...t?.parserPlugin??[]]),i=e.computed(()=>s.value?b.value?.findLast(a=>s.value&&a.format.includes(s.value)):void 0),w=async()=>{try{if(o.value=!0,r.value=void 0,!t?.src)return;if(t.src?.startsWith("http")||t.src?.startsWith("data:")||t.src?.startsWith("blob:")){r.value=t.src;return}const a=t.src?.match(/^([^:]+):(.*)$/),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),P=require("@aplus-frontend/antdv"),q=require("@aplus-frontend/oss");require("../../config-provider/index.js");require("./components/error-result/index.vue.js");const N=require("./style/index.js"),O=require("./utils/default-parser-plugin.js"),v=require("../../config-provider/hooks/use-global-config.js"),S=require("../../config-provider/hooks/use-namespace.js"),U=require("../../config-provider/hooks/use-locale.js"),g=require("./components/error-result/index.vue2.js"),F=e.defineComponent({__name:"ap-file-preview",props:{src:{},fileName:{},format:{},parserPlugin:{},getOssAccess:{type:Function}},setup(d){const t=d,k=v.useGlobalConfig("apUpload"),h=v.useGlobalConfig("apFilePreview"),{b:l}=S.useNamespace("ap-file-preview"),_=N.default("ap-file-preview"),{lang:C}=U.useLocale(),y={"zh-cn":"zh_CN",en:"en_US"},r=e.ref(),o=e.ref(!1),u=e.computed(()=>t.getOssAccess||k.value?.getOssAccess),s=e.computed(()=>t?.format??t?.src?.split(".").pop()),b=e.computed(()=>[...O.defaultParserPlugins,...h.value?.parserPlugin??[],...t?.parserPlugin??[]]),i=e.computed(()=>s.value?b.value?.findLast(a=>s.value&&a.format.includes(s.value)):void 0),w=async()=>{try{if(o.value=!0,r.value=void 0,!t?.src)return;if(t.src?.startsWith("http")||t.src?.startsWith("data:")||t.src?.startsWith("blob:")){r.value=t.src;return}const a=t.src?.match(/^([^:]+):(.*)$/),n=a?.[1],p=a?.[2]??t.src,f=q.createOssInstance();await f.initOssClient({getOssAccess:()=>n?u.value?.(n):u.value?.(),locale:y[C.value]??"zh_CN",onFailure:c=>{throw new Error(typeof c?.message=="string"?c.message:"oss create error")}});const m=await f.getSignatureUrl(p,3600,t?.fileName??p);if(m){const c=await fetch(m).then(B=>B.blob());r.value=URL.createObjectURL(c)}else throw new Error("oss getSignatureUrl error")}finally{o.value=!1}};return e.watch(()=>[t.src],()=>{w()},{immediate:!0}),(a,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(l)(),e.unref(_)])},[o.value?(e.openBlock(),e.createBlock(e.unref(P.Spin),{key:0,class:e.normalizeClass([e.unref(l)("spin")])},null,8,["class"])):!o.value&&r.value&&t.src?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[i.value&&s.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[r.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.h(e.Fragment,[i.value?.parser?.({src:r.value,originalSrc:t.src,format:s.value,fileName:t.fileName})])),{key:0})):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(g.default,{key:1,type:"notPreview"}))],64)):(e.openBlock(),e.createBlock(g.default,{key:2,type:"notExist"}))],2))}});exports.default=F;
|
|
@@ -9,12 +9,14 @@ export type ApFilePreviewParser = {
|
|
|
9
9
|
/**
|
|
10
10
|
* 文件解析
|
|
11
11
|
* @param option.src 文件地址
|
|
12
|
+
* @param option.originalSrc 原始文件地址
|
|
12
13
|
* @param option.format 文件格式
|
|
13
14
|
* @param option.fileName 文件名
|
|
14
15
|
* @returns
|
|
15
16
|
*/
|
|
16
17
|
parser: (option: {
|
|
17
18
|
src: string;
|
|
19
|
+
originalSrc: string;
|
|
18
20
|
format: string;
|
|
19
21
|
fileName?: string;
|
|
20
22
|
}) => VNodeChild;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),B=require("@aplus-frontend/utils"),j=require("../../ap-table/context.js");require("../../config-provider/index.js");const k=require("../ap-batch-action-group/index.js");require("./components/main-button-content.vue.js");require("./components/menu-list-content.vue.js");const A=require("./hooks/use-view-provide.js"),G=require("./icons/line-down.vue.js"),U=require("./style/index.js"),m=require("./utils/enum.js"),$=require("../../config-provider/hooks/use-global-config.js"),z=require("../../config-provider/hooks/use-namespace.js"),R=require("../../config-provider/hooks/use-locale.js"),H=require("./components/main-button-content.vue2.js"),J=require("./components/menu-list-content.vue2.js"),Q=t.defineComponent({name:"ApView",__name:"ap-view",props:{tableKey:{},saveDataSource:{},viewCacheOption:{},maxViewNum:{default:20},isDefaultSystemView:{type:Boolean,default:!1},isFirstDefaultSystemView:{type:Boolean,default:!1},manual:{type:Boolean,default:!1},emptyData:{},extraParams:{}},setup(g,{expose:C}){const r=g,D=$.useGlobalConfig("viewCacheOption"),{b:y}=z.useNamespace("ap-view"),{t:E}=R.useLocale(),_=U.default("ap-view"),d=t.computed(()=>({viewKey:m.SYSTEM_VIEW_KEY,viewName:E("ap.apView.systemView")})),{getSearchFormValues:q,setSearchFormValues:F,submit:I,reset:N,submitWith:Y,getSearchFormSorterItems:x,setSearchFormSorterItems:O,resetSearchFormSorterItems:T}=j.useInjectApTable(),L=t.ref(!1),V=t.ref(!1),w=t.ref("");let f=!1,K=!1;const W={dropdownType:"dropdown",content:t.createVNode(H.default,{maxViewNum:r.maxViewNum},null)},s=t.ref([d.value]),M=t.computed(()=>s.value.map(a=>({id:a.viewKey,content:t.createVNode(J.default,{view:a},null)}))),o={getSearchFormValues:q,setSearchFormValues:F,submit:I,reset:N,submitWith:Y,getSearchFormSorterItems:x,setSearchFormSorterItems:O,resetSearchFormSorterItems:T,...r.saveDataSource},p={...D.value,...r.viewCacheOption},h=()=>r.isDefaultSystemView||(r.isFirstDefaultSystemView||K)&&f?m.SYSTEM_VIEW_KEY:s.value.find(i=>i.isDefault)?.viewKey??m.SYSTEM_VIEW_KEY,l=a=>{w.value=a;const i=s.value.find(e=>e.viewKey===w.value);i&&setTimeout(()=>{i.viewKey===m.SYSTEM_VIEW_KEY?f?r.manual||o?.submitWith?.():r.manual||(o?.resetSearchFormSorterItems?.(),o?.reset?.()):(o?.setSearchFormValues?.({...Object.fromEntries(Object.keys(o?.getSearchFormValues?.()??{}).map(e=>[e,void 0]))??{},...r?.emptyData??{},...[...o?.getSearchFormSorterItems?.()??[],...r?.extraParams?.map(e=>({name:e}))??[]].reduce((e,n)=>(i.viewConfig?.searchForm?.[n.name]&&(e[n.name]=i.viewConfig?.searchForm?.[n.name]),e),{})??{}}),o?.setSearchFormSorterItems?.(i.viewConfig?.sorterItems??[]),f?r.manual||o?.submitWith?.():o?.submit?.()),f=!1})},b={getViewList:async a=>{try{const{tableKey:i}=a,e=await p?.getViewList?.({tableKey:i});return s.value=[d.value,...e??[]],l(h()),s.value}catch{return s.value=[d.value],l(m.SYSTEM_VIEW_KEY),s.value}},addView:async a=>{const{tableKey:i,viewKey:e,viewName:n,isDefault:u,viewConfig:v}=a;await p?.addView?.({tableKey:i,viewKey:e,viewName:n,isDefault:u,viewConfig:v}),u&&(s.value=s.value.map(c=>({...c,isDefault:!1}))),s.value=[...s.value,{viewKey:e,viewName:n,isDefault:u,viewConfig:v}],l(e)},changeView:async a=>{const{tableKey:i,viewKey:e,viewName:n,isDefault:u,viewConfig:v}=a;await p?.changeView?.({tableKey:i,viewKey:e,viewName:n,isDefault:u,viewConfig:v}),u&&(s.value=s.value.map(S=>({...S,isDefault:!1})));const c=s.value.find(S=>S.viewKey===e);c&&(c.viewName=n,c.isDefault=u,c.viewConfig=v),l(e)},removeView:async a=>{const{tableKey:i,viewKey:e}=a;await p?.removeView?.({tableKey:i,viewKey:e}),s.value=s.value.filter(n=>n.viewKey!==e),e===w.value&&l(h())}},P={tableKey:r.tableKey,currentViewKey:w,changeCurrentViewKey:l,popoverOpen:L,menuOpen:V,viewList:s,viewListCRUD:b,saveDataSource:o};return A.useViewProvide(P),t.watch(()=>r.tableKey,a=>{B.isValid(a)&&(f=!0,b?.getViewList?.({tableKey:a}))},{immediate:!0}),C({setFirstDefaultSystemView:a=>{K=a}}),(a,i)=>(t.openBlock(),t.createBlock(t.unref(k.ApBatchActionGroup),t.mergeProps({...a.$attrs},{open:V.value,"onUpdate:open":i[0]||(i[0]=e=>V.value=e),class:[t.unref(y)(),t.unref(_)],"button-props":W,"menu-list":M.value,"overlay-class-name":[t.unref(y)("overlay"),t.unref(_)],trigger:"click",placement:"bottom"}),{icon:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass([t.unref(y)("icon")])},[t.createVNode(G.default)],2)]),_:1},16,["open","class","menu-list","overlay-class-name"]))}});exports.default=Q;
|
|
@@ -86,6 +86,10 @@ export interface ApViewProps {
|
|
|
86
86
|
* 表单项为空时的状态数据,适用于为空时其值不为undefined的情况
|
|
87
87
|
*/
|
|
88
88
|
emptyData?: Recordable;
|
|
89
|
+
/**
|
|
90
|
+
* 视图额外需要被设置的参数Key
|
|
91
|
+
*/
|
|
92
|
+
extraParams?: string[];
|
|
89
93
|
}
|
|
90
94
|
export interface ApViewExpose {
|
|
91
95
|
setFirstDefaultSystemView: (value: boolean) => void;
|
package/lib/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.11.
|
|
1
|
+
declare const _default: "7.11.2";
|
|
2
2
|
export default _default;
|
package/lib/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.11.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.11.2";exports.default=e;
|