Skip to content

Commit d487245

Browse files
committed
search file manager
1 parent b241552 commit d487245

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+9909
-6963
lines changed

.browserslistrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> 1%
2+
last 2 versions
3+
not ie <= 8

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist/
2+
/*.js

.eslintrc.js

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
11
module.exports = {
2-
env: {
3-
browser: true,
4-
es2021: true,
5-
},
6-
extends: ['plugin:vue/essential', 'airbnb-base', 'prettier'],
7-
parserOptions: {
8-
ecmaVersion: 'latest',
9-
sourceType: 'module',
10-
},
11-
plugins: ['vue', 'prettier'],
12-
rules: {
13-
'prettier/prettier': 'error',
14-
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
15-
'no-param-reassign': [
16-
'error',
17-
{
18-
props: true,
19-
ignorePropertyModificationsFor: ['state'],
20-
},
2+
root: true,
3+
env: {
4+
node: true,
5+
},
6+
extends: [
7+
'plugin:vue/essential',
8+
'@vue/airbnb',
9+
],
10+
rules: {
11+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
12+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
13+
'no-param-reassign': [
14+
'error',
15+
{
16+
'props': true,
17+
'ignorePropertyModificationsFor': [
18+
'state',
19+
'acc',
20+
'e',
21+
'ctx',
22+
'req',
23+
'request',
24+
'res',
25+
'response',
26+
'$scope',
2127
],
22-
},
28+
},
29+
],
30+
'max-len': 'off',
31+
'vue/no-use-v-if-with-v-for': [
32+
'error', {
33+
'allowUsingIterationVar': true,
34+
}],
35+
},
36+
parserOptions: {
37+
parser: 'babel-eslint',
38+
},
2339
};

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# Contributing
22

33
> Contributions are welcome, and are accepted via pull requests.
4+
5+
## Pull requests
6+
7+
Please ensure all pull requests are made against the `develop` branch on GitHub.
8+

README.md

Lines changed: 74 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
# Laravel file manager (Frontend)
1+
# laravel-file-manager (Frontend)
22

3-
> Backend - Laravel package - [alexusmai/laravel-file-manager](https://github.com/alexusmai/laravel-file-manager)
3+
> File manager for Laravel - Frontend - Vue.js
4+
5+
> Backend - Laravel 5 package - [alexusmai/laravel-file-manager](https://github.com/alexusmai/laravel-file-manager)
46
57
![Laravel File Manager](https://raw.github.com/alexusmai/vue-laravel-file-manager/master/src/assets/laravel-file-manager.gif?raw=true)
68

7-
# New in version 3
9+
# v 2.4.0
10+
11+
Now you can overwrite default settings using props
812

9-
- Vue.js 3
10-
- Bootstrap 5
11-
- Bootstrap icons
1213

1314
## Installation
1415

@@ -22,74 +23,90 @@ $ npm install laravel-file-manager --save
2223
**IF** your App using Vuex store
2324

2425
```
25-
import { createApp } from 'vue';
26-
import { createStore } from 'vuex';
27-
28-
// Source main component
29-
import Main from './components/Main.vue';
3026
import FileManager from 'laravel-file-manager'
31-
// your Vuex store
32-
import store from './path-to-your-store/store'
27+
import store from './path-to-your-store/store' // your Vuex store
3328
34-
createApp(Main).use(store).use(FileManager, {store}).mount('#id');
29+
Vue.use(FileManager, {store})
3530
```
3631

3732
**ELSE** you need to create a new vuex instance
3833

3934
```
40-
import { createApp } from 'vue';
41-
import { createStore } from 'vuex';
42-
43-
// Source main component
44-
import Main from './components/Main.vue';
35+
import Vue from 'vue';
36+
import Vuex from 'vuex';
4537
import FileManager from 'laravel-file-manager'
4638
47-
// Create a new store instance.
48-
const store = createStore();
39+
Vue.use(Vuex);
40+
41+
// create Vuex store, if you don't have it
42+
const store = new Vuex.Store();
4943
50-
createApp(Main).use(store).use(FileManager, {store}).mount('#id');
44+
Vue.use(FileManager, {store});
5145
```
5246

5347
`The application store module will be registered under the name 'fm'`
5448

55-
Now vue component is registered and you can use it in your app
56-
```
57-
<file-manager></file-manager>
58-
```
59-
60-
### You can overwrite some default settings
49+
You can overwrite some default settings
6150

6251
```
6352
// In the new version 2.4.0 and higher
6453
<file-manager v-bind:settings="settings"></file-manager>
6554
6655
...
6756
// settings object structure
68-
computed: {
69-
settings() {
70-
return {
71-
// axios headers
72-
headers: {
73-
'X-Requested-With': 'XMLHttpRequest',
74-
Authorization: `Bearer ${window.localStorage.getItem('user-token')}`,
75-
},
76-
baseUrl: 'http://test.loc/file-manager/', // overwrite base url Axios
77-
windowsConfig: 2, // overwrite config
78-
lang: 'de', // set language
79-
translation: { // add new translation
80-
name: de,
81-
content: {
82-
about: 'Über',
83-
back: 'Zurück',
84-
... see lang file structure
85-
},
86-
},
87-
};
57+
settings: {
58+
// axios headers
59+
headers: {
60+
'X-Requested-With': 'XMLHttpRequest',
61+
Authorization: `Bearer ${window.localStorage.getItem('user-token')}`,
62+
},
63+
baseUrl: 'http://test.loc/file-manager/', // overwrite base url Axios
64+
windowsConfig: 2, // overwrite config
65+
lang: 'de', // set language
66+
translation: { // add new translation
67+
name: de,
68+
content: {
69+
about: 'Über',
70+
back: 'Zurück',
71+
... see lang file structure
8872
},
89-
}
73+
},
74+
},
9075
...
9176
77+
// Old versions
78+
Vue.use(FileManager, {
79+
store, // required
80+
81+
// not required params
82+
83+
headers: {
84+
'X-Requested-With': 'XMLHttpRequest',
85+
'Authorization': 'Bearer ...'
86+
},
87+
// default headers example
88+
headers: {
89+
'X-Requested-With': 'XMLHttpRequest',
90+
'X-CSRF-TOKEN': 'set laravel csrf token here...'
91+
},
92+
93+
baseUrl: 'http://my_url:80/file-manager/', // overwrite base url Axios
94+
windowsConfig: 2,
95+
lang: 'de', // set language
96+
translation: { // add new translation
97+
name: de,
98+
content: {
99+
about: 'Über',
100+
back: 'Zurück',
101+
... see lang file structure
102+
},
103+
},
104+
}
105+
```
92106

107+
Now vue component is registered and you can use it in your app
108+
```
109+
<file-manager></file-manager>
93110
```
94111

95112
## Available Props
@@ -104,22 +121,25 @@ computed: {
104121
| lang | String | 'de' | No | Set language |
105122
| translation | Object | { ... see lang file structure }, | No | Add new translation |
106123

107-
## CSRF, Bootstrap, Bootstrap icons
124+
## CSRF, Bootstrap, FontAwesome
108125

109-
Don't forget to add a csrf token to head block in your Laravel view and add bootstrap 5 and bootstrap icons 5 styles
126+
Don't forget add a csrf token to head block in your Laravel view and add bootstrap 4 and fontawesome 5 styles
110127
```
111128
<!-- CSRF Token -->
112129
<meta name="csrf-token" content="{{ csrf_token() }}">
113130
<!-- Example -->
114-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
115-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap[email protected]/font/bootstrap-icons.css">
131+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css">
132+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
116133
```
117134

118-
[Laravel mix environment variables](https://laravel.com/docs/mix#environment-variables)
135+
You can use [environment variables](https://laravel.com/docs/mix#environment-variables)
136+
119137
```
120138
// set baseUrl
121139
MIX_LFM_BASE_URL=http://my-url.loc/file-manager/
122140
123141
// if you don't want to use csrf-token - you can off it
124142
MIX_LFM_CSRF_TOKEN=OFF
125143
```
144+
145+
Warning! Package use axios (Promise) - use babel-polyfill for ie11

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset',
4+
],
5+
};

jest.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
moduleFileExtensions: [
3+
'js',
4+
'jsx',
5+
'json',
6+
'vue',
7+
],
8+
transform: {
9+
'^.+\\.vue$': 'vue-jest',
10+
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
11+
'^.+\\.jsx?$': 'babel-jest',
12+
},
13+
moduleNameMapper: {
14+
'^@/(.*)$': '<rootDir>/src/$1',
15+
},
16+
snapshotSerializers: [
17+
'jest-serializer-vue',
18+
],
19+
testMatch: [
20+
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)',
21+
],
22+
testURL: 'http://localhost/',
23+
};

package.json

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "laravel-file-manager",
3-
"version": "3.0.1",
3+
"version": "2.5.4",
44
"description": "File manager for Laravel",
55
"keywords": [
66
"laravel",
@@ -12,31 +12,33 @@
1212
"license": "MIT",
1313
"main": "src/init.js",
1414
"scripts": {
15-
"dev": "vite",
16-
"build": "vite build",
17-
"preview": "vite preview"
15+
"serve": "vue-cli-service serve",
16+
"build": "vue-cli-service build",
17+
"lint": "vue-cli-service lint",
18+
"test:unit": "vue-cli-service test:unit"
1819
},
1920
"dependencies": {
20-
"axios": "^0.25.0",
21-
"codemirror": "^5.65.1",
22-
"codemirror-editor-vue3": "^1.0.1",
23-
"cropperjs": "^1.5.12",
24-
"mitt": "^3.0.0",
25-
"plyr": "^3.6.12",
26-
"vue": "^3.2.25",
27-
"vuex": "^4.0.2"
21+
"axios": "^0.21.1",
22+
"codemirror": "^5.59.2",
23+
"core-js": "^3.9.0",
24+
"cropperjs": "^1.5.11",
25+
"plyr": "^3.6.4",
26+
"vue": "^2.6.12",
27+
"vue-codemirror": "^4.0.6",
28+
"vuex": "^3.6.2"
2829
},
2930
"devDependencies": {
30-
"@vitejs/plugin-vue": "^2.0.0",
31-
"eslint": "^8.8.0",
32-
"eslint-config-airbnb-base": "^15.0.0",
33-
"eslint-config-prettier": "^8.3.0",
34-
"eslint-plugin-import": "^2.25.4",
35-
"eslint-plugin-prettier": "^4.0.0",
36-
"eslint-plugin-vue": "^8.4.0",
37-
"prettier": "^2.5.1",
38-
"sass": "^1.49.7",
39-
"vite": "^2.7.2",
40-
"vite-plugin-environment": "^1.1.0"
31+
"@vue/cli-plugin-babel": "~4.4.6",
32+
"@vue/cli-plugin-eslint": "~4.4.6",
33+
"@vue/cli-plugin-vuex": "~4.4.6",
34+
"@vue/cli-service": "~4.4.6",
35+
"@vue/eslint-config-airbnb": "^5.0.2",
36+
"babel-eslint": "^10.1.0",
37+
"eslint": "^6.8.0",
38+
"eslint-plugin-import": "^2.22.0",
39+
"eslint-plugin-vue": "^6.2.2",
40+
"node-sass": "^4.14.1",
41+
"sass-loader": "^8.0.2",
42+
"vue-template-compiler": "^2.6.12"
4143
}
4244
}

postcss.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
plugins: {
3+
autoprefixer: {},
4+
},
5+
};

public/favicon.ico

-3.06 KB
Binary file not shown.

public/index.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title>new-file-manager</title>
9+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
10+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css">
11+
</head>
12+
<body>
13+
<noscript>
14+
<strong>
15+
We're sorry but file-manager doesn't work properly without JavaScript enabled. Please enable it to continue.
16+
</strong>
17+
</noscript>
18+
<div class="container">
19+
<div style="height: 600px;">
20+
<div id="fm"></div>
21+
</div>
22+
</div>
23+
<!-- built files will be auto injected -->
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)