@vrojs/element-plus 0.0.3 → 0.0.4

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.
Files changed (41) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +85 -78
  3. package/dist/vro-el-image/index.d.ts +207 -0
  4. package/dist/vro-el-image/index.js +12 -0
  5. package/dist/vro-el-image/style/css.d.ts +0 -0
  6. package/dist/vro-el-image/style/css.js +3 -0
  7. package/dist/vro-el-image/style/deps.d.ts +0 -0
  8. package/dist/vro-el-image/style/deps.js +1 -0
  9. package/dist/vro-el-image/style/index.d.ts +0 -0
  10. package/dist/vro-el-image/style/index.js +4 -0
  11. package/dist/vro-el-image/types.d.ts +54 -0
  12. package/dist/vro-el-image/types.js +15 -0
  13. package/dist/vro-el-image/utils.d.ts +2 -0
  14. package/dist/vro-el-image/utils.js +6 -0
  15. package/dist/vro-el-image/vro-el-image.vue.d.ts +122 -0
  16. package/dist/vro-el-image/vro-el-image.vue.js +32 -0
  17. package/dist/vro-el-image/vro-el-image.vue2.js +4 -0
  18. package/dist/vro-el-image-upload/index.d.ts +7 -7
  19. package/dist/vro-el-image-upload/style/css.js +1 -0
  20. package/dist/vro-el-image-upload/style/deps.js +1 -1
  21. package/dist/vro-el-image-upload/style/index.js +2 -1
  22. package/dist/vro-el-image-upload/types.d.ts +9 -7
  23. package/dist/vro-el-image-upload/types.js +2 -2
  24. package/dist/vro-el-image-upload/vro-el-image-upload.vue.d.ts +10 -9
  25. package/dist/vro-el-image-upload/vro-el-image-upload.vue.js +81 -75
  26. package/dist/vro-el-schema-filter/index.d.ts +1 -3
  27. package/dist/vro-el-schema-filter/style/css.js +1 -0
  28. package/dist/vro-el-schema-filter/style/index.js +1 -0
  29. package/dist/vro-el-schema-filter/vro-el-schema-filter.vue.d.ts +2 -6
  30. package/dist/vro-el-schema-form/index.d.ts +1 -3
  31. package/dist/vro-el-schema-form/style/css.js +1 -0
  32. package/dist/vro-el-schema-form/style/index.js +1 -0
  33. package/dist/vro-el-schema-form/types.d.ts +8 -0
  34. package/dist/vro-el-schema-form/useVroElSchemaForm.d.ts +2 -6
  35. package/dist/vro-el-schema-form/vro-el-schema-form.vue.d.ts +1 -3
  36. package/dist/vro-el-schema-form/vro-el-schema-form.vue.js +82 -75
  37. package/dist/vro-el-schema-form-dialog/index.d.ts +4 -12
  38. package/dist/vro-el-schema-form-dialog/style/css.js +1 -0
  39. package/dist/vro-el-schema-form-dialog/style/index.js +1 -0
  40. package/dist/vro-el-schema-form-dialog/vro-el-schema-form-dialog.vue.d.ts +3 -9
  41. package/package.json +3 -3
@@ -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
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./vro-el-image.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -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<string | string[]>;
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('./types').VroElImageUploadImageProps>>;
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: string | string[]) => any;
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<string | string[]>;
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('./types').VroElImageUploadImageProps>>;
35
+ imageProps: import('vue').PropType<Partial<import('..').VroElImageProps>>;
36
36
  upload: import('vue').PropType<import('./types').VroElImageUploadCallback>;
37
37
  }>> & Readonly<{
38
- "onUpdate:modelValue"?: ((value: string | string[]) => any) | undefined;
38
+ "onUpdate:modelValue"?: ((value: import('./types').VroElImageUploadModelValue) => any) | undefined;
39
39
  }>, {
40
40
  disabled: boolean;
41
- modelValue: string | string[];
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,5 @@
1
1
  import '../../style/base.css';
2
2
  import './index.css';
3
3
  /* empty css */
4
+ /* empty css */
4
5
  /* empty css */
@@ -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
- export type VroElImageUploadImageProps = InstanceType<typeof ElImage>['$props'];
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<string[]>;
14
+ }): Promise<VroElImageUploadUploadResult>;
13
15
  }
