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.
Files changed (43) hide show
  1. package/README.md +391 -30
  2. package/dist/components/InsertButton.vue.d.ts +24 -0
  3. package/dist/components/SelectFileIconType.vue.d.ts +29 -0
  4. package/dist/components/SimpleUploader.vue.d.ts +60 -0
  5. package/dist/components/TableUploader.vue.d.ts +62 -0
  6. package/dist/components/ThumbnailUploader.vue.d.ts +59 -0
  7. package/dist/components/handyUploader.vue.d.ts +146 -0
  8. package/dist/composables/useErrorHandler.d.ts +39 -0
  9. package/dist/composables/useFileUpload.d.ts +33 -0
  10. package/dist/favicon.ico +0 -0
  11. package/dist/handy-uploader.es.js +2407 -0
  12. package/dist/handy-uploader.umd.js +1 -0
  13. package/dist/lib/index.d.ts +713 -0
  14. package/dist/lib/language.d.ts +39 -0
  15. package/dist/types/index.d.ts +129 -0
  16. package/dist/utils/documentation.d.ts +95 -0
  17. package/dist/utils/fileUtils.d.ts +41 -0
  18. package/dist/utils/propValidation.d.ts +71 -0
  19. package/package.json +59 -56
  20. package/.eslintrc.js +0 -14
  21. package/LICENSE +0 -21
  22. package/babel.config.js +0 -3
  23. package/dist/demo.html +0 -10
  24. package/dist/handyUploader.common.js +0 -30712
  25. package/dist/handyUploader.common.js.map +0 -1
  26. package/dist/handyUploader.css +0 -5
  27. package/dist/handyUploader.umd.js +0 -30722
  28. package/dist/handyUploader.umd.js.map +0 -1
  29. package/dist/handyUploader.umd.min.js +0 -11
  30. package/dist/handyUploader.umd.min.js.map +0 -1
  31. package/package-lock.json +0 -11831
  32. package/src/App.vue +0 -69
  33. package/src/components/InsertButton.vue +0 -61
  34. package/src/components/SelectFileIconType.vue +0 -103
  35. package/src/components/SimpleUploader.vue +0 -401
  36. package/src/components/TableUploader.vue +0 -350
  37. package/src/components/ThumbnailUploader.vue +0 -371
  38. package/src/components/handyUploader.vue +0 -883
  39. package/src/components/index.js +0 -10
  40. package/src/components/language.js +0 -148
  41. package/src/main.js +0 -10
  42. package/src/plugins/vuetify.js +0 -11
  43. package/vue.config.js +0 -3
