@ember-joinery/file-upload 0.0.0-stage → 1.1.0
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/CHANGELOG.md +176 -0
- package/LICENSE.md +9 -0
- package/NOTICE +532 -0
- package/README.md +63 -2
- package/addon-main.cjs +4 -0
- package/declarations/-private/upload-actor.d.ts +46 -0
- package/declarations/-private/upload-actor.d.ts.map +1 -0
- package/declarations/components/file-upload/context.d.ts +21 -0
- package/declarations/components/file-upload/context.d.ts.map +1 -0
- package/declarations/components/file-upload/dropzone.d.ts +48 -0
- package/declarations/components/file-upload/dropzone.d.ts.map +1 -0
- package/declarations/components/file-upload/index.d.ts +137 -0
- package/declarations/components/file-upload/index.d.ts.map +1 -0
- package/declarations/components/file-upload/labels.d.ts +25 -0
- package/declarations/components/file-upload/labels.d.ts.map +1 -0
- package/declarations/components/file-upload/list.d.ts +18 -0
- package/declarations/components/file-upload/list.d.ts.map +1 -0
- package/declarations/components/file-upload/queue.d.ts +23 -0
- package/declarations/components/file-upload/queue.d.ts.map +1 -0
- package/declarations/components/file-upload/state.d.ts +156 -0
- package/declarations/components/file-upload/state.d.ts.map +1 -0
- package/declarations/components/file-upload.d.ts +3 -0
- package/declarations/index.d.ts +5 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/messages.d.ts +55 -0
- package/declarations/messages.d.ts.map +1 -0
- package/declarations/test-support/file-upload.d.ts +112 -0
- package/declarations/test-support/file-upload.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +2 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/declarations/test-support.d.ts +2 -0
- package/declarations/utils.d.ts +25 -0
- package/declarations/utils.d.ts.map +1 -0
- package/dist/components/file-upload.js +722 -0
- package/dist/components/file-upload.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.js +57 -0
- package/dist/messages.js.map +1 -0
- package/dist/test-support.js +266 -0
- package/dist/test-support.js.map +1 -0
- package/dist/utils.js +60 -0
- package/dist/utils.js.map +1 -0
- package/package.json +120 -3
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { hash, fn } from '@ember/helper';
|
|
3
|
+
import { modifier } from 'ember-modifier';
|
|
4
|
+
import { tracked, cached } from '@glimmer/tracking';
|
|
5
|
+
import FileDropzone from 'ember-file-upload/components/file-dropzone';
|
|
6
|
+
import { Upload as Upload$1, FileImage, FileVideo, FileAudio, FileArchive, FileSpreadsheet, FileText, File as File$1, X, RotateCw } from 'lucide';
|
|
7
|
+
import Icon from '@ember-joinery/ember/components/icon';
|
|
8
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
9
|
+
import { setComponentTemplate } from '@ember/component';
|
|
10
|
+
import { g, i, n } from 'decorator-transforms/runtime';
|
|
11
|
+
import { on } from '@ember/modifier';
|
|
12
|
+
import Button from '@ember-joinery/ember/components/button';
|
|
13
|
+
import Item, { ItemGroup } from '@ember-joinery/ember/components/item';
|
|
14
|
+
import templateOnly from '@ember/component/template-only';
|
|
15
|
+
import Progress from '@ember-joinery/ember/components/progress';
|
|
16
|
+
import { isObject, isFunction, isString, isNumber } from '@sindresorhus/is';
|
|
17
|
+
import { registerDestructor } from '@ember/destroyable';
|
|
18
|
+
import { Queue } from 'ember-file-upload';
|
|
19
|
+
import { ControllableState } from '@ember-joinery/primitives/controllable-state';
|
|
20
|
+
import { formatFileSize, fileKind, acceptsFile } from '../utils.js';
|
|
21
|
+
import '@switchyard-ts/ember';
|
|
22
|
+
import { State, Machine, invoke, transition, onEntry } from '@switchyard-ts/core';
|
|
23
|
+
import { translator, translate } from '@ember-joinery/primitives/i18n';
|
|
24
|
+
import { messages } from '../messages.js';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The zone to drop files on, or to press to choose them: ember-file-upload's `FileDropzone`
|
|
28
|
+
* around a visually hidden `<input type="file">`, in the look of shadcn's Empty with a dashed
|
|
29
|
+
* border. It turns `--primary` while files are dragged over it, shows the focus ring while its
|
|
30
|
+
* input has focus, and names the files a choice or drop turned away under its prompt, in a
|
|
31
|
+
* status region that is always there (empty until then), so screen readers announce it.
|
|
32
|
+
*/
|
|
33
|
+
class FileUploadDropzone extends Component {
|
|
34
|
+
static {
|
|
35
|
+
g(this.prototype, "isDragging", [tracked], function () {
|
|
36
|
+
return false;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
#isDragging = (i(this, "isDragging"), void 0);
|
|
40
|
+
get state() {
|
|
41
|
+
return this.args.upload.state;
|
|
42
|
+
}
|
|
43
|
+
get labels() {
|
|
44
|
+
return this.args.upload.labels;
|
|
45
|
+
}
|
|
46
|
+
get rejected() {
|
|
47
|
+
const names = this.state.rejected;
|
|
48
|
+
return names.length ? this.labels.rejectedLabel([...names]) : undefined;
|
|
49
|
+
}
|
|
50
|
+
get leftOut() {
|
|
51
|
+
const names = this.state.leftOut;
|
|
52
|
+
return names.length ? this.labels.leftOutLabel([...names]) : undefined;
|
|
53
|
+
}
|
|
54
|
+
/** Whether to say files can be dropped: only where they can be, and while it takes them. */
|
|
55
|
+
get showsHint() {
|
|
56
|
+
return !this.state.disabled;
|
|
57
|
+
}
|
|
58
|
+
get description() {
|
|
59
|
+
return this.labels.description ?? this.state.accept;
|
|
60
|
+
}
|
|
61
|
+
enter = () => {
|
|
62
|
+
if (!this.state.disabled) this.isDragging = true;
|
|
63
|
+
};
|
|
64
|
+
leave = () => {
|
|
65
|
+
this.isDragging = false;
|
|
66
|
+
};
|
|
67
|
+
drop = (files, transfer) => {
|
|
68
|
+
this.isDragging = false;
|
|
69
|
+
this.state.onDrop(files, transfer);
|
|
70
|
+
};
|
|
71
|
+
static {
|
|
72
|
+
setComponentTemplate(precompileTemplate("<FileDropzone @queue={{this.state.queue}} @multiple={{this.state.multiple}} @filter={{this.state.filter}} @onDragEnter={{this.enter}} @onDragLeave={{this.leave}} @onDrop={{this.drop}} class=\"jn-file-upload-dropzone\" data-slot=\"file-upload-dropzone\" data-dragging={{if this.isDragging \"\"}} data-disabled={{if this.state.disabled \"\"}} data-invalid={{if @upload.invalid \"\"}} data-test-jn-part=\"dropzone\" ...attributes as |dropzone|>\n <label class=\"jn-file-upload-dropzone-label\" data-slot=\"file-upload-dropzone-label\">\n <input id={{@upload.inputId}} class=\"jn-file-upload-input\" type=\"file\" accept={{this.state.accept}} multiple={{this.state.multiple}} disabled={{this.state.disabled}} required={{@upload.required}} aria-label={{@upload.label}} aria-invalid={{if @upload.invalid \"true\"}} aria-describedby={{@upload.describedBy}} data-test-jn-part=\"input\" {{this.state.queue.selectFile filter=this.state.filter onFilesSelected=this.state.onSelect}} />\n {{#if (has-block)}}\n {{yield (hash isDragging=this.isDragging isSupported=dropzone.supported)}}\n {{else}}\n <span class=\"jn-empty-header\" data-slot=\"file-upload-dropzone-header\">\n <span class=\"jn-empty-media jn-empty-media-icon\" data-slot=\"file-upload-dropzone-media\">\n <Icon @icon={{UploadIcon}} />\n </span>\n <span class=\"jn-empty-title jn-font-heading\" data-slot=\"file-upload-dropzone-title\">\n {{if this.isDragging this.labels.dropLabel this.labels.prompt}}\n </span>\n {{#if dropzone.supported}}\n {{#if this.showsHint}}\n {{#unless this.isDragging}}\n <span class=\"jn-empty-description\" data-slot=\"file-upload-dropzone-hint\">\n {{this.labels.hint}}\n </span>\n {{/unless}}\n {{/if}}\n {{/if}}\n {{#if this.description}}\n <span class=\"jn-empty-description\" data-slot=\"file-upload-dropzone-description\">\n {{this.description}}\n </span>\n {{/if}}\n </span>\n {{/if}}\n </label>\n {{!-- A live region already in the page, so what is put in it is announced. --}}\n <div class=\"jn-file-upload-status\" data-slot=\"file-upload-status\" role=\"status\" data-test-jn-part=\"status\">\n {{#if this.rejected}}\n <p data-slot=\"file-upload-rejected\" data-test-jn-part=\"rejected\">{{this.rejected}}</p>\n {{/if}}\n {{#if this.leftOut}}\n <p data-slot=\"file-upload-left-out\" data-test-jn-part=\"left-out\">{{this.leftOut}}</p>\n {{/if}}\n </div>\n</FileDropzone>", {
|
|
73
|
+
strictMode: true,
|
|
74
|
+
scope: () => ({
|
|
75
|
+
FileDropzone,
|
|
76
|
+
hash,
|
|
77
|
+
Icon,
|
|
78
|
+
UploadIcon: Upload$1
|
|
79
|
+
})
|
|
80
|
+
}), this);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** The strings a `<FileUpload>` shows, each an argument with an English default. */
|
|
85
|
+
|
|
86
|
+
const ARCHIVES = new Set(['zip', 'gz', 'tgz', 'tar', 'rar', '7z', 'bz2', 'xz']);
|
|
87
|
+
const SHEETS = new Set(['csv', 'tsv', 'xls', 'xlsx', 'ods', 'numbers']);
|
|
88
|
+
const TEXTS = new Set(['pdf', 'txt', 'md', 'doc', 'docx', 'odt', 'rtf', 'pages']);
|
|
89
|
+
const IMAGES = new Set(['png', 'jpg', 'jpeg', 'gif', 'webp', 'avif', 'svg', 'heic', 'bmp', 'tiff']);
|
|
90
|
+
const VIDEOS = new Set(['mp4', 'mov', 'webm', 'mkv', 'avi', 'm4v']);
|
|
91
|
+
const AUDIO = new Set(['mp3', 'wav', 'ogg', 'flac', 'm4a', 'aac']);
|
|
92
|
+
|
|
93
|
+
/** The lucide icon for a file, from its MIME type when it has one, else its extension. */
|
|
94
|
+
function fileIcon(name, type = '') {
|
|
95
|
+
const extension = name.includes('.') ? name.split('.').pop().toLowerCase() : '';
|
|
96
|
+
if (type.startsWith('image/') || IMAGES.has(extension)) return FileImage;
|
|
97
|
+
if (type.startsWith('video/') || VIDEOS.has(extension)) return FileVideo;
|
|
98
|
+
if (type.startsWith('audio/') || AUDIO.has(extension)) return FileAudio;
|
|
99
|
+
if (ARCHIVES.has(extension)) return FileArchive;
|
|
100
|
+
if (SHEETS.has(extension) || type === 'text/csv') return FileSpreadsheet;
|
|
101
|
+
if (TEXTS.has(extension) || type.startsWith('text/') || type === 'application/pdf') return FileText;
|
|
102
|
+
return File$1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const call$1 = (fn, arg) => fn(arg);
|
|
106
|
+
/**
|
|
107
|
+
* The files the value holds, one shadcn Item each (`role="listitem"`, outlined and small, in an
|
|
108
|
+
* `ItemGroup`): a preview of an image, or an icon for its kind, its name, its kind and size, and
|
|
109
|
+
* a button that removes it. A disabled `<FileUpload>` shows no remove buttons.
|
|
110
|
+
*/
|
|
111
|
+
const FileUploadList = setComponentTemplate(precompileTemplate("{{#if @upload.state.files.length}}\n <ItemGroup class=\"jn-file-upload-list\" data-test-jn-part=\"list\" ...attributes>\n {{!-- Keyed on the value, so a row (and the focus on its button) stays when others change. --}}\n {{#each @upload.state.files key=\"value\" as |entry|}}\n <Item @variant=\"outline\" @size=\"sm\" @name={{entry.name}} role=\"listitem\" class=\"jn-file-upload-file\" data-state=\"done\" as |i|>\n <i.Media @variant=\"image\" class=\"jn-file-upload-file-media\">\n {{#if entry.preview}}\n <img src={{entry.preview}} alt />\n {{else}}\n <Icon @icon={{fileIcon entry.name entry.value.type}} />\n {{/if}}\n </i.Media>\n <i.Content class=\"jn-file-upload-file-content\">\n <i.Title class=\"jn-file-upload-file-title\">\n <span class=\"jn-file-upload-file-name\">{{entry.name}}</span>\n </i.Title>\n <i.Description>\n {{entry.kind}}{{#if entry.size}} \xB7 {{entry.size}}{{/if}}\n </i.Description>\n </i.Content>\n {{#unless @upload.state.disabled}}\n <i.Actions>\n <Button @variant=\"ghost\" @size=\"icon-sm\" @name=\"remove\" class=\"jn-file-upload-remove\" aria-label={{call @upload.labels.removeLabel entry.name}} {{on \"click\" (fn @upload.state.remove entry.value)}}>\n <Icon @icon={{X}} />\n </Button>\n </i.Actions>\n {{/unless}}\n </Item>\n {{/each}}\n </ItemGroup>\n{{/if}}", {
|
|
112
|
+
strictMode: true,
|
|
113
|
+
scope: () => ({
|
|
114
|
+
ItemGroup,
|
|
115
|
+
Item,
|
|
116
|
+
Icon,
|
|
117
|
+
fileIcon,
|
|
118
|
+
Button,
|
|
119
|
+
call: call$1,
|
|
120
|
+
on,
|
|
121
|
+
fn,
|
|
122
|
+
X
|
|
123
|
+
})
|
|
124
|
+
}), templateOnly());
|
|
125
|
+
|
|
126
|
+
const call = (fn, arg) => fn(arg);
|
|
127
|
+
const isError = state => state === 'error';
|
|
128
|
+
/**
|
|
129
|
+
* The files `@upload` is sending, one shadcn Item each, like the file list's: a preview or an
|
|
130
|
+
* icon, the name, its kind and size, and a Progress bar across the row's foot that follows
|
|
131
|
+
* ember-file-upload's `progress`. A failed upload shows its error, with buttons that retry it and
|
|
132
|
+
* remove it (none while the `<FileUpload>` is disabled). A file leaves the queue for the list once
|
|
133
|
+
* its upload resolves.
|
|
134
|
+
*/
|
|
135
|
+
const FileUploadQueue = setComponentTemplate(precompileTemplate("{{#if @upload.state.uploads.length}}\n <ItemGroup class=\"jn-file-upload-queue\" aria-busy={{if @upload.state.isUploading \"true\"}} data-test-jn-part=\"queue\" ...attributes>\n {{#each @upload.state.uploads as |upload|}}\n <Item @variant=\"outline\" @size=\"sm\" @name={{upload.name}} role=\"listitem\" class=\"jn-file-upload-file\" data-state={{upload.state}} as |i|>\n <i.Media @variant=\"image\" class=\"jn-file-upload-file-media\">\n {{#let (call @upload.state.previewOf upload.file) as |preview|}}\n {{#if preview}}\n <img src={{preview}} alt />\n {{else}}\n <Icon @icon={{fileIcon upload.name upload.file.type}} />\n {{/if}}\n {{/let}}\n </i.Media>\n <i.Content class=\"jn-file-upload-file-content\">\n <i.Title class=\"jn-file-upload-file-title\">\n <span class=\"jn-file-upload-file-name\">{{upload.name}}</span>\n </i.Title>\n <i.Description class=\"jn-file-upload-file-description\">\n {{#if (isError upload.state)}}\n {{upload.error}}\n {{else}}\n {{call @upload.state.kindOf upload.name}}\n \xB7\n {{call @upload.state.sizeOf upload.file}}\n {{/if}}\n </i.Description>\n </i.Content>\n {{#if (isError upload.state)}}\n {{#unless @upload.state.disabled}}\n <i.Actions>\n <Button @variant=\"ghost\" @size=\"icon-sm\" @name=\"retry\" class=\"jn-file-upload-retry\" aria-label={{call @upload.labels.retryLabel upload.name}} {{on \"click\" (fn @upload.state.retry upload)}}>\n <Icon @icon={{RotateCw}} />\n </Button>\n <Button @variant=\"ghost\" @size=\"icon-sm\" @name=\"remove\" class=\"jn-file-upload-remove\" aria-label={{call @upload.labels.removeLabel upload.name}} {{on \"click\" (fn @upload.state.dismiss upload)}}>\n <Icon @icon={{X}} />\n </Button>\n </i.Actions>\n {{/unless}}\n {{else}}\n <i.Footer>\n <Progress @value={{upload.progress}} class=\"jn-file-upload-progress\" aria-label={{call @upload.labels.progressLabel upload.name}} />\n </i.Footer>\n {{/if}}\n </Item>\n {{/each}}\n </ItemGroup>\n{{/if}}", {
|
|
136
|
+
strictMode: true,
|
|
137
|
+
scope: () => ({
|
|
138
|
+
ItemGroup,
|
|
139
|
+
Item,
|
|
140
|
+
call,
|
|
141
|
+
Icon,
|
|
142
|
+
fileIcon,
|
|
143
|
+
isError,
|
|
144
|
+
Button,
|
|
145
|
+
on,
|
|
146
|
+
fn,
|
|
147
|
+
RotateCw,
|
|
148
|
+
X,
|
|
149
|
+
Progress
|
|
150
|
+
})
|
|
151
|
+
}), templateOnly());
|
|
152
|
+
|
|
153
|
+
// Importing @switchyard-ts/ember wires tracking and test waiters: `settled()` waits for uploads.
|
|
154
|
+
class UploadState extends State {
|
|
155
|
+
/** `upload(file, { signal })` is running. */
|
|
156
|
+
static Uploading = UploadState.of('uploading');
|
|
157
|
+
/** It rejected; `retry()` sends it again. */
|
|
158
|
+
static Failed = UploadState.of('failed');
|
|
159
|
+
/** It resolved, and the host has what it resolved to. */
|
|
160
|
+
static Done = UploadState.of('done', {
|
|
161
|
+
final: true
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** What an upload reports to. */
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* One file's upload, as a chart: it uploads, then is done or has failed, and a failed one can
|
|
169
|
+
* be retried. Stopping it aborts the upload's signal, and what the upload settles with after
|
|
170
|
+
* that is dropped.
|
|
171
|
+
*/
|
|
172
|
+
class UploadActor extends Machine {
|
|
173
|
+
file;
|
|
174
|
+
host;
|
|
175
|
+
/** What the upload resolved with, kept for `Done`'s entry. */
|
|
176
|
+
result;
|
|
177
|
+
/** What the last attempt rejected with. */
|
|
178
|
+
failure;
|
|
179
|
+
constructor(file, host) {
|
|
180
|
+
super();
|
|
181
|
+
this.file = file;
|
|
182
|
+
this.host = host;
|
|
183
|
+
}
|
|
184
|
+
get isEnabled() {
|
|
185
|
+
return !this.host.isDisabled();
|
|
186
|
+
}
|
|
187
|
+
upload(signal) {
|
|
188
|
+
// In a promise, so an upload that throws, or returns a plain value, is handled as `await` did.
|
|
189
|
+
const sent = new Promise(resolve => resolve(this.host.upload(this.file, {
|
|
190
|
+
signal
|
|
191
|
+
}))).then(value => this.result = value, error => {
|
|
192
|
+
this.failure = error;
|
|
193
|
+
throw error;
|
|
194
|
+
});
|
|
195
|
+
// Not a Promise, so Switchyard doesn't make it a test waiter: `settled()` doesn't wait for an
|
|
196
|
+
// upload, which a test settles by hand.
|
|
197
|
+
return {
|
|
198
|
+
then: sent.then.bind(sent)
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
static {
|
|
202
|
+
n(this.prototype, "upload", [invoke(UploadState.Uploading, {
|
|
203
|
+
onDone: UploadState.Done,
|
|
204
|
+
onError: UploadState.Failed
|
|
205
|
+
})]);
|
|
206
|
+
}
|
|
207
|
+
retry() {}
|
|
208
|
+
static {
|
|
209
|
+
n(this.prototype, "retry", [transition({
|
|
210
|
+
from: UploadState.Failed,
|
|
211
|
+
to: UploadState.Uploading,
|
|
212
|
+
guard: m => m.isEnabled
|
|
213
|
+
})]);
|
|
214
|
+
}
|
|
215
|
+
done() {
|
|
216
|
+
this.host.uploaded(this.result);
|
|
217
|
+
}
|
|
218
|
+
static {
|
|
219
|
+
n(this.prototype, "done", [onEntry(UploadState.Done)]);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** A chosen file that is uploading, or whose upload failed: an entry in the upload queue. */
|
|
224
|
+
class Upload {
|
|
225
|
+
/** ember-file-upload's file. */
|
|
226
|
+
file;
|
|
227
|
+
#actor;
|
|
228
|
+
#failedLabel;
|
|
229
|
+
constructor(file, host, failedLabel) {
|
|
230
|
+
this.file = file;
|
|
231
|
+
this.#failedLabel = failedLabel;
|
|
232
|
+
this.#actor = new UploadActor(file, host).start();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** `uploading`, or `error` once its upload has failed. */
|
|
236
|
+
get state() {
|
|
237
|
+
return this.#actor.matches(UploadState.Failed) ? 'error' : 'uploading';
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** Why its upload failed. */
|
|
241
|
+
get error() {
|
|
242
|
+
if (this.state !== 'error') return undefined;
|
|
243
|
+
const error = this.#actor.failure;
|
|
244
|
+
if (error instanceof Error && error.message) return error.message;
|
|
245
|
+
return isString(error) && error ? error : this.#failedLabel();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** Whether `retry()` would send it again: it failed, and the component isn't disabled. */
|
|
249
|
+
get canRetry() {
|
|
250
|
+
return Boolean(this.#actor.can.retry);
|
|
251
|
+
}
|
|
252
|
+
retry() {
|
|
253
|
+
this.#actor.retry();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Stops it: a running upload's signal aborts, and what it settles with is dropped. */
|
|
257
|
+
stop() {
|
|
258
|
+
this.#actor.stop();
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** Its name. */
|
|
262
|
+
get name() {
|
|
263
|
+
return this.file.name;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** How much of it has uploaded, from 0 to 100: ember-file-upload's `progress`. */
|
|
267
|
+
get progress() {
|
|
268
|
+
return this.file.progress;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** What the state reads from the component's arguments, each read live. */
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Where a row lost the button that had focus (it was removed, or a retry took its buttons away),
|
|
276
|
+
* so focus can move to the nearest button of the same kind once that has rendered.
|
|
277
|
+
*/
|
|
278
|
+
|
|
279
|
+
let nextQueue = 0;
|
|
280
|
+
function isImage(value) {
|
|
281
|
+
return value instanceof Blob && value.type.startsWith('image/');
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** A value's name when the caller gives no `@nameOf`: a file's, or a record's `name` or `label`. */
|
|
285
|
+
function defaultName(value) {
|
|
286
|
+
if (value instanceof File) return value.name;
|
|
287
|
+
if (isObject(value) && !isFunction(value)) {
|
|
288
|
+
const {
|
|
289
|
+
name,
|
|
290
|
+
label
|
|
291
|
+
} = value;
|
|
292
|
+
if (isString(name)) return name;
|
|
293
|
+
if (isString(label)) return label;
|
|
294
|
+
}
|
|
295
|
+
return String(value);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** A value's size in bytes when the caller gives no `@sizeOf`: its `size`, if it is a number. */
|
|
299
|
+
function defaultSize(value) {
|
|
300
|
+
const size = value?.size;
|
|
301
|
+
return isNumber(size) ? size : undefined;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* The state of a `<FileUpload>`: the files its value holds, the uploads in its queue, and what
|
|
306
|
+
* its last drop turned away. Its parts read it, and act through it.
|
|
307
|
+
*/
|
|
308
|
+
class FileUploadState {
|
|
309
|
+
#options;
|
|
310
|
+
/** The value: what the list shows. */
|
|
311
|
+
value;
|
|
312
|
+
/** The queue ember-file-upload puts the chosen files in, unless the caller gave one. */
|
|
313
|
+
#ownQueue;
|
|
314
|
+
/** Previews made for image files, each an object URL, revoked when the component goes. */
|
|
315
|
+
#previews = new Map();
|
|
316
|
+
|
|
317
|
+
/** The uploads in flight or failed, in the order the files were chosen. */
|
|
318
|
+
static {
|
|
319
|
+
g(this.prototype, "uploads", [tracked], function () {
|
|
320
|
+
return [];
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
#uploads = (i(this, "uploads"), void 0);
|
|
324
|
+
static {
|
|
325
|
+
g(this.prototype, "rejected", [tracked], function () {
|
|
326
|
+
return [];
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
#rejected = (i(this, "rejected"), void 0);
|
|
330
|
+
/** The names of the files the last choice or drop turned away, as `@accept` doesn't take them. */
|
|
331
|
+
static {
|
|
332
|
+
g(this.prototype, "leftOut", [tracked], function () {
|
|
333
|
+
return [];
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
#leftOut = (i(this, "leftOut"), void 0);
|
|
337
|
+
/** The names of the files the last choice or drop left out, without `@multiple`: all but one. */
|
|
338
|
+
static {
|
|
339
|
+
g(this.prototype, "focusRequest", [tracked]);
|
|
340
|
+
}
|
|
341
|
+
#focusRequest = (i(this, "focusRequest"), void 0);
|
|
342
|
+
/** Where focus goes once a removal or a retry has rendered. */
|
|
343
|
+
/** What `filter` has turned away from the choice or drop being taken, for its message. */
|
|
344
|
+
#unaccepted = [];
|
|
345
|
+
#extra = [];
|
|
346
|
+
#destroyed = false;
|
|
347
|
+
constructor(owner, options) {
|
|
348
|
+
this.#options = options;
|
|
349
|
+
this.value = new ControllableState({
|
|
350
|
+
name: 'value',
|
|
351
|
+
value: options.value,
|
|
352
|
+
defaultValue: options.defaultValue,
|
|
353
|
+
onChange: options.onValueChange,
|
|
354
|
+
fallback: []
|
|
355
|
+
});
|
|
356
|
+
// The queue isn't the app's `file-queue` service's, so the component needs no service and a
|
|
357
|
+
// test's files never meet another's. Pass `@queue` to use one of the service's.
|
|
358
|
+
this.#ownQueue = new Queue({
|
|
359
|
+
name: `joinery-file-upload-${nextQueue++}`,
|
|
360
|
+
fileQueue: undefined
|
|
361
|
+
});
|
|
362
|
+
registerDestructor(owner, () => {
|
|
363
|
+
this.#destroyed = true;
|
|
364
|
+
for (const url of this.#previews.values()) URL.revokeObjectURL(url);
|
|
365
|
+
this.#previews.clear();
|
|
366
|
+
// Its uploads stop and leave whichever queue they are in, `@queue` included.
|
|
367
|
+
for (const entry of this.uploads) {
|
|
368
|
+
entry.stop();
|
|
369
|
+
entry.file.queue?.remove(entry.file);
|
|
370
|
+
}
|
|
371
|
+
for (const file of this.#ownQueue.files) this.#ownQueue.remove(file);
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** The ember-file-upload queue the chosen files go into: `@queue`, or the component's own. */
|
|
376
|
+
get queue() {
|
|
377
|
+
return this.#options.queue() ?? this.#ownQueue;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/** Whether it takes more than one file. */
|
|
381
|
+
get multiple() {
|
|
382
|
+
return Boolean(this.#options.multiple());
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** Which files it takes (`@accept`). */
|
|
386
|
+
get accept() {
|
|
387
|
+
return this.#options.accept();
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** Whether it takes no files and removes none. */
|
|
391
|
+
get disabled() {
|
|
392
|
+
return Boolean(this.#options.disabled());
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** Whether any upload is still running. */
|
|
396
|
+
get isUploading() {
|
|
397
|
+
return this.uploads.some(upload => upload.state === 'uploading');
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* The value's files, as the list shows them. Cached, so they are the same objects until the
|
|
402
|
+
* value (or how it is named, sized or previewed) changes; the list keys its rows on `value`, so
|
|
403
|
+
* a row, and the focus on its button, stays put when another file comes or goes.
|
|
404
|
+
*/
|
|
405
|
+
get files() {
|
|
406
|
+
const nameOf = this.#options.nameOf() ?? defaultName;
|
|
407
|
+
const sizeOf = this.#options.sizeOf() ?? defaultSize;
|
|
408
|
+
const previewOf = this.#options.previewOf() ?? (value => this.#preview(value));
|
|
409
|
+
const locale = this.#options.locale();
|
|
410
|
+
return this.value.value.map(value => {
|
|
411
|
+
const name = nameOf(value);
|
|
412
|
+
const bytes = sizeOf(value);
|
|
413
|
+
return {
|
|
414
|
+
value,
|
|
415
|
+
name,
|
|
416
|
+
kind: this.kindOf(name),
|
|
417
|
+
size: bytes === undefined ? undefined : formatFileSize(bytes, locale),
|
|
418
|
+
preview: previewOf(value)
|
|
419
|
+
};
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** A file's kind, from its name: `PDF`, or `@unknownKindLabel` (`FILE`) without an extension. */
|
|
424
|
+
static {
|
|
425
|
+
n(this.prototype, "files", [cached]);
|
|
426
|
+
}
|
|
427
|
+
kindOf = name => fileKind(name, this.#options.unknownKindLabel());
|
|
428
|
+
|
|
429
|
+
/** The values the list holds, as `@value` hands them over. */
|
|
430
|
+
get values() {
|
|
431
|
+
return this.value.value;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** A file's size, formatted in the component's locale. */
|
|
435
|
+
sizeOf = file => formatFileSize(file.size, this.#options.locale());
|
|
436
|
+
|
|
437
|
+
/** A preview of a file being uploaded: an object URL for an image, else `undefined`. */
|
|
438
|
+
previewOf = file => this.#preview(file.file);
|
|
439
|
+
|
|
440
|
+
/** An object URL showing an image file, made once per file. */
|
|
441
|
+
#preview(value) {
|
|
442
|
+
if (!isImage(value) || this.#destroyed) return undefined;
|
|
443
|
+
let url = this.#previews.get(value);
|
|
444
|
+
if (!url) {
|
|
445
|
+
url = URL.createObjectURL(value);
|
|
446
|
+
this.#previews.set(value, url);
|
|
447
|
+
}
|
|
448
|
+
return url;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Revokes the previews of the files that are neither in the value nor in the queue. It runs
|
|
453
|
+
* after each change, so in controlled mode a removal the caller refuses keeps its preview: the
|
|
454
|
+
* value still holds the file.
|
|
455
|
+
*/
|
|
456
|
+
#sweep() {
|
|
457
|
+
if (!this.#previews.size) return;
|
|
458
|
+
const kept = new Set(this.value.value);
|
|
459
|
+
for (const entry of this.uploads) kept.add(entry.file.file);
|
|
460
|
+
for (const [blob, url] of this.#previews) {
|
|
461
|
+
if (kept.has(blob)) continue;
|
|
462
|
+
URL.revokeObjectURL(url);
|
|
463
|
+
this.#previews.delete(blob);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* What the picker and the drop zone may take: ember-file-upload's `filter`. It notes what it
|
|
469
|
+
* turns away, which `onSelect` and `onDrop` then name.
|
|
470
|
+
*/
|
|
471
|
+
filter = (file, _files, index) => {
|
|
472
|
+
if (this.disabled) return false;
|
|
473
|
+
if (!this.multiple && index > 0) {
|
|
474
|
+
this.#extra.push(file.name);
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
if (acceptsFile(file, this.accept)) return true;
|
|
478
|
+
this.#unaccepted.push(file.name);
|
|
479
|
+
return false;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Files dropped on the zone: those that passed `filter`, and the whole drop. Without
|
|
484
|
+
* `@multiple`, ember-file-upload's zone offers `filter` only the first file, so the rest are
|
|
485
|
+
* named as left out here.
|
|
486
|
+
*/
|
|
487
|
+
onDrop = (files, transfer) => {
|
|
488
|
+
if (!this.multiple && !this.disabled) {
|
|
489
|
+
this.#extra.push(...transfer.files.slice(1).map(file => file.name));
|
|
490
|
+
}
|
|
491
|
+
this.#report();
|
|
492
|
+
this.take(files);
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Files chosen in the file picker. Its `accept` filters what the dialog shows, but a choice of
|
|
497
|
+
* "All files" there lets anything through, so `filter` checks them again and they are named as
|
|
498
|
+
* a drop's are.
|
|
499
|
+
*/
|
|
500
|
+
onSelect = files => {
|
|
501
|
+
this.#report();
|
|
502
|
+
this.take(files);
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
/** Names what `filter` turned away from the choice or drop just taken, and starts afresh. */
|
|
506
|
+
#report() {
|
|
507
|
+
this.rejected = this.#unaccepted;
|
|
508
|
+
this.leftOut = this.#extra;
|
|
509
|
+
this.#unaccepted = [];
|
|
510
|
+
this.#extra = [];
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Keeps the files, or, with `@upload`, queues them and uploads each. Without `@multiple`, a new
|
|
515
|
+
* file replaces the one uploading or failed: that one leaves ember-file-upload's queue, and
|
|
516
|
+
* whatever its upload resolves to is dropped.
|
|
517
|
+
*/
|
|
518
|
+
take(files) {
|
|
519
|
+
if (!files.length) return;
|
|
520
|
+
const upload = this.#options.upload();
|
|
521
|
+
if (!upload) {
|
|
522
|
+
for (const file of files) file.queue?.remove(file);
|
|
523
|
+
this.#store(files.map(file => file.file));
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
const fresh = files.map(file => this.#upload(file, upload));
|
|
527
|
+
if (this.multiple) this.uploads = [...this.uploads, ...fresh];else {
|
|
528
|
+
for (const old of this.uploads) {
|
|
529
|
+
old.stop();
|
|
530
|
+
old.file.queue?.remove(old.file);
|
|
531
|
+
}
|
|
532
|
+
this.uploads = fresh;
|
|
533
|
+
this.#sweep();
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/** An upload of `file`, which `upload` sends (a retry sends it with the current `@upload`). */
|
|
538
|
+
#upload(file, upload) {
|
|
539
|
+
const host = {
|
|
540
|
+
isDisabled: () => this.disabled,
|
|
541
|
+
upload: (file, options) => (this.#options.upload() ?? upload)(file, options),
|
|
542
|
+
// An upload settles a microtask after it starts at the soonest, so `entry` is set by then.
|
|
543
|
+
uploaded: value => {
|
|
544
|
+
this.uploads = this.uploads.filter(other => other !== entry);
|
|
545
|
+
file.queue?.remove(file);
|
|
546
|
+
this.#store([value]);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
const entry = new Upload(file, host, this.#options.uploadFailedLabel);
|
|
550
|
+
return entry;
|
|
551
|
+
}
|
|
552
|
+
#store(values) {
|
|
553
|
+
if (this.multiple) this.value.set(current => [...current, ...values]);else this.value.set(values.slice(-1));
|
|
554
|
+
this.#sweep();
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** Takes a file out of the value. Focus moves to the row that takes its place. */
|
|
558
|
+
remove = value => {
|
|
559
|
+
if (this.disabled) return;
|
|
560
|
+
const index = this.value.value.indexOf(value);
|
|
561
|
+
if (index === -1) return;
|
|
562
|
+
this.value.set(current => current.filter(other => other !== value));
|
|
563
|
+
this.#sweep();
|
|
564
|
+
this.focusRequest = {
|
|
565
|
+
list: 'list',
|
|
566
|
+
index,
|
|
567
|
+
button: 'remove'
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
/** Empties the value. */
|
|
572
|
+
clear = () => {
|
|
573
|
+
if (this.disabled) return;
|
|
574
|
+
this.value.set([]);
|
|
575
|
+
this.#sweep();
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Uploads a failed file again. Its row loses its buttons while it uploads, so focus moves to
|
|
580
|
+
* the nearest row's Retry (or remove) button, else to the file input.
|
|
581
|
+
*/
|
|
582
|
+
retry = entry => {
|
|
583
|
+
const index = this.uploads.indexOf(entry);
|
|
584
|
+
if (!this.#options.upload() || index === -1 || !entry.canRetry) return;
|
|
585
|
+
entry.retry();
|
|
586
|
+
this.focusRequest = {
|
|
587
|
+
list: 'queue',
|
|
588
|
+
index,
|
|
589
|
+
button: 'retry'
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
/** Takes a file out of the upload queue, uploading or failed; its result, if any, is dropped. */
|
|
594
|
+
dismiss = entry => {
|
|
595
|
+
if (this.disabled) return;
|
|
596
|
+
const index = this.uploads.indexOf(entry);
|
|
597
|
+
if (index === -1) return;
|
|
598
|
+
this.uploads = this.uploads.filter(other => other !== entry);
|
|
599
|
+
entry.stop();
|
|
600
|
+
entry.file.queue?.remove(entry.file);
|
|
601
|
+
this.#sweep();
|
|
602
|
+
this.focusRequest = {
|
|
603
|
+
list: 'queue',
|
|
604
|
+
index,
|
|
605
|
+
button: 'remove'
|
|
606
|
+
};
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** What `<FileUpload>` yields: its parts, its files and uploads, and what it can do with them. */
|
|
611
|
+
const handled = new WeakSet();
|
|
612
|
+
/**
|
|
613
|
+
* Once a removal or a retry has rendered, moves focus from the button that went to the nearest
|
|
614
|
+
* one left: in the row now at that index (the one that took a removed row's place, or the
|
|
615
|
+
* retried row, if it still has a button), then the rows after it, then those before it,
|
|
616
|
+
* preferring a button of the same kind (remove, or Retry) in each. Failing that, any remove
|
|
617
|
+
* button, then the file input. It moves focus only when it was lost with the button, so it
|
|
618
|
+
* never takes focus from somewhere else.
|
|
619
|
+
*/
|
|
620
|
+
const focusAfterChange = modifier((element, [request]) => {
|
|
621
|
+
if (!request || handled.has(request)) return;
|
|
622
|
+
handled.add(request);
|
|
623
|
+
const active = element.ownerDocument.activeElement;
|
|
624
|
+
if (active && active !== element.ownerDocument.body && active.isConnected) return;
|
|
625
|
+
const list = element.querySelector(`.jn-file-upload-${request.list}`);
|
|
626
|
+
const rows = list ? [...list.querySelectorAll(':scope > .jn-file-upload-file')] : [];
|
|
627
|
+
const nearest = [...rows.slice(request.index), ...rows.slice(0, request.index).reverse()];
|
|
628
|
+
const target = nearest.map(row => row.querySelector(`.jn-file-upload-${request.button}`) ?? row.querySelector('button')).find(Boolean) ?? element.querySelector('.jn-file-upload-remove') ?? element.querySelector('.jn-file-upload-input');
|
|
629
|
+
target?.focus();
|
|
630
|
+
});
|
|
631
|
+
/**
|
|
632
|
+
* File uploads in shadcn's look, on ember-file-upload: a drop zone around a native file input, the
|
|
633
|
+
* list of chosen files (an Item each, with a preview, the name and size, and a remove button), and,
|
|
634
|
+
* with `@upload`, a queue of the files uploading, each with a Progress bar.
|
|
635
|
+
*
|
|
636
|
+
* <FileUpload @multiple={{true}} @accept="image/*,.pdf" @onValueChange={{this.setFiles}} />
|
|
637
|
+
*
|
|
638
|
+
* <FileUpload @upload={{this.upload}} as |u|>
|
|
639
|
+
* <u.Dropzone />
|
|
640
|
+
* <u.List />
|
|
641
|
+
* <u.Queue />
|
|
642
|
+
* </FileUpload>
|
|
643
|
+
*
|
|
644
|
+
* The value is always a list: of `File`s, or, with `@upload`, of what each upload resolved to.
|
|
645
|
+
* Without `@multiple` it holds one at most, and a new choice replaces it.
|
|
646
|
+
*/
|
|
647
|
+
class FileUpload extends Component {
|
|
648
|
+
state;
|
|
649
|
+
constructor(owner, args) {
|
|
650
|
+
super(owner, args);
|
|
651
|
+
this.state = new FileUploadState(this, {
|
|
652
|
+
multiple: () => this.args.multiple,
|
|
653
|
+
accept: () => this.args.accept,
|
|
654
|
+
disabled: () => this.args.disabled,
|
|
655
|
+
value: () => this.args.value,
|
|
656
|
+
defaultValue: () => this.args.defaultValue,
|
|
657
|
+
onValueChange: () => this.args.onValueChange,
|
|
658
|
+
upload: () => this.args.upload,
|
|
659
|
+
queue: () => this.args.queue,
|
|
660
|
+
nameOf: () => this.args.nameOf,
|
|
661
|
+
sizeOf: () => this.args.sizeOf,
|
|
662
|
+
previewOf: () => this.args.previewOf,
|
|
663
|
+
uploadFailedLabel: () => this.args.uploadFailedLabel ?? translate(this, messages.uploadFailed),
|
|
664
|
+
unknownKindLabel: () => this.args.unknownKindLabel ?? translate(this, messages.unknownKind),
|
|
665
|
+
locale: () => this.args.locale ?? translator(this)?.locale
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
get labels() {
|
|
669
|
+
const multiple = this.state.multiple;
|
|
670
|
+
return {
|
|
671
|
+
prompt: this.args.prompt ?? translate(this, multiple ? messages.promptMultiple : messages.prompt),
|
|
672
|
+
hint: this.args.hint ?? translate(this, messages.hint),
|
|
673
|
+
dropLabel: this.args.dropLabel ?? translate(this, messages.dropLabel),
|
|
674
|
+
description: this.args.description,
|
|
675
|
+
rejectedLabel: this.args.rejectedLabel ?? (names => translate(this, messages.rejected, {
|
|
676
|
+
names: names.join(', ')
|
|
677
|
+
})),
|
|
678
|
+
leftOutLabel: this.args.leftOutLabel ?? (names => translate(this, messages.leftOut, {
|
|
679
|
+
names: names.join(', ')
|
|
680
|
+
})),
|
|
681
|
+
removeLabel: this.args.removeLabel ?? (name => translate(this, messages.remove, {
|
|
682
|
+
name
|
|
683
|
+
})),
|
|
684
|
+
retryLabel: this.args.retryLabel ?? (name => translate(this, messages.retry, {
|
|
685
|
+
name
|
|
686
|
+
})),
|
|
687
|
+
progressLabel: this.args.progressLabel ?? (name => translate(this, messages.progress, {
|
|
688
|
+
name
|
|
689
|
+
}))
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
/** What the parts read: the state, the strings, and the input's arguments. */
|
|
693
|
+
get context() {
|
|
694
|
+
const {
|
|
695
|
+
state
|
|
696
|
+
} = this;
|
|
697
|
+
return {
|
|
698
|
+
state,
|
|
699
|
+
labels: this.labels,
|
|
700
|
+
inputId: this.args.id,
|
|
701
|
+
label: this.args.label,
|
|
702
|
+
invalid: this.args.invalid,
|
|
703
|
+
describedBy: this.args.describedBy,
|
|
704
|
+
required: this.args.required
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
static {
|
|
708
|
+
setComponentTemplate(precompileTemplate("{{#let (hash Dropzone=(component FileUploadDropzone upload=this.context) List=(component FileUploadList upload=this.context) Queue=(component FileUploadQueue upload=this.context) files=this.state.files uploads=this.state.uploads isUploading=this.state.isUploading remove=this.state.remove clear=this.state.clear retry=this.state.retry queue=this.state.queue) as |u|}}\n <div class=\"jn-file-upload\" data-slot=\"file-upload\" data-multiple={{if this.state.multiple \"\"}} data-disabled={{if this.state.disabled \"\"}} data-uploading={{if this.state.isUploading \"\"}} data-test-jn=\"file-upload\" data-test-jn-name={{@name}} {{focusAfterChange this.state.focusRequest}} ...attributes>\n {{#if (has-block)}}\n {{yield u}}\n {{else}}\n <u.Dropzone />\n <u.List />\n <u.Queue />\n {{/if}}\n </div>\n{{/let}}", {
|
|
709
|
+
strictMode: true,
|
|
710
|
+
scope: () => ({
|
|
711
|
+
hash,
|
|
712
|
+
FileUploadDropzone,
|
|
713
|
+
FileUploadList,
|
|
714
|
+
FileUploadQueue,
|
|
715
|
+
focusAfterChange
|
|
716
|
+
})
|
|
717
|
+
}), this);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
export { FileUpload as default };
|
|
722
|
+
//# sourceMappingURL=file-upload.js.map
|