@adminforth/upload 1.0.23 → 1.0.24

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/ChangeLog.md ADDED
@@ -0,0 +1,7 @@
1
+
2
+
3
+ ## [1.0.23] - 2021-10-07
4
+
5
+ ### Fixed
6
+ - preview maxWidth to limit max width of image
7
+ - Added accept attribute to input
@@ -59,7 +59,7 @@
59
59
  </div>
60
60
 
61
61
  </div>
62
- <input :id="inputId" type="file" class="hidden" @change="onFileChange" ref="uploadInputRef" />
62
+ <input :id="inputId" type="file" :accept="allowedExtensionsAttribute" class="hidden" @change="onFileChange" ref="uploadInputRef" />
63
63
  </label>
64
64
  </div>
65
65
 
@@ -134,6 +134,13 @@ const allowedExtensionsLabel = computed(() => {
134
134
  return label
135
135
  });
136
136
 
137
+ const allowedExtensionsAttribute = computed(() => {
138
+ const allowedExtensions = props.meta.allowedExtensions || [];
139
+ return allowedExtensions.length > 0
140
+ ? allowedExtensions.map(ext => `.${ext}`).join(', ')
141
+ : '';
142
+ });
143
+
137
144
  function clear() {
138
145
  imgPreview.value = null;
139
146
  progress.value = 0;
@@ -59,7 +59,7 @@
59
59
  </div>
60
60
 
61
61
  </div>
62
- <input :id="inputId" type="file" class="hidden" @change="onFileChange" ref="uploadInputRef" />
62
+ <input :id="inputId" type="file" :accept="allowedExtensionsAttribute" class="hidden" @change="onFileChange" ref="uploadInputRef" />
63
63
  </label>
64
64
  </div>
65
65
 
@@ -134,6 +134,13 @@ const allowedExtensionsLabel = computed(() => {
134
134
  return label
135
135
  });
136
136
 
137
+ const allowedExtensionsAttribute = computed(() => {
138
+ const allowedExtensions = props.meta.allowedExtensions || [];
139
+ return allowedExtensions.length > 0
140
+ ? allowedExtensions.map(ext => `.${ext}`).join(', ')
141
+ : '';
142
+ });
143
+
137
144
  function clear() {
138
145
  imgPreview.value = null;
139
146
  progress.value = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/upload",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",