handy-uploader 1.1.8 → 2.0.1
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/README.md +391 -30
- package/dist/components/InsertButton.vue.d.ts +24 -0
- package/dist/components/SelectFileIconType.vue.d.ts +29 -0
- package/dist/components/SimpleUploader.vue.d.ts +60 -0
- package/dist/components/TableUploader.vue.d.ts +62 -0
- package/dist/components/ThumbnailUploader.vue.d.ts +59 -0
- package/dist/components/handyUploader.vue.d.ts +146 -0
- package/dist/composables/useErrorHandler.d.ts +39 -0
- package/dist/composables/useFileUpload.d.ts +33 -0
- package/dist/favicon.ico +0 -0
- package/dist/handy-uploader.es.js +2407 -0
- package/dist/handy-uploader.umd.js +1 -0
- package/dist/lib/index.d.ts +713 -0
- package/dist/lib/language.d.ts +39 -0
- package/dist/types/index.d.ts +129 -0
- package/dist/utils/documentation.d.ts +95 -0
- package/dist/utils/fileUtils.d.ts +41 -0
- package/dist/utils/propValidation.d.ts +71 -0
- package/package.json +59 -56
- package/.eslintrc.js +0 -14
- package/LICENSE +0 -21
- package/babel.config.js +0 -3
- package/dist/demo.html +0 -10
- package/dist/handyUploader.common.js +0 -30712
- package/dist/handyUploader.common.js.map +0 -1
- package/dist/handyUploader.css +0 -5
- package/dist/handyUploader.umd.js +0 -30722
- package/dist/handyUploader.umd.js.map +0 -1
- package/dist/handyUploader.umd.min.js +0 -11
- package/dist/handyUploader.umd.min.js.map +0 -1
- package/package-lock.json +0 -11831
- package/src/App.vue +0 -69
- package/src/components/InsertButton.vue +0 -61
- package/src/components/SelectFileIconType.vue +0 -103
- package/src/components/SimpleUploader.vue +0 -401
- package/src/components/TableUploader.vue +0 -350
- package/src/components/ThumbnailUploader.vue +0 -371
- package/src/components/handyUploader.vue +0 -883
- package/src/components/index.js +0 -10
- package/src/components/language.js +0 -148
- package/src/main.js +0 -10
- package/src/plugins/vuetify.js +0 -11
- package/vue.config.js +0 -3
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { DocumentAttachment, LanguageCode, CardType, FileUploaderType, LanguageCollection } from "@/types";
|
|
2
|
+
interface Props {
|
|
3
|
+
documentAttachment: DocumentAttachment[];
|
|
4
|
+
lang: LanguageCode;
|
|
5
|
+
maxFileSize?: number;
|
|
6
|
+
fileUploaderType?: FileUploaderType;
|
|
7
|
+
maxFileCount?: number;
|
|
8
|
+
badgeCounter?: boolean;
|
|
9
|
+
btnColor?: string;
|
|
10
|
+
imageCompressor?: boolean;
|
|
11
|
+
imageCompressLevel?: number;
|
|
12
|
+
fileAccept?: string;
|
|
13
|
+
thumb?: boolean;
|
|
14
|
+
tableThumbColumn?: boolean;
|
|
15
|
+
tableFixedHeader?: boolean;
|
|
16
|
+
tableHeight?: number;
|
|
17
|
+
rtlSupport?: boolean;
|
|
18
|
+
changeFileName?: boolean;
|
|
19
|
+
addFileDescription?: boolean;
|
|
20
|
+
addFileTag?: boolean;
|
|
21
|
+
tags?: string[];
|
|
22
|
+
customLang?: LanguageCollection | null;
|
|
23
|
+
insertPermission?: boolean;
|
|
24
|
+
cols?: number;
|
|
25
|
+
editPermission?: boolean;
|
|
26
|
+
deletePermission?: boolean;
|
|
27
|
+
cardType?: CardType;
|
|
28
|
+
outlined?: boolean;
|
|
29
|
+
raised?: boolean;
|
|
30
|
+
shaped?: boolean;
|
|
31
|
+
tile?: boolean;
|
|
32
|
+
}
|
|
33
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
34
|
+
maxFileSize: number;
|
|
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, {
|
|
55
|
+
updateCardType: (...args: any[]) => void;
|
|
56
|
+
updateBadgeCounter: (...args: any[]) => void;
|
|
57
|
+
updateMaxFileCount: (...args: any[]) => void;
|
|
58
|
+
updateMaxFileSize: (...args: any[]) => void;
|
|
59
|
+
updateImageCompressor: (...args: any[]) => void;
|
|
60
|
+
updateImageCompressLevel: (...args: any[]) => void;
|
|
61
|
+
updateFileAccept: (...args: any[]) => void;
|
|
62
|
+
updateThumb: (...args: any[]) => void;
|
|
63
|
+
updateChangeFileName: (...args: any[]) => void;
|
|
64
|
+
updateAddFileDescription: (...args: any[]) => void;
|
|
65
|
+
updateTableThumbColumn: (...args: any[]) => void;
|
|
66
|
+
updateTableFixedHeader: (...args: any[]) => void;
|
|
67
|
+
updateTableHeight: (...args: any[]) => void;
|
|
68
|
+
updateLang: (...args: any[]) => void;
|
|
69
|
+
updateDocumentAttachment: (...args: any[]) => void;
|
|
70
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
71
|
+
maxFileSize: number;
|
|
72
|
+
fileUploaderType: string;
|
|
73
|
+
maxFileCount: number;
|
|
74
|
+
badgeCounter: boolean;
|
|
75
|
+
btnColor: string;
|
|
76
|
+
imageCompressLevel: number;
|
|
77
|
+
thumb: boolean;
|
|
78
|
+
tableFixedHeader: boolean;
|
|
79
|
+
tableHeight: number;
|
|
80
|
+
lang: string;
|
|
81
|
+
rtlSupport: boolean;
|
|
82
|
+
changeFileName: boolean;
|
|
83
|
+
addFileDescription: boolean;
|
|
84
|
+
addFileTag: boolean;
|
|
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;
|
|
107
|
+
}>, {
|
|
108
|
+
maxFileSize: number;
|
|
109
|
+
fileUploaderType: FileUploaderType;
|
|
110
|
+
maxFileCount: number;
|
|
111
|
+
badgeCounter: boolean;
|
|
112
|
+
btnColor: string;
|
|
113
|
+
imageCompressLevel: number;
|
|
114
|
+
tableFixedHeader: boolean;
|
|
115
|
+
tableHeight: number;
|
|
116
|
+
rtlSupport: boolean;
|
|
117
|
+
changeFileName: boolean;
|
|
118
|
+
addFileDescription: boolean;
|
|
119
|
+
addFileTag: boolean;
|
|
120
|
+
customLang: LanguageCollection | null;
|
|
121
|
+
insertPermission: boolean;
|
|
122
|
+
lang: LanguageCode;
|
|
123
|
+
thumb: boolean;
|
|
124
|
+
cols: number;
|
|
125
|
+
editPermission: boolean;
|
|
126
|
+
deletePermission: boolean;
|
|
127
|
+
cardType: CardType;
|
|
128
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
129
|
+
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
|
+
} & {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface ErrorInfo {
|
|
2
|
+
id: string;
|
|
3
|
+
message: string;
|
|
4
|
+
type: 'error' | 'warning' | 'info' | 'success';
|
|
5
|
+
timestamp: Date;
|
|
6
|
+
context?: Record<string, any>;
|
|
7
|
+
action?: {
|
|
8
|
+
label: string;
|
|
9
|
+
handler: () => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface ErrorHandlerOptions {
|
|
13
|
+
maxErrors?: number;
|
|
14
|
+
autoRemoveTimeout?: number;
|
|
15
|
+
logToConsole?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function useErrorHandler(options?: ErrorHandlerOptions): {
|
|
18
|
+
errors: unknown;
|
|
19
|
+
isLoading: unknown;
|
|
20
|
+
addError: (message: string, type?: ErrorInfo['type'], context?: Record<string, any>, action?: ErrorInfo['action']) => string;
|
|
21
|
+
removeError: (id: string) => boolean;
|
|
22
|
+
clearErrors: () => void;
|
|
23
|
+
clearErrorsByType: (type: ErrorInfo['type']) => void;
|
|
24
|
+
handleAsync: <T>(operation: () => Promise<T>, errorMessage?: string, context?: Record<string, any>) => Promise<T | null>;
|
|
25
|
+
validate: (condition: boolean, message: string, context?: Record<string, any>) => boolean;
|
|
26
|
+
showSuccess: (message: string, context?: Record<string, any>) => string;
|
|
27
|
+
showWarning: (message: string, context?: Record<string, any>) => string;
|
|
28
|
+
showInfo: (message: string, context?: Record<string, any>) => string;
|
|
29
|
+
getErrorsByType: (type: ErrorInfo['type']) => ErrorInfo[];
|
|
30
|
+
getLatestError: () => ErrorInfo | null;
|
|
31
|
+
hasErrors: (type?: ErrorInfo['type']) => boolean;
|
|
32
|
+
fileUploadErrors: {
|
|
33
|
+
fileSizeExceeded: (fileName: string, maxSize: number) => string;
|
|
34
|
+
fileCountExceeded: (maxCount: number) => string;
|
|
35
|
+
invalidFileType: (fileName: string, allowedTypes: string) => string;
|
|
36
|
+
uploadFailed: (fileName: string, reason?: string) => string;
|
|
37
|
+
compressionFailed: (fileName: string) => string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { DocumentAttachment, FileData, SnackbarConfig } from '../types';
|
|
3
|
+
export interface UseFileUploadOptions {
|
|
4
|
+
maxFileSize?: number;
|
|
5
|
+
maxFileCount?: number;
|
|
6
|
+
imageCompressor?: boolean;
|
|
7
|
+
imageCompressLevel?: number;
|
|
8
|
+
fileAccept?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function useFileUpload(documentAttachment: Ref<DocumentAttachment[]>, options?: UseFileUploadOptions): {
|
|
11
|
+
isUploading: Readonly<Ref<boolean, boolean>>;
|
|
12
|
+
snackbar: Readonly<Ref<SnackbarConfig | {
|
|
13
|
+
show: boolean;
|
|
14
|
+
text: string;
|
|
15
|
+
color: string;
|
|
16
|
+
}, SnackbarConfig | {
|
|
17
|
+
show: boolean;
|
|
18
|
+
text: string;
|
|
19
|
+
color: string;
|
|
20
|
+
}>>;
|
|
21
|
+
fileCount: import("vue").ComputedRef<number>;
|
|
22
|
+
canAddMoreFiles: import("vue").ComputedRef<boolean>;
|
|
23
|
+
totalSize: import("vue").ComputedRef<number>;
|
|
24
|
+
uploadFiles: (files: FileList | File[]) => Promise<boolean>;
|
|
25
|
+
removeFile: (index: number) => boolean;
|
|
26
|
+
updateFileMetadata: (index: number, updates: Partial<Pick<FileData, 'name' | 'description' | 'tags'>>) => boolean;
|
|
27
|
+
clearAllFiles: () => void;
|
|
28
|
+
validateFile: (file: File) => {
|
|
29
|
+
valid: boolean;
|
|
30
|
+
error?: string;
|
|
31
|
+
};
|
|
32
|
+
showSnackbar: (text: string, color?: 'success' | 'error' | 'warning') => void;
|
|
33
|
+
};
|
package/dist/favicon.ico
ADDED
|
Binary file
|