@drax/media-vue 1.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/package.json +15 -30
- package/src/components/MediaField.vue +22 -1
- package/src/components/MediaFullField.vue +16 -0
- package/README.md +0 -61
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "2.0.2",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -24,42 +24,27 @@
|
|
|
24
24
|
"format": "prettier --write src/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@drax/media-front": "^
|
|
27
|
+
"@drax/media-front": "^2.0.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"vue": "^
|
|
32
|
-
"vue-i18n": "^9.14.0",
|
|
30
|
+
"vue": "^3.5.28",
|
|
31
|
+
"vue-i18n": "^11.2.8",
|
|
33
32
|
"vuetify": "^3.9.2"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
|
-
"@rushstack/eslint-patch": "^1.8.0",
|
|
37
35
|
"@tsconfig/node20": "^20.1.4",
|
|
38
|
-
"@types/
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@vue/
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"@vue/tsconfig": "^0.5.1",
|
|
45
|
-
"cypress": "^13.7.2",
|
|
46
|
-
"eslint": "^8.57.0",
|
|
47
|
-
"eslint-plugin-cypress": "^2.15.1",
|
|
48
|
-
"eslint-plugin-vue": "^9.23.0",
|
|
49
|
-
"jsdom": "^24.0.0",
|
|
50
|
-
"npm-run-all2": "^6.1.2",
|
|
51
|
-
"pinia": "^2.1.7",
|
|
52
|
-
"pinia-plugin-persistedstate": "^3.2.1",
|
|
53
|
-
"prettier": "^3.2.5",
|
|
54
|
-
"start-server-and-test": "^2.0.3",
|
|
55
|
-
"typescript": "~5.4.0",
|
|
56
|
-
"vite": "^5.4.3",
|
|
36
|
+
"@types/node": "^25.2.3",
|
|
37
|
+
"@vitejs/plugin-vue": "^6.0.4",
|
|
38
|
+
"@vue/test-utils": "^2.4.6",
|
|
39
|
+
"@vue/tsconfig": "^0.8.1",
|
|
40
|
+
"typescript": "5.9.3",
|
|
41
|
+
"vite": "^7.3.1",
|
|
57
42
|
"vite-plugin-css-injected-by-js": "^3.5.1",
|
|
58
43
|
"vite-plugin-dts": "^3.9.1",
|
|
59
|
-
"vitest": "^
|
|
60
|
-
"vue": "^3.5.
|
|
61
|
-
"vue-tsc": "^2.
|
|
62
|
-
"vuetify": "^3.
|
|
44
|
+
"vitest": "^3.2.4",
|
|
45
|
+
"vue": "^3.5.28",
|
|
46
|
+
"vue-tsc": "^3.2.4",
|
|
47
|
+
"vuetify": "^3.11.8"
|
|
63
48
|
},
|
|
64
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "4ae64cc2ae14f3cc4d768a97689b2ff597e3401d"
|
|
65
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {MediaSystemFactory} from "@drax/media-front"
|
|
3
|
-
import {type PropType, ref} from "vue";
|
|
3
|
+
import {type PropType, ref, computed} from "vue";
|
|
4
4
|
|
|
5
5
|
const mediaSystem = MediaSystemFactory.getInstance()
|
|
6
6
|
|
|
@@ -30,6 +30,8 @@ const {dir, readonly, timeout} = defineProps({
|
|
|
30
30
|
type: String as PropType<'underlined' | 'outlined' | 'filled' | 'solo' | 'solo-inverted' | 'solo-filled' | 'plain'>,
|
|
31
31
|
default: 'filled'
|
|
32
32
|
},
|
|
33
|
+
preview: {type: Boolean, default: false},
|
|
34
|
+
previewHeight: {type: String, default: '100px'},
|
|
33
35
|
})
|
|
34
36
|
|
|
35
37
|
let fileInput = ref()
|
|
@@ -95,6 +97,17 @@ const handleDragLeave = () => {
|
|
|
95
97
|
|
|
96
98
|
defineEmits(['updateValue'])
|
|
97
99
|
|
|
100
|
+
const isImage = computed(() => {
|
|
101
|
+
|
|
102
|
+
if (typeof valueModel.value !== 'string' || !valueModel.value.trim()) return false;
|
|
103
|
+
|
|
104
|
+
// matches: .jpg/.jpeg/.png/.gif/.webp/.bmp/.svg/.tif/.tiff/.avif/.ico
|
|
105
|
+
// supports optional query/hash: ".../file.jpg?x=1#y"
|
|
106
|
+
const imageExtRegex = /\.(?:jpe?g|png|gif|webp|bmp|svg|tiff?|avif|ico)(?:[?#].*)?$/i;
|
|
107
|
+
|
|
108
|
+
return imageExtRegex.test(valueModel.value);
|
|
109
|
+
});
|
|
110
|
+
|
|
98
111
|
</script>
|
|
99
112
|
|
|
100
113
|
<template>
|
|
@@ -140,8 +153,16 @@ defineEmits(['updateValue'])
|
|
|
140
153
|
@change="onFileChanged"
|
|
141
154
|
>
|
|
142
155
|
|
|
156
|
+
{{preview}} {{isImage}}
|
|
157
|
+
|
|
143
158
|
<v-btn @click="onFileClick" :loading="loading" density="compact" color="grey" variant="text">Click | Drag & Drop</v-btn>
|
|
144
159
|
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
<template v-if="preview && isImage">
|
|
163
|
+
<v-img :src="valueModel" alt="Preview" :height="previewHeight" class="mt-4"></v-img>
|
|
164
|
+
</template>
|
|
165
|
+
|
|
145
166
|
</div>
|
|
146
167
|
|
|
147
168
|
</template>
|
|
@@ -33,6 +33,8 @@ const {dir, readonly, timeout} = defineProps({
|
|
|
33
33
|
type: String as PropType<'underlined' | 'outlined' | 'filled' | 'solo' | 'solo-inverted' | 'solo-filled' | 'plain'>,
|
|
34
34
|
default: 'filled'
|
|
35
35
|
},
|
|
36
|
+
preview: {type: Boolean, default: false},
|
|
37
|
+
previewHeight: {type: String, default: '100px'},
|
|
36
38
|
})
|
|
37
39
|
|
|
38
40
|
let fileInput = ref()
|
|
@@ -98,6 +100,16 @@ const handleDragLeave = () => {
|
|
|
98
100
|
|
|
99
101
|
defineEmits(['updateValue'])
|
|
100
102
|
|
|
103
|
+
const isImage = computed(() => {
|
|
104
|
+
|
|
105
|
+
if (typeof valueModel.value.url !== 'string' || !valueModel.value.url.trim()) return false;
|
|
106
|
+
|
|
107
|
+
// supports optional query/hash: ".../file.jpg?x=1#y"
|
|
108
|
+
const imageExtRegex = /\.(?:jpe?g|png|gif|webp|bmp|svg|tiff?|avif|ico)(?:[?#].*)?$/i;
|
|
109
|
+
|
|
110
|
+
return imageExtRegex.test(valueModel.value.url);
|
|
111
|
+
});
|
|
112
|
+
|
|
101
113
|
</script>
|
|
102
114
|
|
|
103
115
|
<template>
|
|
@@ -145,6 +157,10 @@ defineEmits(['updateValue'])
|
|
|
145
157
|
|
|
146
158
|
<v-btn @click="onFileClick" :loading="loading" density="compact" color="grey" variant="text">Click | Drag & Drop</v-btn>
|
|
147
159
|
|
|
160
|
+
<template v-if="preview && isImage">
|
|
161
|
+
<v-img :src="valueModel.url" alt="Preview" :height="previewHeight" class="mt-4"></v-img>
|
|
162
|
+
</template>
|
|
163
|
+
|
|
148
164
|
</div>
|
|
149
165
|
|
|
150
166
|
</template>
|
package/README.md
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# identity-front
|
|
2
|
-
|
|
3
|
-
This template should help get you started developing with Vue 3 in Vite.
|
|
4
|
-
|
|
5
|
-
## Recommended IDE Setup
|
|
6
|
-
|
|
7
|
-
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
|
8
|
-
|
|
9
|
-
## Type Support for `.vue` Imports in TS
|
|
10
|
-
|
|
11
|
-
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
|
|
12
|
-
|
|
13
|
-
## Customize configuration
|
|
14
|
-
|
|
15
|
-
See [Vite Configuration Reference](https://vitejs.dev/config/).
|
|
16
|
-
|
|
17
|
-
## Project Setup
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
npm install
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Compile and Hot-Reload for Development
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
npm run dev
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Type-Check, Compile and Minify for Production
|
|
30
|
-
|
|
31
|
-
```sh
|
|
32
|
-
npm run build
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Run Unit Tests with [Vitest](https://vitest.dev/)
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
npm run test:unit
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Run End-to-End Tests with [Cypress](https://www.cypress.io/)
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
npm run test:e2e:dev
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
This runs the end-to-end tests against the Vite development server.
|
|
48
|
-
It is much faster than the production build.
|
|
49
|
-
|
|
50
|
-
But it's still recommended to test the production build with `test:e2e` before deploying (e.g. in CI environments):
|
|
51
|
-
|
|
52
|
-
```sh
|
|
53
|
-
npm run build
|
|
54
|
-
npm run test:e2e
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Lint with [ESLint](https://eslint.org/)
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
npm run lint
|
|
61
|
-
```
|