@aplus-frontend/ui 7.10.3 → 7.10.5
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/ap-field/interface.d.ts +1 -1
- package/es/src/ap-field/slider/index.vue.d.ts +196 -412
- package/es/src/ap-field/slider/index.vue.mjs +50 -39
- package/es/src/business/ap-attachment/ApAttachment.d.ts +2 -8
- package/es/src/business/ap-attachment/ApAttachment.mjs +46 -40
- package/es/src/business/ap-attachment/constans.d.ts +1 -4
- package/es/src/business/ap-attachment/constans.mjs +3 -6
- package/es/src/business/ap-attachment/index.d.ts +3 -12
- package/es/src/business/ap-download/ap-download.vue.d.ts +2 -1
- package/es/src/business/ap-download/ap-download.vue.mjs +10 -10
- package/es/src/business/ap-image/ApImage.vue2.mjs +49 -46
- package/es/src/business/ap-image/hooks/useOss.d.ts +1 -1
- package/es/src/business/ap-image/hooks/useOss.mjs +30 -28
- package/es/src/business/ap-image/interface.d.ts +1 -1
- package/es/src/business/ap-ladder/components/RenderValue.mjs +25 -22
- package/es/src/business/ap-ladder/utils.d.ts +1 -0
- package/es/src/business/ap-ladder/utils.mjs +10 -9
- package/es/src/business/ap-title/ApTitle.vue.d.ts +1 -1
- package/es/src/business/ap-title/index.d.ts +3 -3
- package/es/src/business/ap-title/interface.d.ts +1 -1
- package/es/src/business/ap-upload/apUpload.vue.d.ts +10 -1
- package/es/src/business/ap-upload/apUpload.vue.mjs +22 -18
- package/es/src/business/ap-upload/components/MultipleFile.vue2.mjs +128 -123
- package/es/src/business/ap-upload/components/Picture.vue2.mjs +150 -147
- package/es/src/business/ap-upload/components/SingleFile.vue2.mjs +130 -127
- package/es/src/business/ap-upload/hooks/useOss.d.ts +2 -1
- package/es/src/business/ap-upload/hooks/useOss.mjs +52 -51
- package/es/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.mjs +11 -10
- package/es/src/business/ap-upload-file/hook/useOss.d.ts +6 -1
- package/es/src/business/ap-upload-file/hook/useOss.mjs +19 -16
- package/es/src/business/ap-upload-file/interface.d.ts +3 -1
- package/es/src/business/ap-upload-file/utils/upload.mjs +22 -20
- package/es/src/config-provider/constants.d.ts +2 -2
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ap-field/interface.d.ts +1 -1
- package/lib/src/ap-field/slider/index.vue.d.ts +196 -412
- package/lib/src/ap-field/slider/index.vue.js +1 -1
- package/lib/src/business/ap-attachment/ApAttachment.d.ts +2 -8
- package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
- package/lib/src/business/ap-attachment/constans.d.ts +1 -4
- package/lib/src/business/ap-attachment/constans.js +1 -1
- package/lib/src/business/ap-attachment/index.d.ts +3 -12
- package/lib/src/business/ap-download/ap-download.vue.d.ts +2 -1
- package/lib/src/business/ap-download/ap-download.vue.js +1 -1
- package/lib/src/business/ap-image/ApImage.vue2.js +1 -1
- package/lib/src/business/ap-image/hooks/useOss.d.ts +1 -1
- package/lib/src/business/ap-image/hooks/useOss.js +1 -1
- package/lib/src/business/ap-image/interface.d.ts +1 -1
- package/lib/src/business/ap-ladder/components/RenderValue.js +1 -1
- package/lib/src/business/ap-ladder/utils.d.ts +1 -0
- package/lib/src/business/ap-ladder/utils.js +1 -1
- package/lib/src/business/ap-title/ApTitle.vue.d.ts +1 -1
- package/lib/src/business/ap-title/index.d.ts +3 -3
- package/lib/src/business/ap-title/interface.d.ts +1 -1
- package/lib/src/business/ap-upload/apUpload.vue.d.ts +10 -1
- package/lib/src/business/ap-upload/apUpload.vue.js +1 -1
- package/lib/src/business/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/business/ap-upload/components/Picture.vue2.js +1 -1
- package/lib/src/business/ap-upload/components/SingleFile.vue2.js +1 -1
- package/lib/src/business/ap-upload/hooks/useOss.d.ts +2 -1
- package/lib/src/business/ap-upload/hooks/useOss.js +1 -1
- package/lib/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.js +1 -1
- package/lib/src/business/ap-upload-file/hook/useOss.d.ts +6 -1
- package/lib/src/business/ap-upload-file/hook/useOss.js +1 -1
- package/lib/src/business/ap-upload-file/interface.d.ts +3 -1
- package/lib/src/business/ap-upload-file/utils/upload.js +1 -1
- package/lib/src/config-provider/constants.d.ts +2 -2
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,65 +1,76 @@
|
|
|
1
|
-
import { defineComponent as B, useSlots as x, shallowRef as
|
|
2
|
-
import { Slider as
|
|
3
|
-
import { isNil as
|
|
1
|
+
import { defineComponent as B, useSlots as x, shallowRef as C, computed as b, unref as t, createElementBlock as g, createBlock as k, openBlock as n, Fragment as F, createTextVNode as S, toDisplayString as h, mergeProps as T, createSlots as V, renderList as _, withCtx as P, renderSlot as R, normalizeProps as N, guardReactiveProps as U } from "vue";
|
|
2
|
+
import { Slider as A } from "@aplus-frontend/antdv";
|
|
3
|
+
import { isNil as H, isArray as L, omit as $ } from "lodash-unified";
|
|
4
4
|
import "../../hooks/index.mjs";
|
|
5
|
-
import { useControllableValue as
|
|
6
|
-
const
|
|
5
|
+
import { useControllableValue as w } from "../../hooks/useControllableValue.mjs";
|
|
6
|
+
const G = /* @__PURE__ */ B({
|
|
7
7
|
name: "ApFieldSlider",
|
|
8
8
|
__name: "index",
|
|
9
9
|
props: {
|
|
10
10
|
mode: {},
|
|
11
11
|
class: {},
|
|
12
12
|
style: {},
|
|
13
|
-
|
|
13
|
+
range: { type: [Boolean, Object] },
|
|
14
|
+
value: {},
|
|
15
|
+
defaultValue: {},
|
|
16
|
+
onChange: {},
|
|
17
|
+
"onUpdate:value": {},
|
|
18
|
+
onAfterChange: {},
|
|
19
|
+
onChangeComplete: {},
|
|
20
|
+
handleStyle: {},
|
|
21
|
+
trackStyle: {},
|
|
14
22
|
prefixCls: {},
|
|
15
|
-
tooltipPrefixCls: {},
|
|
16
|
-
range: {},
|
|
17
23
|
reverse: { type: Boolean },
|
|
18
24
|
min: { default: 0 },
|
|
19
25
|
max: { default: 100 },
|
|
20
26
|
step: { default: 1 },
|
|
21
27
|
marks: {},
|
|
22
28
|
dots: { type: Boolean },
|
|
23
|
-
value: {},
|
|
24
|
-
defaultValue: {},
|
|
25
29
|
included: { type: Boolean, default: !0 },
|
|
26
30
|
disabled: { type: Boolean, default: void 0 },
|
|
31
|
+
keyboard: { type: Boolean },
|
|
27
32
|
vertical: { type: Boolean },
|
|
33
|
+
className: {},
|
|
34
|
+
rootClassName: {},
|
|
35
|
+
id: {},
|
|
36
|
+
tooltip: {},
|
|
37
|
+
autoFocus: { type: Boolean },
|
|
38
|
+
styles: {},
|
|
39
|
+
classNames: {},
|
|
40
|
+
onFocus: {},
|
|
41
|
+
onBlur: {},
|
|
42
|
+
tooltipPrefixCls: {},
|
|
28
43
|
tipFormatter: {},
|
|
29
|
-
tooltipOpen: { type: Boolean, default: void 0 },
|
|
30
44
|
tooltipVisible: { type: Boolean, default: void 0 },
|
|
31
|
-
tooltipPlacement: {},
|
|
32
45
|
getTooltipPopupContainer: {},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
onBlur: {},
|
|
40
|
-
"onUpdate:value": {},
|
|
46
|
+
tooltipPlacement: {},
|
|
47
|
+
tabIndex: {},
|
|
48
|
+
ariaLabelForHandle: {},
|
|
49
|
+
ariaLabelledByForHandle: {},
|
|
50
|
+
ariaRequired: { type: Boolean },
|
|
51
|
+
ariaValueTextFormatterForHandle: {},
|
|
41
52
|
emptyText: { default: "--" }
|
|
42
53
|
},
|
|
43
54
|
emits: ["update:value"],
|
|
44
|
-
setup(
|
|
45
|
-
const p = x(), o =
|
|
46
|
-
const e = t(
|
|
47
|
-
return
|
|
55
|
+
setup(s, { expose: u, emit: i }) {
|
|
56
|
+
const p = x(), o = C(), a = s, d = i, { value: l, updateValue: m } = w(a, d), c = b(() => {
|
|
57
|
+
const e = t(l);
|
|
58
|
+
return H(e) ? a.emptyText : L(e) ? `${e[0]}-${e[1]}` : e;
|
|
48
59
|
});
|
|
49
|
-
function
|
|
60
|
+
function f() {
|
|
50
61
|
o.value?.focus?.();
|
|
51
62
|
}
|
|
52
|
-
function
|
|
63
|
+
function y() {
|
|
53
64
|
o.value?.blur?.();
|
|
54
65
|
}
|
|
55
|
-
return
|
|
56
|
-
focus:
|
|
57
|
-
blur:
|
|
58
|
-
}), (e,
|
|
59
|
-
h(
|
|
60
|
-
], 64)) : (n(),
|
|
66
|
+
return u({
|
|
67
|
+
focus: f,
|
|
68
|
+
blur: y
|
|
69
|
+
}), (e, j) => e.mode === "read" ? (n(), g(F, { key: 0 }, [
|
|
70
|
+
S(h(c.value), 1)
|
|
71
|
+
], 64)) : (n(), k(t(A), T(
|
|
61
72
|
{ key: 1 },
|
|
62
|
-
t(
|
|
73
|
+
t($)(a, [
|
|
63
74
|
"value",
|
|
64
75
|
"onUpdate:value",
|
|
65
76
|
"mode",
|
|
@@ -69,19 +80,19 @@ const I = /* @__PURE__ */ B({
|
|
|
69
80
|
{
|
|
70
81
|
ref_key: "sliderRef",
|
|
71
82
|
ref: o,
|
|
72
|
-
value: t(
|
|
73
|
-
"onUpdate:value": t(
|
|
83
|
+
value: t(l),
|
|
84
|
+
"onUpdate:value": t(m)
|
|
74
85
|
}
|
|
75
86
|
), V({ _: 2 }, [
|
|
76
|
-
|
|
87
|
+
_(p, (q, r) => ({
|
|
77
88
|
name: r,
|
|
78
|
-
fn:
|
|
79
|
-
|
|
89
|
+
fn: P((v) => [
|
|
90
|
+
R(e.$slots, r, N(U(v || {})))
|
|
80
91
|
])
|
|
81
92
|
}))
|
|
82
93
|
]), 1040, ["value", "onUpdate:value"]));
|
|
83
94
|
}
|
|
84
95
|
});
|
|
85
96
|
export {
|
|
86
|
-
|
|
97
|
+
G as default
|
|
87
98
|
};
|
|
@@ -31,10 +31,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
31
31
|
nameKey?: string;
|
|
32
32
|
pathKey?: string;
|
|
33
33
|
}>;
|
|
34
|
-
default:
|
|
35
|
-
nameKey: string;
|
|
36
|
-
pathKey: string;
|
|
37
|
-
};
|
|
34
|
+
default: undefined;
|
|
38
35
|
};
|
|
39
36
|
getOssAccess: {
|
|
40
37
|
type: PropType< ApAttachmentProps["getOssAccess"]>;
|
|
@@ -76,10 +73,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
76
73
|
nameKey?: string;
|
|
77
74
|
pathKey?: string;
|
|
78
75
|
}>;
|
|
79
|
-
default:
|
|
80
|
-
nameKey: string;
|
|
81
|
-
pathKey: string;
|
|
82
|
-
};
|
|
76
|
+
default: undefined;
|
|
83
77
|
};
|
|
84
78
|
getOssAccess: {
|
|
85
79
|
type: PropType< ApAttachmentProps["getOssAccess"]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { LoadingOutlined as
|
|
1
|
+
import { defineComponent as U, ref as k, useSlots as W, computed as o, cloneVNode as _, toRaw as g, unref as j, createVNode as t, createTextVNode as R } from "vue";
|
|
2
|
+
import { LoadingOutlined as p } from "@ant-design/icons-vue";
|
|
3
3
|
import { Tooltip as B, Popover as G } from "@aplus-frontend/antdv";
|
|
4
4
|
import { debounce as H, isArray as M } from "lodash-unified";
|
|
5
5
|
import { useToken as q } from "../../config-provider/hooks/use-token.mjs";
|
|
@@ -12,44 +12,50 @@ import X from "./style/index.mjs";
|
|
|
12
12
|
import { useNamespace as Y } from "../../config-provider/hooks/use-namespace.mjs";
|
|
13
13
|
import { useGlobalConfig as T } from "../../config-provider/hooks/use-global-config.mjs";
|
|
14
14
|
import { useLocale as Z } from "../../config-provider/hooks/use-locale.mjs";
|
|
15
|
-
const fe = /* @__PURE__ */
|
|
15
|
+
const fe = /* @__PURE__ */ U({
|
|
16
16
|
name: "ApAttachment",
|
|
17
17
|
props: Q(),
|
|
18
18
|
setup(e, {
|
|
19
|
-
emit:
|
|
19
|
+
emit: N
|
|
20
20
|
}) {
|
|
21
21
|
const {
|
|
22
22
|
b: x,
|
|
23
23
|
e: a
|
|
24
|
-
} = Y("ap-attachment"),
|
|
25
|
-
token:
|
|
24
|
+
} = Y("ap-attachment"), y = X("ap-attachment"), r = T("apUpload"), L = T("downloadCenterTriggerConfig"), {
|
|
25
|
+
token: C
|
|
26
26
|
} = q(), {
|
|
27
27
|
lang: O,
|
|
28
|
-
t:
|
|
29
|
-
} = Z(), i = k(!1), c = k(""),
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
t: d
|
|
29
|
+
} = Z(), i = k(!1), c = k(""), f = W(), K = o(() => O.value === "zh-cn" ? "zh_CN" : "en_US"), s = o(() => e.needName ?? (r?.value?.needName === !0 ? {
|
|
30
|
+
nameKey: "fileName",
|
|
31
|
+
pathKey: "path"
|
|
32
|
+
} : r?.value?.needName ?? {
|
|
33
|
+
nameKey: "fileName",
|
|
34
|
+
pathKey: "filePath"
|
|
35
|
+
})), v = o(() => e.attachmentList.length === 1), w = o(() => s.value ? e.attachmentList.length > 0 && s.value && s.value?.nameKey ? e.attachmentList[0][s.value.nameKey] : "" : e.attachmentList.length > 0 ? e.attachmentList[0].fileName : ""), P = o(() => v.value ? w.value : d("ap.apAttachment.downloadall")), A = o(() => ({
|
|
36
|
+
"--download-main-color": C.value?.colorLink,
|
|
37
|
+
"--download-main-color-opacity": J(C.value?.colorLink, 0.6)
|
|
38
|
+
})), I = o(() => e.getOssAccess || r.value?.getOssAccess), S = o(() => {
|
|
39
|
+
const l = f.default ? f.default()[0] : null;
|
|
40
|
+
return l ? _(l, {
|
|
35
41
|
style: {
|
|
36
42
|
"font-size": "16px"
|
|
37
43
|
}
|
|
38
44
|
}) : null;
|
|
39
|
-
}),
|
|
45
|
+
}), h = H(async (l, u) => {
|
|
40
46
|
if (!e.disabled) {
|
|
41
|
-
i.value = !0,
|
|
47
|
+
i.value = !0, u && (c.value = u);
|
|
42
48
|
try {
|
|
43
|
-
const n = M(
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
49
|
+
const n = M(g(l)) ? g(l) : [g(l)];
|
|
50
|
+
if (L.value?.trigger) {
|
|
51
|
+
const m = F(s.value, n).map((b) => ({
|
|
46
52
|
objectName: b.path,
|
|
47
53
|
fileName: b.fileName
|
|
48
54
|
}));
|
|
49
|
-
|
|
55
|
+
L.value?.trigger(m), N("downloadCallback", m);
|
|
50
56
|
} else {
|
|
51
|
-
const
|
|
52
|
-
|
|
57
|
+
const m = await (await E(I.value, j(K))).downloadFile(F(e.needName, n));
|
|
58
|
+
N("downloadCallback", m);
|
|
53
59
|
}
|
|
54
60
|
} catch (n) {
|
|
55
61
|
D(!1, n);
|
|
@@ -57,56 +63,56 @@ const fe = /* @__PURE__ */ W({
|
|
|
57
63
|
i.value = !1, c.value = "";
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
|
-
}, 500),
|
|
61
|
-
class: [a("file-list"),
|
|
66
|
+
}, 500), V = (l) => l && l.length > 0 ? t("ul", {
|
|
67
|
+
class: [a("file-list"), y.value],
|
|
62
68
|
style: A.value
|
|
63
|
-
}, [l.map((
|
|
69
|
+
}, [l.map((u, n) => t("li", {
|
|
64
70
|
key: n,
|
|
65
71
|
class: [a("file-item")],
|
|
66
|
-
onClick: () =>
|
|
72
|
+
onClick: () => h(u, n + 1)
|
|
67
73
|
}, [i.value && c.value === n + 1 ? t("span", {
|
|
68
74
|
class: [a("spin")]
|
|
69
|
-
}, [t(
|
|
75
|
+
}, [t(p, {
|
|
70
76
|
spin: !0
|
|
71
|
-
}, null)]) : null,
|
|
77
|
+
}, null)]) : null, u.fileName])), t("li", {
|
|
72
78
|
class: [a("download-all")],
|
|
73
|
-
onClick: () =>
|
|
79
|
+
onClick: () => h(e.attachmentList, "all")
|
|
74
80
|
}, [i.value && c.value === "all" ? t("span", {
|
|
75
81
|
class: [a("spin")]
|
|
76
|
-
}, [t(
|
|
82
|
+
}, [t(p, {
|
|
77
83
|
spin: !0
|
|
78
|
-
}, null)]) : null,
|
|
84
|
+
}, null)]) : null, d("ap.apAttachment.downloadall")])]) : null;
|
|
79
85
|
return () => e.attachmentList?.length > 0 && t("div", {
|
|
80
|
-
class: [x(),
|
|
86
|
+
class: [x(), y.value],
|
|
81
87
|
style: [A.value]
|
|
82
88
|
}, [t(B, {
|
|
83
|
-
title:
|
|
89
|
+
title: P.value,
|
|
84
90
|
placement: e.textToolTipPlacement,
|
|
85
91
|
color: e.toolTipBgColor
|
|
86
92
|
}, {
|
|
87
93
|
default: () => [t("div", {
|
|
88
94
|
class: [a("content")],
|
|
89
|
-
onClick: () => v
|
|
95
|
+
onClick: () => h(v.value ? e.attachmentList[0] : e.attachmentList, "global")
|
|
90
96
|
}, [i.value && c.value === "global" ? t("div", {
|
|
91
97
|
class: [a("spin")]
|
|
92
|
-
}, [t(
|
|
98
|
+
}, [t(p, {
|
|
93
99
|
spin: !0
|
|
94
|
-
}, null)]) : null,
|
|
100
|
+
}, null)]) : null, f.default ? t("div", {
|
|
95
101
|
class: [a("text-render")]
|
|
96
|
-
}, [
|
|
102
|
+
}, [S.value, R(" ")]) : null, t("div", {
|
|
97
103
|
class: [a("text-inner")],
|
|
98
104
|
style: {
|
|
99
105
|
"max-width": e.maxWidth ? e.maxWidth + "px" : "auto"
|
|
100
106
|
}
|
|
101
|
-
}, [
|
|
107
|
+
}, [w.value])])]
|
|
102
108
|
}), t(G, {
|
|
103
|
-
content:
|
|
109
|
+
content: V(e.attachmentList),
|
|
104
110
|
placement: e.fileMorePopoverPlacement,
|
|
105
111
|
color: "#fff"
|
|
106
112
|
}, {
|
|
107
|
-
default: () => [!
|
|
113
|
+
default: () => [!v.value && t("div", {
|
|
108
114
|
class: [a("more")]
|
|
109
|
-
}, [
|
|
115
|
+
}, [d("ap.apAttachment.more")])]
|
|
110
116
|
})]);
|
|
111
117
|
}
|
|
112
118
|
});
|
|
@@ -30,10 +30,7 @@ export declare const ApAttachmentProps: () => {
|
|
|
30
30
|
nameKey?: string;
|
|
31
31
|
pathKey?: string;
|
|
32
32
|
}>;
|
|
33
|
-
default:
|
|
34
|
-
nameKey: string;
|
|
35
|
-
pathKey: string;
|
|
36
|
-
};
|
|
33
|
+
default: undefined;
|
|
37
34
|
};
|
|
38
35
|
getOssAccess: {
|
|
39
36
|
type: PropType<_ApAttachmentProps["getOssAccess"]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t = () => ({
|
|
2
2
|
attachmentList: {
|
|
3
3
|
type: Array,
|
|
4
4
|
default: [],
|
|
@@ -25,10 +25,7 @@ const e = () => ({
|
|
|
25
25
|
},
|
|
26
26
|
needName: {
|
|
27
27
|
type: Object,
|
|
28
|
-
default:
|
|
29
|
-
nameKey: "fileName",
|
|
30
|
-
pathKey: "filePath"
|
|
31
|
-
})
|
|
28
|
+
default: void 0
|
|
32
29
|
},
|
|
33
30
|
getOssAccess: {
|
|
34
31
|
type: Function
|
|
@@ -42,5 +39,5 @@ const e = () => ({
|
|
|
42
39
|
}
|
|
43
40
|
});
|
|
44
41
|
export {
|
|
45
|
-
|
|
42
|
+
t as ApAttachmentProps
|
|
46
43
|
};
|
|
@@ -33,10 +33,7 @@ declare const ApAttachment: {
|
|
|
33
33
|
nameKey?: string;
|
|
34
34
|
pathKey?: string;
|
|
35
35
|
}>;
|
|
36
|
-
default:
|
|
37
|
-
nameKey: string;
|
|
38
|
-
pathKey: string;
|
|
39
|
-
};
|
|
36
|
+
default: undefined;
|
|
40
37
|
};
|
|
41
38
|
getOssAccess: {
|
|
42
39
|
type: PropType< ApAttachmentProps["getOssAccess"]>;
|
|
@@ -96,10 +93,7 @@ declare const ApAttachment: {
|
|
|
96
93
|
nameKey?: string;
|
|
97
94
|
pathKey?: string;
|
|
98
95
|
}>;
|
|
99
|
-
default:
|
|
100
|
-
nameKey: string;
|
|
101
|
-
pathKey: string;
|
|
102
|
-
};
|
|
96
|
+
default: undefined;
|
|
103
97
|
};
|
|
104
98
|
getOssAccess: {
|
|
105
99
|
type: PropType< ApAttachmentProps["getOssAccess"]>;
|
|
@@ -156,10 +150,7 @@ declare const ApAttachment: {
|
|
|
156
150
|
nameKey?: string;
|
|
157
151
|
pathKey?: string;
|
|
158
152
|
}>;
|
|
159
|
-
default:
|
|
160
|
-
nameKey: string;
|
|
161
|
-
pathKey: string;
|
|
162
|
-
};
|
|
153
|
+
default: undefined;
|
|
163
154
|
};
|
|
164
155
|
getOssAccess: {
|
|
165
156
|
type: PropType< ApAttachmentProps["getOssAccess"]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApDownLoadProps, downloadCallbackResponse } from './interface';
|
|
1
|
+
import { ApDownLoadProps, downloadCallbackResponse, ApDownLoadNeedNameModel } from './interface';
|
|
2
2
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
3
|
import { ButtonType } from '@aplus-frontend/antdv/es/button';
|
|
4
4
|
type __VLS_Props = ApDownLoadProps;
|
|
@@ -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
|
+
needName: ApDownLoadNeedNameModel;
|
|
22
23
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
23
24
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
24
25
|
export default _default;
|
|
@@ -40,20 +40,20 @@ const M = {
|
|
|
40
40
|
variant: {},
|
|
41
41
|
text: {},
|
|
42
42
|
fileName: {},
|
|
43
|
-
needName: { type: [Boolean, Object] },
|
|
43
|
+
needName: { type: [Boolean, Object], default: void 0 },
|
|
44
44
|
getOssAccess: {}
|
|
45
45
|
},
|
|
46
46
|
emits: ["downloadCallback"],
|
|
47
47
|
setup(C, { emit: N }) {
|
|
48
|
-
const r = N,
|
|
48
|
+
const r = N, l = z(!1), { lang: b } = G(), v = A(), w = s(() => b.value === "zh-cn" ? "zh_CN" : "en_US"), e = C, n = y("apUpload"), c = y(
|
|
49
49
|
"downloadCenterTriggerConfig"
|
|
50
|
-
), d = s(() => e.disabled),
|
|
50
|
+
), d = s(() => e.disabled), h = s(() => e.size), { getInnerWrapperClass: _ } = P(h, d), k = s(() => e.getOssAccess || n.value?.getOssAccess), B = async () => {
|
|
51
51
|
if (!e.disabled) {
|
|
52
|
-
|
|
52
|
+
l.value = !0;
|
|
53
53
|
try {
|
|
54
54
|
if (c.value?.trigger) {
|
|
55
55
|
let a = g(
|
|
56
|
-
e.needName ??
|
|
56
|
+
e.needName ?? n?.value?.needName,
|
|
57
57
|
e.fileName
|
|
58
58
|
).map((p) => ({
|
|
59
59
|
objectName: p.path,
|
|
@@ -63,10 +63,10 @@ const M = {
|
|
|
63
63
|
} else {
|
|
64
64
|
const a = await (await E(
|
|
65
65
|
k.value,
|
|
66
|
-
t(
|
|
66
|
+
t(w)
|
|
67
67
|
)).downloadFile(
|
|
68
68
|
g(
|
|
69
|
-
e.needName ??
|
|
69
|
+
e.needName ?? n?.value?.needName,
|
|
70
70
|
e.fileName
|
|
71
71
|
)
|
|
72
72
|
);
|
|
@@ -75,7 +75,7 @@ const M = {
|
|
|
75
75
|
} catch (o) {
|
|
76
76
|
console.error(o);
|
|
77
77
|
} finally {
|
|
78
|
-
|
|
78
|
+
l.value = !1;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
};
|
|
@@ -89,10 +89,10 @@ const M = {
|
|
|
89
89
|
m("div", {
|
|
90
90
|
class: j(t(_))
|
|
91
91
|
}, [
|
|
92
|
-
|
|
92
|
+
l.value ? (i(), f("span", M, [
|
|
93
93
|
I(t(U), { spin: !0 })
|
|
94
94
|
])) : u("", !0),
|
|
95
|
-
t(
|
|
95
|
+
t(v).icon ? (i(), f("span", R, [
|
|
96
96
|
F(o.$slots, "icon")
|
|
97
97
|
])) : u("", !0),
|
|
98
98
|
m("span", W, T(o.text), 1)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { DownloadOutlined as
|
|
3
|
-
import { Image as
|
|
4
|
-
import { omit as
|
|
1
|
+
import { defineComponent as S, computed as n, ref as j, watchEffect as B, createBlock as h, openBlock as i, unref as o, mergeProps as v, withCtx as E, renderSlot as F, normalizeProps as L, guardReactiveProps as U, createElementVNode as b, normalizeClass as W, createElementBlock as x, Fragment as D, renderList as P, resolveDynamicComponent as R, createVNode as T } from "vue";
|
|
2
|
+
import { DownloadOutlined as z } from "@ant-design/icons-vue";
|
|
3
|
+
import { Image as V } from "@aplus-frontend/antdv";
|
|
4
|
+
import { omit as $ } from "lodash-unified";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
|
-
import { injectLocaleToOss as
|
|
6
|
+
import { injectLocaleToOss as G, getOssInstance as q, getSignatureUrl as H } from "./hooks/useOss.mjs";
|
|
7
7
|
import J from "./imgs/admin-fallback.jpg.mjs";
|
|
8
8
|
import K from "./imgs/user-fallback.jpg.mjs";
|
|
9
9
|
import Q from "./style/index.mjs";
|
|
10
10
|
import { useNamespace as X } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
|
-
import { useGlobalConfig as
|
|
11
|
+
import { useGlobalConfig as m } from "../../config-provider/hooks/use-global-config.mjs";
|
|
12
12
|
import { useLocale as Y } from "../../config-provider/hooks/use-locale.mjs";
|
|
13
|
-
const ue = /* @__PURE__ */
|
|
13
|
+
const ue = /* @__PURE__ */ S({
|
|
14
14
|
__name: "ApImage",
|
|
15
15
|
props: {
|
|
16
16
|
getOssAccess: {},
|
|
@@ -23,78 +23,81 @@ const ue = /* @__PURE__ */ M({
|
|
|
23
23
|
uiMode: {},
|
|
24
24
|
preview: { type: [Boolean, Object], default: !0 }
|
|
25
25
|
},
|
|
26
|
-
setup(
|
|
27
|
-
const { b:
|
|
26
|
+
setup(k) {
|
|
27
|
+
const { b: u } = X("ap-image"), p = Q("ap-image"), e = k, d = {
|
|
28
28
|
aplus: K,
|
|
29
29
|
admin: J
|
|
30
|
-
},
|
|
30
|
+
}, w = m("apImage", { uiMode: "aplus" }), C = m("apUpload"), f = m(
|
|
31
31
|
"downloadCenterTriggerConfig"
|
|
32
|
-
),
|
|
33
|
-
() => e.uiMode ||
|
|
34
|
-
), { t:
|
|
35
|
-
() => e.getOssAccess ||
|
|
36
|
-
),
|
|
37
|
-
() =>
|
|
38
|
-
),
|
|
39
|
-
|
|
32
|
+
), O = n(
|
|
33
|
+
() => e.uiMode || w.value?.uiMode
|
|
34
|
+
), { t: y, lang: A } = Y(), g = n(
|
|
35
|
+
() => e.getOssAccess || C.value?.getOssAccess
|
|
36
|
+
), N = n(
|
|
37
|
+
() => d[O.value] || d.aplus
|
|
38
|
+
), I = n(() => e?.fallback || N.value), s = j("");
|
|
39
|
+
G(y, A), B(async () => {
|
|
40
40
|
if (!e?.src) {
|
|
41
41
|
s.value = "";
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
if (
|
|
44
|
+
if (e.src?.startsWith("http") || e.src?.startsWith("data:")) {
|
|
45
45
|
s.value = e.src;
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
const a = e.src?.match(/^([^:]+):(.*)$/), r = a?.[1], t = a?.[2] ?? e.src, l = await q(
|
|
50
|
+
() => r ? g.value?.(r) : g.value?.(),
|
|
51
|
+
r
|
|
52
|
+
), c = await H({
|
|
53
|
+
oss: l,
|
|
54
|
+
fileName: t
|
|
52
55
|
});
|
|
53
|
-
|
|
56
|
+
c && (s.value = c);
|
|
54
57
|
} catch {
|
|
55
58
|
s.value = "";
|
|
56
59
|
}
|
|
57
60
|
});
|
|
58
|
-
async function
|
|
61
|
+
async function _() {
|
|
59
62
|
if (!e?.src)
|
|
60
63
|
return;
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
+
const a = e.src, r = e.fileName ?? e.src;
|
|
65
|
+
if (e.src?.startsWith("http") || e.src?.startsWith("data:")) {
|
|
66
|
+
M(a, r);
|
|
64
67
|
return;
|
|
65
68
|
}
|
|
66
|
-
if (
|
|
67
|
-
let
|
|
69
|
+
if (f.value?.trigger) {
|
|
70
|
+
let t = [
|
|
68
71
|
{
|
|
69
|
-
objectName:
|
|
72
|
+
objectName: a,
|
|
70
73
|
fileName: r
|
|
71
74
|
}
|
|
72
75
|
];
|
|
73
|
-
await
|
|
76
|
+
await f.value?.trigger(t);
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
+
const M = (a, r) => {
|
|
80
|
+
const t = document.createElement("a");
|
|
81
|
+
t.href = a, t.rel = "noopener noreferrer", t.setAttribute("download", r), document.body.appendChild(t), t.click(), document.body.removeChild(t);
|
|
79
82
|
};
|
|
80
|
-
return (
|
|
81
|
-
class: [
|
|
83
|
+
return (a, r) => (i(), h(o(V), v({
|
|
84
|
+
class: [o(u)(), o(p)]
|
|
82
85
|
}, {
|
|
83
|
-
...
|
|
84
|
-
fallback:
|
|
86
|
+
...o($)(e, ["src", "getOssAccess"]),
|
|
87
|
+
fallback: I.value,
|
|
85
88
|
src: s.value
|
|
86
89
|
}), {
|
|
87
|
-
toolbarRender:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
class:
|
|
90
|
+
toolbarRender: E((t) => [
|
|
91
|
+
F(a.$slots, "toolbarRender", L(U({ ...t })), () => [
|
|
92
|
+
b("div", {
|
|
93
|
+
class: W([o(u)("toolbar"), o(p)])
|
|
91
94
|
}, [
|
|
92
|
-
(
|
|
93
|
-
|
|
95
|
+
(i(!0), x(D, null, P(t.originalNodes, (l, c) => (i(), h(R(l), v({ ref_for: !0 }, e, { key: c }), null, 16))), 128)),
|
|
96
|
+
b("div", {
|
|
94
97
|
class: "ant-image-preview-operations-operation",
|
|
95
|
-
onClick:
|
|
98
|
+
onClick: _
|
|
96
99
|
}, [
|
|
97
|
-
|
|
100
|
+
T(o(z))
|
|
98
101
|
])
|
|
99
102
|
], 2)
|
|
100
103
|
])
|
|
@@ -3,7 +3,7 @@ import { Ref } from 'vue';
|
|
|
3
3
|
import { Translator } from '../../../config-provider';
|
|
4
4
|
type GetOssAccess = () => Promise<accessCreate>;
|
|
5
5
|
export declare function injectLocaleToOss(tValue: Translator, langValue: Ref<string>): void;
|
|
6
|
-
export declare function getOssInstance(getOssAccess?: GetOssAccess): Promise<Oss>;
|
|
6
|
+
export declare function getOssInstance(getOssAccess?: GetOssAccess, bucket?: string): Promise<Oss>;
|
|
7
7
|
export declare function getSignatureUrl({ oss, fileName }: {
|
|
8
8
|
oss: Oss;
|
|
9
9
|
fileName: string;
|