handy-uploader 2.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +183 -297
- package/dist/components/InsertButton.vue.d.ts +5 -13
- package/dist/components/SelectFileIconType.vue.d.ts +3 -23
- package/dist/components/SimpleUploader.vue.d.ts +7 -35
- package/dist/components/TableUploader.vue.d.ts +6 -38
- package/dist/components/ThumbnailUploader.vue.d.ts +8 -44
- package/dist/components/handyUploader.vue.d.ts +21 -79
- package/dist/composables/deprecation.d.ts +2 -0
- package/dist/composables/useErrorHandler.d.ts +8 -4
- package/dist/composables/useFileUpload.d.ts +7 -2
- package/dist/core/attachments.d.ts +91 -0
- package/dist/core/fileUtils.d.ts +56 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/videoThumbnail.d.ts +32 -0
- package/dist/handy-uploader.cjs +1 -0
- package/dist/handy-uploader.css +1 -0
- package/dist/handy-uploader.mjs +1110 -0
- package/dist/language-CYpPw-mk.mjs +551 -0
- package/dist/language-fvWXvWRx.js +1 -0
- package/dist/lib/index.d.ts +10 -712
- package/dist/lib/language.d.ts +3 -0
- package/dist/lib/shared.d.ts +5 -0
- package/dist/lib/vuetify.d.ts +15 -0
- package/dist/logo.png +0 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/utils/fileUtils.d.ts +1 -41
- package/dist/vue/components/HandyDialog.vue.d.ts +31 -0
- package/dist/vue/components/HandyDropzone.vue.d.ts +38 -0
- package/dist/vue/components/HandyFileIcon.vue.d.ts +9 -0
- package/dist/vue/components/HandyFileList.vue.d.ts +65 -0
- package/dist/vue/components/HandyIcon.vue.d.ts +10 -0
- package/dist/vue/components/HandyUploader.vue.d.ts +137 -0
- package/dist/vue/index.d.ts +9 -0
- package/dist/vue/types.d.ts +5 -0
- package/dist/vue/useUploader.d.ts +46 -0
- package/dist/vuetify.cjs +1 -0
- package/dist/vuetify.mjs +1870 -0
- package/package.json +66 -26
- package/dist/handy-uploader.es.js +0 -2407
- package/dist/handy-uploader.umd.js +0 -1
|
@@ -2,28 +2,8 @@ interface Props {
|
|
|
2
2
|
fileFormat: string;
|
|
3
3
|
size: number;
|
|
4
4
|
}
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
6
6
|
size: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
}>>> & Readonly<{}>, {
|
|
10
|
-
size: number;
|
|
11
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
12
9
|
export default _default;
|
|
13
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
14
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
15
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
16
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
17
|
-
} : {
|
|
18
|
-
type: import('vue').PropType<T[K]>;
|
|
19
|
-
required: true;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
type __VLS_WithDefaults<P, D> = {
|
|
23
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
24
|
-
default: D[K];
|
|
25
|
-
}> : P[K];
|
|
26
|
-
};
|
|
27
|
-
type __VLS_Prettify<T> = {
|
|
28
|
-
[K in keyof T]: T[K];
|
|
29
|
-
} & {};
|
|
@@ -13,48 +13,20 @@ interface Props {
|
|
|
13
13
|
deletePermission: boolean;
|
|
14
14
|
selectedLang: LanguageCollection;
|
|
15
15
|
}
|
|
16
|
-
declare const
|
|
17
|
-
thumb: boolean;
|
|
18
|
-
lang: string;
|
|
19
|
-
cols: number;
|
|
20
|
-
editPermission: boolean;
|
|
21
|
-
deletePermission: boolean;
|
|
22
|
-
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
17
|
openDeleteDialog: (...args: any[]) => void;
|
|
24
18
|
openEditDocumentDialog: (...args: any[]) => void;
|
|
25
19
|
setCardTheme: (...args: any[]) => void;
|
|
26
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
editPermission: boolean;
|
|
31
|
-
deletePermission: boolean;
|
|
32
|
-
}>>> & Readonly<{
|
|
33
|
-
onOpenDeleteDialog?: ((...args: any[]) => any) | undefined;
|
|
34
|
-
onOpenEditDocumentDialog?: ((...args: any[]) => any) | undefined;
|
|
35
|
-
onSetCardTheme?: ((...args: any[]) => any) | undefined;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
21
|
+
onOpenDeleteDialog?: (...args: any[]) => any;
|
|
22
|
+
onOpenEditDocumentDialog?: (...args: any[]) => any;
|
|
23
|
+
onSetCardTheme?: (...args: any[]) => any;
|
|
36
24
|
}>, {
|
|
37
25
|
lang: string;
|
|
38
26
|
thumb: boolean;
|
|
39
27
|
cols: number;
|
|
40
28
|
editPermission: boolean;
|
|
41
29
|
deletePermission: boolean;
|
|
42
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions,
|
|
30
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
|
+
declare const _default: typeof __VLS_export;
|
|
43
32
|
export default _default;
|
|
44
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
45
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
46
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
47
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
48
|
-
} : {
|
|
49
|
-
type: import('vue').PropType<T[K]>;
|
|
50
|
-
required: true;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
type __VLS_WithDefaults<P, D> = {
|
|
54
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
55
|
-
default: D[K];
|
|
56
|
-
}> : P[K];
|
|
57
|
-
};
|
|
58
|
-
type __VLS_Prettify<T> = {
|
|
59
|
-
[K in keyof T]: T[K];
|
|
60
|
-
} & {};
|
|
@@ -11,28 +11,12 @@ interface Props {
|
|
|
11
11
|
tableHeight: number;
|
|
12
12
|
selectedLang: LanguageCollection;
|
|
13
13
|
}
|
|
14
|
-
declare const
|
|
15
|
-
thumb: boolean;
|
|
16
|
-
lang: string;
|
|
17
|
-
cols: number;
|
|
18
|
-
editPermission: boolean;
|
|
19
|
-
deletePermission: boolean;
|
|
20
|
-
tableFixedHeader: boolean;
|
|
21
|
-
tableHeight: number;
|
|
22
|
-
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
15
|
openDeleteDialog: (...args: any[]) => void;
|
|
24
16
|
openEditDocumentDialog: (...args: any[]) => void;
|
|
25
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
cols: number;
|
|
29
|
-
editPermission: boolean;
|
|
30
|
-
deletePermission: boolean;
|
|
31
|
-
tableFixedHeader: boolean;
|
|
32
|
-
tableHeight: number;
|
|
33
|
-
}>>> & Readonly<{
|
|
34
|
-
onOpenDeleteDialog?: ((...args: any[]) => any) | undefined;
|
|
35
|
-
onOpenEditDocumentDialog?: ((...args: any[]) => any) | undefined;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
18
|
+
onOpenDeleteDialog?: (...args: any[]) => any;
|
|
19
|
+
onOpenEditDocumentDialog?: (...args: any[]) => any;
|
|
36
20
|
}>, {
|
|
37
21
|
tableFixedHeader: boolean;
|
|
38
22
|
tableHeight: number;
|
|
@@ -41,22 +25,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
41
25
|
cols: number;
|
|
42
26
|
editPermission: boolean;
|
|
43
27
|
deletePermission: boolean;
|
|
44
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions,
|
|
28
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
45
30
|
export default _default;
|
|
46
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
47
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
48
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
49
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
50
|
-
} : {
|
|
51
|
-
type: import('vue').PropType<T[K]>;
|
|
52
|
-
required: true;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
type __VLS_WithDefaults<P, D> = {
|
|
56
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
57
|
-
default: D[K];
|
|
58
|
-
}> : P[K];
|
|
59
|
-
};
|
|
60
|
-
type __VLS_Prettify<T> = {
|
|
61
|
-
[K in keyof T]: T[K];
|
|
62
|
-
} & {};
|
|
@@ -2,32 +2,12 @@ import type { DocumentAttachment, BaseUploaderProps, CardThemeProps, LanguageCod
|
|
|
2
2
|
interface Props extends BaseUploaderProps, CardThemeProps {
|
|
3
3
|
lang: LanguageCode;
|
|
4
4
|
}
|
|
5
|
-
declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
outlined: boolean;
|
|
12
|
-
raised: boolean;
|
|
13
|
-
shaped: boolean;
|
|
14
|
-
tile: boolean;
|
|
15
|
-
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
-
openDeleteDialog: (index: number, deleteId: string) => void;
|
|
17
|
-
openEditDocumentDialog: (item: DocumentAttachment, index: number) => void;
|
|
18
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
19
|
-
thumb: boolean;
|
|
20
|
-
lang: string;
|
|
21
|
-
cols: number;
|
|
22
|
-
editPermission: boolean;
|
|
23
|
-
deletePermission: boolean;
|
|
24
|
-
outlined: boolean;
|
|
25
|
-
raised: boolean;
|
|
26
|
-
shaped: boolean;
|
|
27
|
-
tile: boolean;
|
|
28
|
-
}>>> & Readonly<{
|
|
29
|
-
onOpenDeleteDialog?: ((index: number, deleteId: string) => any) | undefined;
|
|
30
|
-
onOpenEditDocumentDialog?: ((item: DocumentAttachment, index: number) => any) | undefined;
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
|
+
openDeleteDialog: (index: number, deleteId: string) => any;
|
|
7
|
+
openEditDocumentDialog: (item: DocumentAttachment, index: number) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
9
|
+
onOpenDeleteDialog?: (index: number, deleteId: string) => any;
|
|
10
|
+
onOpenEditDocumentDialog?: (item: DocumentAttachment, index: number) => any;
|
|
31
11
|
}>, {
|
|
32
12
|
outlined: boolean;
|
|
33
13
|
shaped: boolean;
|
|
@@ -38,22 +18,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
38
18
|
cols: number;
|
|
39
19
|
editPermission: boolean;
|
|
40
20
|
deletePermission: boolean;
|
|
41
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions,
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
42
23
|
export default _default;
|
|
43
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
44
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
45
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
46
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
47
|
-
} : {
|
|
48
|
-
type: import('vue').PropType<T[K]>;
|
|
49
|
-
required: true;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
type __VLS_WithDefaults<P, D> = {
|
|
53
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
54
|
-
default: D[K];
|
|
55
|
-
}> : P[K];
|
|
56
|
-
};
|
|
57
|
-
type __VLS_Prettify<T> = {
|
|
58
|
-
[K in keyof T]: T[K];
|
|
59
|
-
} & {};
|
|
@@ -30,28 +30,8 @@ interface Props {
|
|
|
30
30
|
shaped?: boolean;
|
|
31
31
|
tile?: boolean;
|
|
32
32
|
}
|
|
33
|
-
declare const
|
|
34
|
-
|
|
35
|
-
fileUploaderType: string;
|
|
36
|
-
maxFileCount: number;
|
|
37
|
-
badgeCounter: boolean;
|
|
38
|
-
btnColor: string;
|
|
39
|
-
imageCompressLevel: number;
|
|
40
|
-
thumb: boolean;
|
|
41
|
-
tableFixedHeader: boolean;
|
|
42
|
-
tableHeight: number;
|
|
43
|
-
lang: string;
|
|
44
|
-
rtlSupport: boolean;
|
|
45
|
-
changeFileName: boolean;
|
|
46
|
-
addFileDescription: boolean;
|
|
47
|
-
addFileTag: boolean;
|
|
48
|
-
cols: number;
|
|
49
|
-
customLang: null;
|
|
50
|
-
insertPermission: boolean;
|
|
51
|
-
editPermission: boolean;
|
|
52
|
-
deletePermission: boolean;
|
|
53
|
-
cardType: string;
|
|
54
|
-
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
updateDocumentAttachment: (...args: any[]) => void;
|
|
55
35
|
updateCardType: (...args: any[]) => void;
|
|
56
36
|
updateBadgeCounter: (...args: any[]) => void;
|
|
57
37
|
updateMaxFileCount: (...args: any[]) => void;
|
|
@@ -66,44 +46,22 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
66
46
|
updateTableFixedHeader: (...args: any[]) => void;
|
|
67
47
|
updateTableHeight: (...args: any[]) => void;
|
|
68
48
|
updateLang: (...args: any[]) => void;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
cols: number;
|
|
86
|
-
customLang: null;
|
|
87
|
-
insertPermission: boolean;
|
|
88
|
-
editPermission: boolean;
|
|
89
|
-
deletePermission: boolean;
|
|
90
|
-
cardType: string;
|
|
91
|
-
}>>> & Readonly<{
|
|
92
|
-
onUpdateCardType?: ((...args: any[]) => any) | undefined;
|
|
93
|
-
onUpdateBadgeCounter?: ((...args: any[]) => any) | undefined;
|
|
94
|
-
onUpdateMaxFileCount?: ((...args: any[]) => any) | undefined;
|
|
95
|
-
onUpdateMaxFileSize?: ((...args: any[]) => any) | undefined;
|
|
96
|
-
onUpdateImageCompressor?: ((...args: any[]) => any) | undefined;
|
|
97
|
-
onUpdateImageCompressLevel?: ((...args: any[]) => any) | undefined;
|
|
98
|
-
onUpdateFileAccept?: ((...args: any[]) => any) | undefined;
|
|
99
|
-
onUpdateThumb?: ((...args: any[]) => any) | undefined;
|
|
100
|
-
onUpdateChangeFileName?: ((...args: any[]) => any) | undefined;
|
|
101
|
-
onUpdateAddFileDescription?: ((...args: any[]) => any) | undefined;
|
|
102
|
-
onUpdateTableThumbColumn?: ((...args: any[]) => any) | undefined;
|
|
103
|
-
onUpdateTableFixedHeader?: ((...args: any[]) => any) | undefined;
|
|
104
|
-
onUpdateTableHeight?: ((...args: any[]) => any) | undefined;
|
|
105
|
-
onUpdateLang?: ((...args: any[]) => any) | undefined;
|
|
106
|
-
onUpdateDocumentAttachment?: ((...args: any[]) => any) | undefined;
|
|
49
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
50
|
+
onUpdateDocumentAttachment?: (...args: any[]) => any;
|
|
51
|
+
onUpdateCardType?: (...args: any[]) => any;
|
|
52
|
+
onUpdateBadgeCounter?: (...args: any[]) => any;
|
|
53
|
+
onUpdateMaxFileCount?: (...args: any[]) => any;
|
|
54
|
+
onUpdateMaxFileSize?: (...args: any[]) => any;
|
|
55
|
+
onUpdateImageCompressor?: (...args: any[]) => any;
|
|
56
|
+
onUpdateImageCompressLevel?: (...args: any[]) => any;
|
|
57
|
+
onUpdateFileAccept?: (...args: any[]) => any;
|
|
58
|
+
onUpdateThumb?: (...args: any[]) => any;
|
|
59
|
+
onUpdateChangeFileName?: (...args: any[]) => any;
|
|
60
|
+
onUpdateAddFileDescription?: (...args: any[]) => any;
|
|
61
|
+
onUpdateTableThumbColumn?: (...args: any[]) => any;
|
|
62
|
+
onUpdateTableFixedHeader?: (...args: any[]) => any;
|
|
63
|
+
onUpdateTableHeight?: (...args: any[]) => any;
|
|
64
|
+
onUpdateLang?: (...args: any[]) => any;
|
|
107
65
|
}>, {
|
|
108
66
|
maxFileSize: number;
|
|
109
67
|
fileUploaderType: FileUploaderType;
|
|
@@ -117,7 +75,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
117
75
|
changeFileName: boolean;
|
|
118
76
|
addFileDescription: boolean;
|
|
119
77
|
addFileTag: boolean;
|
|
120
|
-
customLang: LanguageCollection
|
|
78
|
+
customLang: LanguageCollection;
|
|
121
79
|
insertPermission: boolean;
|
|
122
80
|
lang: LanguageCode;
|
|
123
81
|
thumb: boolean;
|
|
@@ -125,22 +83,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
125
83
|
editPermission: boolean;
|
|
126
84
|
deletePermission: boolean;
|
|
127
85
|
cardType: CardType;
|
|
128
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions,
|
|
86
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
87
|
+
declare const _default: typeof __VLS_export;
|
|
129
88
|
export default _default;
|
|
130
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
131
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
132
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
133
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
134
|
-
} : {
|
|
135
|
-
type: import('vue').PropType<T[K]>;
|
|
136
|
-
required: true;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
type __VLS_WithDefaults<P, D> = {
|
|
140
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
141
|
-
default: D[K];
|
|
142
|
-
}> : P[K];
|
|
143
|
-
};
|
|
144
|
-
type __VLS_Prettify<T> = {
|
|
145
|
-
[K in keyof T]: T[K];
|
|
146
|
-
} & {};
|
|
@@ -14,21 +14,25 @@ export interface ErrorHandlerOptions {
|
|
|
14
14
|
autoRemoveTimeout?: number;
|
|
15
15
|
logToConsole?: boolean;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use the `errors` returned by `useUploader` (or the `error` event of
|
|
19
|
+
* HandyUploader) instead. `useErrorHandler` will be removed in the next major version.
|
|
20
|
+
*/
|
|
17
21
|
export declare function useErrorHandler(options?: ErrorHandlerOptions): {
|
|
18
22
|
errors: unknown;
|
|
19
23
|
isLoading: unknown;
|
|
20
|
-
addError: (message: string, type?: ErrorInfo[
|
|
24
|
+
addError: (message: string, type?: ErrorInfo["type"], context?: Record<string, any>, action?: ErrorInfo["action"]) => string;
|
|
21
25
|
removeError: (id: string) => boolean;
|
|
22
26
|
clearErrors: () => void;
|
|
23
|
-
clearErrorsByType: (type: ErrorInfo[
|
|
27
|
+
clearErrorsByType: (type: ErrorInfo["type"]) => void;
|
|
24
28
|
handleAsync: <T>(operation: () => Promise<T>, errorMessage?: string, context?: Record<string, any>) => Promise<T | null>;
|
|
25
29
|
validate: (condition: boolean, message: string, context?: Record<string, any>) => boolean;
|
|
26
30
|
showSuccess: (message: string, context?: Record<string, any>) => string;
|
|
27
31
|
showWarning: (message: string, context?: Record<string, any>) => string;
|
|
28
32
|
showInfo: (message: string, context?: Record<string, any>) => string;
|
|
29
|
-
getErrorsByType: (type: ErrorInfo[
|
|
33
|
+
getErrorsByType: (type: ErrorInfo["type"]) => ErrorInfo[];
|
|
30
34
|
getLatestError: () => ErrorInfo | null;
|
|
31
|
-
hasErrors: (type?: ErrorInfo[
|
|
35
|
+
hasErrors: (type?: ErrorInfo["type"]) => boolean;
|
|
32
36
|
fileUploadErrors: {
|
|
33
37
|
fileSizeExceeded: (fileName: string, maxSize: number) => string;
|
|
34
38
|
fileCountExceeded: (maxCount: number) => string;
|
|
@@ -7,6 +7,11 @@ export interface UseFileUploadOptions {
|
|
|
7
7
|
imageCompressLevel?: number;
|
|
8
8
|
fileAccept?: string;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use `useUploader` from 'handy-uploader' instead: it validates before reading,
|
|
12
|
+
* supports drag and drop, image compression and editing files before they are added.
|
|
13
|
+
* `useFileUpload` will be removed in the next major version.
|
|
14
|
+
*/
|
|
10
15
|
export declare function useFileUpload(documentAttachment: Ref<DocumentAttachment[]>, options?: UseFileUploadOptions): {
|
|
11
16
|
isUploading: Readonly<Ref<boolean, boolean>>;
|
|
12
17
|
snackbar: Readonly<Ref<SnackbarConfig | {
|
|
@@ -23,11 +28,11 @@ export declare function useFileUpload(documentAttachment: Ref<DocumentAttachment
|
|
|
23
28
|
totalSize: import("vue").ComputedRef<number>;
|
|
24
29
|
uploadFiles: (files: FileList | File[]) => Promise<boolean>;
|
|
25
30
|
removeFile: (index: number) => boolean;
|
|
26
|
-
updateFileMetadata: (index: number, updates: Partial<Pick<FileData,
|
|
31
|
+
updateFileMetadata: (index: number, updates: Partial<Pick<FileData, "name" | "description" | "tags">>) => boolean;
|
|
27
32
|
clearAllFiles: () => void;
|
|
28
33
|
validateFile: (file: File) => {
|
|
29
34
|
valid: boolean;
|
|
30
35
|
error?: string;
|
|
31
36
|
};
|
|
32
|
-
showSnackbar: (text: string, color?:
|
|
37
|
+
showSnackbar: (text: string, color?: "success" | "error" | "warning") => void;
|
|
33
38
|
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { DocumentAttachment } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic attachment pipeline: read selected files, then validate and
|
|
4
|
+
* prepare them for the attachment list. Nothing here touches Vue, Vuetify or i18n —
|
|
5
|
+
* errors come back as codes so each UI layer can render its own messages.
|
|
6
|
+
*/
|
|
7
|
+
export type AttachmentErrorCode = 'maxFileCount' | 'maxFileSize' | 'invalidFormat' | 'fileType';
|
|
8
|
+
export interface AttachmentError {
|
|
9
|
+
code: AttachmentErrorCode;
|
|
10
|
+
fileName?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface PrepareOptions {
|
|
14
|
+
/** Number of attachments already in the list. */
|
|
15
|
+
currentCount: number;
|
|
16
|
+
maxFileCount: number;
|
|
17
|
+
/** Maximum size per file, in bytes. */
|
|
18
|
+
maxFileSize: number;
|
|
19
|
+
imageCompressor?: boolean;
|
|
20
|
+
/** JPEG quality between 0 and 1. */
|
|
21
|
+
imageCompressLevel?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface PrepareResult {
|
|
24
|
+
accepted: DocumentAttachment[];
|
|
25
|
+
errors: AttachmentError[];
|
|
26
|
+
}
|
|
27
|
+
export type CompressFn = (dataUrl: string, quality: number) => Promise<string>;
|
|
28
|
+
/** Extensions that imageCompressor re-encodes as JPEG. */
|
|
29
|
+
export declare const COMPRESSIBLE_EXTENSIONS: string[];
|
|
30
|
+
/** Splits "my.report.pdf" into { name: "my.report", format: "pdf" }. */
|
|
31
|
+
export declare function splitFileName(fileName: string): {
|
|
32
|
+
name: string;
|
|
33
|
+
format: string;
|
|
34
|
+
};
|
|
35
|
+
/** Joins a base name and extension back together ("README" stays "README"). */
|
|
36
|
+
export declare function joinFileName(name: string, format: string): string;
|
|
37
|
+
/** Size in bytes of the data a base64 string decodes to. */
|
|
38
|
+
export declare function base64ByteLength(base64: string): number;
|
|
39
|
+
/**
|
|
40
|
+
* Checks a file against an `accept` string in the same format as the HTML attribute
|
|
41
|
+
* (".pdf,image/*,application/zip"). An empty string or "*" accepts everything.
|
|
42
|
+
*/
|
|
43
|
+
export declare function matchesAccept(file: {
|
|
44
|
+
name: string;
|
|
45
|
+
type?: string;
|
|
46
|
+
}, accept?: string): boolean;
|
|
47
|
+
/** Splits files into those matching `accept` and a `fileType` error for each other one. */
|
|
48
|
+
export declare function filterByAccept(files: File[], accept?: string): {
|
|
49
|
+
accepted: File[];
|
|
50
|
+
errors: AttachmentError[];
|
|
51
|
+
};
|
|
52
|
+
export interface PrecheckOptions {
|
|
53
|
+
currentCount: number;
|
|
54
|
+
maxFileCount: number;
|
|
55
|
+
/** Maximum size per file, in bytes. */
|
|
56
|
+
maxFileSize: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Applies the count and size limits using File metadata only, before any file is read,
|
|
60
|
+
* so oversized or surplus files never get loaded into memory.
|
|
61
|
+
*/
|
|
62
|
+
export declare function precheckFiles(files: File[], { currentCount, maxFileCount, maxFileSize }: PrecheckOptions): {
|
|
63
|
+
accepted: File[];
|
|
64
|
+
errors: AttachmentError[];
|
|
65
|
+
};
|
|
66
|
+
/** Formats a byte count as "12.3 KB" / "4.5 MB", with translatable unit labels. */
|
|
67
|
+
export declare function formatBytes(bytes: number, units?: {
|
|
68
|
+
kb: string;
|
|
69
|
+
mb: string;
|
|
70
|
+
}): string;
|
|
71
|
+
/** Reads a Blob as a data URL. */
|
|
72
|
+
export declare function readFileAsDataUrl(file: Blob): Promise<string>;
|
|
73
|
+
/**
|
|
74
|
+
* Turns selected files into staged attachments (base name, extension as format, raw
|
|
75
|
+
* base64, size in bytes). Files that cannot be read are skipped.
|
|
76
|
+
*/
|
|
77
|
+
export declare function readFiles(files: File[]): Promise<DocumentAttachment[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Re-encodes an image data URL as JPEG at the given quality (0–1). Transparent areas
|
|
80
|
+
* are filled with white, since JPEG has no alpha channel. Browser only.
|
|
81
|
+
*/
|
|
82
|
+
export declare function compressDataUrl(dataUrl: string, quality: number): Promise<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Validates staged attachments against the limits and converts them to the shape that
|
|
85
|
+
* is stored in the attachment list. Stops at the file-count limit; skips files that are
|
|
86
|
+
* too large or cannot be processed.
|
|
87
|
+
*
|
|
88
|
+
* With imageCompressor on, JPEG/PNG/WebP images are re-encoded as JPEG; the result is
|
|
89
|
+
* kept only if it is smaller, in which case the stored format becomes "jpg".
|
|
90
|
+
*/
|
|
91
|
+
export declare function prepareAttachments(staged: DocumentAttachment[], options: PrepareOptions, compress?: CompressFn): Promise<PrepareResult>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { FileSizeResult, FileIconProps, MimeType } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Formats file size into human-readable format with appropriate color coding
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatFileSize(size: number): FileSizeResult;
|
|
6
|
+
/**
|
|
7
|
+
* Determines file type based on file extension or MIME type
|
|
8
|
+
*/
|
|
9
|
+
export declare function getFileType(fileName: string, mimeType?: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Gets appropriate icon and color for file type (legacy function for backward compatibility)
|
|
12
|
+
*/
|
|
13
|
+
export declare function getFileIcon(fileName: string, mimeType?: string): FileIconProps;
|
|
14
|
+
/**
|
|
15
|
+
* Gets detailed icon and color for specific file extension
|
|
16
|
+
*/
|
|
17
|
+
export declare function getDetailedFileIcon(fileName: string): {
|
|
18
|
+
icon: string;
|
|
19
|
+
color: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Gets only the icon name for a file extension
|
|
23
|
+
*/
|
|
24
|
+
export declare function getFileIconName(fileName: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Gets only the color for a file extension
|
|
27
|
+
*/
|
|
28
|
+
export declare function getFileIconColor(fileName: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if file is an image type
|
|
31
|
+
*/
|
|
32
|
+
export declare function isImageFile(fileName: string, mimeType?: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Validates file size against maximum allowed size
|
|
35
|
+
*/
|
|
36
|
+
export declare function validateFileSize(fileSize: number, maxSize: number): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Validates file count against maximum allowed count
|
|
39
|
+
*/
|
|
40
|
+
export declare function validateFileCount(currentCount: number, maxCount: number): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Gets MIME type from file extension
|
|
43
|
+
*/
|
|
44
|
+
export declare function getMimeTypeFromExtension(fileName: string): MimeType;
|
|
45
|
+
/**
|
|
46
|
+
* Constructs proper data URL for base64 image data
|
|
47
|
+
*/
|
|
48
|
+
export declare function constructImageDataUrl(base64: string | undefined, format: string | undefined): string;
|
|
49
|
+
/**
|
|
50
|
+
* Compresses image using canvas
|
|
51
|
+
*/
|
|
52
|
+
export declare function compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Converts file to base64 string
|
|
55
|
+
*/
|
|
56
|
+
export declare function fileToBase64(file: File): Promise<string>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FileData } from '../types';
|
|
2
|
+
type VideoSource = Pick<FileData, 'name' | 'format' | 'base64'>;
|
|
3
|
+
/** Builds a playable data URL for a stored video attachment. */
|
|
4
|
+
export declare function getVideoDataUrl(file: VideoSource): string;
|
|
5
|
+
/**
|
|
6
|
+
* Captures a frame (at 1s or 10% of the duration, whichever is earlier) and returns
|
|
7
|
+
* it as a JPEG data URL. Browser only.
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateVideoThumbnail(file: VideoSource): Promise<string>;
|
|
10
|
+
export interface VideoThumbnailCache {
|
|
11
|
+
/** Returns the cached thumbnail, or starts generating it and returns undefined. */
|
|
12
|
+
get(file: VideoSource): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Drops a cached thumbnail (e.g. its <img> failed to load) and notifies, so the UI
|
|
15
|
+
* re-renders and the next get() regenerates it. After one retry the file is given up on.
|
|
16
|
+
*/
|
|
17
|
+
invalidate(file: VideoSource): void;
|
|
18
|
+
/** Frees thumbnails of files that are no longer shown. */
|
|
19
|
+
retain(files: VideoSource[]): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Key from name, total length and the end of the data. The first bytes of a video are
|
|
23
|
+
* the container header, which is often identical across clips from the same device.
|
|
24
|
+
*/
|
|
25
|
+
export declare function videoThumbnailKey(file: VideoSource): string;
|
|
26
|
+
/**
|
|
27
|
+
* Caches generated thumbnails and de-duplicates in-flight work. `onUpdate` fires when a
|
|
28
|
+
* thumbnail becomes available or is invalidated, so a UI layer can re-render (bump a Vue
|
|
29
|
+
* ref, set React state, …). Failed generations are retried once, then given up on.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createVideoThumbnailCache(onUpdate: () => void, generate?: (file: VideoSource) => Promise<string>): VideoThumbnailCache;
|
|
32
|
+
export {};
|