adminforth 2.4.0-next.318 → 2.4.0-next.319

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.
@@ -46,7 +46,7 @@
46
46
 
47
47
  <div
48
48
  v-else
49
- class="flex items-center justify-center py-1 flex-wrap gap-2 w-full gap-2 mt-1 mb-4 px-4"
49
+ class="flex items-center justify-center py-1 flex-wrap gap-2 w-full mt-1 mb-4 px-4"
50
50
  >
51
51
  <template v-for="(file, index) in selectedFiles" :key="index">
52
52
  <div
@@ -54,7 +54,12 @@
54
54
  flex items-center gap-1 px-2 py-1 group"
55
55
  >
56
56
  <IconFileSolid class="w-4 h-4 flex-shrink-0" />
57
- <span class="truncate max-w-[200px]">{{ file.name }}</span>
57
+ <span
58
+ class="truncate max-w-[200px]"
59
+ :title="file.name"
60
+ >
61
+ {{ shortenFileName(file.name) }}
62
+ </span>
58
63
  <span class="text-xs">({{ humanifySize(file.size) }})</span>
59
64
  <button
60
65
  type="button"
@@ -123,6 +128,19 @@ const selectedFiles: Ref<{
123
128
 
124
129
  const storedFiles: Ref<File[]> = ref([]);
125
130
 
131
+ function shortenFileName(name: string, maxLength = 24) {
132
+ if (name.length <= maxLength) return name;
133
+
134
+ const lastDotIndex = name.lastIndexOf('.');
135
+ const hasExtension = lastDotIndex > 0 && lastDotIndex < name.length - 1;
136
+ const extension = hasExtension ? name.slice(lastDotIndex + 1) : '';
137
+ const baseName = hasExtension ? name.slice(0, lastDotIndex) : name;
138
+
139
+ const startName = baseName.slice(0, 12);
140
+ const endName = baseName.split('').reverse().slice(0, 4).reverse().join('');
141
+ return hasExtension ? `${startName}...${endName}.${extension}` : `${startName}...${endName}`;
142
+ }
143
+
126
144
  watch(() => props.modelValue, (files) => {
127
145
  if (files && files.length > 0) {
128
146
  selectedFiles.value = Array.from(files).map(file => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.4.0-next.318",
3
+ "version": "2.4.0-next.319",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",