@wyfex/ivue 0.18.0 → 0.19.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.
@@ -4,7 +4,7 @@ import { GlobalConfig } from '../../../types';
4
4
  declare var __VLS_9: {
5
5
  label: string | undefined;
6
6
  prop: string | undefined;
7
- }, __VLS_24: string, __VLS_25: {
7
+ }, __VLS_24: `${string}-header`, __VLS_25: {
8
8
  item: TableColumn;
9
9
  column: any;
10
10
  $index: any;
@@ -0,0 +1,21 @@
1
+ export declare const useElUpload: ({ props, emits }: any) => {
2
+ acceptComputed: import('vue').ComputedRef<any>;
3
+ state: any;
4
+ dialogState: import('vue').Ref<{
5
+ show: boolean;
6
+ src: string;
7
+ }, {
8
+ show: boolean;
9
+ src: string;
10
+ } | {
11
+ show: boolean;
12
+ src: string;
13
+ }>;
14
+ handlePreview: (uploadFile: any) => void;
15
+ handleSuccess: (res: any, uploadFile: any) => void;
16
+ handleError: (err: any) => void;
17
+ handleBeforeUpload: (file: any) => false | {
18
+ signal: AbortSignal;
19
+ };
20
+ handleBeforeRemove: (uploadFile: any) => Promise<boolean>;
21
+ };
@@ -0,0 +1,101 @@
1
+ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ fileId: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ linkUrl: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ uploadConfig: {
11
+ type: import('vue').PropType<Record<string, unknown>>;
12
+ default: () => {};
13
+ };
14
+ uploadType: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ validator: (value: string) => boolean;
18
+ };
19
+ uploadTip: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ uploadList: {
24
+ type: import('vue').PropType<Record<string, unknown>[]>;
25
+ default: () => never[];
26
+ };
27
+ limit: {
28
+ type: NumberConstructor;
29
+ default: number;
30
+ validator: (value: number) => boolean;
31
+ };
32
+ disabled: {
33
+ type: BooleanConstructor;
34
+ default: boolean;
35
+ };
36
+ maxSize: {
37
+ type: NumberConstructor;
38
+ default: number;
39
+ };
40
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
41
+ onError: (error: string | Error) => any;
42
+ onFileObj: (file: Record<string, any>) => any;
43
+ "update:fileId": (value: string | number) => any;
44
+ "update:linkUrl": (url: string) => any;
45
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
46
+ fileId: {
47
+ type: StringConstructor;
48
+ default: string;
49
+ };
50
+ linkUrl: {
51
+ type: StringConstructor;
52
+ default: string;
53
+ };
54
+ uploadConfig: {
55
+ type: import('vue').PropType<Record<string, unknown>>;
56
+ default: () => {};
57
+ };
58
+ uploadType: {
59
+ type: StringConstructor;
60
+ default: string;
61
+ validator: (value: string) => boolean;
62
+ };
63
+ uploadTip: {
64
+ type: StringConstructor;
65
+ default: string;
66
+ };
67
+ uploadList: {
68
+ type: import('vue').PropType<Record<string, unknown>[]>;
69
+ default: () => never[];
70
+ };
71
+ limit: {
72
+ type: NumberConstructor;
73
+ default: number;
74
+ validator: (value: number) => boolean;
75
+ };
76
+ disabled: {
77
+ type: BooleanConstructor;
78
+ default: boolean;
79
+ };
80
+ maxSize: {
81
+ type: NumberConstructor;
82
+ default: number;
83
+ };
84
+ }>> & Readonly<{
85
+ onOnError?: ((error: string | Error) => any) | undefined;
86
+ onOnFileObj?: ((file: Record<string, any>) => any) | undefined;
87
+ "onUpdate:fileId"?: ((value: string | number) => any) | undefined;
88
+ "onUpdate:linkUrl"?: ((url: string) => any) | undefined;
89
+ }>, {
90
+ disabled: boolean;
91
+ uploadConfig: Record<string, unknown>;
92
+ fileId: string;
93
+ linkUrl: string;
94
+ uploadType: string;
95
+ uploadTip: string;
96
+ uploadList: Record<string, unknown>[];
97
+ limit: number;
98
+ maxSize: number;
99
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
100
+ declare const _default: typeof __VLS_export;
101
+ export default _default;
@@ -0,0 +1,42 @@
1
+ import { PropType } from 'vue';
2
+ declare const _default: {
3
+ fileId: {
4
+ type: StringConstructor;
5
+ default: string;
6
+ };
7
+ linkUrl: {
8
+ type: StringConstructor;
9
+ default: string;
10
+ };
11
+ uploadConfig: {
12
+ type: PropType<Record<string, unknown>>;
13
+ default: () => {};
14
+ };
15
+ uploadType: {
16
+ type: StringConstructor;
17
+ default: string;
18
+ validator: (value: string) => boolean;
19
+ };
20
+ uploadTip: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ uploadList: {
25
+ type: PropType<Record<string, unknown>[]>;
26
+ default: () => never[];
27
+ };
28
+ limit: {
29
+ type: NumberConstructor;
30
+ default: number;
31
+ validator: (value: number) => boolean;
32
+ };
33
+ disabled: {
34
+ type: BooleanConstructor;
35
+ default: boolean;
36
+ };
37
+ maxSize: {
38
+ type: NumberConstructor;
39
+ default: number;
40
+ };
41
+ };
42
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+ import { default as componentProps } from './props';
3
+ export type Props = ExtractPropTypes<typeof componentProps>;
4
+ export interface Emits {
5
+ 'update:fileId': [value: string | number];
6
+ 'update:linkUrl': [url: string];
7
+ onFileObj: [file: Record<string, any>];
8
+ onError: [error: Error | string];
9
+ }
@@ -0,0 +1,3 @@
1
+ export declare const FILE_TYPE_CONFIG: any;
2
+ export declare const ACCEPT_MAP: any;
3
+ export declare const debounce: (fn: any, delay?: number) => any;
@@ -12,6 +12,7 @@ export { default as UseElSelect } from './UseElSelect/index.vue';
12
12
  export { default as UseElSwitch } from './UseElSwitch/index.vue';
13
13
  export { default as UseElTable } from './UseElTable/index.vue';
14
14
  export { default as UseElTooltip } from './UseElTooltip/index.vue';
15
+ export { default as UseElUpload } from './UseElUpload/index.vue';
15
16
  export { default as UseIconfont } from './UseIconfont/index.vue';
16
17
  export { default as UseLineTitle } from './UseLineTitle/index.vue';
17
18
  export { default as UseRender } from './UseRender/index.vue';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@wyfex/ivue",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "万有前端 X 体系下基于 Vite8 + Vue3 + Typescript6 + ElementPlus2 构建的 iVue 组件库",
5
- "homepage": "https://wyfe.top/idocs/ivue",
5
+ "homepage": "https://wyfex.top/idocs/ivue",
6
6
  "type": "module",
7
7
  "main": "dist/index.umd.cjs",
8
8
  "module": "dist/index.es.js",
@@ -50,7 +50,7 @@
50
50
  "vue": ">=3.2.0 <4.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/node": "^26.0.1",
53
+ "@types/node": "^26.1.0",
54
54
  "@vitejs/plugin-vue": "^6.0.7",
55
55
  "@vue/tsconfig": "^0.9.1",
56
56
  "@wyfex/iutils": "^0.40.0",
@@ -61,7 +61,7 @@
61
61
  "unplugin-auto-import": "^21.0.0",
62
62
  "unplugin-dts": "^1.0.3",
63
63
  "unplugin-vue-components": "^32.1.0",
64
- "vite": "^8.1.2",
64
+ "vite": "^8.1.3",
65
65
  "vite-svg-loader": "^5.1.1",
66
66
  "vue": "^3.5.39",
67
67
  "vue-tsc": "^3.3.6"
@@ -0,0 +1,84 @@
1
+ import type { PropType } from 'vue'
2
+
3
+ /**
4
+ * 组件props
5
+ */
6
+ export default {
7
+ /**
8
+ * 文件id
9
+ */
10
+ fileId: {
11
+ type: String,
12
+ default: ''
13
+ },
14
+ /**
15
+ * 链接地址
16
+ */
17
+ linkUrl: {
18
+ type: String,
19
+ default: ''
20
+ },
21
+ /**
22
+ * 上传配置
23
+ * action:请求URL,eg:'/api/file/upload'
24
+ * headers:设置上传的请求头部,eg:{ Authorization: `Bearer ${token}` }
25
+ * data:上传时附带的额外参数,eg:{ referer: window.location.href }
26
+ */
27
+ uploadConfig: {
28
+ type: Object as PropType<Record<string, unknown>>,
29
+ default: () => ({
30
+ // action: '/api/file/upload',
31
+ // headers: { Authorization: `Bearer ${token}` },
32
+ // data: { referer: window.location.href }
33
+ })
34
+ },
35
+ /**
36
+ * 上传类型
37
+ * 为ALL支持所有文件格式
38
+ * 为IMG仅可上传支持的图片格式且按照片墙形式展示
39
+ * 为VIDEO仅可上传支持的视频格式
40
+ * 为EXCLUDE_VIDEO可上传除视频格式外的所有支持的文件格式
41
+ */
42
+ uploadType: {
43
+ type: String,
44
+ default: 'ALL',
45
+ validator: (value: string) =>
46
+ ['ALL', 'IMG', 'VIDEO', 'EXCLUDE_VIDEO'].includes(value)
47
+ },
48
+ /**
49
+ * 上传提示
50
+ */
51
+ uploadTip: {
52
+ type: String,
53
+ default: ''
54
+ },
55
+ /**
56
+ * 上传列表 用于数据回显
57
+ */
58
+ uploadList: {
59
+ type: Array as PropType<Record<string, unknown>[]>,
60
+ default: () => []
61
+ },
62
+ /**
63
+ * 上传数量限制 默认1
64
+ */
65
+ limit: {
66
+ type: Number,
67
+ default: 1,
68
+ validator: (value: number) => value >= 1
69
+ },
70
+ /**
71
+ * 是否禁用上传 默认否
72
+ */
73
+ disabled: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ /**
78
+ * 最大文件大小 默认2GB
79
+ */
80
+ maxSize: {
81
+ type: Number,
82
+ default: 2
83
+ }
84
+ }
@@ -0,0 +1,17 @@
1
+ import type { ExtractPropTypes } from 'vue'
2
+ import componentProps from './props'
3
+
4
+ /**
5
+ * props类型
6
+ */
7
+ export type Props = ExtractPropTypes<typeof componentProps>
8
+
9
+ /**
10
+ * emits接口
11
+ */
12
+ export interface Emits {
13
+ 'update:fileId': [value: string | number]
14
+ 'update:linkUrl': [url: string]
15
+ onFileObj: [file: Record<string, any>]
16
+ onError: [error: Error | string]
17
+ }
@@ -1,5 +1,5 @@
1
1
  import type { PropType } from 'vue'
2
- import { isArray } from '@wyfex/iutils'
2
+ import { isArray, isNumber } from '@wyfex/iutils'
3
3
  import { parseUnit, isValidUnit } from '@/utils'
4
4
 
5
5
  /**
@@ -20,7 +20,7 @@ export default {
20
20
  type: [Number, String],
21
21
  default: 28,
22
22
  validator(val: any) {
23
- if (typeof val === 'number') return val
23
+ if (isNumber(val)) return val
24
24
  return isValidUnit(parseUnit(val)) && val
25
25
  }
26
26
  },