@umbraco-ui/uui-file-dropzone 1.17.0 → 1.17.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 +14 -25
- package/lib/uui-file-dropzone.element.d.ts +3 -9
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -75,21 +75,6 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
75
75
|
browse() {
|
|
76
76
|
this._input.click();
|
|
77
77
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Process a single file entry and categorize it as accepted or rejected.
|
|
80
|
-
* @param entry - The data transfer item containing the file
|
|
81
|
-
* @param files - Array to store accepted files
|
|
82
|
-
* @param rejectedFiles - Array to store rejected files
|
|
83
|
-
*/
|
|
84
|
-
_processFileEntry(entry, files, rejectedFiles) {
|
|
85
|
-
const file = entry.getAsFile();
|
|
86
|
-
if (!file) return;
|
|
87
|
-
if (this._isAccepted(file)) {
|
|
88
|
-
files.push(file);
|
|
89
|
-
} else {
|
|
90
|
-
rejectedFiles.push(file);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
78
|
/**
|
|
94
79
|
* Check if folder upload should be processed based on component settings.
|
|
95
80
|
* @returns true if folder upload is allowed and multiple files are enabled
|
|
@@ -98,25 +83,29 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
98
83
|
return !this.disallowFolderUpload && this.multiple;
|
|
99
84
|
}
|
|
100
85
|
async _getAllEntries(dataTransferItemList) {
|
|
101
|
-
const
|
|
86
|
+
const rootEntries = [...dataTransferItemList].filter((item) => item?.kind === "file").map((item) => this._getEntry(item)).filter((entry) => entry !== null);
|
|
87
|
+
return this._processRootEntries(rootEntries);
|
|
88
|
+
}
|
|
89
|
+
async _processRootEntries(rootEntries) {
|
|
102
90
|
const folders = [];
|
|
103
91
|
const files = [];
|
|
104
92
|
const rejectedFiles = [];
|
|
105
|
-
for (const entry of
|
|
106
|
-
if (entry
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
93
|
+
for (const entry of rootEntries) {
|
|
94
|
+
if (!entry.isDirectory) {
|
|
95
|
+
const file = await this._getAsFile(entry);
|
|
96
|
+
if (this._isAccepted(file)) {
|
|
97
|
+
files.push(file);
|
|
98
|
+
} else {
|
|
99
|
+
rejectedFiles.push(file);
|
|
100
|
+
}
|
|
111
101
|
} else if (this._shouldProcessFolder()) {
|
|
112
|
-
|
|
113
|
-
folders.push(structure);
|
|
102
|
+
folders.push(await this._mkdir(entry));
|
|
114
103
|
}
|
|
115
104
|
}
|
|
116
105
|
return { files, folders, rejectedFiles };
|
|
117
106
|
}
|
|
118
107
|
/**
|
|
119
|
-
* Get the
|
|
108
|
+
* Get the filesystem entry (file or directory) from a DataTransferItem.
|
|
120
109
|
* @remark Supports both WebKit and non-WebKit browsers.
|
|
121
110
|
*/
|
|
122
111
|
_getEntry(entry) {
|
|
@@ -5,7 +5,7 @@ export interface UUIFileFolder {
|
|
|
5
5
|
folders: UUIFileFolder[];
|
|
6
6
|
files: File[];
|
|
7
7
|
}
|
|
8
|
-
declare const UUIFileDropzoneElement_base: (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").
|
|
8
|
+
declare const UUIFileDropzoneElement_base: (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").UUILabelMixinInterface) & typeof LitElement;
|
|
9
9
|
/**
|
|
10
10
|
* @element uui-file-dropzone
|
|
11
11
|
* @fires {UUIFileDropzoneEvent} change - fires when a file has been selected.
|
|
@@ -46,21 +46,15 @@ export declare class UUIFileDropzoneElement extends UUIFileDropzoneElement_base
|
|
|
46
46
|
*/
|
|
47
47
|
browse(): void;
|
|
48
48
|
constructor();
|
|
49
|
-
/**
|
|
50
|
-
* Process a single file entry and categorize it as accepted or rejected.
|
|
51
|
-
* @param entry - The data transfer item containing the file
|
|
52
|
-
* @param files - Array to store accepted files
|
|
53
|
-
* @param rejectedFiles - Array to store rejected files
|
|
54
|
-
*/
|
|
55
|
-
private _processFileEntry;
|
|
56
49
|
/**
|
|
57
50
|
* Check if folder upload should be processed based on component settings.
|
|
58
51
|
* @returns true if folder upload is allowed and multiple files are enabled
|
|
59
52
|
*/
|
|
60
53
|
private _shouldProcessFolder;
|
|
61
54
|
private _getAllEntries;
|
|
55
|
+
private _processRootEntries;
|
|
62
56
|
/**
|
|
63
|
-
* Get the
|
|
57
|
+
* Get the filesystem entry (file or directory) from a DataTransferItem.
|
|
64
58
|
* @remark Supports both WebKit and non-WebKit browsers.
|
|
65
59
|
*/
|
|
66
60
|
private _getEntry;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-file-dropzone",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.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.17.
|
|
34
|
-
"@umbraco-ui/uui-symbol-file-dropzone": "1.17.
|
|
33
|
+
"@umbraco-ui/uui-base": "1.17.2",
|
|
34
|
+
"@umbraco-ui/uui-symbol-file-dropzone": "1.17.2"
|
|
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": "773aaaeb28591e78a90d5fa0d2c2ceff0eaba855"
|
|
46
46
|
}
|