handy-uploader 2.0.0 → 2.0.2

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 CHANGED
@@ -1,10 +1,12 @@
1
- # Handy Uploader Vue
1
+ # Handy Uploader
2
2
 
3
- [![npm version](https://badge.fury.io/js/handy-uploader-vue.svg)](https://badge.fury.io/js/handy-uploader-vue)
3
+ [![npm version](https://badge.fury.io/js/handy-uploader.svg)](https://badge.fury.io/js/handy-uploader)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Vue 3](https://img.shields.io/badge/Vue-3.x-4FC08D.svg)](https://vuejs.org/)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
7
7
 
8
+ ## 🚀 [Live Demo](https://friendly-varahamihira-45c09f.netlify.app)
9
+
8
10
  A comprehensive Vue 3 file uploader component library with advanced features including **automatic video thumbnail generation**, multiple upload styles, and extensive file type support.
9
11
 
10
12
  ## ✨ Key Features
@@ -37,15 +39,15 @@ A comprehensive Vue 3 file uploader component library with advanced features inc
37
39
  ## 📦 Installation
38
40
 
39
41
  ```bash
40
- npm install handy-uploader-vue
42
+ npm install handy-uploader
41
43
  ```
42
44
 
43
45
  ```bash
44
- yarn add handy-uploader-vue
46
+ yarn add handy-uploader
45
47
  ```
46
48
 
47
49
  ```bash
48
- pnpm add handy-uploader-vue
50
+ pnpm add handy-uploader
49
51
  ```
50
52
 
51
53
  ## 🚀 Quick Start
@@ -75,8 +77,8 @@ npm install vue@^3.0.0 vuetify@^3.0.0
75
77
  </template>
76
78
 
77
79
  <script setup lang="ts">
78
- import { ThumbnailUploader } from 'handy-uploader-vue'
79
- import type { FileData } from 'handy-uploader-vue'
80
+ import { ThumbnailUploader } from 'handy-uploader'
81
+ import type { FileData } from 'handy-uploader'
80
82
 
81
83
  const handleFilesSelected = (files: FileData[]) => {
82
84
  console.log('Selected files:', files)
@@ -122,7 +124,7 @@ Perfect for media files with automatic video thumbnail generation:
122
124
  </template>
123
125
 
124
126
  <script setup>
125
- import { ThumbnailUploader } from 'handy-uploader-vue'
127
+ import { ThumbnailUploader } from 'handy-uploader'
126
128
 
127
129
  const onFilesSelected = (files) => {
128
130
  // Video files will have thumbnails automatically generated
@@ -342,7 +344,7 @@ export default createVuetify({
342
344
 
343
345
  <script setup lang="ts">
344
346
  import { ref } from 'vue'
345
- import { ThumbnailUploader, type FileData } from 'handy-uploader-vue'
347
+ import { ThumbnailUploader, type FileData } from 'handy-uploader'
346
348
 
347
349
  const selectedFiles = ref<FileData[]>([])
348
350
  const currentLanguage = ref('en')
@@ -385,16 +387,16 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
385
387
 
386
388
  ## 🔗 Links
387
389
 
388
- - [GitHub Repository](https://github.com/yourusername/handy-uploader-vue)
389
- - [npm Package](https://www.npmjs.com/package/handy-uploader-vue)
390
- - [Documentation](https://github.com/yourusername/handy-uploader-vue#readme)
391
- - [Issues](https://github.com/yourusername/handy-uploader-vue/issues)
390
+ - [GitHub Repository](https://github.com/alijahanpak/vue-file-uploader)
391
+ - [npm Package](https://www.npmjs.com/package/handy-uploader)
392
+ - [Documentation](https://github.com/alijahanpak/vue-file-uploader#readme)
393
+ - [Issues](https://github.com/alijahanpak/vue-file-uploader/issues)
392
394
 
393
395
  ## 📊 Stats
394
396
 
395
- ![npm downloads](https://img.shields.io/npm/dm/handy-uploader-vue.svg)
396
- ![GitHub stars](https://img.shields.io/github/stars/yourusername/handy-uploader-vue.svg)
397
- ![GitHub issues](https://img.shields.io/github/issues/yourusername/handy-uploader-vue.svg)
397
+ ![npm downloads](https://img.shields.io/npm/dm/handy-uploader.svg)
398
+ ![GitHub stars](https://img.shields.io/github/stars/alijahanpak/handy-uploader.svg)
399
+ ![GitHub issues](https://img.shields.io/github/issues/alijahanpak/handy-uploader.svg)
398
400
 
399
401
  ---
400
402
 
@@ -0,0 +1,24 @@
1
+ import type { DocumentAttachment, LanguageCollection } from '@/types';
2
+ interface Props {
3
+ documentAttachment: DocumentAttachment[];
4
+ badgeCounter: boolean;
5
+ btnColor: string;
6
+ lang: string;
7
+ maxFileCount: number;
8
+ selectedLang: LanguageCollection;
9
+ }
10
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ openInputDocumentModal: (...args: any[]) => void;
12
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>> & Readonly<{
13
+ onOpenInputDocumentModal?: ((...args: any[]) => any) | undefined;
14
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
15
+ export default _default;
16
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
17
+ type __VLS_TypePropsToRuntimeProps<T> = {
18
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
19
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
20
+ } : {
21
+ type: import('vue').PropType<T[K]>;
22
+ required: true;
23
+ };
24
+ };
@@ -0,0 +1,29 @@
1
+ interface Props {
2
+ fileFormat: string;
3
+ size: number;
4
+ }
5
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
6
+ size: number;
7
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
8
+ size: number;
9
+ }>>> & Readonly<{}>, {
10
+ size: number;
11
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
+ 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
+ } & {};
@@ -0,0 +1,60 @@
1
+ import type { DocumentAttachment, LanguageCollection } from '@/types';
2
+ interface Props {
3
+ documentAttachment: DocumentAttachment[];
4
+ lang: string;
5
+ thumb: boolean;
6
+ cols: number;
7
+ editPermission: boolean;
8
+ cardType?: string;
9
+ outlined?: boolean;
10
+ raised?: boolean;
11
+ shaped?: boolean;
12
+ tile?: boolean;
13
+ deletePermission: boolean;
14
+ selectedLang: LanguageCollection;
15
+ }
16
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
17
+ thumb: boolean;
18
+ lang: string;
19
+ cols: number;
20
+ editPermission: boolean;
21
+ deletePermission: boolean;
22
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
+ openDeleteDialog: (...args: any[]) => void;
24
+ openEditDocumentDialog: (...args: any[]) => void;
25
+ setCardTheme: (...args: any[]) => void;
26
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
27
+ thumb: boolean;
28
+ lang: string;
29
+ cols: number;
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;
36
+ }>, {
37
+ lang: string;
38
+ thumb: boolean;
39
+ cols: number;
40
+ editPermission: boolean;
41
+ deletePermission: boolean;
42
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
43
+ 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
+ } & {};
@@ -0,0 +1,62 @@
1
+ import type { DocumentAttachment, LanguageCollection } from '@/types';
2
+ interface Props {
3
+ documentAttachment: DocumentAttachment[];
4
+ thumb: boolean;
5
+ lang: string;
6
+ cols: number;
7
+ editPermission: boolean;
8
+ deletePermission: boolean;
9
+ tableThumbColumn: boolean;
10
+ tableFixedHeader: boolean;
11
+ tableHeight: number;
12
+ selectedLang: LanguageCollection;
13
+ }
14
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
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, {
23
+ openDeleteDialog: (...args: any[]) => void;
24
+ openEditDocumentDialog: (...args: any[]) => void;
25
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
26
+ thumb: boolean;
27
+ lang: string;
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;
36
+ }>, {
37
+ tableFixedHeader: boolean;
38
+ tableHeight: number;
39
+ lang: string;
40
+ thumb: boolean;
41
+ cols: number;
42
+ editPermission: boolean;
43
+ deletePermission: boolean;
44
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
45
+ 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
+ } & {};
@@ -0,0 +1,59 @@
1
+ import type { DocumentAttachment, BaseUploaderProps, CardThemeProps, LanguageCode } from "@/types";
2
+ interface Props extends BaseUploaderProps, CardThemeProps {
3
+ lang: LanguageCode;
4
+ }
5
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
6
+ thumb: boolean;
7
+ lang: string;
8
+ cols: number;
9
+ editPermission: boolean;
10
+ deletePermission: boolean;
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;
31
+ }>, {
32
+ outlined: boolean;
33
+ shaped: boolean;
34
+ raised: boolean;
35
+ tile: boolean;
36
+ lang: LanguageCode;
37
+ thumb: boolean;
38
+ cols: number;
39
+ editPermission: boolean;
40
+ deletePermission: boolean;
41
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
42
+ 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
+ } & {};
@@ -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
+ };