@aplus-frontend/ui 7.10.6 → 7.11.0
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/index.mjs +93 -91
- package/es/src/ag-grid/editable/form-item.vue.mjs +75 -63
- package/es/src/ag-grid/editable/index.vue.mjs +80 -72
- package/es/src/ag-grid/editable/interface.d.ts +2 -1
- package/es/src/ag-grid/editable/utils.d.ts +7 -0
- package/es/src/ag-grid/editable/utils.mjs +32 -17
- package/es/src/ap-form/ap-form.vue2.mjs +144 -153
- package/es/src/ap-form/utils/transform.d.ts +6 -0
- package/es/src/ap-form/utils/transform.mjs +30 -0
- package/es/src/ap-pro-card/components/card/index.vue.d.ts +1 -1
- package/es/src/business/ap-appendix/ap-appendix.vue2.mjs +129 -93
- package/es/src/business/ap-appendix/interface.d.ts +4 -0
- package/es/src/business/ap-appendix/style/index.mjs +56 -34
- package/es/src/business/ap-attachment/ApAttachment.mjs +112 -89
- package/es/src/business/ap-attachment/style/index.mjs +21 -7
- package/es/src/business/ap-file-preview/ap-file-preview.vue.d.ts +4 -0
- package/es/src/business/ap-file-preview/ap-file-preview.vue.mjs +4 -0
- package/es/src/business/ap-file-preview/ap-file-preview.vue2.mjs +103 -0
- package/es/src/business/ap-file-preview/components/error-result/index.vue.d.ts +6 -0
- package/es/src/business/ap-file-preview/components/error-result/index.vue.mjs +4 -0
- package/es/src/business/ap-file-preview/components/error-result/index.vue2.mjs +40 -0
- package/es/src/business/ap-file-preview/icons/not-exist-icon.vue.d.ts +3 -0
- package/es/src/business/ap-file-preview/icons/not-exist-icon.vue.mjs +20 -0
- package/es/src/business/ap-file-preview/icons/not-preview-icon.vue.d.ts +3 -0
- package/es/src/business/ap-file-preview/icons/not-preview-icon.vue.mjs +20 -0
- package/es/src/business/ap-file-preview/index.d.ts +7 -0
- package/es/src/business/ap-file-preview/index.mjs +8 -0
- package/es/src/business/ap-file-preview/interface.d.ts +43 -0
- package/es/src/business/ap-file-preview/style/index.d.ts +5 -0
- package/es/src/business/ap-file-preview/style/index.mjs +46 -0
- package/es/src/business/ap-file-preview/utils/create-file-preview-modal.d.ts +2 -0
- package/es/src/business/ap-file-preview/utils/create-file-preview-modal.mjs +18 -0
- package/es/src/business/ap-file-preview/utils/default-parser-plugin.d.ts +4 -0
- package/es/src/business/ap-file-preview/utils/default-parser-plugin.mjs +48 -0
- package/es/src/business/ap-image/ApImage.vue2.mjs +16 -16
- package/es/src/business/ap-upload/apUpload.vue.d.ts +1 -1
- package/es/src/business/ap-upload/apUploadTypes.d.ts +2 -2
- package/es/src/business/ap-upload/components/MultipleFile.vue2.mjs +94 -82
- package/es/src/business/ap-upload/style/multiple-file.mjs +6 -3
- package/es/src/business/index.d.ts +1 -0
- package/es/src/business/index.mjs +16 -14
- package/es/src/config-provider/config-provider-props.d.ts +6 -0
- package/es/src/config-provider/config-provider-props.mjs +6 -2
- package/es/src/config-provider/config-provider.d.ts +17 -1
- package/es/src/config-provider/config-provider.mjs +24 -23
- package/es/src/config-provider/hooks/use-global-config.d.ts +7 -0
- package/es/src/config-provider/index.d.ts +31 -3
- package/es/src/index.mjs +74 -72
- package/es/src/locale/lang/en.mjs +5 -0
- package/es/src/locale/lang/zh-cn.mjs +5 -0
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/index.js +1 -1
- package/lib/src/ag-grid/editable/form-item.vue.js +1 -1
- package/lib/src/ag-grid/editable/index.vue.js +1 -1
- package/lib/src/ag-grid/editable/interface.d.ts +2 -1
- package/lib/src/ag-grid/editable/utils.d.ts +7 -0
- package/lib/src/ag-grid/editable/utils.js +1 -1
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/utils/transform.d.ts +6 -0
- package/lib/src/ap-form/utils/transform.js +1 -0
- package/lib/src/ap-pro-card/components/card/index.vue.d.ts +1 -1
- package/lib/src/business/ap-appendix/ap-appendix.vue2.js +1 -1
- package/lib/src/business/ap-appendix/interface.d.ts +4 -0
- package/lib/src/business/ap-appendix/style/index.js +1 -1
- package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
- package/lib/src/business/ap-attachment/style/index.js +1 -1
- package/lib/src/business/ap-file-preview/ap-file-preview.vue.d.ts +4 -0
- package/lib/src/business/ap-file-preview/ap-file-preview.vue.js +1 -0
- package/lib/src/business/ap-file-preview/ap-file-preview.vue2.js +1 -0
- package/lib/src/business/ap-file-preview/components/error-result/index.vue.d.ts +6 -0
- package/lib/src/business/ap-file-preview/components/error-result/index.vue.js +1 -0
- package/lib/src/business/ap-file-preview/components/error-result/index.vue2.js +1 -0
- package/lib/src/business/ap-file-preview/icons/not-exist-icon.vue.d.ts +3 -0
- package/lib/src/business/ap-file-preview/icons/not-exist-icon.vue.js +1 -0
- package/lib/src/business/ap-file-preview/icons/not-preview-icon.vue.d.ts +3 -0
- package/lib/src/business/ap-file-preview/icons/not-preview-icon.vue.js +1 -0
- package/lib/src/business/ap-file-preview/index.d.ts +7 -0
- package/lib/src/business/ap-file-preview/index.js +1 -0
- package/lib/src/business/ap-file-preview/interface.d.ts +43 -0
- package/lib/src/business/ap-file-preview/style/index.d.ts +5 -0
- package/lib/src/business/ap-file-preview/style/index.js +1 -0
- package/lib/src/business/ap-file-preview/utils/create-file-preview-modal.d.ts +2 -0
- package/lib/src/business/ap-file-preview/utils/create-file-preview-modal.js +1 -0
- package/lib/src/business/ap-file-preview/utils/default-parser-plugin.d.ts +4 -0
- package/lib/src/business/ap-file-preview/utils/default-parser-plugin.js +1 -0
- package/lib/src/business/ap-image/ApImage.vue2.js +1 -1
- package/lib/src/business/ap-upload/apUpload.vue.d.ts +1 -1
- package/lib/src/business/ap-upload/apUploadTypes.d.ts +2 -2
- package/lib/src/business/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/business/ap-upload/style/multiple-file.js +1 -1
- package/lib/src/business/index.d.ts +1 -0
- package/lib/src/business/index.js +1 -1
- package/lib/src/config-provider/config-provider-props.d.ts +6 -0
- package/lib/src/config-provider/config-provider-props.js +1 -1
- package/lib/src/config-provider/config-provider.d.ts +17 -1
- package/lib/src/config-provider/config-provider.js +1 -1
- package/lib/src/config-provider/hooks/use-global-config.d.ts +7 -0
- package/lib/src/config-provider/index.d.ts +31 -3
- package/lib/src/index.js +1 -1
- package/lib/src/locale/lang/en.js +1 -1
- package/lib/src/locale/lang/zh-cn.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,121 +1,144 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { LoadingOutlined as
|
|
3
|
-
import { Tooltip as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { defineComponent as j, ref as g, useSlots as M, computed as i, cloneVNode as R, toRaw as w, unref as B, createVNode as e, createTextVNode as D } from "vue";
|
|
2
|
+
import { LoadingOutlined as N } from "@ant-design/icons-vue";
|
|
3
|
+
import { Tooltip as A, Popover as G } from "@aplus-frontend/antdv";
|
|
4
|
+
import { IconApAdLineDownload as H } from "@aplus-frontend/icon";
|
|
5
|
+
import { debounce as q, isArray as E } from "lodash-unified";
|
|
6
|
+
import { useToken as J } from "../../config-provider/hooks/use-token.mjs";
|
|
7
|
+
import { warning as Q } from "../../utils/warning.mjs";
|
|
7
8
|
import "../../config-provider/index.mjs";
|
|
8
|
-
import { useOssInit as
|
|
9
|
-
import { getHexWithOpacity as
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
9
|
+
import { useOssInit as X } from "../ap-download/hooks/index.mjs";
|
|
10
|
+
import { getHexWithOpacity as Y, getFileInfo as L } from "../ap-download/utils/getFileInfo.mjs";
|
|
11
|
+
import { ApFilePreview as Z } from "../ap-file-preview/index.mjs";
|
|
12
|
+
import { ApAttachmentProps as $ } from "./constans.mjs";
|
|
13
|
+
import ee from "./style/index.mjs";
|
|
14
|
+
import { useNamespace as te } from "../../config-provider/hooks/use-namespace.mjs";
|
|
13
15
|
import { useGlobalConfig as T } from "../../config-provider/hooks/use-global-config.mjs";
|
|
14
|
-
import { useLocale as
|
|
15
|
-
const
|
|
16
|
+
import { useLocale as ae } from "../../config-provider/hooks/use-locale.mjs";
|
|
17
|
+
const Ne = /* @__PURE__ */ j({
|
|
16
18
|
name: "ApAttachment",
|
|
17
|
-
props:
|
|
18
|
-
setup(
|
|
19
|
-
emit:
|
|
19
|
+
props: $(),
|
|
20
|
+
setup(t, {
|
|
21
|
+
emit: y
|
|
20
22
|
}) {
|
|
21
23
|
const {
|
|
22
|
-
b:
|
|
23
|
-
e:
|
|
24
|
-
} =
|
|
25
|
-
token:
|
|
26
|
-
} =
|
|
27
|
-
lang:
|
|
28
|
-
t:
|
|
29
|
-
} =
|
|
24
|
+
b: P,
|
|
25
|
+
e: l
|
|
26
|
+
} = te("ap-attachment"), C = ee("ap-attachment"), d = T("apUpload"), F = T("downloadCenterTriggerConfig"), {
|
|
27
|
+
token: x
|
|
28
|
+
} = J(), {
|
|
29
|
+
lang: I,
|
|
30
|
+
t: c
|
|
31
|
+
} = ae(), s = g(!1), r = g(""), f = M(), K = i(() => I.value === "zh-cn" ? "zh_CN" : "en_US"), m = i(() => t.needName ?? (d?.value?.needName === !0 ? {
|
|
30
32
|
nameKey: "fileName",
|
|
31
33
|
pathKey: "path"
|
|
32
|
-
} :
|
|
34
|
+
} : d?.value?.needName ?? {
|
|
33
35
|
nameKey: "fileName",
|
|
34
36
|
pathKey: "filePath"
|
|
35
|
-
})),
|
|
36
|
-
"--download-main-color":
|
|
37
|
-
"--download-main-color-opacity":
|
|
38
|
-
})),
|
|
39
|
-
const
|
|
40
|
-
return
|
|
37
|
+
})), p = i(() => t.attachmentList.length === 1), b = i(() => m.value ? t.attachmentList.length > 0 && m.value && m.value?.nameKey ? t.attachmentList[0][m.value.nameKey] : "" : t.attachmentList.length > 0 ? t.attachmentList[0].fileName : ""), S = i(() => p.value ? b.value : c("ap.apAttachment.downloadall")), k = i(() => ({
|
|
38
|
+
"--download-main-color": x.value?.colorLink,
|
|
39
|
+
"--download-main-color-opacity": Y(x.value?.colorLink, 0.6)
|
|
40
|
+
})), U = i(() => t.getOssAccess || d.value?.getOssAccess), V = i(() => {
|
|
41
|
+
const a = f.default ? f.default()[0] : null;
|
|
42
|
+
return a ? R(a, {
|
|
41
43
|
style: {
|
|
42
44
|
"font-size": "16px"
|
|
43
45
|
}
|
|
44
46
|
}) : null;
|
|
45
|
-
}), h =
|
|
46
|
-
if (!
|
|
47
|
-
|
|
47
|
+
}), v = g(!1), h = q(async (a, n) => {
|
|
48
|
+
if (!t.disabled) {
|
|
49
|
+
s.value = !0, n && (r.value = n);
|
|
48
50
|
try {
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
objectName:
|
|
53
|
-
fileName:
|
|
51
|
+
const o = E(w(a)) ? w(a) : [w(a)];
|
|
52
|
+
if (F.value?.trigger) {
|
|
53
|
+
const u = L(m.value, o).map((O) => ({
|
|
54
|
+
objectName: O.path,
|
|
55
|
+
fileName: O.fileName
|
|
54
56
|
}));
|
|
55
|
-
|
|
57
|
+
F.value?.trigger(u), y("downloadCallback", u);
|
|
56
58
|
} else {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
+
const u = await (await X(U.value, B(K))).downloadFile(L(t.needName, o));
|
|
60
|
+
y("downloadCallback", u);
|
|
59
61
|
}
|
|
60
|
-
} catch (
|
|
61
|
-
|
|
62
|
+
} catch (o) {
|
|
63
|
+
Q(!1, o);
|
|
62
64
|
} finally {
|
|
63
|
-
|
|
65
|
+
s.value = !1, r.value = "";
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
|
-
}, 500),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}, [
|
|
68
|
+
}, 500), z = (a) => {
|
|
69
|
+
const n = L(t.needName, a)?.[0];
|
|
70
|
+
Z.createFilePreviewModal({
|
|
71
|
+
src: n.path,
|
|
72
|
+
fileName: n.fileName
|
|
73
|
+
}), v.value = !1;
|
|
74
|
+
}, W = (a) => a && a.length > 0 ? e("ul", {
|
|
75
|
+
class: [l("file-list"), C.value],
|
|
76
|
+
style: k.value
|
|
77
|
+
}, [a.map((n, o) => e("li", {
|
|
78
|
+
key: o,
|
|
79
|
+
class: [l("file-item")]
|
|
80
|
+
}, [s.value && r.value === o + 1 ? e("span", {
|
|
81
|
+
class: [l("spin")]
|
|
82
|
+
}, [e(N, {
|
|
76
83
|
spin: !0
|
|
77
|
-
}, null)]) : null,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
}, null)]) : null, e(A, {
|
|
85
|
+
title: c("ap.apAppendix.previewFile")
|
|
86
|
+
}, {
|
|
87
|
+
default: () => [e("span", {
|
|
88
|
+
class: [l("file-item-text")],
|
|
89
|
+
onClick: () => z(n)
|
|
90
|
+
}, [n.fileName])]
|
|
91
|
+
}), e(A, {
|
|
92
|
+
title: c("ap.apAppendix.downloadFile")
|
|
93
|
+
}, {
|
|
94
|
+
default: () => [e("span", {
|
|
95
|
+
class: [l("file-item-download")],
|
|
96
|
+
onClick: () => h(n, o + 1)
|
|
97
|
+
}, [e(H, null, null)])]
|
|
98
|
+
})])), e("li", {
|
|
99
|
+
class: [l("download-all")],
|
|
100
|
+
onClick: () => h(t.attachmentList, "all")
|
|
101
|
+
}, [s.value && r.value === "all" ? e("span", {
|
|
102
|
+
class: [l("spin")]
|
|
103
|
+
}, [e(N, {
|
|
83
104
|
spin: !0
|
|
84
|
-
}, null)]) : null,
|
|
85
|
-
return () =>
|
|
86
|
-
class: [
|
|
87
|
-
style: [
|
|
88
|
-
}, [
|
|
89
|
-
title:
|
|
90
|
-
placement:
|
|
91
|
-
color:
|
|
105
|
+
}, null)]) : null, c("ap.apAttachment.downloadall")])]) : null;
|
|
106
|
+
return () => t.attachmentList?.length > 0 && e("div", {
|
|
107
|
+
class: [P(), C.value],
|
|
108
|
+
style: [k.value]
|
|
109
|
+
}, [e(A, {
|
|
110
|
+
title: S.value,
|
|
111
|
+
placement: t.textToolTipPlacement,
|
|
112
|
+
color: t.toolTipBgColor
|
|
92
113
|
}, {
|
|
93
|
-
default: () => [
|
|
94
|
-
class: [
|
|
95
|
-
onClick: () => h(
|
|
96
|
-
}, [
|
|
97
|
-
class: [
|
|
98
|
-
}, [
|
|
114
|
+
default: () => [e("div", {
|
|
115
|
+
class: [l("content")],
|
|
116
|
+
onClick: () => h(p.value ? t.attachmentList[0] : t.attachmentList, "global")
|
|
117
|
+
}, [s.value && r.value === "global" ? e("div", {
|
|
118
|
+
class: [l("spin")]
|
|
119
|
+
}, [e(N, {
|
|
99
120
|
spin: !0
|
|
100
|
-
}, null)]) : null, f.default ?
|
|
101
|
-
class: [
|
|
102
|
-
}, [
|
|
103
|
-
class: [
|
|
121
|
+
}, null)]) : null, f.default ? e("div", {
|
|
122
|
+
class: [l("text-render")]
|
|
123
|
+
}, [V.value, D(" ")]) : null, e("div", {
|
|
124
|
+
class: [l("text-inner")],
|
|
104
125
|
style: {
|
|
105
|
-
"max-width":
|
|
126
|
+
"max-width": t.maxWidth ? t.maxWidth + "px" : "auto"
|
|
106
127
|
}
|
|
107
|
-
}, [
|
|
108
|
-
}),
|
|
109
|
-
content:
|
|
110
|
-
placement:
|
|
111
|
-
color: "#fff"
|
|
128
|
+
}, [b.value])])]
|
|
129
|
+
}), e(G, {
|
|
130
|
+
content: W(t.attachmentList),
|
|
131
|
+
placement: t.fileMorePopoverPlacement,
|
|
132
|
+
color: "#fff",
|
|
133
|
+
open: v.value,
|
|
134
|
+
"onUpdate:open": (a) => v.value = a
|
|
112
135
|
}, {
|
|
113
|
-
default: () => [!
|
|
114
|
-
class: [
|
|
115
|
-
}, [
|
|
136
|
+
default: () => [!p.value && e("div", {
|
|
137
|
+
class: [l("more")]
|
|
138
|
+
}, [c("ap.apAttachment.more")])]
|
|
116
139
|
})]);
|
|
117
140
|
}
|
|
118
141
|
});
|
|
119
142
|
export {
|
|
120
|
-
|
|
143
|
+
Ne as default
|
|
121
144
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { genComponentStyleHook as e } from "../../../utils/cssinjs/index.mjs";
|
|
2
|
-
const
|
|
2
|
+
const a = (o) => {
|
|
3
3
|
const { componentCls: r } = o;
|
|
4
4
|
return {
|
|
5
5
|
[r]: {
|
|
@@ -59,10 +59,24 @@ const n = (o) => {
|
|
|
59
59
|
wordWrap: "break-word",
|
|
60
60
|
marginBlockEnd: o.spaceLG,
|
|
61
61
|
fontSize: o.fontSize,
|
|
62
|
-
color:
|
|
63
|
-
cursor: "pointer",
|
|
62
|
+
color: o.textColor1,
|
|
64
63
|
"&:hover": {
|
|
65
|
-
|
|
64
|
+
[`${r}__file-item-download`]: {
|
|
65
|
+
opacity: 1
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"&-text": {
|
|
69
|
+
cursor: "pointer",
|
|
70
|
+
"&:hover": {
|
|
71
|
+
color: "var(--download-main-color)"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"&-download": {
|
|
75
|
+
cursor: "pointer",
|
|
76
|
+
color: "var(--download-main-color)",
|
|
77
|
+
marginLeft: o.space,
|
|
78
|
+
opacity: 0,
|
|
79
|
+
fontSize: o.fontSizeXL
|
|
66
80
|
}
|
|
67
81
|
},
|
|
68
82
|
[`${r}__download-all`]: {
|
|
@@ -76,13 +90,13 @@ const n = (o) => {
|
|
|
76
90
|
}
|
|
77
91
|
}
|
|
78
92
|
};
|
|
79
|
-
},
|
|
93
|
+
}, n = e(
|
|
80
94
|
"ApAttachment",
|
|
81
|
-
(o) => [
|
|
95
|
+
(o) => [a(o)],
|
|
82
96
|
{
|
|
83
97
|
apAttachmentListMaxWidth: 312
|
|
84
98
|
}
|
|
85
99
|
);
|
|
86
100
|
export {
|
|
87
|
-
|
|
101
|
+
n as default
|
|
88
102
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ApFilePreviewProps } from './interface';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
declare const _default: DefineComponent<ApFilePreviewProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApFilePreviewProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { defineComponent as E, ref as w, computed as l, watch as L, createElementBlock as m, openBlock as t, normalizeClass as C, unref as c, createBlock as i, Fragment as p, createCommentVNode as x, resolveDynamicComponent as B, h as R } from "vue";
|
|
2
|
+
import { Spin as W } from "@aplus-frontend/antdv";
|
|
3
|
+
import { createOssInstance as I } from "@aplus-frontend/oss";
|
|
4
|
+
import "../../config-provider/index.mjs";
|
|
5
|
+
import "./components/error-result/index.vue.mjs";
|
|
6
|
+
import $ from "./style/index.mjs";
|
|
7
|
+
import { defaultParserPlugins as j } from "./utils/default-parser-plugin.mjs";
|
|
8
|
+
import { useGlobalConfig as _ } from "../../config-provider/hooks/use-global-config.mjs";
|
|
9
|
+
import { useNamespace as D } from "../../config-provider/hooks/use-namespace.mjs";
|
|
10
|
+
import { useLocale as G } from "../../config-provider/hooks/use-locale.mjs";
|
|
11
|
+
import b from "./components/error-result/index.vue2.mjs";
|
|
12
|
+
const ee = /* @__PURE__ */ E({
|
|
13
|
+
__name: "ap-file-preview",
|
|
14
|
+
props: {
|
|
15
|
+
src: {},
|
|
16
|
+
fileName: {},
|
|
17
|
+
format: {},
|
|
18
|
+
parserPlugin: {},
|
|
19
|
+
getOssAccess: { type: Function }
|
|
20
|
+
},
|
|
21
|
+
setup(k) {
|
|
22
|
+
const e = k, P = _("apUpload"), N = _("apFilePreview"), { b: f } = D("ap-file-preview"), O = $("ap-file-preview"), { lang: U } = G(), S = {
|
|
23
|
+
"zh-cn": "zh_CN",
|
|
24
|
+
en: "en_US"
|
|
25
|
+
}, r = w(), o = w(!1), v = l(
|
|
26
|
+
() => e.getOssAccess || P.value?.getOssAccess
|
|
27
|
+
), s = l(() => e?.format ?? e?.src?.split(".").pop()), A = l(() => [
|
|
28
|
+
...j,
|
|
29
|
+
...N.value?.parserPlugin ?? [],
|
|
30
|
+
...e?.parserPlugin ?? []
|
|
31
|
+
]), g = l(() => s.value ? A.value?.findLast(
|
|
32
|
+
(a) => s.value && a.format.includes(s.value)
|
|
33
|
+
) : void 0), F = async () => {
|
|
34
|
+
try {
|
|
35
|
+
if (o.value = !0, r.value = void 0, !e?.src)
|
|
36
|
+
return;
|
|
37
|
+
if (e.src?.startsWith("http") || e.src?.startsWith("data:") || e.src?.startsWith("blob:")) {
|
|
38
|
+
r.value = e.src;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const a = e.src?.match(/^([^:]+):(.*)$/), u = a?.[1], h = a?.[2] ?? e.src, d = I();
|
|
42
|
+
await d.initOssClient({
|
|
43
|
+
getOssAccess: () => u ? v.value?.(u) : v.value?.(),
|
|
44
|
+
locale: S[U.value] ?? "zh_CN",
|
|
45
|
+
onFailure: (n) => {
|
|
46
|
+
throw new Error(
|
|
47
|
+
typeof n?.message == "string" ? n.message : "oss create error"
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const y = await d.getSignatureUrl(
|
|
52
|
+
h,
|
|
53
|
+
3600,
|
|
54
|
+
e?.fileName ?? h
|
|
55
|
+
);
|
|
56
|
+
if (y) {
|
|
57
|
+
const n = await fetch(y).then((z) => z.blob());
|
|
58
|
+
r.value = URL.createObjectURL(n);
|
|
59
|
+
} else
|
|
60
|
+
throw new Error("oss getSignatureUrl error");
|
|
61
|
+
} finally {
|
|
62
|
+
o.value = !1;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return L(
|
|
66
|
+
() => [e.src],
|
|
67
|
+
() => {
|
|
68
|
+
F();
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
immediate: !0
|
|
72
|
+
}
|
|
73
|
+
), (a, u) => (t(), m("div", {
|
|
74
|
+
class: C([c(f)(), c(O)])
|
|
75
|
+
}, [
|
|
76
|
+
o.value ? (t(), i(c(W), {
|
|
77
|
+
key: 0,
|
|
78
|
+
class: C([c(f)("spin")])
|
|
79
|
+
}, null, 8, ["class"])) : !o.value && r.value ? (t(), m(p, { key: 1 }, [
|
|
80
|
+
g.value && s.value ? (t(), m(p, { key: 0 }, [
|
|
81
|
+
r.value ? (t(), i(B(
|
|
82
|
+
R(p, [
|
|
83
|
+
g.value?.parser?.({
|
|
84
|
+
src: r.value,
|
|
85
|
+
format: s.value,
|
|
86
|
+
fileName: e.fileName
|
|
87
|
+
})
|
|
88
|
+
])
|
|
89
|
+
), { key: 0 })) : x("", !0)
|
|
90
|
+
], 64)) : (t(), i(b, {
|
|
91
|
+
key: 1,
|
|
92
|
+
type: "notPreview"
|
|
93
|
+
}))
|
|
94
|
+
], 64)) : (t(), i(b, {
|
|
95
|
+
key: 2,
|
|
96
|
+
type: "notExist"
|
|
97
|
+
}))
|
|
98
|
+
], 2));
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
export {
|
|
102
|
+
ee as default
|
|
103
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
type?: 'notExist' | 'notPreview';
|
|
4
|
+
};
|
|
5
|
+
declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineComponent as u, createVNode as r, computed as c, createElementBlock as v, openBlock as a, normalizeClass as t, unref as o, createElementVNode as s, createBlock as f, resolveDynamicComponent as d, h as x, Fragment as w, toDisplayString as y } from "vue";
|
|
2
|
+
import "../../../../config-provider/index.mjs";
|
|
3
|
+
import E from "../../icons/not-exist-icon.vue.mjs";
|
|
4
|
+
import C from "../../icons/not-preview-icon.vue.mjs";
|
|
5
|
+
import { useNamespace as N } from "../../../../config-provider/hooks/use-namespace.mjs";
|
|
6
|
+
import { useLocale as P } from "../../../../config-provider/hooks/use-locale.mjs";
|
|
7
|
+
const V = /* @__PURE__ */ u({
|
|
8
|
+
__name: "index",
|
|
9
|
+
props: {
|
|
10
|
+
type: {
|
|
11
|
+
default: "notExist"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
setup(n) {
|
|
15
|
+
const {
|
|
16
|
+
b: e
|
|
17
|
+
} = N("ap-file-preview"), {
|
|
18
|
+
t: i
|
|
19
|
+
} = P(), l = {
|
|
20
|
+
notExist: {
|
|
21
|
+
icon: r(E, null, null),
|
|
22
|
+
title: i("ap.apFilePreview.notExist")
|
|
23
|
+
},
|
|
24
|
+
notPreview: {
|
|
25
|
+
icon: r(C, null, null),
|
|
26
|
+
title: i("ap.apFilePreview.notPreview")
|
|
27
|
+
}
|
|
28
|
+
}, p = c(() => l[n.type]?.title), m = c(() => l[n.type]?.icon);
|
|
29
|
+
return (_, k) => (a(), v("div", {
|
|
30
|
+
class: t([o(e)("result")])
|
|
31
|
+
}, [s("div", {
|
|
32
|
+
class: t([o(e)("result-icon")])
|
|
33
|
+
}, [(a(), f(d(x(w, [m.value]))))], 2), s("div", {
|
|
34
|
+
class: t([o(e)("result-title")])
|
|
35
|
+
}, y(p.value), 3)], 2));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
V as default
|
|
40
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, SVGSVGElement>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createElementBlock as e, openBlock as o, createStaticVNode as l } from "vue";
|
|
2
|
+
import r from "../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
const C = {}, i = {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
6
|
+
fill: "none",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
width: "36",
|
|
9
|
+
height: "36",
|
|
10
|
+
viewBox: "0 0 36 36"
|
|
11
|
+
};
|
|
12
|
+
function s(L, t) {
|
|
13
|
+
return o(), e("svg", i, [...t[0] || (t[0] = [
|
|
14
|
+
l('<defs><clipPath id="master_svg0_1279_004842"><rect x="0" y="0" width="36" height="36" rx="0"></rect></clipPath></defs><g clip-path="url(#master_svg0_1279_004842)"><g><path d="M34.40176053125,31.784765L31.22363453125,28.606639899999998C32.74590153125,26.3460922,32.50683753125,23.2523422,30.506446831250003,21.2519531C29.37089923125,20.11640549,27.88027383125,19.546875,26.389648431250002,19.546875C24.89902303125,19.546875,23.41191483125,20.11640549,22.27285193125,21.2519531C19.99824333125,23.5230465,19.99824333125,27.2074223,22.27285193125,29.4785156C23.40839963125,30.614063,24.89902303125,31.183594,26.389648431250002,31.183594C27.52167893125,31.183594,28.65371133125,30.853125,29.63105393125,30.199219L32.80917953125,33.377342C33.03066253125,33.59531,33.315429531250004,33.707809,33.60371053125,33.707809C33.89199053125,33.707809,34.18027153125,33.598824,34.39824253125,33.377342C34.84121353125,32.934371999999996,34.84121353125,32.224216,34.40176053125,31.784765ZM26.389648431250002,28.9335938C25.43691443125,28.9335938,24.54043003125,28.5609379,23.86542893125,27.8894539C22.47324183125,26.4972668,22.47324183125,24.2332039,23.86542893125,22.844532C24.54042813125,22.1695328,25.43691253125,21.8003922,26.389648431250002,21.8003922C27.34238243125,21.8003922,28.23886683125,22.173048,28.91386793125,22.844532C30.30605503125,24.236719100000002,30.30605503125,26.500782,28.91386793125,27.8894539C28.23886873125,28.5609379,27.34238433125,28.9335938,26.389648431250002,28.9335938Z" fill="currentColor" fill-opacity="1" style="mix-blend-mode:passthrough;"></path></g><g><path d="M29.024608125,18L29.024608125,4.5C29.024608125,3.2589843,28.099998125,2.25,26.960937125,2.25L6.331249925,2.25C5.192187545,2.25,4.267578125,3.2589843,4.267578125,4.5L4.267578125,33.75L8.391406025,31.5L12.518749225,33.75L16.656640125,31.5L20.773437125,33.75L20.773437125,31.187109L17.735937125,29.527735L16.660156125,28.937109L15.580859125,29.524218L12.522265425,31.187109L9.470703125,29.524218L8.391406025,28.937109L7.312108725,29.524218L6.517577425,29.95664L6.517577425,5.625C6.517577425,5.0027342,7.020311625,4.5,7.642577425,4.5L25.649608125,4.5C26.271873125,4.5,26.774608125,5.0027342,26.774608125,5.625L26.774608125,18.028126L29.024608125,18Z" fill="currentColor" fill-opacity="1" style="mix-blend-mode:passthrough;"></path></g><g><path d="M22.27451109375,11.25L11.02099609375,11.25C10.398730273750001,11.25,9.89599609375,10.747265800000001,9.89599609375,10.125C9.89599609375,9.502734180000001,10.398730273750001,9,11.02099609375,9L22.27451109375,9C22.89677609375,9,23.39951109375,9.502734180000001,23.39951109375,10.125C23.39951109375,10.747265800000001,22.89677609375,11.25,22.27451109375,11.25ZM22.27451109375,16.875L11.02099609375,16.875C10.398730273750001,16.875,9.89599609375,16.3722649,9.89599609375,15.75C9.89599609375,15.127735099999999,10.398730273750001,14.625,11.02099609375,14.625L22.27451109375,14.625C22.89677609375,14.625,23.39951109375,15.127734199999999,23.39951109375,15.75C23.39951109375,16.3722649,22.89677609375,16.875,22.27451109375,16.875ZM20.02451109375,22.5L11.02099609375,22.5C10.398730273750001,22.5,9.89599609375,21.997265,9.89599609375,21.375C9.89599609375,20.752735,10.398730273750001,20.25,11.02099609375,20.25L20.02451109375,20.25C20.64677609375,20.25,21.14951109375,20.752735,21.14951109375,21.375C21.14951109375,21.997265,20.64326109375,22.5,20.02451109375,22.5Z" fill="currentColor" fill-opacity="1" style="mix-blend-mode:passthrough;"></path></g></g>', 2)
|
|
15
|
+
])]);
|
|
16
|
+
}
|
|
17
|
+
const h = /* @__PURE__ */ r(C, [["render", s]]);
|
|
18
|
+
export {
|
|
19
|
+
h as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, SVGSVGElement>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createElementBlock as C, openBlock as r, createStaticVNode as e } from "vue";
|
|
2
|
+
import o from "../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
const i = {}, l = {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
6
|
+
fill: "none",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
width: "38",
|
|
9
|
+
height: "38",
|
|
10
|
+
viewBox: "0 0 38 38"
|
|
11
|
+
};
|
|
12
|
+
function c(n, t) {
|
|
13
|
+
return r(), C("svg", l, [...t[0] || (t[0] = [
|
|
14
|
+
e('<defs><clipPath id="master_svg0_1279_004593"><rect x="0" y="0" width="38" height="38" rx="0"></rect></clipPath></defs><g clip-path="url(#master_svg0_1279_004593)"><g><path d="M18.9999355625,30.01997946875C9.3732690625,30.01997946875,1.7732691725,20.01331146875,1.4566015724999999,19.56997946875C1.2032681925,19.25331346875,1.2032681925,18.74664546875,1.4566015724999999,18.42998046875C1.5199349225,18.303313468749998,3.4199347625,15.76997946875,6.5232677625,13.23664566875C6.9032678625,12.91997956875,7.5366010625,12.98331166875,7.8532681625,13.36331176875C8.169935262500001,13.74331186875,8.1066012625,14.37664556875,7.7266011625,14.693311668749999C5.6366009625,16.40331176875,4.1166009625,18.11331146875,3.4199342625,18.99997846875C5.129935762500001,21.08998046875,11.5899355625,28.11997946875,18.9999355625,28.11997946875C20.0132695625,28.11997946875,21.0899375625,27.99331246875,22.1032715625,27.73998046875C22.6099375625,27.61331346875,23.1166055625,27.92997946875,23.2432705625,28.43664746875C23.3699375625,28.94331546875,23.0532705625,29.44997946875,22.5466045625,29.57664846875C21.4066025625,29.89331446875,20.1399365625,30.01997946875,18.9999355625,30.01997946875ZM30.8432675625,25.01664746875C30.5899395625,25.01664746875,30.2732655625,24.88997846875,30.0832675625,24.69997946875C29.7666035625,24.31998046875,29.8299385625,23.68664446875,30.2099375625,23.36998046875C32.2999385625,21.65998046875,33.8199385625,19.94997846875,34.5166015625,19.06331346875C32.8699375625,16.90997986875,26.4099365625,9.87998046875,18.9999365625,9.87998046875C17.9866025625,9.87998046875,16.973270562499998,10.00664736875,15.8966035625,10.25998046875C15.3899375625,10.38664726875,14.8832705625,10.06998036875,14.7566035625,9.56331346875C14.6299375625,9.05664666875,14.9466025625,8.54998045875,15.4532685625,8.42331355875C16.656603562500003,8.10664665875,17.8599375625,7.97998046875,18.9999355625,7.97998046875C28.6266045625,7.97998046875,36.2266045625,17.98664646875,36.5432735625,18.42998046875C36.7966005625,18.74664546875,36.7966005625,19.25331346875,36.5432735625,19.56997946875C36.4799385625,19.69664546875,34.5799365625,22.229979468750003,31.4766045625,24.76331346875C31.2866015625,24.88997846875,31.0966035625,25.01664546875,30.8432675625,25.01664746875Z" fill="currentColor" fill-opacity="1"></path></g><g><path d="M19.000116787499998,24.129969546875C16.1501171875,24.129969546875,13.8701171875,21.849969346875,13.8701171875,18.999969446875C13.8701171875,17.733303346875,14.3767833675,16.466635846875,15.2001170875,15.516635656875C15.5801171875,15.136635660875,16.1501171875,15.073301846875,16.5301169875,15.453301846875C16.9101171875,15.833301896875,16.9734511875,16.403301946875,16.5934509875,16.783301946875C16.0234508875,17.353302046875,15.7701171875,18.176635946875,15.7701171875,18.999968246875C15.7701171875,20.773302046875,17.226783287499998,22.229968546875,19.000116787499998,22.229968546875C19.8234510875,22.229968546875,20.6467833875,21.913302446875,21.2801169875,21.279968246875C21.6601171875,20.899968146875,22.2301168875,20.899968146875,22.6101169875,21.279968246875C22.9901170875,21.659968346875,22.9901170875,22.229968546875,22.6101169875,22.609968646875C21.6601171875,23.623302446875,20.3301171875,24.129968646875,19.000116787499998,24.129969546875Z" fill="currentColor" fill-opacity="1"></path></g><g><path d="M34.07315421875,35.023399359375C33.819822218750005,35.023399359375,33.56648621875,34.960067359375,33.37648821875,34.770067359375L3.22982418875,4.560068359375C2.84982422775,4.180068359375,2.84982422775,3.610068319375,3.22982418875,3.230068359375C3.6098241187499998,2.850068360375,4.17982411875,2.850068360375,4.55982411875,3.230068359375L34.769821218749996,33.440067359375C35.14981821875,33.820068359375,35.14981821875,34.390066359375,34.769821218749996,34.770067359375C34.579822218749996,34.960067359375,34.326490218749996,35.023399359375,34.07315421875,35.023399359375Z" fill="currentColor" fill-opacity="1"></path></g></g>', 2)
|
|
15
|
+
])]);
|
|
16
|
+
}
|
|
17
|
+
const s = /* @__PURE__ */ o(i, [["render", c]]);
|
|
18
|
+
export {
|
|
19
|
+
s as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as _ApFilePreview } from './ap-file-preview.vue';
|
|
2
|
+
import { CreateFilePreviewModal } from './interface';
|
|
3
|
+
export type ApFilePreviewType = typeof _ApFilePreview & {
|
|
4
|
+
createFilePreviewModal: CreateFilePreviewModal;
|
|
5
|
+
};
|
|
6
|
+
declare const ApFilePreview: ApFilePreviewType;
|
|
7
|
+
export { ApFilePreview };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { accessCreate } from '@aplus-frontend/oss';
|
|
2
|
+
import { VNodeChild } from 'vue';
|
|
3
|
+
import { CreateModalFuncProps } from '../../ap-modal';
|
|
4
|
+
export type ApFilePreviewParser = {
|
|
5
|
+
/**
|
|
6
|
+
* 文件格式
|
|
7
|
+
*/
|
|
8
|
+
format: string[];
|
|
9
|
+
/**
|
|
10
|
+
* 文件解析
|
|
11
|
+
* @param option.src 文件地址
|
|
12
|
+
* @param option.format 文件格式
|
|
13
|
+
* @param option.fileName 文件名
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
parser: (option: {
|
|
17
|
+
src: string;
|
|
18
|
+
format: string;
|
|
19
|
+
fileName?: string;
|
|
20
|
+
}) => VNodeChild;
|
|
21
|
+
};
|
|
22
|
+
export interface ApFilePreviewProps {
|
|
23
|
+
/**
|
|
24
|
+
* 文件地址,支持网络地址和Oss路径
|
|
25
|
+
*/
|
|
26
|
+
src?: string;
|
|
27
|
+
/**
|
|
28
|
+
* 文件名
|
|
29
|
+
*/
|
|
30
|
+
fileName?: string;
|
|
31
|
+
/**
|
|
32
|
+
* 文件格式,默认为文件后缀
|
|
33
|
+
*/
|
|
34
|
+
format?: string;
|
|
35
|
+
/**
|
|
36
|
+
* 文件解析器,默认支持PDF和图片
|
|
37
|
+
*/
|
|
38
|
+
parserPlugin?: ApFilePreviewParser[];
|
|
39
|
+
getOssAccess?: (bucket?: string) => Promise<accessCreate>;
|
|
40
|
+
}
|
|
41
|
+
export type CreateFilePreviewModal = (option: ApFilePreviewProps & {
|
|
42
|
+
modalProps?: CreateModalFuncProps;
|
|
43
|
+
}) => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { genComponentStyleHook as i } from "../../../utils/cssinjs/index.mjs";
|
|
2
|
+
const n = (e) => {
|
|
3
|
+
const { componentCls: t } = e;
|
|
4
|
+
return {
|
|
5
|
+
[`${t}`]: {
|
|
6
|
+
width: "100%",
|
|
7
|
+
height: "100%",
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
[`${t}-spin`]: {
|
|
10
|
+
display: "flex",
|
|
11
|
+
"align-items": "center",
|
|
12
|
+
"justify-content": "center",
|
|
13
|
+
width: "100%",
|
|
14
|
+
height: "100%"
|
|
15
|
+
},
|
|
16
|
+
[`${t}-result`]: {
|
|
17
|
+
display: "flex",
|
|
18
|
+
"align-items": "center",
|
|
19
|
+
"justify-content": "center",
|
|
20
|
+
"flex-direction": "column",
|
|
21
|
+
width: "100%",
|
|
22
|
+
height: "100%",
|
|
23
|
+
color: e.textColor3,
|
|
24
|
+
"&-icon": {
|
|
25
|
+
width: "64px",
|
|
26
|
+
height: "64px",
|
|
27
|
+
background: e.calc(e.antdv.colorTextPlaceholder).colorMix(10),
|
|
28
|
+
borderRadius: "100%",
|
|
29
|
+
display: "flex",
|
|
30
|
+
"align-items": "center",
|
|
31
|
+
"justify-content": "center"
|
|
32
|
+
},
|
|
33
|
+
"&-title": {
|
|
34
|
+
marginTop: e.spaceXL,
|
|
35
|
+
fontSize: e.fontSizeLG
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, l = i("ApFilePreview", (e) => [
|
|
41
|
+
n(e)
|
|
42
|
+
]);
|
|
43
|
+
export {
|
|
44
|
+
l as default,
|
|
45
|
+
n as genApFilePreviewStyle
|
|
46
|
+
};
|