Skip to content

Commit 7527a69

Browse files
committed
dont copy license and readme file again
1 parent 273670e commit 7527a69

File tree

4 files changed

+45
-46
lines changed

4 files changed

+45
-46
lines changed

README.md

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Vue File selector
1+
# Vue File selector for Vuejs 3
22
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fd2phap%2Fvue-file-selector.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fd2phap%2Fvue-file-selector?ref=badge_shield)
33

44
File selector with validation that supports drag-n-drop for Vuejs.
@@ -27,46 +27,56 @@ Please see [Demo project](https://github.com/d2phap/vue-file-selector/tree/maste
2727

2828
### Declare the plugin
2929
```js
30-
// import main css
31-
import 'vue-file-selector/main.css';
30+
// in main.ts
3231

33-
// import the library
32+
import { createApp } from 'vue';
33+
34+
// import FileSelector main css
35+
import 'vue-file-selector/dist/main.css';
36+
37+
// import the FileSelector plugin
3438
import FileSelector from 'vue-file-selector';
3539

36-
// then use it!
37-
Vue.use(FileSelector);
40+
41+
import App from './App.vue';
42+
43+
createApp(App)
44+
45+
// then use it!
46+
.use(FileSelector)
47+
.mount('#app');
3848
```
3949

4050
### Use in Vue file
4151
```html
4252
<template>
4353
<div>
44-
<file-selector
54+
<FileSelector
4555
accept-extensions=".jpg,.svg"
4656
:multiple="true"
4757
:max-file-size="5 * 1024 * 1024"
4858
@validated="handleFilesValidated"
49-
@changed="handleFilesChanged"
50-
>
59+
@changed="handleFilesChanged">
5160
Select image files
52-
</file-selector>
61+
</FileSelector>
5362
</div>
5463
</template>
5564

56-
<script>
57-
export default {
58-
name: 'App',
59-
methods: {
60-
handleFilesValidated(result, files) {
61-
console.log('Validation result: ' + result);
62-
},
63-
64-
handleFilesChanged(files) {
65-
console.log('Selected files: ');
66-
console.table(files);
67-
},
65+
<script lang="ts">
66+
import { Options, Vue } from 'vue-class-component';
67+
import { FsValidationResult } from 'vue-file-selector/dist';
68+
69+
@Options({})
70+
export default class App extends Vue {
71+
handleFilesValidated(result: FsValidationResult, files: File[]) {
72+
console.log('Validation result: ' + result);
73+
},
74+
75+
handleFilesChanged(files: File[]) {
76+
console.log('Selected files: ');
77+
console.table(files);
6878
},
69-
};
79+
}
7080
</script>
7181
```
7282

@@ -82,20 +92,20 @@ export default {
8292
## Props
8393
| Name | Type | Default | Description |
8494
| -- | -- | -- | -- |
85-
| `multiple` | `Boolean` | `false` | Allow multiple files selected. |
86-
| `isLoading` | `Boolean` | `false` | Show or hide the loading section (slot: `loader`). |
87-
| `acceptExtensions` | `String` | `(empty)` | List of file extensions accepted. Each extension separated by a comma (`,`). E.g. `accept-extensions=".zip,.rar"`. |
88-
| `maxFileSize` | `Number` | `NaN` | Maximum **size in byte** of every single file allowed. E.g. `:max-file-size="2*1024*1024"` (only the files that ≤2 MB are allowed). |
89-
| `height` | `Number` | `NaN` | The height of droppable section. |
90-
| `validateFn` | `Function -> Boolean` | `() => true` | A custom validation function that returns boolean value. |
95+
| `multiple` | `boolean` | `false` | Allow multiple files selected. |
96+
| `isLoading` | `boolean` | `false` | Show or hide the loading section (slot: `loader`). |
97+
| `acceptExtensions` | `string` | `(empty)` | List of file extensions accepted. Each extension separated by a comma (`,`). E.g. `accept-extensions=".zip,.rar"`. |
98+
| `maxFileSize` | `number` | `NaN` | Maximum **size in byte** of every single file allowed. E.g. `:max-file-size="2*1024*1024"` (only the files that ≤2 MB are allowed). |
99+
| `height` | `number` | `NaN` | The height of droppable section. |
100+
| `validateFn` | `FsValidateFn` | `() => true` | A custom validation function that returns boolean value. |
91101

92102

93103
## Events
94104
### 1. `@validated`
95105
Occurs after the selected files validated.
96106

97107
```js
98-
Function(result: String | Boolean, files: FileList): void
108+
Function(result: FsValidationResult, files: File[]): void
99109
```
100110
- `result`: validation result,
101111
+ returns `true` if the file validation is valid, else
@@ -106,13 +116,13 @@ Function(result: String | Boolean, files: FileList): void
106116
Occurs if the selected files pass validation.
107117

108118
```js
109-
Function(files: FileList): void
119+
Function(files: File[]): void
110120
```
111121
- `files`: list of files validated.
112122

113123

114124
## Error codes
115-
List of error codes returned after validation.
125+
List of error codes returned after validation, see `FsValidationResult`.
116126

117127
| Code | Error description |
118128
| -- | -- |

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
"name": "vue-file-selector",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "File selector component that supports drag-n-drop for VueJs 3",
5-
"private": true,
65
"main": "dist/index.js",
7-
"types": "dist/main.d.ts",
6+
"types": "dist/index.d.ts",
87
"files": [
98
"dist"
109
],

rollup.config.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import typescript from 'rollup-plugin-typescript2';
22
import vue from 'rollup-plugin-vue';
33
import clear from 'rollup-plugin-clear';
44
import externals from 'rollup-plugin-node-externals';
5-
import copy from 'rollup-plugin-copy';
65
import { terser } from 'rollup-plugin-terser';
76
import banner2 from 'rollup-plugin-banner2';
87
import styles from 'rollup-plugin-styles';
@@ -62,15 +61,6 @@ export default async function config(args) {
6261
output: { quote_style: 1 },
6362
}),
6463

65-
copy({
66-
targets: [
67-
{
68-
src: ['./LICENSE', './README.md'],
69-
dest: './dist',
70-
},
71-
],
72-
}),
73-
7464
banner2(() => `/**
7565
* ${pjson.name} v${pjson.version} by ${pjson.author}
7666
* Homepage: ${pjson.homepage}

0 commit comments

Comments
 (0)