@@ -0,0 +1,39 @@
1
+ interface Translation {
2
+ insertFile: string;
3
+ insertNewFile: string;
4
+ add: string;
5
+ delete: string;
6
+ edit: string;
7
+ deleteDialog: {
8
+ message: string;
9
+ cancel: string;
10
+ };
11
+ table: {
12
+ thumb: string;
13
+ name: string;
14
+ size: string;
15
+ tags?: string;
16
+ action: {
17
+ action: string;
18
+ deleteTooltip: string;
19
+ };
20
+ };
21
+ size: {
22
+ kb: string;
23
+ mb: string;
24
+ };
25
+ maxFileSizeAlert?: string;
26
+ maxFileCountAlert: string;
27
+ fileName: string;
28
+ fileDescription: string;
29
+ fileTags: string;
30
+ }
31
+ interface Language {
32
+ en: Translation;
33
+ fa: Translation;
34
+ fr: Translation;
35
+ ch: Translation;
36
+ ar: Translation;
37
+ }
38
+ export declare const languages: Language;
39
+ export {};
@@ -0,0 +1,129 @@
1
+ export interface FileData {
2
+ name: string;
3
+ format: string;
4
+ base64: string;
5
+ size: number;
6
+ tags: string[];
7
+ description: string | null;
8
+ showDetailState: boolean;
9
+ }
10
+ export interface DocumentAttachment {
11
+ file: FileData;
12
+ }
13
+ export type FileUploaderType = 'simple' | 'thumbnail' | 'table';
14
+ export type CardType = 'default' | 'outlined' | 'shaped' | 'raised' | 'tile';
15
+ export type LanguageCode = 'en' | 'fa' | 'fr' | 'ch' | 'ar';
16
+ export interface FileSizeResult {
17
+ text: string;
18
+ color: string;
19
+ }
20
+ export interface FileIconProps {
21
+ icon: string;
22
+ color: string;
23
+ }
24
+ export interface Translation {
25
+ insertFile: string;
26
+ insertNewFile: string;
27
+ add: string;
28
+ delete: string;
29
+ edit: string;
30
+ deleteDialog: {
31
+ message: string;
32
+ cancel: string;
33
+ };
34
+ table: {
35
+ thumb: string;
36
+ name: string;
37
+ size: string;
38
+ tags?: string;
39
+ action: {
40
+ action: string;
41
+ deleteTooltip: string;
42
+ };
43
+ };
44
+ size: {
45
+ kb: string;
46
+ mb: string;
47
+ };
48
+ maxFileSizeAlert?: string;
49
+ maxFileCountAlert: string;
50
+ fileName: string;
51
+ fileDescription: string;
52
+ fileTags: string;
53
+ }
54
+ export interface LanguageCollection {
55
+ [key: string]: Translation;
56
+ }
57
+ export interface BaseUploaderProps {
58
+ documentAttachment: DocumentAttachment[];
59
+ lang?: LanguageCode;
60
+ thumb?: boolean;
61
+ cols?: number;
62
+ editPermission?: boolean;
63
+ deletePermission?: boolean;
64
+ selectedLang: LanguageCollection;
65
+ }
66
+ export interface CardThemeProps {
67
+ cardType?: CardType;
68
+ outlined?: boolean;
69
+ raised?: boolean;
70
+ shaped?: boolean;
71
+ tile?: boolean;
72
+ }
73
+ export interface HandyUploaderProps extends BaseUploaderProps, CardThemeProps {
74
+ maxFileSize?: number;
75
+ fileUploaderType?: FileUploaderType;
76
+ maxFileCount?: number;
77
+ badgeCounter?: boolean;
78
+ btnColor?: string;
79
+ imageCompressor?: boolean;
80
+ imageCompressLevel?: number;
81
+ fileAccept?: string;
82
+ tableThumbColumn?: boolean;
83
+ tableFixedHeader?: boolean;
84
+ tableHeight?: number;
85
+ rtlSupport?: boolean;
86
+ changeFileName?: boolean;
87
+ addFileDescription?: boolean;
88
+ addFileTag?: boolean;
89
+ tags?: string[];
90
+ customLang?: LanguageCollection | null;
91
+ insertPermission?: boolean;
92
+ }
93
+ export interface UploaderEvents {
94
+ openDeleteDialog: (index: number, deleteId: string) => void;
95
+ openEditDocumentDialog: (item: DocumentAttachment, index: number) => void;
96
+ setCardTheme?: () => void;
97
+ }
98
+ export interface HandyUploaderEvents extends UploaderEvents {
99
+ updateCardType: (value: CardType) => void;
100
+ updateBadgeCounter: (value: boolean) => void;
101
+ updateMaxFileCount: (value: number) => void;
102
+ updateMaxFileSize: (value: number) => void;
103
+ updateImageCompressor: (value: boolean) => void;
104
+ updateImageCompressLevel: (value: number) => void;
105
+ updateFileAccept: (value: string) => void;
106
+ updateThumb: (value: boolean) => void;
107
+ updateChangeFileName: (value: boolean) => void;
108
+ updateAddFileDescription: (value: boolean) => void;
109
+ updateTableThumbColumn: (value: boolean) => void;
110
+ updateTableFixedHeader: (value: boolean) => void;
111
+ updateTableHeight: (value: number) => void;
112
+ updateLang: (value: LanguageCode) => void;
113
+ updateDocumentAttachment: (value: DocumentAttachment[]) => void;
114
+ }
115
+ export type MimeType = 'image/jpeg' | 'image/png' | 'image/tiff' | 'image/bmp' | string;
116
+ export interface ProcessedFile {
117
+ base64: string;
118
+ size: string;
119
+ name: string;
120
+ tags: string[];
121
+ description: string;
122
+ showDetailState: boolean;
123
+ format: string;
124
+ }
125
+ export interface SnackbarConfig {
126
+ show: boolean;
127
+ text: string;
128
+ color: string;
129
+ }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Component documentation and usage examples
3
+ */
4
+ export interface PropDocumentation {
5
+ name: string;
6
+ type: string;
7
+ required: boolean;
8
+ default?: any;
9
+ description: string;
10
+ examples?: any[];
11
+ validation?: string;
12
+ }
13
+ export interface ComponentDocumentation {
14
+ name: string;
15
+ description: string;
16
+ props: PropDocumentation[];
17
+ events: EventDocumentation[];
18
+ slots: SlotDocumentation[];
19
+ examples: ComponentExample[];
20
+ }
21
+ export interface EventDocumentation {
22
+ name: string;
23
+ description: string;
24
+ payload?: string;
25
+ example?: string;
26
+ }
27
+ export interface SlotDocumentation {
28
+ name: string;
29
+ description: string;
30
+ props?: string;
31
+ example?: string;
32
+ }
33
+ export interface ComponentExample {
34
+ title: string;
35
+ description: string;
36
+ code: string;
37
+ }
38
+ /**
39
+ * HandyUploader component documentation
40
+ */
41
+ export declare const handyUploaderDocumentation: ComponentDocumentation;
42
+ /**
43
+ * Usage examples for different scenarios
44
+ */
45
+ export declare const usageExamples: {
46
+ /**
47
+ * Basic file upload
48
+ */
49
+ basic: string;
50
+ /**
51
+ * Advanced configuration
52
+ */
53
+ advanced: string;
54
+ /**
55
+ * TypeScript usage
56
+ */
57
+ typescript: string;
58
+ };
59
+ /**
60
+ * Best practices and recommendations
61
+ */
62
+ export declare const bestPractices: {
63
+ performance: string[];
64
+ accessibility: string[];
65
+ userExperience: string[];
66
+ security: string[];
67
+ };
68
+ /**
69
+ * Troubleshooting guide
70
+ */
71
+ export declare const troubleshooting: {
72
+ commonIssues: {
73
+ issue: string;
74
+ solutions: string[];
75
+ }[];
76
+ };
77
+ /**
78
+ * Migration guide for upgrading
79
+ */
80
+ export declare const migrationGuide: {
81
+ fromV1: string[];
82
+ breakingChanges: string[];
83
+ };
84
+ /**
85
+ * Get documentation for a specific component
86
+ */
87
+ export declare function getComponentDocumentation(componentName: string): ComponentDocumentation | null;
88
+ /**
89
+ * Generate prop validation code
90
+ */
91
+ export declare function generatePropValidation(props: PropDocumentation[]): string;
92
+ /**
93
+ * Generate TypeScript interface from props
94
+ */
95
+ export declare function generateTypeScriptInterface(componentName: string, props: PropDocumentation[]): string;
@@ -0,0 +1,41 @@
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
12
+ */
13
+ export declare function getFileIcon(fileName: string, mimeType?: string): FileIconProps;
14
+ /**
15
+ * Checks if file is an image type
16
+ */
17
+ export declare function isImageFile(fileName: string, mimeType?: string): boolean;
18
+ /**
19
+ * Validates file size against maximum allowed size
20
+ */
21
+ export declare function validateFileSize(fileSize: number, maxSize: number): boolean;
22
+ /**
23
+ * Validates file count against maximum allowed count
24
+ */
25
+ export declare function validateFileCount(currentCount: number, maxCount: number): boolean;
26
+ /**
27
+ * Gets MIME type from file extension
28
+ */
29
+ export declare function getMimeTypeFromExtension(fileName: string): MimeType;
30
+ /**
31
+ * Constructs proper data URL for base64 image data
32
+ */
33
+ export declare function constructImageDataUrl(base64: string, format: string): string;
34
+ /**
35
+ * Compresses image using canvas
36
+ */
37
+ export declare function compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<string>;
38
+ /**
39
+ * Converts file to base64 string
40
+ */
41
+ export declare function fileToBase64(file: File): Promise<string>;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Validation utilities for component props
3
+ */
4
+ export interface ValidationResult {
5
+ isValid: boolean;
6
+ errors: string[];
7
+ warnings: string[];
8
+ }
9
+ /**
10
+ * Validates file uploader type
11
+ */
12
+ export declare function validateFileUploaderType(value: any): ValidationResult;
13
+ /**
14
+ * Validates card type
15
+ */
16
+ export declare function validateCardType(value: any): ValidationResult;
17
+ /**
18
+ * Validates language code
19
+ */
20
+ export declare function validateLanguageCode(value: any): ValidationResult;
21
+ /**
22
+ * Validates file size (in bytes)
23
+ */
24
+ export declare function validateFileSize(value: any): ValidationResult;
25
+ /**
26
+ * Validates file count
27
+ */
28
+ export declare function validateFileCount(value: any): ValidationResult;
29
+ /**
30
+ * Validates image compression level
31
+ */
32
+ export declare function validateCompressionLevel(value: any): ValidationResult;
33
+ /**
34
+ * Validates file accept pattern
35
+ */
36
+ export declare function validateFileAccept(value: any): ValidationResult;
37
+ /**
38
+ * Validates columns count for grid layout
39
+ */
40
+ export declare function validateColumns(value: any): ValidationResult;
41
+ /**
42
+ * Validates table height
43
+ */
44
+ export declare function validateTableHeight(value: any): ValidationResult;
45
+ /**
46
+ * Validates document attachment array
47
+ */
48
+ export declare function validateDocumentAttachment(value: any): ValidationResult;
49
+ /**
50
+ * Comprehensive prop validation for HandyUploader component
51
+ */
52
+ export declare function validateHandyUploaderProps(props: Record<string, any>): ValidationResult;
53
+ /**
54
+ * Creates a prop validator function for Vue components
55
+ */
56
+ export declare function createPropValidator<T>(validator: (value: any) => ValidationResult): (value: T) => boolean;
57
+ /**
58
+ * Prop validators for Vue components
59
+ */
60
+ export declare const propValidators: {
61
+ fileUploaderType: (value: unknown) => boolean;
62
+ cardType: (value: unknown) => boolean;
63
+ languageCode: (value: unknown) => boolean;
64
+ fileSize: (value: unknown) => boolean;
65
+ fileCount: (value: unknown) => boolean;
66
+ compressionLevel: (value: unknown) => boolean;
67
+ fileAccept: (value: unknown) => boolean;
68
+ columns: (value: unknown) => boolean;
69
+ tableHeight: (value: unknown) => boolean;
70
+ documentAttachment: (value: unknown) => boolean;
71
+ };
package/package.json CHANGED
@@ -1,71 +1,74 @@
1
1
  {
2
2
  "name": "handy-uploader",
3
- "version": "1.1.8",
4
- "description": "Complete and simple file uploader with an image compressor in Vue.js. Choice Theme : Thumbnail, Simple, Table, Add custom fields, Image compressor, Manage files count, Manage files size, Multi language support , ...",
5
- "author": "ali jahanpak",
6
- "license": "MIT",
7
- "scripts": {
8
- "serve": "vue-cli-service serve",
9
- "build": "vue-cli-service build",
10
- "lint": "vue-cli-service lint",
11
- "build-package": "vue-cli-service build --target lib --name handyUploader ./src/components/index.js"
12
- },
13
- "main": "dist/handyUploader.common.js",
14
- "dependencies": {
15
- "core-js": "^3.15.2",
16
- "css-loader": "^3.6.0",
17
- "vue": "^2.6.14",
18
- "vuetify": "^2.5.6"
19
- },
20
- "devDependencies": {
21
- "@mdi/font": "^5.8.55",
22
- "@vue/cli-plugin-babel": "~4.4.0",
23
- "@vue/cli-plugin-eslint": "~4.4.0",
24
- "@vue/cli-service": "~4.4.0",
25
- "@vue/eslint-config-prettier": "^6.0.0",
26
- "babel-eslint": "^10.1.0",
27
- "eslint": "^6.7.2",
28
- "eslint-plugin-prettier": "^3.3.0",
29
- "eslint-plugin-vue": "^6.2.2",
30
- "prettier": "^1.19.1",
31
- "sass": "^1.35.2",
32
- "sass-loader": "^8.0.2",
33
- "vue-cli-plugin-vuetify": "^2.4.1",
34
- "vue-template-compiler": "^2.6.14",
35
- "vuetify-loader": "^1.3.0"
3
+ "version": "2.0.1",
4
+ "description": "A comprehensive Vue 3 file uploader component library with video thumbnail generation and multiple upload styles",
5
+ "main": "dist/handy-uploader.umd.js",
6
+ "module": "dist/handy-uploader.es.js",
7
+ "types": "dist/lib/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/handy-uploader.es.js",
11
+ "require": "./dist/handy-uploader.umd.js",
12
+ "types": "./dist/lib/index.d.ts"
13
+ }
36
14
  },
