@umbraco-ui/uui-file-dropzone 1.9.0-rc.0 → 1.9.0-rc.2
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/lib/index.js +16 -6
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -82,7 +82,7 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
82
82
|
if (this._isAccepted(file)) {
|
|
83
83
|
files.push(file);
|
|
84
84
|
}
|
|
85
|
-
} else if (!this.disallowFolderUpload) {
|
|
85
|
+
} else if (!this.disallowFolderUpload && this.multiple) {
|
|
86
86
|
const dir = this._getEntry(entry);
|
|
87
87
|
if (dir) {
|
|
88
88
|
const structure = await this._mkdir(dir);
|
|
@@ -130,7 +130,7 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
130
130
|
folders.push(directory);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
readEntries(reader2);
|
|
133
|
+
await readEntries(reader2);
|
|
134
134
|
resolve();
|
|
135
135
|
}, reject);
|
|
136
136
|
});
|
|
@@ -148,10 +148,10 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
148
148
|
if (fileExtension && this._acceptedFileExtensions.includes(fileExtension.toLowerCase())) {
|
|
149
149
|
return true;
|
|
150
150
|
}
|
|
151
|
-
for (const mimeType
|
|
151
|
+
for (const mimeType of this._acceptedMimeTypes) {
|
|
152
152
|
if (fileType === mimeType) {
|
|
153
153
|
return true;
|
|
154
|
-
} else if (mimeType.endsWith("/*") && fileType.startsWith(mimeType.replace("
|
|
154
|
+
} else if (mimeType.endsWith("/*") && fileType.startsWith(mimeType.replace("*", ""))) {
|
|
155
155
|
return true;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -168,8 +168,11 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
168
168
|
const fileSystemResult = await this._getAllEntries(items);
|
|
169
169
|
if (this.multiple === false && fileSystemResult.files.length) {
|
|
170
170
|
fileSystemResult.files = [fileSystemResult.files[0]];
|
|
171
|
+
fileSystemResult.folders = [];
|
|
172
|
+
}
|
|
173
|
+
if (!fileSystemResult.files.length && !fileSystemResult.folders.length) {
|
|
174
|
+
return;
|
|
171
175
|
}
|
|
172
|
-
this._getAllEntries(items);
|
|
173
176
|
this.dispatchEvent(
|
|
174
177
|
new UUIFileDropzoneEvent(UUIFileDropzoneEvent.CHANGE, {
|
|
175
178
|
detail: fileSystemResult
|
|
@@ -190,9 +193,16 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
190
193
|
}
|
|
191
194
|
_onFileInputChange() {
|
|
192
195
|
const files = this._input.files ? Array.from(this._input.files) : [];
|
|
196
|
+
if (this.multiple === false && files.length > 1) {
|
|
197
|
+
files.splice(1, files.length - 1);
|
|
198
|
+
}
|
|
199
|
+
const allowedFiles = files.filter((file) => this._isAccepted(file));
|
|
200
|
+
if (!allowedFiles.length) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
193
203
|
this.dispatchEvent(
|
|
194
204
|
new UUIFileDropzoneEvent(UUIFileDropzoneEvent.CHANGE, {
|
|
195
|
-
detail: { files }
|
|
205
|
+
detail: { files: allowedFiles, folders: [] }
|
|
196
206
|
})
|
|
197
207
|
);
|
|
198
208
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-file-dropzone",
|
|
3
|
-
"version": "1.9.0-rc.
|
|
3
|
+
"version": "1.9.0-rc.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"custom-elements.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-base": "1.9.0-rc.
|
|
34
|
-
"@umbraco-ui/uui-symbol-file-dropzone": "1.9.0-rc.
|
|
33
|
+
"@umbraco-ui/uui-base": "1.9.0-rc.1",
|
|
34
|
+
"@umbraco-ui/uui-symbol-file-dropzone": "1.9.0-rc.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "npm run analyze && tsc --build && rollup -c rollup.config.js",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-file-dropzone",
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "39d5e62e7481783219cbccbf8a58468c962f095a"
|
|
46
46
|
}
|