@vrojs/element-plus 0.0.3 → 0.0.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/dist/index.d.ts +1 -0
- package/dist/index.js +89 -80
- package/dist/locale/index.d.ts +1 -0
- package/dist/locale/index.js +6 -4
- package/dist/locale/lang/en.d.ts +46 -0
- package/dist/locale/lang/en.js +48 -0
- package/dist/locale/lang/zh-cn.d.ts +0 -1
- package/dist/locale/lang/zh-cn.js +1 -2
- package/dist/locale/useLocale.d.ts +0 -1
- package/dist/vro-el-image/index.d.ts +207 -0
- package/dist/vro-el-image/index.js +12 -0
- package/dist/vro-el-image/style/css.d.ts +0 -0
- package/dist/vro-el-image/style/css.js +3 -0
- package/dist/vro-el-image/style/deps.d.ts +0 -0
- package/dist/vro-el-image/style/deps.js +1 -0
- package/dist/vro-el-image/style/index.d.ts +0 -0
- package/dist/vro-el-image/style/index.js +4 -0
- package/dist/vro-el-image/types.d.ts +54 -0
- package/dist/vro-el-image/types.js +15 -0
- package/dist/vro-el-image/utils.d.ts +2 -0
- package/dist/vro-el-image/utils.js +6 -0
- package/dist/vro-el-image/vro-el-image.vue.d.ts +122 -0
- package/dist/vro-el-image/vro-el-image.vue.js +32 -0
- package/dist/vro-el-image/vro-el-image.vue2.js +4 -0
- package/dist/vro-el-image-upload/index.d.ts +7 -7
- package/dist/vro-el-image-upload/style/css.js +1 -0
- package/dist/vro-el-image-upload/style/deps.js +1 -1
- package/dist/vro-el-image-upload/style/index.js +2 -1
- package/dist/vro-el-image-upload/types.d.ts +9 -7
- package/dist/vro-el-image-upload/types.js +2 -2
- package/dist/vro-el-image-upload/vro-el-image-upload.vue.d.ts +10 -9
- package/dist/vro-el-image-upload/vro-el-image-upload.vue.js +81 -75
- package/dist/vro-el-schema-filter/index.d.ts +1 -3
- package/dist/vro-el-schema-filter/style/css.js +1 -0
- package/dist/vro-el-schema-filter/style/index.js +1 -0
- package/dist/vro-el-schema-filter/vro-el-schema-filter.vue.d.ts +2 -6
- package/dist/vro-el-schema-form/index.d.ts +1 -3
- package/dist/vro-el-schema-form/style/css.js +1 -0
- package/dist/vro-el-schema-form/style/index.js +1 -0
- package/dist/vro-el-schema-form/types.d.ts +8 -0
- package/dist/vro-el-schema-form/useVroElSchemaForm.d.ts +2 -6
- package/dist/vro-el-schema-form/useVroElSchemaForm.js +14 -17
- package/dist/vro-el-schema-form/vro-el-schema-form.vue.d.ts +1 -3
- package/dist/vro-el-schema-form/vro-el-schema-form.vue.js +84 -77
- package/dist/vro-el-schema-form-dialog/index.d.ts +4 -12
- package/dist/vro-el-schema-form-dialog/style/css.js +1 -0
- package/dist/vro-el-schema-form-dialog/style/index.js +1 -0
- package/dist/vro-el-schema-form-dialog/vro-el-schema-form-dialog.vue.d.ts +3 -9
- package/package.json +4 -4
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
export type VroElImageNormalizeSrc = (options: {
|
|
3
|
+
src: string;
|
|
4
|
+
ratio?: string | number;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
}) => string;
|
|
7
|
+
export declare const vroElImageProps: {
|
|
8
|
+
previewTeleported: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
default: boolean;
|
|
11
|
+
};
|
|
12
|
+
baseUrl: StringConstructor;
|
|
13
|
+
ratio: (NumberConstructor | StringConstructor)[];
|
|
14
|
+
previewRatio: (NumberConstructor | StringConstructor)[];
|
|
15
|
+
normalizeSrc: PropType<VroElImageNormalizeSrc>;
|
|
16
|
+
hideOnClickModal: BooleanConstructor;
|
|
17
|
+
src: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
18
|
+
fit: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<StringConstructor, "" | "none" | "fill" | "contain" | "cover" | "scale-down", unknown, "", boolean>;
|
|
19
|
+
loading: {
|
|
20
|
+
readonly type: PropType<import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<StringConstructor, "lazy" | "eager", unknown>>;
|
|
21
|
+
readonly required: false;
|
|
22
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
23
|
+
__epPropKey: true;
|
|
24
|
+
};
|
|
25
|
+
lazy: BooleanConstructor;
|
|
26
|
+
scrollContainer: {
|
|
27
|
+
readonly type: PropType<import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement | undefined) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement | undefined)) | null)[], unknown, unknown>>;
|
|
28
|
+
readonly required: false;
|
|
29
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
30
|
+
__epPropKey: true;
|
|
31
|
+
};
|
|
32
|
+
previewSrcList: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<(new (...args: any[]) => string[]) | (() => string[]) | (((new (...args: any[]) => string[]) | (() => string[])) | null)[], unknown, unknown, () => [], boolean>;
|
|
33
|
+
zIndex: {
|
|
34
|
+
readonly type: PropType<number>;
|
|
35
|
+
readonly required: false;
|
|
36
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
37
|
+
__epPropKey: true;
|
|
38
|
+
};
|
|
39
|
+
initialIndex: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
40
|
+
infinite: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
41
|
+
closeOnPressEscape: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
42
|
+
zoomRate: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 1.2, boolean>;
|
|
43
|
+
scale: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
|
|
44
|
+
minScale: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 0.2, boolean>;
|
|
45
|
+
maxScale: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
|
|
46
|
+
showProgress: BooleanConstructor;
|
|
47
|
+
crossorigin: {
|
|
48
|
+
readonly type: PropType<import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<(new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => import('element-plus').ImageCrossorigin) | (((new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => import('element-plus').ImageCrossorigin)) | null)[], unknown, unknown>>;
|
|
49
|
+
readonly required: false;
|
|
50
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
51
|
+
__epPropKey: true;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type VroElImageProps = ExtractPropTypes<typeof vroElImageProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { imageProps as r } from "element-plus";
|
|
2
|
+
const o = {
|
|
3
|
+
...r,
|
|
4
|
+
previewTeleported: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: !0
|
|
7
|
+
},
|
|
8
|
+
baseUrl: String,
|
|
9
|
+
ratio: [String, Number],
|
|
10
|
+
previewRatio: [String, Number],
|
|
11
|
+
normalizeSrc: Function
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
o as vroElImageProps
|
|
15
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { VroElImageProps } from './types';
|
|
2
|
+
export declare const setVroElImageOptions: (value: Partial<Pick<VroElImageProps, "baseUrl" | "normalizeSrc">>) => Partial<Pick<VroElImageProps, "baseUrl" | "normalizeSrc">>, getVroElImageOptions: () => Partial<Pick<VroElImageProps, "baseUrl" | "normalizeSrc">>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
declare function __VLS_template(): {
|
|
2
|
+
attrs: Partial<{}>;
|
|
3
|
+
slots: Partial<Record<string, (_: any) => any>>;
|
|
4
|
+
refs: {};
|
|
5
|
+
rootEl: any;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
8
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
9
|
+
previewTeleported: {
|
|
10
|
+
type: BooleanConstructor;
|
|
11
|
+
default: boolean;
|
|
12
|
+
};
|
|
13
|
+
baseUrl: StringConstructor;
|
|
14
|
+
ratio: (NumberConstructor | StringConstructor)[];
|
|
15
|
+
previewRatio: (NumberConstructor | StringConstructor)[];
|
|
16
|
+
normalizeSrc: import('vue').PropType<import('./types').VroElImageNormalizeSrc>;
|
|
17
|
+
hideOnClickModal: BooleanConstructor;
|
|
18
|
+
src: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
19
|
+
fit: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<StringConstructor, "" | "none" | "fill" | "contain" | "cover" | "scale-down", unknown, "", boolean>;
|
|
20
|
+
loading: {
|
|
21
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<StringConstructor, "lazy" | "eager", unknown>>;
|
|
22
|
+
readonly required: false;
|
|
23
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
24
|
+
__epPropKey: true;
|
|
25
|
+
};
|
|
26
|
+
lazy: BooleanConstructor;
|
|
27
|
+
scrollContainer: {
|
|
28
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement | undefined) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement | undefined)) | null)[], unknown, unknown>>;
|
|
29
|
+
readonly required: false;
|
|
30
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
31
|
+
__epPropKey: true;
|
|
32
|
+
};
|
|
33
|
+
previewSrcList: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<(new (...args: any[]) => string[]) | (() => string[]) | (((new (...args: any[]) => string[]) | (() => string[])) | null)[], unknown, unknown, () => [], boolean>;
|
|
34
|
+
zIndex: {
|
|
35
|
+
readonly type: import('vue').PropType<number>;
|
|
36
|
+
readonly required: false;
|
|
37
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
38
|
+
__epPropKey: true;
|
|
39
|
+
};
|
|
40
|
+
initialIndex: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
41
|
+
infinite: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
42
|
+
closeOnPressEscape: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
43
|
+
zoomRate: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 1.2, boolean>;
|
|
44
|
+
scale: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
|
|
45
|
+
minScale: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 0.2, boolean>;
|
|
46
|
+
maxScale: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
|
|
47
|
+
showProgress: BooleanConstructor;
|
|
48
|
+
crossorigin: {
|
|
49
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<(new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => import('element-plus').ImageCrossorigin) | (((new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => import('element-plus').ImageCrossorigin)) | null)[], unknown, unknown>>;
|
|
50
|
+
readonly required: false;
|
|
51
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
52
|
+
__epPropKey: true;
|
|
53
|
+
};
|
|
54
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
55
|
+
previewTeleported: {
|
|
56
|
+
type: BooleanConstructor;
|
|
57
|
+
default: boolean;
|
|
58
|
+
};
|
|
59
|
+
baseUrl: StringConstructor;
|
|
60
|
+
ratio: (NumberConstructor | StringConstructor)[];
|
|
61
|
+
previewRatio: (NumberConstructor | StringConstructor)[];
|
|
62
|
+
normalizeSrc: import('vue').PropType<import('./types').VroElImageNormalizeSrc>;
|
|
63
|
+
hideOnClickModal: BooleanConstructor;
|
|
64
|
+
src: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
65
|
+
fit: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<StringConstructor, "" | "none" | "fill" | "contain" | "cover" | "scale-down", unknown, "", boolean>;
|
|
66
|
+
loading: {
|
|
67
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<StringConstructor, "lazy" | "eager", unknown>>;
|
|
68
|
+
readonly required: false;
|
|
69
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
70
|
+
__epPropKey: true;
|
|
71
|
+
};
|
|
72
|
+
lazy: BooleanConstructor;
|
|
73
|
+
scrollContainer: {
|
|
74
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement | undefined) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement | undefined)) | null)[], unknown, unknown>>;
|
|
75
|
+
readonly required: false;
|
|
76
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
77
|
+
__epPropKey: true;
|
|
78
|
+
};
|
|
79
|
+
previewSrcList: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<(new (...args: any[]) => string[]) | (() => string[]) | (((new (...args: any[]) => string[]) | (() => string[])) | null)[], unknown, unknown, () => [], boolean>;
|
|
80
|
+
zIndex: {
|
|
81
|
+
readonly type: import('vue').PropType<number>;
|
|
82
|
+
readonly required: false;
|
|
83
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
84
|
+
__epPropKey: true;
|
|
85
|
+
};
|
|
86
|
+
initialIndex: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
87
|
+
infinite: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
88
|
+
closeOnPressEscape: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
89
|
+
zoomRate: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 1.2, boolean>;
|
|
90
|
+
scale: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
|
|
91
|
+
minScale: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 0.2, boolean>;
|
|
92
|
+
maxScale: import('element-plus/es/utils/vue/props/types.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
|
|
93
|
+
showProgress: BooleanConstructor;
|
|
94
|
+
crossorigin: {
|
|
95
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<(new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => import('element-plus').ImageCrossorigin) | (((new (...args: any[]) => "" | "anonymous" | "use-credentials") | (() => import('element-plus').ImageCrossorigin)) | null)[], unknown, unknown>>;
|
|
96
|
+
readonly required: false;
|
|
97
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
98
|
+
__epPropKey: true;
|
|
99
|
+
};
|
|
100
|
+
}>> & Readonly<{}>, {
|
|
101
|
+
previewTeleported: boolean;
|
|
102
|
+
hideOnClickModal: boolean;
|
|
103
|
+
src: string;
|
|
104
|
+
fit: import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<StringConstructor, "" | "fill" | "none" | "contain" | "cover" | "scale-down", unknown>;
|
|
105
|
+
lazy: boolean;
|
|
106
|
+
previewSrcList: string[];
|
|
107
|
+
initialIndex: number;
|
|
108
|
+
infinite: import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
109
|
+
closeOnPressEscape: import('element-plus/es/utils/vue/props/types.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
110
|
+
zoomRate: number;
|
|
111
|
+
scale: number;
|
|
112
|
+
minScale: number;
|
|
113
|
+
maxScale: number;
|
|
114
|
+
showProgress: boolean;
|
|
115
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
116
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
117
|
+
export default _default;
|
|
118
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
119
|
+
new (): {
|
|
120
|
+
$slots: S;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineComponent as g, useSlots as d, computed as i, createBlock as v, openBlock as _, unref as P, mergeProps as S, createSlots as w, renderList as E, withCtx as I, renderSlot as h, normalizeProps as k, guardReactiveProps as B } from "vue";
|
|
2
|
+
import { omitBy as b, isUndefined as x } from "@daysnap/utils";
|
|
3
|
+
import { ElImage as y } from "element-plus";
|
|
4
|
+
import { vroElImageProps as z } from "./types.js";
|
|
5
|
+
import { getVroElImageOptions as C } from "./utils.js";
|
|
6
|
+
const j = /* @__PURE__ */ g({
|
|
7
|
+
name: "VroElImage",
|
|
8
|
+
__name: "vro-el-image",
|
|
9
|
+
props: z,
|
|
10
|
+
setup(m) {
|
|
11
|
+
const n = m, l = d(), p = i(() => Object.keys(l)), c = i(() => {
|
|
12
|
+
let { ratio: o, previewRatio: s, previewSrcList: e, normalizeSrc: r, baseUrl: a, src: t, ...f } = {
|
|
13
|
+
...C(),
|
|
14
|
+
...b(n, x)
|
|
15
|
+
};
|
|
16
|
+
return r && (t = r({ src: t, ratio: o, baseUrl: a }), e?.length && (e = e.map(
|
|
17
|
+
(u) => r({ src: u, ratio: s ?? o, baseUrl: a })
|
|
18
|
+
))), { ...f, src: t, previewSrcList: e };
|
|
19
|
+
});
|
|
20
|
+
return (o, s) => (_(), v(P(y), S(c.value, { class: "vro-el-image" }), w({ _: 2 }, [
|
|
21
|
+
E(p.value, (e) => ({
|
|
22
|
+
name: e,
|
|
23
|
+
fn: I((r) => [
|
|
24
|
+
h(o.$slots, e, k(B(r ?? {})))
|
|
25
|
+
])
|
|
26
|
+
}))
|
|
27
|
+
]), 1040));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
j as default
|
|
32
|
+
};
|
|
@@ -2,7 +2,7 @@ export * from './types';
|
|
|
2
2
|
export * from './utils';
|
|
3
3
|
export declare const VroElImageUpload: import('@vrojs/base').WithInstall<import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
4
|
modelValue: {
|
|
5
|
-
type: import('vue').PropType<
|
|
5
|
+
type: import('vue').PropType<import('./types').VroElImageUploadModelValue>;
|
|
6
6
|
default: string;
|
|
7
7
|
};
|
|
8
8
|
max: {
|
|
@@ -14,13 +14,13 @@ export declare const VroElImageUpload: import('@vrojs/base').WithInstall<import(
|
|
|
14
14
|
value: boolean;
|
|
15
15
|
}>;
|
|
16
16
|
params: import('vue').PropType<Record<string, any>>;
|
|
17
|
-
imageProps: import('vue').PropType<Partial<import('
|
|
17
|
+
imageProps: import('vue').PropType<Partial<import('..').VroElImageProps>>;
|
|
18
18
|
upload: import('vue').PropType<import('./types').VroElImageUploadCallback>;
|
|
19
19
|
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
20
|
-
"update:modelValue": (value:
|
|
20
|
+
"update:modelValue": (value: import('./types').VroElImageUploadModelValue) => any;
|
|
21
21
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
22
22
|
modelValue: {
|
|
23
|
-
type: import('vue').PropType<
|
|
23
|
+
type: import('vue').PropType<import('./types').VroElImageUploadModelValue>;
|
|
24
24
|
default: string;
|
|
25
25
|
};
|
|
26
26
|
max: {
|
|
@@ -32,13 +32,13 @@ export declare const VroElImageUpload: import('@vrojs/base').WithInstall<import(
|
|
|
32
32
|
value: boolean;
|
|
33
33
|
}>;
|
|
34
34
|
params: import('vue').PropType<Record<string, any>>;
|
|
35
|
-
imageProps: import('vue').PropType<Partial<import('
|
|
35
|
+
imageProps: import('vue').PropType<Partial<import('..').VroElImageProps>>;
|
|
36
36
|
upload: import('vue').PropType<import('./types').VroElImageUploadCallback>;
|
|
37
37
|
}>> & Readonly<{
|
|
38
|
-
"onUpdate:modelValue"?: ((value:
|
|
38
|
+
"onUpdate:modelValue"?: ((value: import('./types').VroElImageUploadModelValue) => any) | undefined;
|
|
39
39
|
}>, {
|
|
40
40
|
disabled: boolean;
|
|
41
|
-
modelValue:
|
|
41
|
+
modelValue: import('./types').VroElImageUploadModelValue;
|
|
42
42
|
max: number;
|
|
43
43
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>>;
|
|
44
44
|
export default VroElImageUpload;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import "element-plus/es/components/image/style/css";
|
|
1
2
|
import "element-plus/es/components/checkbox/style/css";
|
|
2
3
|
import "element-plus/es/components/icon/style/css";
|
|
3
|
-
import "element-plus/es/components/image/style/css";
|
|
4
4
|
import "element-plus/es/components/loading/style/css";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import '../../style/base.css';
|
|
2
2
|
import './index.css';
|
|
3
|
+
import "element-plus/es/components/image/style/css";
|
|
3
4
|
import "element-plus/es/components/checkbox/style/css";
|
|
4
5
|
import "element-plus/es/components/icon/style/css";
|
|
5
|
-
import "element-plus/es/components/image/style/css";
|
|
6
6
|
import "element-plus/es/components/loading/style/css";
|
|
7
7
|
/* empty css */
|
|
8
|
+
/* empty css */
|
|
8
9
|
/* empty css */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ElImage } from 'element-plus';
|
|
2
1
|
import { ExtractPropTypes, PropType } from 'vue';
|
|
3
|
-
|
|
2
|
+
import { VroElImageProps } from '../vro-el-image/types';
|
|
3
|
+
export type VroElImageUploadItem = string | File;
|
|
4
|
+
export type VroElImageUploadModelValue = string | VroElImageUploadItem[];
|
|
5
|
+
export type VroElImageUploadUploadResult = string[] | File[];
|
|
4
6
|
export interface VroElImageUploadCallback<T = any> {
|
|
5
7
|
(
|
|
6
8
|
/** 当前待上传的图片文件列表 */
|
|
@@ -9,12 +11,12 @@ export interface VroElImageUploadCallback<T = any> {
|
|
|
9
11
|
compress: boolean;
|
|
10
12
|
/** 上传时透传的自定义参数 */
|
|
11
13
|
params: T;
|
|
12
|
-
}): Promise<
|
|
14
|
+
}): Promise<VroElImageUploadUploadResult>;
|
|
13
15
|
}
|
|
14
16
|
export declare const vroElImageUploadProps: {
|
|
15
|
-
/**
|
|
17
|
+
/** 绑定值,字符串为单图远程地址,数组为多图或本地 File 列表 */
|
|
16
18
|
modelValue: {
|
|
17
|
-
type: PropType<
|
|
19
|
+
type: PropType<VroElImageUploadModelValue>;
|
|
18
20
|
default: string;
|
|
19
21
|
};
|
|
20
22
|
/** 最多可上传的图片数量 */
|
|
@@ -31,8 +33,8 @@ export declare const vroElImageUploadProps: {
|
|
|
31
33
|
/** 上传时透传给 upload 回调的自定义参数 */
|
|
32
34
|
params: PropType<Record<string, any>>;
|
|
33
35
|
/** 透传给 Element Plus Image 的属性 */
|
|
34
|
-
imageProps: PropType<Partial<
|
|
35
|
-
/**
|
|
36
|
+
imageProps: PropType<Partial<VroElImageProps>>;
|
|
37
|
+
/** 自定义上传方法,默认返回 File 列表用于本地预览和后续业务处理 */
|
|
36
38
|
upload: PropType<VroElImageUploadCallback>;
|
|
37
39
|
};
|
|
38
40
|
export type VroElImageUploadProps = ExtractPropTypes<typeof vroElImageUploadProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const e = {
|
|
2
|
-
/**
|
|
2
|
+
/** 绑定值,字符串为单图远程地址,数组为多图或本地 File 列表 */
|
|
3
3
|
modelValue: {
|
|
4
4
|
type: [String, Array],
|
|
5
5
|
default: ""
|
|
@@ -17,7 +17,7 @@ const e = {
|
|
|
17
17
|
params: Object,
|
|
18
18
|
/** 透传给 Element Plus Image 的属性 */
|
|
19
19
|
imageProps: Object,
|
|
20
|
-
/**
|
|
20
|
+
/** 自定义上传方法,默认返回 File 列表用于本地预览和后续业务处理 */
|
|
21
21
|
upload: Function
|
|
22
22
|
};
|
|
23
23
|
export {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { VroElImageUploadCallback, VroElImageUploadModelValue } from './types';
|
|
1
2
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
3
|
modelValue: {
|
|
3
|
-
type: import('vue').PropType<
|
|
4
|
+
type: import('vue').PropType<VroElImageUploadModelValue>;
|
|
4
5
|
default: string;
|
|
5
6
|
};
|
|
6
7
|
max: {
|
|
@@ -12,13 +13,13 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
12
13
|
value: boolean;
|
|
13
14
|
}>;
|
|
14
15
|
params: import('vue').PropType<Record<string, any>>;
|
|
15
|
-
imageProps: import('vue').PropType<Partial<import('
|
|
16
|
-
upload: import('vue').PropType<
|
|
16
|
+
imageProps: import('vue').PropType<Partial<import('..').VroElImageProps>>;
|
|
17
|
+
upload: import('vue').PropType<VroElImageUploadCallback>;
|
|
17
18
|
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
18
|
-
"update:modelValue": (value:
|
|
19
|
+
"update:modelValue": (value: VroElImageUploadModelValue) => any;
|
|
19
20
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
20
21
|
modelValue: {
|
|
21
|
-
type: import('vue').PropType<
|
|
22
|
+
type: import('vue').PropType<VroElImageUploadModelValue>;
|
|
22
23
|
default: string;
|
|
23
24
|
};
|
|
24
25
|
max: {
|
|
@@ -30,13 +31,13 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
30
31
|
value: boolean;
|
|
31
32
|
}>;
|
|
32
33
|
params: import('vue').PropType<Record<string, any>>;
|
|
33
|
-
imageProps: import('vue').PropType<Partial<import('
|
|
34
|
-
upload: import('vue').PropType<
|
|
34
|
+
imageProps: import('vue').PropType<Partial<import('..').VroElImageProps>>;
|
|
35
|
+
upload: import('vue').PropType<VroElImageUploadCallback>;
|
|
35
36
|
}>> & Readonly<{
|
|
36
|
-
"onUpdate:modelValue"?: ((value:
|
|
37
|
+
"onUpdate:modelValue"?: ((value: VroElImageUploadModelValue) => any) | undefined;
|
|
37
38
|
}>, {
|
|
38
39
|
disabled: boolean;
|
|
39
|
-
modelValue:
|
|
40
|
+
modelValue: VroElImageUploadModelValue;
|
|
40
41
|
max: number;
|
|
41
42
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
42
43
|
export default _default;
|
|
@@ -1,126 +1,132 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { omitBy as
|
|
3
|
-
import { CircleCloseFilled as
|
|
4
|
-
import { useAsyncTask as
|
|
5
|
-
import { ElLoading as
|
|
6
|
-
import { VueDraggable as
|
|
7
|
-
import { useLocale as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { defineComponent as A, computed as g, ref as M, onBeforeUnmount as O, createElementBlock as m, openBlock as s, createVNode as i, createBlock as k, createCommentVNode as V, unref as o, withCtx as c, withDirectives as T, Fragment as j, renderList as S, mergeProps as z, createElementVNode as K, createTextVNode as q, toDisplayString as G } from "vue";
|
|
2
|
+
import { omitBy as H, isUndefined as J, isBoolean as Q, isArray as p } from "@daysnap/utils";
|
|
3
|
+
import { CircleCloseFilled as W, Plus as X } from "@element-plus/icons-vue";
|
|
4
|
+
import { useAsyncTask as Y } from "@vrojs/use";
|
|
5
|
+
import { ElLoading as Z, ElIcon as w, ElCheckbox as ee } from "element-plus";
|
|
6
|
+
import { VueDraggable as le } from "vue-draggable-plus";
|
|
7
|
+
import { useLocale as ae } from "../locale/useLocale.js";
|
|
8
|
+
import { VroElImage as oe } from "../vro-el-image/index.js";
|
|
9
|
+
import { vroElImageUploadProps as te } from "./types.js";
|
|
10
|
+
import { getVroElImageUploadOptions as re } from "./utils.js";
|
|
11
|
+
const se = { class: "vro-el-image-upload" }, ue = {
|
|
11
12
|
key: 0,
|
|
12
13
|
class: "vro-el-image-upload-item vro-el-image-upload-btn"
|
|
13
|
-
},
|
|
14
|
+
}, ie = ["multiple"], ye = /* @__PURE__ */ A({
|
|
14
15
|
name: "VroElImageUpload",
|
|
15
16
|
__name: "vro-el-image-upload",
|
|
16
|
-
props:
|
|
17
|
+
props: te,
|
|
17
18
|
emits: ["update:modelValue"],
|
|
18
|
-
setup(
|
|
19
|
-
const
|
|
19
|
+
setup(E, { emit: x }) {
|
|
20
|
+
const v = x, C = E, { t: L } = ae(), n = /* @__PURE__ */ new Map(), U = async (e) => e, a = g(() => {
|
|
20
21
|
const {
|
|
21
|
-
compressible:
|
|
22
|
-
upload:
|
|
22
|
+
compressible: e = !1,
|
|
23
|
+
upload: l = U,
|
|
23
24
|
...t
|
|
24
25
|
} = {
|
|
25
|
-
...
|
|
26
|
-
...
|
|
26
|
+
...re(),
|
|
27
|
+
...H(C, J)
|
|
27
28
|
};
|
|
28
29
|
return {
|
|
29
|
-
upload:
|
|
30
|
-
compressible:
|
|
31
|
-
compress:
|
|
30
|
+
upload: l,
|
|
31
|
+
compressible: e,
|
|
32
|
+
compress: Q(e) ? e : e.value,
|
|
32
33
|
...t
|
|
33
34
|
};
|
|
34
|
-
}),
|
|
35
|
-
const { modelValue:
|
|
36
|
-
return
|
|
37
|
-
}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
}), B = Z.directive, f = M(a.value.compress), u = g(() => {
|
|
36
|
+
const { modelValue: e } = a.value;
|
|
37
|
+
return p(e) ? e : e ? [e] : [];
|
|
38
|
+
}), y = g(() => u.value.map((e) => I(e))), I = (e) => {
|
|
39
|
+
if (typeof e == "string")
|
|
40
|
+
return e;
|
|
41
|
+
let l = n.get(e);
|
|
42
|
+
return l || (l = URL.createObjectURL(e), n.set(e, l)), l;
|
|
43
|
+
}, P = (e, l) => typeof e == "string" ? e : `${e.name}-${e.size}-${e.lastModified}-${l}`, $ = (e) => e.some((l) => l instanceof File), D = (e) => {
|
|
44
|
+
p(a.value.modelValue) && v("update:modelValue", e);
|
|
45
|
+
}, F = (e) => {
|
|
46
|
+
let l = "";
|
|
47
|
+
p(a.value.modelValue) && (l = [...a.value.modelValue], l.splice(e, 1)), v("update:modelValue", l);
|
|
48
|
+
}, { loading: N, trigger: b } = Y(
|
|
49
|
+
async (e) => {
|
|
50
|
+
const l = e.target, t = Array.from(l.files ?? []);
|
|
51
|
+
if (l.value = "", !t?.length)
|
|
46
52
|
return;
|
|
47
|
-
const { max:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const V = await v(t.slice(0, u - s.value.length), {
|
|
51
|
-
compress: c.value,
|
|
52
|
-
params: P
|
|
53
|
+
const { max: r, upload: _ = U, params: R } = a.value, d = await _(t.slice(0, r - u.value.length), {
|
|
54
|
+
compress: f.value,
|
|
55
|
+
params: R
|
|
53
56
|
});
|
|
54
|
-
let
|
|
55
|
-
|
|
57
|
+
let h = $(d) ? d : d[0];
|
|
58
|
+
p(a.value.modelValue) && (h = [...a.value.modelValue, ...d]), v("update:modelValue", h);
|
|
56
59
|
},
|
|
57
60
|
{
|
|
58
61
|
throwError: !0
|
|
59
62
|
}
|
|
60
63
|
);
|
|
61
|
-
return (
|
|
62
|
-
|
|
64
|
+
return O(() => {
|
|
65
|
+
n.forEach((e) => URL.revokeObjectURL(e)), n.clear();
|
|
66
|
+
}), (e, l) => (s(), m("div", se, [
|
|
67
|
+
i(o(le), {
|
|
63
68
|
class: "vro-el-image-upload-content",
|
|
64
|
-
disabled:
|
|
69
|
+
disabled: a.value.disabled || a.value.max <= 1,
|
|
65
70
|
animation: 150,
|
|
66
|
-
"model-value":
|
|
71
|
+
"model-value": u.value,
|
|
67
72
|
filter: ".vro-el-image-upload-btn",
|
|
68
|
-
"onUpdate:modelValue":
|
|
73
|
+
"onUpdate:modelValue": D
|
|
69
74
|
}, {
|
|
70
|
-
default:
|
|
71
|
-
(
|
|
75
|
+
default: c(() => [
|
|
76
|
+
(s(!0), m(j, null, S(u.value, (t, r) => (s(), m("div", {
|
|
72
77
|
class: "vro-el-image-upload-item",
|
|
73
|
-
key: t
|
|
78
|
+
key: P(t, r)
|
|
74
79
|
}, [
|
|
75
|
-
i(o(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
80
|
+
i(o(oe), z({ ref_for: !0 }, a.value.imageProps, {
|
|
81
|
+
class: "vro-el-image-upload-image",
|
|
82
|
+
src: y.value[r],
|
|
83
|
+
"preview-src-list": y.value,
|
|
84
|
+
"initial-index": r
|
|
79
85
|
}), null, 16, ["src", "preview-src-list", "initial-index"]),
|
|
80
|
-
|
|
86
|
+
a.value.disabled ? V("", !0) : (s(), k(o(w), {
|
|
81
87
|
key: 0,
|
|
82
88
|
class: "vro-el-image-upload-clear",
|
|
83
|
-
onClick: (
|
|
89
|
+
onClick: (_) => F(r)
|
|
84
90
|
}, {
|
|
85
|
-
default:
|
|
86
|
-
i(o(
|
|
91
|
+
default: c(() => [
|
|
92
|
+
i(o(W))
|
|
87
93
|
]),
|
|
88
94
|
_: 1
|
|
89
95
|
}, 8, ["onClick"]))
|
|
90
96
|
]))), 128)),
|
|
91
|
-
|
|
92
|
-
i(o(
|
|
93
|
-
default:
|
|
94
|
-
i(o(
|
|
97
|
+
u.value.length < a.value.max && !a.value.disabled ? T((s(), m("div", ue, [
|
|
98
|
+
i(o(w), { class: "vro-el-image-upload-add" }, {
|
|
99
|
+
default: c(() => [
|
|
100
|
+
i(o(X))
|
|
95
101
|
]),
|
|
96
102
|
_: 1
|
|
97
103
|
}),
|
|
98
|
-
|
|
104
|
+
K("input", {
|
|
99
105
|
type: "file",
|
|
100
106
|
accept: "image/*",
|
|
101
|
-
multiple:
|
|
102
|
-
onChange:
|
|
103
|
-
(...t) => o(
|
|
104
|
-
}, null, 40,
|
|
107
|
+
multiple: a.value.max > 1,
|
|
108
|
+
onChange: l[0] || (l[0] = //@ts-ignore
|
|
109
|
+
(...t) => o(b) && o(b)(...t))
|
|
110
|
+
}, null, 40, ie)
|
|
105
111
|
])), [
|
|
106
|
-
[o(
|
|
107
|
-
]) :
|
|
112
|
+
[o(B), o(N)]
|
|
113
|
+
]) : V("", !0)
|
|
108
114
|
]),
|
|
109
115
|
_: 1
|
|
110
116
|
}, 8, ["disabled", "model-value"]),
|
|
111
|
-
!
|
|
117
|
+
!a.value.disabled && a.value.compressible ? (s(), k(o(ee), {
|
|
112
118
|
key: 0,
|
|
113
|
-
modelValue:
|
|
114
|
-
"onUpdate:modelValue":
|
|
119
|
+
modelValue: f.value,
|
|
120
|
+
"onUpdate:modelValue": l[1] || (l[1] = (t) => f.value = t)
|
|
115
121
|
}, {
|
|
116
|
-
default:
|
|
117
|
-
|
|
122
|
+
default: c(() => [
|
|
123
|
+
q(G(o(L)("imageUpload.compressText")), 1)
|
|
118
124
|
]),
|
|
119
125
|
_: 1
|
|
120
|
-
}, 8, ["modelValue"])) :
|
|
126
|
+
}, 8, ["modelValue"])) : V("", !0)
|
|
121
127
|
]));
|
|
122
128
|
}
|
|
123
129
|
});
|
|
124
130
|
export {
|
|
125
|
-
|
|
131
|
+
ye as default
|
|
126
132
|
};
|