37
15
  "files": [
38
- "dist/*",
39
- "src/*",
40
- "public/*",
41
- "*.json",
42
- "*.js"
16
+ "dist"
43
17
  ],
44
18
  "keywords": [
45
- "vue.js",
46
19
  "vue",
47
- "nuxt",
48
- "image",
49
- "responsive",
50
- "fileUploader",
51
- "vue-file-upload",
52
- "vue-file-component",
53
- "vue-image-upload",
54
- "upload",
20
+ "vue3",
55
21
  "uploader",
56
- "easy-upload",
57
- "component",
58
- "vue-component",
59
- "multiple",
60
- "compressor",
61
- "vuetify"
22
+ "file-upload",
23
+ "video-thumbnail",
24
+ "drag-drop",
25
+ "vuetify",
26
+ "typescript",
27
+ "component-library"
62
28
  ],
29
+ "author": "Your Name <your.email@example.com>",
30
+ "license": "MIT",
63
31
  "repository": {
64
32
  "type": "git",
65
- "url": "git+https://github.com/alijahanpak/handy-uploader.git"
33
+ "url": "https://github.com/yourusername/handy-uploader.git"
66
34
  },
35
+ "homepage": "https://github.com/yourusername/handy-uploader#readme",
67
36
  "bugs": {
68
- "url": "https://github.com/alijahanpak/handy-uploader/issues"
37
+ "url": "https://github.com/yourusername/handy-uploader/issues"
38
+ },
39
+ "scripts": {
40
+ "dev": "vite",
41
+ "build": "run-p type-check build-lib && npm run build-types",
42
+ "build-lib": "vite build --mode lib",
43
+ "build-types": "vue-tsc --project tsconfig.build.json",
44
+ "preview": "vite preview",
45
+ "build-only": "vite build",
46
+ "type-check": "vue-tsc --noEmit",
47
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
48
+ "format": "prettier --write src/",
49
+ "prepublishOnly": "npm run build"
69
50
  },
