@awes-io/ui 2.114.2 → 2.116.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.116.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.115.0...@awes-io/ui@2.116.0) (2024-11-21)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix props name in uploader ([d219631](https://github.com/awes-io/client/commit/d21963105f821ce97f935851d2b4e1337020005d))
12
+
13
+
14
+ ### Features
15
+
16
+ * add file type in aw uploader ([b037bd9](https://github.com/awes-io/client/commit/b037bd977e2f76d21be4adf3041073e4ca6e5e58))
17
+
18
+
19
+
20
+
21
+
22
+ # [2.115.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.114.2...@awes-io/ui@2.115.0) (2024-11-14)
23
+
24
+
25
+ ### Features
26
+
27
+ * add max files for upload in uploader ([53a2237](https://github.com/awes-io/client/commit/53a2237eaaaadf48ae976e6452d7115f593c3138))
28
+
29
+
30
+
31
+
32
+
6
33
  ## [2.114.2](https://github.com/awes-io/client/compare/@awes-io/ui@2.114.1...@awes-io/ui@2.114.2) (2024-11-01)
7
34
 
8
35
 
@@ -205,6 +205,21 @@ export default {
205
205
  processData: {
206
206
  type: Function,
207
207
  default: null
208
+ },
209
+
210
+ maxFiles: {
211
+ type: Number,
212
+ default: null
213
+ },
214
+
215
+ uploadedFilesNumber: {
216
+ type: Number,
217
+ default: null
218
+ },
219
+
220
+ fieldName: {
221
+ type: String,
222
+ default: 'file'
208
223
  }
209
224
  },
210
225
 
@@ -300,7 +315,23 @@ export default {
300
315
  _uploadFile(files) {
301
316
  this.errorText = ''
302
317
 
303
- for (var i = files.length - 1; i >= 0; i--) {
318
+ let maxFilesForUpload = files.length - 1
319
+
320
+ if (this.maxFiles) {
321
+ maxFilesForUpload = this.maxFiles - this.uploadedFilesNumber - 1
322
+
323
+ if (files.length > maxFilesForUpload) {
324
+ this.$notify({
325
+ type: 'error',
326
+ title: this.$tc(
327
+ `ui.general.interface.max_upload_files__count`,
328
+ this.maxFiles
329
+ )
330
+ })
331
+ }
332
+ }
333
+
334
+ for (var i = maxFilesForUpload; i >= 0; i--) {
304
335
  const file = files[i]
305
336
  const errors = this._validateFile(file)
306
337
 
@@ -316,7 +347,7 @@ export default {
316
347
  const id = uploader.id
317
348
  const data = new FormData()
318
349
 
319
- data.append('file', file)
350
+ data.append(this.fieldName, file)
320
351
 
321
352
  if (isType('Function', this.processData)) {
322
353
  this.processData(data)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awes-io/ui",
3
- "version": "2.114.2",
3
+ "version": "2.116.0",
4
4
  "description": "User Interface (UI) components",
5
5
  "keywords": [
6
6
  "ui",
@@ -114,5 +114,5 @@
114
114
  "rollup-plugin-visualizer": "^2.6.0",
115
115
  "rollup-plugin-vue": "^5.0.1"
116
116
  },
117
- "gitHead": "48217f0639aabe19ba1044e7cb7b3bf2307b5f35"
117
+ "gitHead": "c37e1f68dd38d3bcf6671cb97b069777ad63134c"
118
118
  }