@v1nt1248/3nclient-lib 0.1.48 → 0.1.49

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@v1nt1248/3nclient-lib",
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "author": "v1nt1248",
5
- "version": "0.1.48",
5
+ "version": "0.1.49",
6
6
  "description": "Library for 3NWeb clients",
7
7
  "type": "module",
8
8
  "files": [
@@ -3,7 +3,7 @@
3
3
  <label
4
4
  :for="id"
5
5
  :class="[$style.label, disabled && $style.disabled]"
6
- v-on="disabled ? {} : { click: selectFiles }"
6
+ @click.stop.prevent="selectFiles"
7
7
  >
8
8
  {{ buttonText }}
9
9
  </label>
@@ -42,6 +42,10 @@
42
42
  const fileInput = ref<Nullable<HTMLInputElement>>(null);
43
43
 
44
44
  function selectFiles(ev: MouseEvent) {
45
+ if (props.disabled) {
46
+ return;
47
+ }
48
+
45
49
  ev.stopImmediatePropagation();
46
50
  fileInput.value!.click();
47
51
  }
@@ -57,10 +61,7 @@
57
61
 
58
62
  const { name, size } = file;
59
63
  if (size > props.maxFileSize) {
60
- emits(
61
- 'error',
62
- `The [${name}] file is too big. Maximum file size ${formatFileSize(props.maxFileSize)}`
63
- );
64
+ emits('error', `The [${name}] file is too big. Maximum file size ${formatFileSize(props.maxFileSize)}`);
64
65
  return false;
65
66
  }
66
67
  return true;
@@ -73,12 +74,9 @@
73
74
 
74
75
  const { name } = file;
75
76
  const fileExt = `.${last(name.split('.'))}`.toLowerCase();
76
- const allowedFileTypes = props.allowedFileTypes
77
- .split(',')
78
- .map(type => trim(type).toLowerCase());
77
+ const allowedFileTypes = props.allowedFileTypes.split(',').map(type => trim(type).toLowerCase());
79
78
 
80
- const isValid =
81
- allowedFileTypes.includes('*') || allowedFileTypes.includes(fileExt);
79
+ const isValid = allowedFileTypes.includes('*') || allowedFileTypes.includes(fileExt);
82
80
  if (!isValid) {
83
81
  emits('error', `The [${name}] file type is not valid.`);
84
82
  }
@@ -91,9 +89,7 @@
91
89
  }
92
90
 
93
91
  const { name } = file;
94
- const isFoundDuplicate = [...props.modelValue].find(
95
- file => file.name === name
96
- );
92
+ const isFoundDuplicate = [...props.modelValue].find(file => file.name === name);
97
93
 
98
94
  if (isFoundDuplicate) {
99
95
  emits('error', `The [${name}] file has already been downloaded.`);
@@ -117,10 +113,7 @@
117
113
 
118
114
  const isValid = total <= Number(props.maxNumberOfFiles);
119
115
  if (!isValid) {
120
- emits(
121
- 'error',
122
- `You cannot select more than ${props.maxNumberOfFiles} files.`
123
- );
116
+ emits('error', `You cannot select more than ${props.maxNumberOfFiles} files.`);
124
117
  }
125
118
  return isValid;
126
119
  }