@adminforth/upload 1.0.0

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.
@@ -0,0 +1,310 @@
1
+ {
2
+ "name": "custom",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "custom",
9
+ "version": "1.0.0",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "@iconify-prerendered/vue-mdi": "^0.25.1718880438",
13
+ "medium-zoom": "^1.1.0"
14
+ }
15
+ },
16
+ "node_modules/@babel/helper-string-parser": {
17
+ "version": "7.25.7",
18
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz",
19
+ "integrity": "sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==",
20
+ "peer": true,
21
+ "engines": {
22
+ "node": ">=6.9.0"
23
+ }
24
+ },
25
+ "node_modules/@babel/helper-validator-identifier": {
26
+ "version": "7.25.7",
27
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz",
28
+ "integrity": "sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==",
29
+ "peer": true,
30
+ "engines": {
31
+ "node": ">=6.9.0"
32
+ }
33
+ },
34
+ "node_modules/@babel/parser": {
35
+ "version": "7.25.7",
36
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.7.tgz",
37
+ "integrity": "sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw==",
38
+ "peer": true,
39
+ "dependencies": {
40
+ "@babel/types": "^7.25.7"
41
+ },
42
+ "bin": {
43
+ "parser": "bin/babel-parser.js"
44
+ },
45
+ "engines": {
46
+ "node": ">=6.0.0"
47
+ }
48
+ },
49
+ "node_modules/@babel/types": {
50
+ "version": "7.25.7",
51
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.7.tgz",
52
+ "integrity": "sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==",
53
+ "peer": true,
54
+ "dependencies": {
55
+ "@babel/helper-string-parser": "^7.25.7",
56
+ "@babel/helper-validator-identifier": "^7.25.7",
57
+ "to-fast-properties": "^2.0.0"
58
+ },
59
+ "engines": {
60
+ "node": ">=6.9.0"
61
+ }
62
+ },
63
+ "node_modules/@iconify-prerendered/vue-mdi": {
64
+ "version": "0.25.1718880438",
65
+ "resolved": "https://registry.npmjs.org/@iconify-prerendered/vue-mdi/-/vue-mdi-0.25.1718880438.tgz",
66
+ "integrity": "sha512-C4ITBtuANNw7ehCjymK6KNqP65Gtp/P7cLgBqwbyZoVU55cxbsUwseW5s4WfuqBd5RdHd2HXZgm+4SJ8E6l8Wg==",
67
+ "funding": {
68
+ "url": "https://www.buymeacoffee.com/kozack/"
69
+ },
70
+ "peerDependencies": {
71
+ "vue": "^3.0.0"
72
+ }
73
+ },
74
+ "node_modules/@jridgewell/sourcemap-codec": {
75
+ "version": "1.5.0",
76
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
77
+ "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
78
+ "peer": true
79
+ },
80
+ "node_modules/@vue/compiler-core": {
81
+ "version": "3.5.10",
82
+ "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.10.tgz",
83
+ "integrity": "sha512-iXWlk+Cg/ag7gLvY0SfVucU8Kh2CjysYZjhhP70w9qI4MvSox4frrP+vDGvtQuzIcgD8+sxM6lZvCtdxGunTAA==",
84
+ "peer": true,
85
+ "dependencies": {
86
+ "@babel/parser": "^7.25.3",
87
+ "@vue/shared": "3.5.10",
88
+ "entities": "^4.5.0",
89
+ "estree-walker": "^2.0.2",
90
+ "source-map-js": "^1.2.0"
91
+ }
92
+ },
93
+ "node_modules/@vue/compiler-dom": {
94
+ "version": "3.5.10",
95
+ "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.10.tgz",
96
+ "integrity": "sha512-DyxHC6qPcktwYGKOIy3XqnHRrrXyWR2u91AjP+nLkADko380srsC2DC3s7Y1Rk6YfOlxOlvEQKa9XXmLI+W4ZA==",
97
+ "peer": true,
98
+ "dependencies": {
99
+ "@vue/compiler-core": "3.5.10",
100
+ "@vue/shared": "3.5.10"
101
+ }
102
+ },
103
+ "node_modules/@vue/compiler-sfc": {
104
+ "version": "3.5.10",
105
+ "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.10.tgz",
106
+ "integrity": "sha512-to8E1BgpakV7224ZCm8gz1ZRSyjNCAWEplwFMWKlzCdP9DkMKhRRwt0WkCjY7jkzi/Vz3xgbpeig5Pnbly4Tow==",
107
+ "peer": true,
108
+ "dependencies": {
109
+ "@babel/parser": "^7.25.3",
110
+ "@vue/compiler-core": "3.5.10",
111
+ "@vue/compiler-dom": "3.5.10",
112
+ "@vue/compiler-ssr": "3.5.10",
113
+ "@vue/shared": "3.5.10",
114
+ "estree-walker": "^2.0.2",
115
+ "magic-string": "^0.30.11",
116
+ "postcss": "^8.4.47",
117
+ "source-map-js": "^1.2.0"
118
+ }
119
+ },
120
+ "node_modules/@vue/compiler-ssr": {
121
+ "version": "3.5.10",
122
+ "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.10.tgz",
123
+ "integrity": "sha512-hxP4Y3KImqdtyUKXDRSxKSRkSm1H9fCvhojEYrnaoWhE4w/y8vwWhnosJoPPe2AXm5sU7CSbYYAgkt2ZPhDz+A==",
124
+ "peer": true,
125
+ "dependencies": {
126
+ "@vue/compiler-dom": "3.5.10",
127
+ "@vue/shared": "3.5.10"
128
+ }
129
+ },
130
+ "node_modules/@vue/reactivity": {
131
+ "version": "3.5.10",
132
+ "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.10.tgz",
133
+ "integrity": "sha512-kW08v06F6xPSHhid9DJ9YjOGmwNDOsJJQk0ax21wKaUYzzuJGEuoKNU2Ujux8FLMrP7CFJJKsHhXN9l2WOVi2g==",
134
+ "peer": true,
135
+ "dependencies": {
136
+ "@vue/shared": "3.5.10"
137
+ }
138
+ },
139
+ "node_modules/@vue/runtime-core": {
140
+ "version": "3.5.10",
141
+ "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.10.tgz",
142
+ "integrity": "sha512-9Q86I5Qq3swSkFfzrZ+iqEy7Vla325M7S7xc1NwKnRm/qoi1Dauz0rT6mTMmscqx4qz0EDJ1wjB+A36k7rl8mA==",
143
+ "peer": true,
144
+ "dependencies": {
145
+ "@vue/reactivity": "3.5.10",
146
+ "@vue/shared": "3.5.10"
147
+ }
148
+ },
149
+ "node_modules/@vue/runtime-dom": {
150
+ "version": "3.5.10",
151
+ "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.10.tgz",
152
+ "integrity": "sha512-t3x7ht5qF8ZRi1H4fZqFzyY2j+GTMTDxRheT+i8M9Ph0oepUxoadmbwlFwMoW7RYCpNQLpP2Yx3feKs+fyBdpA==",
153
+ "peer": true,
154
+ "dependencies": {
155
+ "@vue/reactivity": "3.5.10",
156
+ "@vue/runtime-core": "3.5.10",
157
+ "@vue/shared": "3.5.10",
158
+ "csstype": "^3.1.3"
159
+ }
160
+ },
161
+ "node_modules/@vue/server-renderer": {
162
+ "version": "3.5.10",
163
+ "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.10.tgz",
164
+ "integrity": "sha512-IVE97tt2kGKwHNq9yVO0xdh1IvYfZCShvDSy46JIh5OQxP1/EXSpoDqetVmyIzL7CYOWnnmMkVqd7YK2QSWkdw==",
165
+ "peer": true,
166
+ "dependencies": {
167
+ "@vue/compiler-ssr": "3.5.10",
168
+ "@vue/shared": "3.5.10"
169
+ },
170
+ "peerDependencies": {
171
+ "vue": "3.5.10"
172
+ }
173
+ },
174
+ "node_modules/@vue/shared": {
175
+ "version": "3.5.10",
176
+ "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.10.tgz",
177
+ "integrity": "sha512-VkkBhU97Ki+XJ0xvl4C9YJsIZ2uIlQ7HqPpZOS3m9VCvmROPaChZU6DexdMJqvz9tbgG+4EtFVrSuailUq5KGQ==",
178
+ "peer": true
179
+ },
180
+ "node_modules/csstype": {
181
+ "version": "3.1.3",
182
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
183
+ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
184
+ "peer": true
185
+ },
186
+ "node_modules/entities": {
187
+ "version": "4.5.0",
188
+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
189
+ "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
190
+ "peer": true,
191
+ "engines": {
192
+ "node": ">=0.12"
193
+ },
194
+ "funding": {
195
+ "url": "https://github.com/fb55/entities?sponsor=1"
196
+ }
197
+ },
198
+ "node_modules/estree-walker": {
199
+ "version": "2.0.2",
200
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
201
+ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
202
+ "peer": true
203
+ },
204
+ "node_modules/magic-string": {
205
+ "version": "0.30.11",
206
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.11.tgz",
207
+ "integrity": "sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==",
208
+ "peer": true,
209
+ "dependencies": {
210
+ "@jridgewell/sourcemap-codec": "^1.5.0"
211
+ }
212
+ },
213
+ "node_modules/medium-zoom": {
214
+ "version": "1.1.0",
215
+ "resolved": "https://registry.npmjs.org/medium-zoom/-/medium-zoom-1.1.0.tgz",
216
+ "integrity": "sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ=="
217
+ },
218
+ "node_modules/nanoid": {
219
+ "version": "3.3.7",
220
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
221
+ "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
222
+ "funding": [
223
+ {
224
+ "type": "github",
225
+ "url": "https://github.com/sponsors/ai"
226
+ }
227
+ ],
228
+ "peer": true,
229
+ "bin": {
230
+ "nanoid": "bin/nanoid.cjs"
231
+ },
232
+ "engines": {
233
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
234
+ }
235
+ },
236
+ "node_modules/picocolors": {
237
+ "version": "1.1.0",
238
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz",
239
+ "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==",
240
+ "peer": true
241
+ },
242
+ "node_modules/postcss": {
243
+ "version": "8.4.47",
244
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz",
245
+ "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==",
246
+ "funding": [
247
+ {
248
+ "type": "opencollective",
249
+ "url": "https://opencollective.com/postcss/"
250
+ },
251
+ {
252
+ "type": "tidelift",
253
+ "url": "https://tidelift.com/funding/github/npm/postcss"
254
+ },
255
+ {
256
+ "type": "github",
257
+ "url": "https://github.com/sponsors/ai"
258
+ }
259
+ ],
260
+ "peer": true,
261
+ "dependencies": {
262
+ "nanoid": "^3.3.7",
263
+ "picocolors": "^1.1.0",
264
+ "source-map-js": "^1.2.1"
265
+ },
266
+ "engines": {
267
+ "node": "^10 || ^12 || >=14"
268
+ }
269
+ },
270
+ "node_modules/source-map-js": {
271
+ "version": "1.2.1",
272
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
273
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
274
+ "peer": true,
275
+ "engines": {
276
+ "node": ">=0.10.0"
277
+ }
278
+ },
279
+ "node_modules/to-fast-properties": {
280
+ "version": "2.0.0",
281
+ "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
282
+ "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==",
283
+ "peer": true,
284
+ "engines": {
285
+ "node": ">=4"
286
+ }
287
+ },
288
+ "node_modules/vue": {
289
+ "version": "3.5.10",
290
+ "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.10.tgz",
291
+ "integrity": "sha512-Vy2kmJwHPlouC/tSnIgXVg03SG+9wSqT1xu1Vehc+ChsXsRd7jLkKgMltVEFOzUdBr3uFwBCG+41LJtfAcBRng==",
292
+ "peer": true,
293
+ "dependencies": {
294
+ "@vue/compiler-dom": "3.5.10",
295
+ "@vue/compiler-sfc": "3.5.10",
296
+ "@vue/runtime-dom": "3.5.10",
297
+ "@vue/server-renderer": "3.5.10",
298
+ "@vue/shared": "3.5.10"
299
+ },
300
+ "peerDependencies": {
301
+ "typescript": "*"
302
+ },
303
+ "peerDependenciesMeta": {
304
+ "typescript": {
305
+ "optional": true
306
+ }
307
+ }
308
+ }
309
+ }
310
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "custom",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "@iconify-prerendered/vue-mdi": "^0.25.1718880438",
14
+ "medium-zoom": "^1.1.0"
15
+ }
16
+ }
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <div>
3
+ <template v-if="url">
4
+ <img
5
+ v-if="contentType && contentType.startsWith('image')"
6
+ :src="url"
7
+ class="rounded-md"
8
+ :style="maxWidth"
9
+ ref="img"
10
+ data-zoomable
11
+ @click.stop="zoom.open()"
12
+ />
13
+ <video
14
+ v-else-if="contentType && contentType.startsWith('video')"
15
+ :src="url"
16
+ class="rounded-md"
17
+ controls
18
+ @click.stop >
19
+ </video>
20
+
21
+ <a v-else :href="url" target="_blank"
22
+ class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-darkListTable dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 rounded-default"
23
+ >
24
+ <!-- download file icon -->
25
+ <svg class="w-4 h-4 me-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
26
+ <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
27
+ </svg>
28
+ {{ $t('Download file') }}
29
+ </a>
30
+ </template>
31
+
32
+
33
+ </div>
34
+ </template>
35
+
36
+ <style>
37
+ .medium-zoom-image {
38
+ z-index: 999999;
39
+ background: rgba(0, 0, 0, 0.8);
40
+ }
41
+ .medium-zoom-overlay {
42
+ background: rgba(255, 255, 255, 0.8) !important
43
+ }
44
+ body.medium-zoom--opened aside {
45
+ filter: grayscale(1)
46
+ }
47
+ </style>
48
+
49
+ <style scoped>
50
+ img {
51
+ min-width: 150px;
52
+ }
53
+ video {
54
+ min-width: 200px;
55
+ }
56
+ </style>
57
+ <script setup>
58
+ import { ref, computed , onMounted, watch} from 'vue'
59
+ import mediumZoom from 'medium-zoom'
60
+
61
+ const img = ref(null);
62
+ const zoom = ref(null);
63
+
64
+ const props = defineProps({
65
+ record: Object,
66
+ column: Object,
67
+ meta: Object,
68
+ })
69
+
70
+ const url = computed(() => {
71
+ return props.record[`previewUrl_${props.meta.pluginInstanceId}`];
72
+ });
73
+
74
+ const maxWidth = computed(() => props.meta.maxWidth ? { maxWidth: props.meta.maxWidth } : {});
75
+
76
+
77
+ // since we have no way to know the content type of the file, we will try to guess it from extension
78
+ // for better experience probably we should check whether user saves content type in the database and use it here
79
+ const contentType = computed(() => {
80
+ if (!url.value) {
81
+ return null;
82
+ }
83
+ const u = new URL(url.value);
84
+ return guessContentType(u.pathname);
85
+ });
86
+
87
+ function guessContentType(url) {
88
+ if (!url) {
89
+ return null;
90
+ }
91
+ const ext = url.split('.').pop();
92
+ if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp', 'ico', 'tiff'].includes(ext)) {
93
+ return 'image';
94
+ }
95
+ if (['mp4', 'webm', 'ogg', 'avi', 'mov', 'flv', 'wmv', 'mkv'].includes(ext)) {
96
+ return 'video';
97
+ }
98
+ }
99
+
100
+
101
+ onMounted(async () => {
102
+
103
+ if (contentType.value?.startsWith('image')) {
104
+ zoom.value = mediumZoom(img.value, {
105
+ margin: 24,
106
+ });
107
+ }
108
+
109
+ });
110
+
111
+ </script>
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".", // This should point to your project root
4
+ "paths": {
5
+ "@/*": [
6
+ // "node_modules/adminforth/dist/spa/src/*"
7
+ "../../../spa/src/*"
8
+ ],
9
+ "*": [
10
+ // "node_modules/adminforth/dist/spa/node_modules/*"
11
+ "../../../spa/node_modules/*"
12
+ ],
13
+ "@@/*": [
14
+ // "node_modules/adminforth/dist/spa/src/*"
15
+ "."
16
+ ]
17
+ }
18
+ }
19
+ }