@uploadcare/file-uploader 1.22.0 → 1.23.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/abstract/UploaderBlock.d.ts.map +1 -1
- package/abstract/UploaderBlock.js +27 -5
- package/abstract/UploaderPublicApi.d.ts.map +1 -1
- package/abstract/UploaderPublicApi.js +9 -1
- package/abstract/managers/ValidationManager.d.ts +71 -12
- package/abstract/managers/ValidationManager.d.ts.map +1 -1
- package/abstract/managers/ValidationManager.js +229 -53
- package/abstract/uploadEntrySchema.d.ts +10 -2
- package/abstract/uploadEntrySchema.d.ts.map +1 -1
- package/abstract/uploadEntrySchema.js +10 -2
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.js +1 -1
- package/blocks/Config/initialConfig.d.ts.map +1 -1
- package/blocks/Config/initialConfig.js +2 -0
- package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
- package/blocks/Config/normalizeConfigValue.js +2 -0
- package/blocks/FileItem/FileItem.d.ts +1 -1
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +68 -49
- package/blocks/UploadList/UploadList.d.ts +2 -0
- package/blocks/UploadList/UploadList.d.ts.map +1 -1
- package/blocks/UploadList/UploadList.js +18 -20
- package/env.d.ts +1 -1
- package/env.js +1 -1
- package/index.ssr.d.ts +1 -1
- package/index.ssr.d.ts.map +1 -1
- package/index.ssr.js +5 -1
- package/locales/file-uploader/ar.d.ts +3 -1
- package/locales/file-uploader/ar.js +4 -2
- package/locales/file-uploader/az.d.ts +3 -1
- package/locales/file-uploader/az.js +5 -2
- package/locales/file-uploader/ca.d.ts +3 -1
- package/locales/file-uploader/ca.js +5 -2
- package/locales/file-uploader/cs.d.ts +3 -1
- package/locales/file-uploader/cs.js +5 -2
- package/locales/file-uploader/da.d.ts +3 -1
- package/locales/file-uploader/da.js +5 -2
- package/locales/file-uploader/de.d.ts +3 -1
- package/locales/file-uploader/de.js +5 -2
- package/locales/file-uploader/el.d.ts +3 -1
- package/locales/file-uploader/el.js +5 -2
- package/locales/file-uploader/en.d.ts +3 -1
- package/locales/file-uploader/en.js +4 -2
- package/locales/file-uploader/es.d.ts +3 -1
- package/locales/file-uploader/es.js +5 -2
- package/locales/file-uploader/et.d.ts +3 -1
- package/locales/file-uploader/et.js +5 -2
- package/locales/file-uploader/fi.d.ts +3 -1
- package/locales/file-uploader/fi.js +5 -2
- package/locales/file-uploader/fr.d.ts +3 -1
- package/locales/file-uploader/fr.js +5 -2
- package/locales/file-uploader/he.d.ts +3 -1
- package/locales/file-uploader/he.js +5 -2
- package/locales/file-uploader/hy.d.ts +3 -1
- package/locales/file-uploader/hy.js +4 -2
- package/locales/file-uploader/is.d.ts +3 -1
- package/locales/file-uploader/is.js +5 -2
- package/locales/file-uploader/it.d.ts +3 -1
- package/locales/file-uploader/it.js +5 -2
- package/locales/file-uploader/ja.d.ts +3 -1
- package/locales/file-uploader/ja.js +5 -2
- package/locales/file-uploader/ka.d.ts +3 -1
- package/locales/file-uploader/ka.js +5 -2
- package/locales/file-uploader/kk.d.ts +3 -1
- package/locales/file-uploader/kk.js +5 -2
- package/locales/file-uploader/ko.d.ts +3 -1
- package/locales/file-uploader/ko.js +5 -2
- package/locales/file-uploader/lv.d.ts +3 -1
- package/locales/file-uploader/lv.js +5 -2
- package/locales/file-uploader/nb.d.ts +3 -1
- package/locales/file-uploader/nb.js +5 -2
- package/locales/file-uploader/nl.d.ts +3 -1
- package/locales/file-uploader/nl.js +5 -2
- package/locales/file-uploader/pl.d.ts +3 -1
- package/locales/file-uploader/pl.js +5 -2
- package/locales/file-uploader/pt.d.ts +3 -1
- package/locales/file-uploader/pt.js +5 -2
- package/locales/file-uploader/ro.d.ts +3 -1
- package/locales/file-uploader/ro.js +5 -2
- package/locales/file-uploader/ru.d.ts +3 -1
- package/locales/file-uploader/ru.js +5 -2
- package/locales/file-uploader/sk.d.ts +3 -1
- package/locales/file-uploader/sk.js +5 -2
- package/locales/file-uploader/sr.d.ts +3 -1
- package/locales/file-uploader/sr.js +5 -2
- package/locales/file-uploader/sv.d.ts +3 -1
- package/locales/file-uploader/sv.js +5 -2
- package/locales/file-uploader/tr.d.ts +3 -1
- package/locales/file-uploader/tr.js +5 -2
- package/locales/file-uploader/uk.d.ts +3 -1
- package/locales/file-uploader/uk.js +5 -2
- package/locales/file-uploader/vi.d.ts +3 -1
- package/locales/file-uploader/vi.js +5 -2
- package/locales/file-uploader/zh-TW.d.ts +3 -1
- package/locales/file-uploader/zh-TW.js +5 -2
- package/locales/file-uploader/zh.d.ts +3 -1
- package/locales/file-uploader/zh.js +5 -2
- package/package.json +8 -8
- package/types/exported.d.ts +26 -4
- package/utils/withResolvers.d.ts +6 -0
- package/utils/withResolvers.d.ts.map +1 -0
- package/utils/withResolvers.js +18 -0
- package/utils/withResolvers.test.d.ts +2 -0
- package/utils/withResolvers.test.d.ts.map +1 -0
- package/utils/withResolvers.test.js +36 -0
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +1 -1
|
@@ -100,7 +100,7 @@ export const uploadEntrySchema = Object.freeze({
|
|
|
100
100
|
}),
|
|
101
101
|
errors: Object.freeze({
|
|
102
102
|
type: Array,
|
|
103
|
-
value: /** @type {
|
|
103
|
+
value: /** @type {import('../types').OutputErrorFile[]} */ ([]),
|
|
104
104
|
}),
|
|
105
105
|
uploadError: Object.freeze({
|
|
106
106
|
type: Error,
|
|
@@ -111,7 +111,15 @@ export const uploadEntrySchema = Object.freeze({
|
|
|
111
111
|
type: Boolean,
|
|
112
112
|
value: false,
|
|
113
113
|
}),
|
|
114
|
-
|
|
114
|
+
isQueuedForUploading: Object.freeze({
|
|
115
|
+
type: Boolean,
|
|
116
|
+
value: false,
|
|
117
|
+
}),
|
|
118
|
+
isValidationPending: Object.freeze({
|
|
119
|
+
type: Boolean,
|
|
120
|
+
value: false,
|
|
121
|
+
}),
|
|
122
|
+
isQueuedForValidation: Object.freeze({
|
|
115
123
|
type: Boolean,
|
|
116
124
|
value: false,
|
|
117
125
|
}),
|
|
@@ -55,9 +55,9 @@ export class CloudImageEditorBlock extends Block {
|
|
|
55
55
|
}, TIMEOUT);
|
|
56
56
|
const resizeObserver = new ResizeObserver(([element]) => {
|
|
57
57
|
if (element.contentRect.width > 0 && element.contentRect.height > 0) {
|
|
58
|
-
resolve();
|
|
59
58
|
clearTimeout(timeoutId);
|
|
60
59
|
resizeObserver.disconnect();
|
|
60
|
+
setTimeout(() => resolve(), 0);
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
resizeObserver.observe(this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialConfig.d.ts","sourceRoot":"","sources":["initialConfig.js"],"names":[],"mappings":"AAKA,gCAAiC,sBAAsB,CAAC;AACxD,+BAAgC,+BAA+B,CAAC;AAChE,sCAAuC,+BAA+B,CAAC;AACvE,+CAAgD,qBAAqB,CAAC;AAEtE,wDAAwD;AACxD,4BADW,OAAO,sBAAsB,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"initialConfig.d.ts","sourceRoot":"","sources":["initialConfig.js"],"names":[],"mappings":"AAKA,gCAAiC,sBAAsB,CAAC;AACxD,+BAAgC,+BAA+B,CAAC;AAChE,sCAAuC,+BAA+B,CAAC;AACvE,+CAAgD,qBAAqB,CAAC;AAEtE,wDAAwD;AACxD,4BADW,OAAO,sBAAsB,EAAE,UAAU,CAkFjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeConfigValue.d.ts","sourceRoot":"","sources":["normalizeConfigValue.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalizeConfigValue.d.ts","sourceRoot":"","sources":["normalizeConfigValue.js"],"names":[],"mappings":"AAqHO,qCAL+C,CAAC,SAA1C,MAAO,OAAO,aAAa,EAAE,UAAW,OAC1C,CAAC,SACD,OAAO,GACL,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAa3D"}
|
|
@@ -88,6 +88,8 @@ const mapping = {
|
|
|
88
88
|
iconHrefResolver: /** @type {typeof asFunction<import('../../types').IconHrefResolver>} */ (asFunction),
|
|
89
89
|
fileValidators: /** @type {typeof asArray<import('../../types').FileValidators>} */ (asArray),
|
|
90
90
|
collectionValidators: /** @type {typeof asArray<import('../../types').CollectionValidators>} */ (asArray),
|
|
91
|
+
validationTimeout: asNumber,
|
|
92
|
+
validationConcurrency: asNumber,
|
|
91
93
|
|
|
92
94
|
cameraModes: asCameraModes,
|
|
93
95
|
defaultCameraMode: asCameraMode,
|
|
@@ -46,7 +46,7 @@ export class FileItem extends FileItemConfig {
|
|
|
46
46
|
private _calculateState;
|
|
47
47
|
/** @private */
|
|
48
48
|
private _debouncedCalculateState;
|
|
49
|
-
|
|
49
|
+
_updateHintAndProgress: (...args: any[]) => void;
|
|
50
50
|
/**
|
|
51
51
|
* @private
|
|
52
52
|
* @param {String} id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"AAoBA;IAIE,eAAe;IACf,sBAAsB;IAKpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+CC;IAQH;;;OAGG;IACH,0BAUC;IAPC,qCAA2C;IAC3C,wCAA0C;IAQ5C,eAAe;IACf,wBAkBG;IAEH,eAAe;IACf,iCAA0E;IAE1E,iDAmCE;IAEF;;;OAGG;IACH,uBA4CC;IAED,6BAA6B;IAC7B,4BADY,OAAO,QASlB;IAgDD,uCAsBE;IAaA,eAAe;IACf,kBAEE;IAUJ;;;MAEC;IAED;;;OAGG;IACH,uBAEC;IAED,0CA8GG;CACJ;;;;;+BAhb8B,qBAAqB"}
|
|
@@ -12,6 +12,9 @@ const FileItemState = Object.freeze({
|
|
|
12
12
|
FINISHED: Symbol('FINISHED'),
|
|
13
13
|
FAILED: Symbol('FAILED'),
|
|
14
14
|
UPLOADING: Symbol('UPLOADING'),
|
|
15
|
+
VALIDATION: Symbol('VALIDATION'),
|
|
16
|
+
QUEUED_UPLOADING: Symbol('QUEUED-UPLOADING'),
|
|
17
|
+
QUEUED_VALIDATION: Symbol('QUEUED-VALIDATION'),
|
|
15
18
|
IDLE: Symbol('IDLE'),
|
|
16
19
|
});
|
|
17
20
|
|
|
@@ -102,6 +105,12 @@ export class FileItem extends FileItemConfig {
|
|
|
102
105
|
|
|
103
106
|
if (entry.getValue('errors').length > 0) {
|
|
104
107
|
state = FileItemState.FAILED;
|
|
108
|
+
} else if (entry.getValue('isQueuedForUploading')) {
|
|
109
|
+
state = FileItemState.QUEUED_UPLOADING;
|
|
110
|
+
} else if (entry.getValue('isQueuedForValidation')) {
|
|
111
|
+
state = FileItemState.QUEUED_VALIDATION;
|
|
112
|
+
} else if (entry.getValue('isValidationPending')) {
|
|
113
|
+
state = FileItemState.VALIDATION;
|
|
105
114
|
} else if (entry.getValue('isUploading')) {
|
|
106
115
|
state = FileItemState.UPLOADING;
|
|
107
116
|
} else if (entry.getValue('fileInfo')) {
|
|
@@ -114,34 +123,41 @@ export class FileItem extends FileItemConfig {
|
|
|
114
123
|
/** @private */
|
|
115
124
|
_debouncedCalculateState = debounce(this._calculateState.bind(this), 100);
|
|
116
125
|
|
|
117
|
-
|
|
118
|
-
throttle(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (externalUrl && source && Object.values(ExternalUploadSource).includes(source)) {
|
|
138
|
-
const hint = this.l10n('waiting-for', { source: this.l10n(`src-type-${source}`) });
|
|
139
|
-
this.$.hint = hint;
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
126
|
+
_updateHintAndProgress = this._withEntry(
|
|
127
|
+
throttle(
|
|
128
|
+
/** @param {(typeof FileItemState)[keyof typeof FileItemState]} state */
|
|
129
|
+
(entry, state) => {
|
|
130
|
+
const errorText = entry.getValue('errors')?.[0]?.message;
|
|
131
|
+
const source = entry.getValue('source');
|
|
132
|
+
const externalUrl = entry.getValue('externalUrl');
|
|
133
|
+
const isUploading = state === FileItemState.UPLOADING;
|
|
134
|
+
const isQueuedForUploading = state === FileItemState.QUEUED_UPLOADING;
|
|
135
|
+
const isQueuedForValidation = state === FileItemState.QUEUED_VALIDATION;
|
|
136
|
+
const isValidationPending = state === FileItemState.VALIDATION;
|
|
137
|
+
const fileName = entry.getValue('fileName');
|
|
138
|
+
let hint = '';
|
|
139
|
+
|
|
140
|
+
if (errorText) {
|
|
141
|
+
hint = '';
|
|
142
|
+
} else if (externalUrl && source && Object.values(ExternalUploadSource).includes(source)) {
|
|
143
|
+
hint = this.l10n('waiting-for', { source: this.l10n(`src-type-${source}`) });
|
|
144
|
+
}
|
|
142
145
|
|
|
143
|
-
|
|
144
|
-
|
|
146
|
+
this.set$({
|
|
147
|
+
hint,
|
|
148
|
+
errorText: errorText,
|
|
149
|
+
progressVisible: isUploading || isQueuedForUploading || isQueuedForValidation || isValidationPending,
|
|
150
|
+
progressValue: isQueuedForValidation || isValidationPending ? 0 : entry.getValue('uploadProgress'),
|
|
151
|
+
ariaLabelStatusFile:
|
|
152
|
+
fileName &&
|
|
153
|
+
this.l10n('a11y-file-item-status', {
|
|
154
|
+
fileName,
|
|
155
|
+
status: this.l10n(state?.description?.toLocaleLowerCase() ?? '').toLocaleLowerCase(),
|
|
156
|
+
}),
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
100,
|
|
160
|
+
),
|
|
145
161
|
);
|
|
146
162
|
|
|
147
163
|
/**
|
|
@@ -158,13 +174,20 @@ export class FileItem extends FileItemConfig {
|
|
|
158
174
|
return;
|
|
159
175
|
}
|
|
160
176
|
|
|
161
|
-
this._subEntry('
|
|
162
|
-
this
|
|
163
|
-
this._updateHint();
|
|
177
|
+
this._subEntry('isQueuedForValidation', () => {
|
|
178
|
+
this._debouncedCalculateState();
|
|
164
179
|
});
|
|
165
180
|
|
|
166
|
-
this._subEntry('
|
|
167
|
-
this.
|
|
181
|
+
this._subEntry('isValidationPending', () => {
|
|
182
|
+
this._debouncedCalculateState();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
this._subEntry('uploadProgress', () => {
|
|
186
|
+
this._debouncedCalculateState();
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
this._subEntry('isQueuedForUploading', () => {
|
|
190
|
+
this._debouncedCalculateState();
|
|
168
191
|
});
|
|
169
192
|
|
|
170
193
|
this._subEntry('fileName', (name) => {
|
|
@@ -256,24 +279,15 @@ export class FileItem extends FileItemConfig {
|
|
|
256
279
|
if (state === FileItemState.UPLOADING) {
|
|
257
280
|
this.$.isFocused = false;
|
|
258
281
|
}
|
|
259
|
-
const fileName = entry.getValue('fileName');
|
|
260
282
|
|
|
261
283
|
this.set$({
|
|
262
284
|
isFailed: state === FileItemState.FAILED,
|
|
263
285
|
isUploading: state === FileItemState.UPLOADING,
|
|
264
286
|
isFinished: state === FileItemState.FINISHED,
|
|
265
|
-
|
|
266
|
-
isEditable: this.cfg.useCloudImageEditor && this._entry?.getValue('isImage') && this._entry?.getValue('cdnUrl'),
|
|
267
|
-
errorText: entry.getValue('errors')?.[0]?.message,
|
|
268
|
-
ariaLabelStatusFile:
|
|
269
|
-
fileName &&
|
|
270
|
-
this.l10n('a11y-file-item-status', {
|
|
271
|
-
fileName,
|
|
272
|
-
status: this.l10n(state?.description?.toLocaleLowerCase() ?? '').toLocaleLowerCase(),
|
|
273
|
-
}),
|
|
287
|
+
isEditable: this.cfg.useCloudImageEditor && entry.getValue('isImage') && entry.getValue('cdnUrl'),
|
|
274
288
|
});
|
|
275
289
|
|
|
276
|
-
this.
|
|
290
|
+
this._updateHintAndProgress(state);
|
|
277
291
|
},
|
|
278
292
|
);
|
|
279
293
|
|
|
@@ -318,7 +332,12 @@ export class FileItem extends FileItemConfig {
|
|
|
318
332
|
return;
|
|
319
333
|
}
|
|
320
334
|
|
|
321
|
-
if (
|
|
335
|
+
if (
|
|
336
|
+
entry.getValue('fileInfo') ||
|
|
337
|
+
entry.getValue('isUploading') ||
|
|
338
|
+
entry.getValue('errors').length > 0 ||
|
|
339
|
+
entry.getValue('isValidationPending')
|
|
340
|
+
) {
|
|
322
341
|
return;
|
|
323
342
|
}
|
|
324
343
|
const multipleMax = this.cfg.multiple ? this.cfg.multipleMax : 1;
|
|
@@ -326,20 +345,20 @@ export class FileItem extends FileItemConfig {
|
|
|
326
345
|
return;
|
|
327
346
|
}
|
|
328
347
|
|
|
329
|
-
this._debouncedCalculateState();
|
|
330
|
-
|
|
331
348
|
entry.setMultipleValues({
|
|
332
349
|
isUploading: true,
|
|
333
350
|
errors: [],
|
|
334
|
-
|
|
351
|
+
isQueuedForUploading: true,
|
|
335
352
|
});
|
|
336
353
|
|
|
354
|
+
this._debouncedCalculateState();
|
|
355
|
+
|
|
337
356
|
try {
|
|
338
357
|
let abortController = new AbortController();
|
|
339
358
|
entry.setValue('abortController', abortController);
|
|
340
359
|
|
|
341
360
|
const uploadTask = async () => {
|
|
342
|
-
entry.setValue('
|
|
361
|
+
entry.setValue('isQueuedForUploading', false);
|
|
343
362
|
/** @type {Blob | File | null} */
|
|
344
363
|
let file = entry.getValue('file');
|
|
345
364
|
if (file && this.cfg.imageShrink) {
|
|
@@ -373,7 +392,7 @@ export class FileItem extends FileItemConfig {
|
|
|
373
392
|
let fileInfo = await this.$['*uploadQueue'].add(uploadTask);
|
|
374
393
|
entry.setMultipleValues({
|
|
375
394
|
fileInfo,
|
|
376
|
-
|
|
395
|
+
isQueuedForUploading: false,
|
|
377
396
|
isUploading: false,
|
|
378
397
|
fileName: fileInfo.originalFilename,
|
|
379
398
|
fileSize: fileInfo.size,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* succeed: number;
|
|
6
6
|
* uploading: number;
|
|
7
7
|
* failed: number;
|
|
8
|
+
* validatingBeforeUploading: number;
|
|
8
9
|
* }} Summary
|
|
9
10
|
*/
|
|
10
11
|
export class UploadList extends UploaderBlock {
|
|
@@ -55,6 +56,7 @@ export type Summary = {
|
|
|
55
56
|
succeed: number;
|
|
56
57
|
uploading: number;
|
|
57
58
|
failed: number;
|
|
59
|
+
validatingBeforeUploading: number;
|
|
58
60
|
};
|
|
59
61
|
import { UploaderBlock } from '../../abstract/UploaderBlock.js';
|
|
60
62
|
//# sourceMappingURL=UploadList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadList.d.ts","sourceRoot":"","sources":["UploadList.js"],"names":[],"mappings":"AAMA,+CAA+C;AAE/C
|
|
1
|
+
{"version":3,"file":"UploadList.d.ts","sourceRoot":"","sources":["UploadList.js"],"names":[],"mappings":"AAMA,+CAA+C;AAE/C;;;;;;;;GAQG;AAEH;IAKE,4BAAoD;IAKlD;;;;;;;;;;;;;;;;;;;;;;;;;;MA0BC;IAGH,eAAe;IACf,yCAaQ;IAER,eAAe;IACf,4BA2CC;IAED;;;OAGG;IACH,uBAsBC;CA0DF;;;;4BArMa,MAAM,GAAG,MAAM;sBAGhB;IACR,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB,EAAE,MAAM,CAAC;CACnC;8BAb0B,iCAAiC"}
|
|
@@ -12,6 +12,7 @@ import { throttle } from '../utils/throttle.js';
|
|
|
12
12
|
* succeed: number;
|
|
13
13
|
* uploading: number;
|
|
14
14
|
* failed: number;
|
|
15
|
+
* validatingBeforeUploading: number;
|
|
15
16
|
* }} Summary
|
|
16
17
|
*/
|
|
17
18
|
|
|
@@ -64,6 +65,10 @@ export class UploadList extends UploaderBlock {
|
|
|
64
65
|
if (!this.couldOpenActivity && this.$['*currentActivity'] === this.activityType) {
|
|
65
66
|
this.historyBack();
|
|
66
67
|
}
|
|
68
|
+
|
|
69
|
+
if (!this.cfg.confirmUpload) {
|
|
70
|
+
this.api.uploadAll();
|
|
71
|
+
}
|
|
67
72
|
}, 300);
|
|
68
73
|
|
|
69
74
|
/** @private */
|
|
@@ -75,19 +80,21 @@ export class UploadList extends UploaderBlock {
|
|
|
75
80
|
succeed: collectionState.successCount,
|
|
76
81
|
uploading: collectionState.uploadingCount,
|
|
77
82
|
failed: collectionState.failedCount,
|
|
83
|
+
validatingBeforeUploading: collectionState.idleEntries.filter((e) => e.isValidationPending).length,
|
|
78
84
|
};
|
|
79
85
|
const fitCountRestrictions = !collectionState.errors.some(
|
|
80
86
|
(err) => err.type === 'TOO_MANY_FILES' || err.type === 'TOO_FEW_FILES',
|
|
81
87
|
);
|
|
82
88
|
const tooMany = collectionState.errors.some((err) => err.type === 'TOO_MANY_FILES');
|
|
83
89
|
const exact = collectionState.totalCount === (this.cfg.multiple ? this.cfg.multipleMax : 1);
|
|
84
|
-
const
|
|
90
|
+
const isValidationPending = collectionState.allEntries.some((entry) => entry.isValidationPending);
|
|
91
|
+
const validationOk = summary.failed === 0 && collectionState.errors.length === 0 && !isValidationPending;
|
|
85
92
|
let uploadBtnVisible = false;
|
|
86
93
|
let allDone = false;
|
|
87
94
|
let doneBtnEnabled = false;
|
|
88
95
|
|
|
89
96
|
const readyToUpload = summary.total - summary.succeed - summary.uploading - summary.failed;
|
|
90
|
-
if (readyToUpload > 0 && fitCountRestrictions) {
|
|
97
|
+
if (readyToUpload > 0 && fitCountRestrictions && validationOk) {
|
|
91
98
|
uploadBtnVisible = true;
|
|
92
99
|
} else {
|
|
93
100
|
allDone = true;
|
|
@@ -103,6 +110,8 @@ export class UploadList extends UploaderBlock {
|
|
|
103
110
|
|
|
104
111
|
addMoreBtnEnabled: summary.total === 0 || (!tooMany && !exact),
|
|
105
112
|
addMoreBtnVisible: !exact || this.cfg.multiple,
|
|
113
|
+
|
|
114
|
+
hasFiles: summary.total > 0,
|
|
106
115
|
});
|
|
107
116
|
|
|
108
117
|
this.bindL10n('headerText', () => this._getHeaderText(summary));
|
|
@@ -115,12 +124,15 @@ export class UploadList extends UploaderBlock {
|
|
|
115
124
|
_getHeaderText(summary) {
|
|
116
125
|
/** @param {keyof Summary} status */
|
|
117
126
|
const localizedText = (status) => {
|
|
118
|
-
|
|
127
|
+
let count = summary[status];
|
|
128
|
+
if (status === 'uploading') {
|
|
129
|
+
count += summary.validatingBeforeUploading;
|
|
130
|
+
}
|
|
119
131
|
return this.l10n(`header-${status}`, {
|
|
120
132
|
count: count,
|
|
121
133
|
});
|
|
122
134
|
};
|
|
123
|
-
if (summary.uploading > 0) {
|
|
135
|
+
if (summary.uploading > 0 || summary.validatingBeforeUploading > 0) {
|
|
124
136
|
return localizedText('uploading');
|
|
125
137
|
}
|
|
126
138
|
if (summary.failed > 0) {
|
|
@@ -164,22 +176,7 @@ export class UploadList extends UploaderBlock {
|
|
|
164
176
|
// TODO: could be performance issue on many files
|
|
165
177
|
// there is no need to update buttons state on every progress tick
|
|
166
178
|
this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate);
|
|
167
|
-
|
|
168
|
-
this.sub(
|
|
169
|
-
'*uploadList',
|
|
170
|
-
(list) => {
|
|
171
|
-
this._throttledHandleCollectionUpdate();
|
|
172
|
-
|
|
173
|
-
this.set$({
|
|
174
|
-
hasFiles: list.length > 0,
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
if (!this.cfg.confirmUpload) {
|
|
178
|
-
this.api.uploadAll();
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
false,
|
|
182
|
-
);
|
|
179
|
+
this.uploadCollection.observeCollection(this._throttledHandleCollectionUpdate);
|
|
183
180
|
|
|
184
181
|
this.sub(
|
|
185
182
|
'*collectionErrors',
|
|
@@ -202,6 +199,7 @@ export class UploadList extends UploaderBlock {
|
|
|
202
199
|
destroyCallback() {
|
|
203
200
|
super.destroyCallback();
|
|
204
201
|
this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate);
|
|
202
|
+
this.uploadCollection.unobserveCollection(this._throttledHandleCollectionUpdate);
|
|
205
203
|
}
|
|
206
204
|
}
|
|
207
205
|
|
package/env.d.ts
CHANGED
package/env.js
CHANGED
package/index.ssr.d.ts
CHANGED
|
@@ -566,7 +566,7 @@ export namespace ModalEvents {
|
|
|
566
566
|
let DESTROY: string;
|
|
567
567
|
}
|
|
568
568
|
export const PACKAGE_NAME: "blocks";
|
|
569
|
-
export const PACKAGE_VERSION: "1.
|
|
569
|
+
export const PACKAGE_VERSION: "1.23.0";
|
|
570
570
|
export const PresenceToggle: {
|
|
571
571
|
new (): {};
|
|
572
572
|
template: string;
|
package/index.ssr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.ssr.d.ts","sourceRoot":"","sources":["index.ssr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAcE;AACF;;;;;;;;;;;;;;;EAcE;AACF;;;;;EAIE;AACF;;;;;;EAKE;AACF;;;;;;;;EAgBE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6IE;AACF;;;;;;;;EAuCE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CE;AACF;;;;;;;;EAuCE;AACF;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.ssr.d.ts","sourceRoot":"","sources":["index.ssr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAcE;AACF;;;;;;;;;;;;;;;EAcE;AACF;;;;;EAIE;AACF;;;;;;EAKE;AACF;;;;;;;;EAgBE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6IE;AACF;;;;;;;;EAuCE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CE;AACF;;;;;;;;EAuCE;AACF;;;;;;;EA4HE;AACF;;;;;;;EAaE;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;EAeE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEE;AACF;;;;;;;EAWE;AACF;;;;;;;EAWE;AACF;;;;;;;EAWE;AACF;;;;;;;EAWE;AACF;;;;;;;EASE;AACF;;;;;;EAKE;AACF;;;;;;;EAWE;AACF;;;;;;;EAME;AACF;;;;;;;EAWE;AACF;;;;;;;EA+IE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0EE;;;;;;;;;;;;;AAaF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqFE;AACF;;;;;;EAKE;AACF;;;;;;EAKE;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CE;AACF;;;;;;;;EAWE;AACF;;;;;;EAwBE;AACF;;;;;;;EAUE;AACF;;;;;;;;EAWE;;;;;;;;;AASF,oCAAqC;AACrC,uCAAwC;AACxC;;;;;;;EAME;AACF;;;;;;;EASE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDE;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DE;AACF;;;;;;;EAeE;AACF;;;;;;EAKE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDE;AACF;;;;;;EAKE;AACF;;;;;;EAKE;AACF;;;;;;;;;;;;;;;;EAeE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDE;AACF;;;;;;;;;;;;EAWE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqEE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6EE;AACK,yCAAiC;AACjC,qCAA6B;AAC7B,6CAAqC;AACrC,oCAA4B"}
|
package/index.ssr.js
CHANGED
|
@@ -376,6 +376,8 @@ export const Config = class {
|
|
|
376
376
|
"user-agent-integration",
|
|
377
377
|
"locale-name",
|
|
378
378
|
"secure-uploads-expire-threshold",
|
|
379
|
+
"validation-timeout",
|
|
380
|
+
"validation-concurrency",
|
|
379
381
|
"camera-modes",
|
|
380
382
|
"default-camera-mode",
|
|
381
383
|
"enable-audio-recording",
|
|
@@ -430,6 +432,8 @@ export const Config = class {
|
|
|
430
432
|
"useragentintegration",
|
|
431
433
|
"localename",
|
|
432
434
|
"secureuploadsexpirethreshold",
|
|
435
|
+
"validationtimeout",
|
|
436
|
+
"validationconcurrency",
|
|
433
437
|
"cameramodes",
|
|
434
438
|
"defaultcameramode",
|
|
435
439
|
"enableaudiorecording",
|
|
@@ -1100,7 +1104,7 @@ export const ModalEvents = {
|
|
|
1100
1104
|
DESTROY: "modal:destroy",
|
|
1101
1105
|
};
|
|
1102
1106
|
export const PACKAGE_NAME = `blocks`;
|
|
1103
|
-
export const PACKAGE_VERSION = `1.
|
|
1107
|
+
export const PACKAGE_VERSION = `1.23.0`;
|
|
1104
1108
|
export const PresenceToggle = class {
|
|
1105
1109
|
static template = `<slot></slot> `;
|
|
1106
1110
|
static reg = () => {};
|
|
@@ -126,9 +126,11 @@ declare const _default: {
|
|
|
126
126
|
failed: string;
|
|
127
127
|
uploading: string;
|
|
128
128
|
idle: string;
|
|
129
|
-
queued: string;
|
|
130
129
|
'a11y-file-item-status': string;
|
|
131
130
|
'waiting-for': string;
|
|
131
|
+
'queued-uploading': string;
|
|
132
|
+
'queued-validation': string;
|
|
133
|
+
validation: string;
|
|
132
134
|
'a11y-cloud-editor-apply-aspect-ratio': string;
|
|
133
135
|
'crop-to-shape': string;
|
|
134
136
|
custom: string;
|
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
'src-type-vk': 'VK',
|
|
64
64
|
'src-type-evernote': 'Evernote',
|
|
65
65
|
'src-type-box': 'Box',
|
|
66
|
-
'src-type-onedrive': '
|
|
66
|
+
'src-type-onedrive': 'OneDrive',
|
|
67
67
|
'src-type-huddle': 'Huddle',
|
|
68
68
|
'src-type-other': 'أخرى',
|
|
69
69
|
'src-type-mobile-video-camera': 'فيديو',
|
|
@@ -127,9 +127,11 @@ export default {
|
|
|
127
127
|
failed: 'فشل',
|
|
128
128
|
uploading: 'جارٍ التحميل',
|
|
129
129
|
idle: 'خامل',
|
|
130
|
-
queued: 'في الانتظار',
|
|
131
130
|
'a11y-file-item-status': 'الملف {{fileName}} في حالة {{status}}',
|
|
132
131
|
'waiting-for': 'في انتظار {{source}}',
|
|
132
|
+
'queued-uploading': 'في انتظار الرفع',
|
|
133
|
+
'queued-validation': 'في انتظار التحقق',
|
|
134
|
+
validation: 'جارٍ التحقق',
|
|
133
135
|
'a11y-cloud-editor-apply-aspect-ratio': 'تطبيق عملية {{name}} {{value}}',
|
|
134
136
|
'crop-to-shape': 'اقتصاص إلى {{value}}',
|
|
135
137
|
custom: 'حر الشكل',
|
|
@@ -118,9 +118,11 @@ declare const _default: {
|
|
|
118
118
|
failed: string;
|
|
119
119
|
uploading: string;
|
|
120
120
|
idle: string;
|
|
121
|
-
queued: string;
|
|
122
121
|
'a11y-file-item-status': string;
|
|
123
122
|
'waiting-for': string;
|
|
123
|
+
'queued-uploading': string;
|
|
124
|
+
'queued-validation': string;
|
|
125
|
+
validation: string;
|
|
124
126
|
'a11y-cloud-editor-apply-aspect-ratio': string;
|
|
125
127
|
'crop-to-shape': string;
|
|
126
128
|
custom: string;
|
|
@@ -55,7 +55,7 @@ export default {
|
|
|
55
55
|
'src-type-vk': 'VK',
|
|
56
56
|
'src-type-evernote': 'Evernote',
|
|
57
57
|
'src-type-box': 'Box',
|
|
58
|
-
'src-type-onedrive': '
|
|
58
|
+
'src-type-onedrive': 'OneDrive',
|
|
59
59
|
'src-type-huddle': 'Huddle',
|
|
60
60
|
'src-type-other': 'Digər',
|
|
61
61
|
'src-type-mobile-video-camera': 'Video',
|
|
@@ -119,9 +119,12 @@ export default {
|
|
|
119
119
|
failed: 'Uğursuz',
|
|
120
120
|
uploading: 'Yüklənir',
|
|
121
121
|
idle: 'Boş',
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
'a11y-file-item-status': '{{fileName}} faylı {{status}} statusundadır',
|
|
124
124
|
'waiting-for': '{{source}} gözlənilir',
|
|
125
|
+
'queued-uploading': 'Yükləmə üçün növbədə',
|
|
126
|
+
'queued-validation': 'Doğrulama üçün növbədə',
|
|
127
|
+
validation: 'Doğrulanır',
|
|
125
128
|
'a11y-cloud-editor-apply-aspect-ratio': '{{name}} {{value}} əməliyyatını tətbiq et',
|
|
126
129
|
'crop-to-shape': '{{value}} ölçüsünə kəs',
|
|
127
130
|
|
|
@@ -120,9 +120,11 @@ declare const _default: {
|
|
|
120
120
|
failed: string;
|
|
121
121
|
uploading: string;
|
|
122
122
|
idle: string;
|
|
123
|
-
queued: string;
|
|
124
123
|
'a11y-file-item-status': string;
|
|
125
124
|
'waiting-for': string;
|
|
125
|
+
'queued-uploading': string;
|
|
126
|
+
'queued-validation': string;
|
|
127
|
+
validation: string;
|
|
126
128
|
'a11y-cloud-editor-apply-aspect-ratio': string;
|
|
127
129
|
'crop-to-shape': string;
|
|
128
130
|
custom: string;
|
|
@@ -57,7 +57,7 @@ export default {
|
|
|
57
57
|
'src-type-vk': 'VK',
|
|
58
58
|
'src-type-evernote': 'Evernote',
|
|
59
59
|
'src-type-box': 'Box',
|
|
60
|
-
'src-type-onedrive': '
|
|
60
|
+
'src-type-onedrive': 'OneDrive',
|
|
61
61
|
'src-type-huddle': 'Huddle',
|
|
62
62
|
'src-type-other': 'Altres',
|
|
63
63
|
'src-type-mobile-video-camera': 'Vídeo',
|
|
@@ -122,9 +122,12 @@ export default {
|
|
|
122
122
|
failed: 'Fallat',
|
|
123
123
|
uploading: 'Carregant',
|
|
124
124
|
idle: 'Inactiu',
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
'a11y-file-item-status': 'El fitxer {{fileName}} està en estat {{status}}',
|
|
127
127
|
'waiting-for': 'Esperant per {{source}}',
|
|
128
|
+
'queued-uploading': 'En cua per pujar',
|
|
129
|
+
'queued-validation': 'En cua per validar',
|
|
130
|
+
validation: 'Validant',
|
|
128
131
|
'a11y-cloud-editor-apply-aspect-ratio': 'Aplicar operació {{name}} {{value}}',
|
|
129
132
|
|
|
130
133
|
'crop-to-shape': 'Retalla a {{value}}',
|
|
@@ -122,9 +122,11 @@ declare const _default: {
|
|
|
122
122
|
failed: string;
|
|
123
123
|
uploading: string;
|
|
124
124
|
idle: string;
|
|
125
|
-
queued: string;
|
|
126
125
|
'a11y-file-item-status': string;
|
|
127
126
|
'waiting-for': string;
|
|
127
|
+
'queued-uploading': string;
|
|
128
|
+
'queued-validation': string;
|
|
129
|
+
validation: string;
|
|
128
130
|
'a11y-cloud-editor-apply-aspect-ratio': string;
|
|
129
131
|
'crop-to-shape': string;
|
|
130
132
|
custom: string;
|
|
@@ -59,7 +59,7 @@ export default {
|
|
|
59
59
|
'src-type-vk': 'VK',
|
|
60
60
|
'src-type-evernote': 'Evernote',
|
|
61
61
|
'src-type-box': 'Box',
|
|
62
|
-
'src-type-onedrive': '
|
|
62
|
+
'src-type-onedrive': 'OneDrive',
|
|
63
63
|
'src-type-huddle': 'Huddle',
|
|
64
64
|
'src-type-other': 'Jiné',
|
|
65
65
|
'src-type-mobile-video-camera': 'Video',
|
|
@@ -124,9 +124,12 @@ export default {
|
|
|
124
124
|
failed: 'Selhalo',
|
|
125
125
|
uploading: 'Nahrává se',
|
|
126
126
|
idle: 'Nečinný',
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
'a11y-file-item-status': 'Soubor {{fileName}} je ve stavu {{status}}',
|
|
129
129
|
'waiting-for': 'Čekání na {{source}}',
|
|
130
|
+
'queued-uploading': 'Ve frontě na nahrání',
|
|
131
|
+
'queued-validation': 'Ve frontě na validaci',
|
|
132
|
+
validation: 'Probíhá validace',
|
|
130
133
|
'a11y-cloud-editor-apply-aspect-ratio': 'Použít operaci {{name}} {{value}}',
|
|
131
134
|
|
|
132
135
|
'crop-to-shape': 'Oříznout na {{value}}',
|
|
@@ -118,9 +118,11 @@ declare const _default: {
|
|
|
118
118
|
failed: string;
|
|
119
119
|
uploading: string;
|
|
120
120
|
idle: string;
|
|
121
|
-
queued: string;
|
|
122
121
|
'a11y-file-item-status': string;
|
|
123
122
|
'waiting-for': string;
|
|
123
|
+
'queued-uploading': string;
|
|
124
|
+
'queued-validation': string;
|
|
125
|
+
validation: string;
|
|
124
126
|
'a11y-cloud-editor-apply-aspect-ratio': string;
|
|
125
127
|
'crop-to-shape': string;
|
|
126
128
|
custom: string;
|
|
@@ -55,7 +55,7 @@ export default {
|
|
|
55
55
|
'src-type-vk': 'VK',
|
|
56
56
|
'src-type-evernote': 'Evernote',
|
|
57
57
|
'src-type-box': 'Box',
|
|
58
|
-
'src-type-onedrive': '
|
|
58
|
+
'src-type-onedrive': 'OneDrive',
|
|
59
59
|
'src-type-huddle': 'Huddle',
|
|
60
60
|
'src-type-other': 'Andet',
|
|
61
61
|
'src-type-mobile-video-camera': 'Video',
|
|
@@ -120,9 +120,12 @@ export default {
|
|
|
120
120
|
failed: 'Mislykkedes',
|
|
121
121
|
uploading: 'Uploader',
|
|
122
122
|
idle: 'Inaktiv',
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
'a11y-file-item-status': 'Filen {{fileName}} er i status {{status}}',
|
|
125
125
|
'waiting-for': 'Venter på {{source}}',
|
|
126
|
+
'queued-uploading': 'I kø til upload',
|
|
127
|
+
'queued-validation': 'I kø til validering',
|
|
128
|
+
validation: 'Validerer',
|
|
126
129
|
'a11y-cloud-editor-apply-aspect-ratio': 'Anvend handling {{name}} {{value}}',
|
|
127
130
|
|
|
128
131
|
'crop-to-shape': 'Beskær til {{value}}',
|