70
- "homepage": "https://github.com/alijahanpak/handy-uploader#readme"
51
+ "peerDependencies": {
52
+ "vue": "^3.0.0",
53
+ "vuetify": "^3.0.0"
54
+ },
55
+ "devDependencies": {
56
+ "@mdi/font": "^7.4.47",
57
+ "@rushstack/eslint-patch": "^1.7.2",
58
+ "@types/node": "^20.11.9",
59
+ "@vitejs/plugin-vue": "^5.0.3",
60
+ "@vitejs/plugin-vue-jsx": "^3.1.0",
61
+ "@vue/eslint-config-prettier": "^9.0.0",
62
+ "@vue/eslint-config-typescript": "^12.0.0",
63
+ "@vue/tsconfig": "^0.5.1",
64
+ "eslint": "^8.56.0",
65
+ "eslint-plugin-vue": "^9.20.1",
66
+ "npm-run-all": "^4.1.5",
67
+ "prettier": "^3.2.4",
68
+ "typescript": "~5.3.3",
69
+ "vite": "^5.0.12",
70
+ "vue": "^3.4.15",
71
+ "vue-tsc": "^1.8.27",
72
+ "vuetify": "^3.5.1"
73
+ }
71
74
  }
package/.eslintrc.js DELETED
@@ -1,14 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: {
4
- node: true
5
- },
6
- extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"],
7
- parserOptions: {
8
- parser: "babel-eslint"
9
- },
10
- rules: {
11
- "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
12
- "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
13
- }
14
- };
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 ali jahanpak
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/babel.config.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- presets: ["@vue/cli-plugin-babel/preset"]
3
- };
package/dist/demo.html DELETED
@@ -1,10 +0,0 @@
1
- <meta charset="utf-8">
2
- <title>handyUploader demo</title>
3
- <script src="./handyUploader.umd.js"></script>
4
-
5
- <link rel="stylesheet" href="./handyUploader.css">
6
-
7
-
8
- <script>
9
- console.log(handyUploader)
10
- </script>