@umbraco-ui/uui-file-dropzone 1.0.0-rc.0 → 1.0.0-rc.3
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/README.md +5 -1
- package/custom-elements.json +2 -2
- package/lib/index.js +23 -9
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# uui-file-dropzone
|
|
2
2
|
|
|
3
|
-

|
|
3
|
+
[](hhttps://www.npmjs.com/package/@umbraco-ui/uui-file-dropzone)
|
|
4
4
|
|
|
5
5
|
Umbraco style file-dropzone component.
|
|
6
6
|
|
|
7
|
+
### See it in action
|
|
8
|
+
|
|
9
|
+
Preview the component on [Storybook](https://uui.umbraco.com/?path=/story/uui-file-dropzone)
|
|
10
|
+
|
|
7
11
|
## Installation
|
|
8
12
|
|
|
9
13
|
### ES imports
|
package/custom-elements.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "label",
|
|
22
|
-
"description": "Label to be used for aria-label and
|
|
22
|
+
"description": "Label to be used for aria-label and potentially as visual label for some components",
|
|
23
23
|
"type": "string"
|
|
24
24
|
}
|
|
25
25
|
],
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
{
|
|
47
47
|
"name": "label",
|
|
48
48
|
"attribute": "label",
|
|
49
|
-
"description": "Label to be used for aria-label and
|
|
49
|
+
"description": "Label to be used for aria-label and potentially as visual label for some components",
|
|
50
50
|
"type": "string"
|
|
51
51
|
}
|
|
52
52
|
],
|
package/lib/index.js
CHANGED
|
@@ -62,7 +62,11 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
62
62
|
fileEntries.push(entry);
|
|
63
63
|
} else if (entry.isDirectory) {
|
|
64
64
|
fileEntries.push(entry);
|
|
65
|
-
queue.push(
|
|
65
|
+
queue.push(
|
|
66
|
+
...await this._readAllDirectoryEntries(
|
|
67
|
+
entry.createReader()
|
|
68
|
+
)
|
|
69
|
+
);
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
} else {
|
|
@@ -72,7 +76,11 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
72
76
|
fileEntries.push(entry);
|
|
73
77
|
} else if (entry.isDirectory) {
|
|
74
78
|
fileEntries.push(entry);
|
|
75
|
-
queue.push(
|
|
79
|
+
queue.push(
|
|
80
|
+
...await this._readAllDirectoryEntries(
|
|
81
|
+
entry.createReader()
|
|
82
|
+
)
|
|
83
|
+
);
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
}
|
|
@@ -97,7 +105,9 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
107
|
async _getFile(fileEntry) {
|
|
100
|
-
return await new Promise(
|
|
108
|
+
return await new Promise(
|
|
109
|
+
(resolve, reject) => fileEntry.file(resolve, reject)
|
|
110
|
+
);
|
|
101
111
|
}
|
|
102
112
|
async _isAccepted(acceptList, wildcards, entry) {
|
|
103
113
|
const file = await this._getFile(entry);
|
|
@@ -124,9 +134,11 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
124
134
|
if (this.multiple === false && result.length > 0) {
|
|
125
135
|
result = [result[0]];
|
|
126
136
|
}
|
|
127
|
-
this.dispatchEvent(
|
|
128
|
-
|
|
129
|
-
|
|
137
|
+
this.dispatchEvent(
|
|
138
|
+
new UUIFileDropzoneEvent(UUIFileDropzoneEvent.FILE_CHANGE, {
|
|
139
|
+
detail: { files: result }
|
|
140
|
+
})
|
|
141
|
+
);
|
|
130
142
|
}
|
|
131
143
|
}
|
|
132
144
|
_onDragOver(e) {
|
|
@@ -142,9 +154,11 @@ let UUIFileDropzoneElement = class extends LabelMixin("", LitElement) {
|
|
|
142
154
|
}
|
|
143
155
|
_onFileInputChange() {
|
|
144
156
|
const files = this._input.files ? Array.from(this._input.files) : [];
|
|
145
|
-
this.dispatchEvent(
|
|
146
|
-
|
|
147
|
-
|
|
157
|
+
this.dispatchEvent(
|
|
158
|
+
new UUIFileDropzoneEvent(UUIFileDropzoneEvent.FILE_CHANGE, {
|
|
159
|
+
detail: { files }
|
|
160
|
+
})
|
|
161
|
+
);
|
|
148
162
|
}
|
|
149
163
|
render() {
|
|
150
164
|
return html`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-file-dropzone",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.3",
|
|
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.0.0-rc.
|
|
34
|
-
"@umbraco-ui/uui-symbol-file-dropzone": "1.0.0-rc.
|
|
33
|
+
"@umbraco-ui/uui-base": "1.0.0-rc.3",
|
|
34
|
+
"@umbraco-ui/uui-symbol-file-dropzone": "1.0.0-rc.3"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "npm run analyze && tsc --build --force && 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": "7d643a3d5f7204efbc3aaad83889c2fd5200af73"
|
|
46
46
|
}
|