14
16
  export declare const vroElImageUploadProps: {
15
- /** 绑定值,字符串为单图模式,数组为多图模式 */
17
+ /** 绑定值,字符串为单图远程地址,数组为多图或本地 File 列表 */
16
18
  modelValue: {
17
- type: PropType<string | string[]>;
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<VroElImageUploadImageProps>>;
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<string | string[]>;
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('./types').VroElImageUploadImageProps>>;
16
- upload: import('vue').PropType<import('./types').VroElImageUploadCallback>;
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: string | string[]) => any;
19
+ "update:modelValue": (value: VroElImageUploadModelValue) => any;
19
20
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
20
21
  modelValue: {
21
- type: import('vue').PropType<string | string[]>;
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('./types').VroElImageUploadImageProps>>;
34
- upload: import('vue').PropType<import('./types').VroElImageUploadCallback>;
34
+ imageProps: import('vue').PropType<Partial<import('..').VroElImageProps>>;
35
+ upload: import('vue').PropType<VroElImageUploadCallback>;
35
36
  }>> & Readonly<{
36
- "onUpdate:modelValue"?: ((value: string | string[]) => any) | undefined;
37
+ "onUpdate:modelValue"?: ((value: VroElImageUploadModelValue) => any) | undefined;
37
38
  }>, {
38
39
  disabled: boolean;
39
- modelValue: string | string[];
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 D, computed as b, ref as L, createElementBlock as m, openBlock as r, createVNode as i, createBlock as h, createCommentVNode as g, unref as o, withCtx as d, withDirectives as N, Fragment as A, renderList as T, mergeProps as F, createElementVNode as O, createTextVNode as S, toDisplayString as $ } from "vue";
2
- import { omitBy as j, isUndefined as q, isBoolean as z, isArray as n } from "@daysnap/utils";
3
- import { CircleCloseFilled as G, Plus as H } from "@element-plus/icons-vue";
4
- import { useAsyncTask as J } from "@vrojs/use";
5
- import { ElLoading as K, ElImage as M, ElIcon as k, ElCheckbox as Q } from "element-plus";
6
- import { VueDraggable as R } from "vue-draggable-plus";
7
- import { useLocale as W } from "../locale/useLocale.js";
8
- import { vroElImageUploadProps as X } from "./types.js";
9
- import { getVroElImageUploadOptions as Y } from "./utils.js";
10
- const Z = { class: "vro-el-image-upload" }, ee = {
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
- }, le = ["multiple"], ne = /* @__PURE__ */ D({
14
+ }, ie = ["multiple"], ye = /* @__PURE__ */ A({
14
15
  name: "VroElImageUpload",
15
16
  __name: "vro-el-image-upload",
16
- props: X,
17
+ props: te,
17
18
  emits: ["update:modelValue"],
18
- setup(x, { emit: y }) {
19
- const p = y, E = x, { t: w } = W(), e = b(() => {
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: l = !1,
22
- upload: a,
22
+ compressible: e = !1,
23
+ upload: l = U,
23
24
  ...t
24
25
  } = {
25
- ...Y(),
26
- ...j(E, q)
26
+ ...re(),
27
+ ...H(C, J)
27
28
  };
28
29
  return {
29
- upload: a,
30
- compressible: l,
31
- compress: z(l) ? l : l.value,
30
+ upload: l,
31
+ compressible: e,
32
+ compress: Q(e) ? e : e.value,
32
33
  ...t
33
34
  };
34
- }), C = K.directive, c = L(e.value.compress), s = b(() => {
35
- const { modelValue: l } = e.value;
36
- return n(l) ? l : l ? [l] : [];
37
- }), U = (l) => {
38
- n(e.value.modelValue) && p("update:modelValue", l);
39
- }, B = (l) => {
40
- let a = "";
41
- n(e.value.modelValue) && (a = [...e.value.modelValue], a.splice(l, 1)), p("update:modelValue", a);
42
- }, { loading: I, trigger: f } = J(
43
- async (l) => {
44
- const a = l.target, t = Array.from(a.files ?? []);
45
- if (a.value = "", !t?.length)
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: u, upload: v, params: P } = e.value;
48
- if (!v)
49
- throw new Error("not set upload");
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 _ = V[0];
55
- n(e.value.modelValue) && (_ = [...e.value.modelValue, ...V]), p("update:modelValue", _);
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 (l, a) => (r(), m("div", Z, [
62
- i(o(R), {
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: e.value.disabled || e.value.max <= 1,
69
+ disabled: a.value.disabled || a.value.max <= 1,
65
70
  animation: 150,
66
- "model-value": s.value,
71
+ "model-value": u.value,
67
72
  filter: ".vro-el-image-upload-btn",
68
- "onUpdate:modelValue": U
73
+ "onUpdate:modelValue": D
69
74
  }, {
70
- default: d(() => [
71
- (r(!0), m(A, null, T(s.value, (t, u) => (r(), m("div", {
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(M), F({ class: "vro-el-image-upload-image" }, { ref_for: !0 }, e.value.imageProps, {
76
- src: t,
77
- "preview-src-list": s.value,
78
- "initial-index": u
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
- e.value.disabled ? g("", !0) : (r(), h(o(k), {
86
+ a.value.disabled ? V("", !0) : (s(), k(o(w), {
81
87
  key: 0,
82
88
  class: "vro-el-image-upload-clear",
83
- onClick: (v) => B(u)
89
+ onClick: (_) => F(r)
84
90
  }, {
85
- default: d(() => [
86
- i(o(G))
91
+ default: c(() => [
92
+ i(o(W))
87
93
  ]),
88
94
  _: 1
89
95
  }, 8, ["onClick"]))
90
96
  ]))), 128)),
91
- s.value.length < e.value.max && !e.value.disabled ? N((r(), m("div", ee, [
92
- i(o(k), { class: "vro-el-image-upload-add" }, {
93
- default: d(() => [
94
- i(o(H))
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
- O("input", {
104
+ K("input", {
99
105
  type: "file",
100
106
  accept: "image/*",
101
- multiple: e.value.max > 1,
102
- onChange: a[0] || (a[0] = //@ts-ignore
103
- (...t) => o(f) && o(f)(...t))
104
- }, null, 40, le)
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(C), o(I)]
107
- ]) : g("", !0)
112
+ [o(B), o(N)]
113
+ ]) : V("", !0)
108
114
  ]),
109
115
  _: 1
110
116
  }, 8, ["disabled", "model-value"]),
111
- !e.value.disabled && e.value.compressible ? (r(), h(o(Q), {
117
+ !a.value.disabled && a.value.compressible ? (s(), k(o(ee), {
112
118
  key: 0,
113
- modelValue: c.value,
114
- "onUpdate:modelValue": a[1] || (a[1] = (t) => c.value = t)
119
+ modelValue: f.value,
120
+ "onUpdate:modelValue": l[1] || (l[1] = (t) => f.value = t)
115
121
  }, {
116
- default: d(() => [
117
- S($(o(w)("imageUpload.compressText")), 1)
122
+ default: c(() => [
123
+ q(G(o(L)("imageUpload.compressText")), 1)
118
124
  ]),
119
125
  _: 1
120
- }, 8, ["modelValue"])) : g("", !0)
126
+ }, 8, ["modelValue"])) : V("", !0)
121
127
  ]));
122
128
  }
123
129
  });
124
130
  export {
125
- ne as default
131
+ ye as default
126
132
  };
@@ -484,9 +484,7 @@ export declare const VroElSchemaFilter: import('@vrojs/base').WithInstall<{
484
484
  extractValues: () => Promise<Record<string, any>>;
485
485
  validateField: (key: string) => Promise<boolean | undefined>;
486
486
  }> & {} & import('vue').ComponentCustomProperties & {} & {
487
- $slots: Partial<Record<number, (_: {
488
- item: import('..').VroElSchemaFormSchemaField;
489
- }) => any>> & {
487
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
490
488
  default?(_: {}): any;
491
489
  };
492
490
  }) | null;
@@ -7,6 +7,7 @@ import '../../vro-el-tree/style/index.css';
7
7
  /* empty css */
8
8
  /* empty css */
9
9
  /* empty css */
10
+ /* empty css */
10
11
  /* empty css */
11
12
  /* empty css */
12
13
  /* empty css */
@@ -29,6 +29,7 @@ import "element-plus/es/components/tree-select/style/css";
29
29
  /* empty css */
30
30
  /* empty css */
31
31
  /* empty css */
32
+ /* empty css */
32
33
  /* empty css */
33
34
  /* empty css */
34
35
  /* empty css */
@@ -445,9 +445,7 @@ declare function __VLS_template(): {
445
445
  extractValues: () => Promise<Record<string, any>>;
446
446
  validateField: (key: string) => Promise<boolean | undefined>;
447
447
  }> & {} & import('vue').ComponentCustomProperties & {} & {
448
- $slots: Partial<Record<number, (_: {
449
- item: import('..').VroElSchemaFormSchemaField;
450
- }) => any>> & {
448
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
451
449
  default?(_: {}): any;
452
450
  };
453
451
  }) | null;
@@ -967,9 +965,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
967
965
  extractValues: () => Promise<Record<string, any>>;
968
966
  validateField: (key: string) => Promise<boolean | undefined>;
969
967
  }> & {} & import('vue').ComponentCustomProperties & {} & {
970
- $slots: Partial<Record<number, (_: {
971
- item: import('..').VroElSchemaFormSchemaField;
972
- }) => any>> & {
968
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
973
969
  default?(_: {}): any;
974
970
  };
975
971
  }) | null;
@@ -548,9 +548,7 @@ export declare const VroElSchemaForm: import('@vrojs/base').WithInstall<{
548
548
  rowProps: Partial<import('element-plus').RowProps>;
549
549
  schema: import('./types').VroElSchemaFormSchema;
550
550
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
551
- $slots: Partial<Record<number, (_: {
552
- item: import('./types').VroElSchemaFormSchemaField;
553
- }) => any>> & {
551
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
554
552
  default?(_: {}): any;
555
553
  };
556
554
  })>;
@@ -6,6 +6,7 @@ import '../../vro-el-tree/style/index.css';
6
6
  /* empty css */
7
7
  /* empty css */
8
8
  /* empty css */
9
+ /* empty css */
9
10
  /* empty css */
10
11
  /* empty css */
11
12
  /* empty css */
@@ -28,6 +28,7 @@ import "element-plus/es/components/tree-select/style/css";
28
28
  /* empty css */
29
29
  /* empty css */
30
30
  /* empty css */
31
+ /* empty css */
31
32
  /* empty css */
32
33
  /* empty css */
33
34
  /* empty css */