@umbraco-ui/uui-file-dropzone 1.17.1 → 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 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 queue = [...dataTransferItemList];
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 queue) {
106
- if (entry?.kind !== "file") continue;
107
- const fileEntry = this._getEntry(entry);
108
- if (!fileEntry) continue;
109
- if (!fileEntry.isDirectory) {
110
- this._processFileEntry(entry, files, rejectedFiles);
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
- const structure = await this._mkdir(fileEntry);
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 directory entry from a DataTransferItem.
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) {
@@ -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 directory entry from a DataTransferItem.
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.1",
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.1",
34
- "@umbraco-ui/uui-symbol-file-dropzone": "1.17.1"
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": "066da7bddb2178bf21224f98c4b390d09773b896"
45
+ "gitHead": "773aaaeb28591e78a90d5fa0d2c2ceff0eaba855"
46
46
  }