@uploadcare/file-uploader 1.15.0-alpha.15 → 1.15.0-alpha.17
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/ValidationManager.d.ts +4 -0
- package/abstract/ValidationManager.d.ts.map +1 -1
- package/abstract/uploadEntrySchema.d.ts +4 -0
- package/abstract/uploadEntrySchema.d.ts.map +1 -1
- package/abstract/uploadEntrySchema.js +4 -0
- package/blocks/CloudImageEditor/src/EditorFilterControl.js +1 -1
- package/blocks/CloudImageEditor/src/EditorImageCropper.js +1 -1
- package/blocks/CloudImageEditor/src/EditorImageFader.js +1 -1
- package/blocks/CloudImageEditor/src/EditorToolbar.js +1 -1
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +29 -9
- package/blocks/Thumb/Thumb.d.ts +6 -2
- package/blocks/Thumb/Thumb.d.ts.map +1 -1
- package/blocks/Thumb/Thumb.js +47 -39
- package/blocks/{CloudImageEditor/src/lib → utils}/preloadImage.js +1 -1
- package/locales/file-uploader/ar.d.ts +1 -0
- package/locales/file-uploader/ar.js +1 -0
- package/locales/file-uploader/az.d.ts +1 -0
- package/locales/file-uploader/az.js +1 -0
- package/locales/file-uploader/ca.d.ts +1 -0
- package/locales/file-uploader/ca.js +1 -0
- package/locales/file-uploader/cs.d.ts +1 -0
- package/locales/file-uploader/cs.js +1 -0
- package/locales/file-uploader/da.d.ts +1 -0
- package/locales/file-uploader/da.js +1 -0
- package/locales/file-uploader/de.d.ts +1 -0
- package/locales/file-uploader/de.js +1 -0
- package/locales/file-uploader/el.d.ts +1 -0
- package/locales/file-uploader/el.js +1 -0
- package/locales/file-uploader/en.d.ts +1 -0
- package/locales/file-uploader/en.js +1 -0
- package/locales/file-uploader/es.d.ts +1 -0
- package/locales/file-uploader/es.js +1 -0
- package/locales/file-uploader/et.d.ts +1 -0
- package/locales/file-uploader/et.js +1 -0
- package/locales/file-uploader/fi.d.ts +1 -0
- package/locales/file-uploader/fi.js +1 -0
- package/locales/file-uploader/fr.d.ts +1 -0
- package/locales/file-uploader/fr.js +1 -0
- package/locales/file-uploader/he.d.ts +1 -0
- package/locales/file-uploader/he.js +1 -0
- package/locales/file-uploader/hy.d.ts +1 -0
- package/locales/file-uploader/hy.js +1 -0
- package/locales/file-uploader/is.d.ts +1 -0
- package/locales/file-uploader/is.js +1 -0
- package/locales/file-uploader/it.d.ts +1 -0
- package/locales/file-uploader/it.js +1 -0
- package/locales/file-uploader/ja.d.ts +1 -0
- package/locales/file-uploader/ja.js +1 -0
- package/locales/file-uploader/ka.d.ts +1 -0
- package/locales/file-uploader/ka.js +1 -0
- package/locales/file-uploader/kk.d.ts +1 -0
- package/locales/file-uploader/kk.js +1 -0
- package/locales/file-uploader/ko.d.ts +1 -0
- package/locales/file-uploader/ko.js +1 -0
- package/locales/file-uploader/lv.d.ts +1 -0
- package/locales/file-uploader/lv.js +1 -0
- package/locales/file-uploader/nb.d.ts +1 -0
- package/locales/file-uploader/nb.js +1 -0
- package/locales/file-uploader/nl.d.ts +1 -0
- package/locales/file-uploader/nl.js +1 -0
- package/locales/file-uploader/pl.d.ts +1 -0
- package/locales/file-uploader/pl.js +1 -0
- package/locales/file-uploader/pt.d.ts +1 -0
- package/locales/file-uploader/pt.js +1 -0
- package/locales/file-uploader/ro.d.ts +1 -0
- package/locales/file-uploader/ro.js +1 -0
- package/locales/file-uploader/ru.d.ts +1 -0
- package/locales/file-uploader/ru.js +1 -0
- package/locales/file-uploader/sk.d.ts +1 -0
- package/locales/file-uploader/sk.js +1 -0
- package/locales/file-uploader/sr.d.ts +1 -0
- package/locales/file-uploader/sr.js +1 -0
- package/locales/file-uploader/sv.d.ts +1 -0
- package/locales/file-uploader/sv.js +1 -0
- package/locales/file-uploader/tr.d.ts +1 -0
- package/locales/file-uploader/tr.js +1 -0
- package/locales/file-uploader/uk.d.ts +1 -0
- package/locales/file-uploader/uk.js +1 -0
- package/locales/file-uploader/vi.d.ts +1 -0
- package/locales/file-uploader/vi.js +1 -0
- package/locales/file-uploader/zh-TW.d.ts +1 -0
- package/locales/file-uploader/zh-TW.js +1 -0
- package/locales/file-uploader/zh.d.ts +1 -0
- package/locales/file-uploader/zh.js +1 -0
- package/package.json +1 -1
- package/types/jsx.d.ts +1 -1
- 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 +1 -1
- 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/blocks/{CloudImageEditor/src/lib → utils}/preloadImage.d.ts +0 -0
- /package/blocks/{CloudImageEditor/src/lib → utils}/preloadImage.d.ts.map +0 -0
|
@@ -125,6 +125,10 @@ export class ValidationManager {
|
|
|
125
125
|
type: BooleanConstructor;
|
|
126
126
|
value: false;
|
|
127
127
|
}>;
|
|
128
|
+
isQueued: Readonly<{
|
|
129
|
+
type: BooleanConstructor;
|
|
130
|
+
value: false;
|
|
131
|
+
}>;
|
|
128
132
|
}>>;
|
|
129
133
|
/** @param {string[]} [entryIds] */
|
|
130
134
|
runFileValidators(entryIds?: string[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationManager.d.ts","sourceRoot":"","sources":["ValidationManager.js"],"names":[],"mappings":"AAkCA;IAaE,wEAAwE;IACxE,2BADY,OAAO,oBAAoB,EAAE,aAAa,EAiBrD;IA7BD;;;OAGG;IACH,uBAAe;IAEf,kCAAkC;IAClC,iBADW,iBAAiB,EAAE,CACmE;IAEjG,wCAAwC;IACxC,uBADW,uBAAuB,EAAE,CACsC;IAMxE
|
|
1
|
+
{"version":3,"file":"ValidationManager.d.ts","sourceRoot":"","sources":["ValidationManager.js"],"names":[],"mappings":"AAkCA;IAaE,wEAAwE;IACxE,2BADY,OAAO,oBAAoB,EAAE,aAAa,EAiBrD;IA7BD;;;OAGG;IACH,uBAAe;IAEf,kCAAkC;IAClC,iBADW,iBAAiB,EAAE,CACmE;IAEjG,wCAAwC;IACxC,uBADW,uBAAuB,EAAE,CACsC;IAMxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAA6D;IAe/D,mCAAmC;IACnC,6BADY,MAAM,EAAE,QASnB;IAED,gCAqCC;IAED;;;OAGG;IACH,mCAyBC;IAED;;;;OAIG;IACH,2BAJa,CAAC,cACH,CAAC,EAAE,GACD,CAAC,EAAE,CAUf;CACF;gCAtJY,CACR,WAAW,EAAE,OAAO,UAAU,EAAE,eAAe,EAC/C,GAAG,EAAE,OAAO,wBAAwB,EAAE,iBAAiB,KACpD,SAAS,GAAG,OAAO,UAAU,EAAE,eAAe;sCAIzC,CACR,UAAU,EAAE,UAAU,CAC1B,cAAoB,iCAAiC,EAAE,0BAA0B,CACjF,OAAe,UAAU,EAAE,sBAAsB,CAC1C,CACF,EACD,GAAG,EAAE,OAAO,wBAAwB,EAAE,iBAAiB,KACpD,SAAS,GAAG,OAAO,UAAU,EAAE,qBAAqB"}
|
|
@@ -114,6 +114,10 @@ export const uploadEntrySchema: Readonly<{
|
|
|
114
114
|
type: BooleanConstructor;
|
|
115
115
|
value: false;
|
|
116
116
|
}>;
|
|
117
|
+
isQueued: Readonly<{
|
|
118
|
+
type: BooleanConstructor;
|
|
119
|
+
value: false;
|
|
120
|
+
}>;
|
|
117
121
|
}>;
|
|
118
122
|
export type UploadEntryData = import("./TypedData").ExtractDataFromSchema<typeof uploadEntrySchema>;
|
|
119
123
|
export type UploadEntryTypedData = import("./TypedData.js").TypedData<typeof uploadEntrySchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadEntrySchema.d.ts","sourceRoot":"","sources":["uploadEntrySchema.js"],"names":[],"mappings":"AAGA,gBAAgB;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAkGsB,KAAK,EAAE
|
|
1
|
+
{"version":3,"file":"uploadEntrySchema.d.ts","sourceRoot":"","sources":["uploadEntrySchema.js"],"names":[],"mappings":"AAGA,gBAAgB;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAkGsB,KAAK,EAAE;;;;;;;;;;;;;;;GAe1B;8BAEW,OAAO,aAAa,EAAE,qBAAqB,CAAC,OAAO,iBAAiB,CAAC;mCAErE,OAAO,gBAAgB,EAAE,SAAS,CAAC,OAAO,iBAAiB,CAAC;8BAE5D,OAAO,gBAAgB,EAAE,qBAAqB,CAAC,OAAO,iBAAiB,CAAC;+BA1HvD,2BAA2B"}
|
|
@@ -111,6 +111,10 @@ export const uploadEntrySchema = Object.freeze({
|
|
|
111
111
|
type: Boolean,
|
|
112
112
|
value: false,
|
|
113
113
|
}),
|
|
114
|
+
isQueued: Object.freeze({
|
|
115
|
+
type: Boolean,
|
|
116
|
+
value: false,
|
|
117
|
+
}),
|
|
114
118
|
});
|
|
115
119
|
|
|
116
120
|
/** @typedef {import('./TypedData').ExtractDataFromSchema<typeof uploadEntrySchema>} UploadEntryData */
|
|
@@ -3,7 +3,7 @@ import { createCdnUrl, createCdnUrlModifiers } from '../../../utils/cdn-utils.js
|
|
|
3
3
|
import { EditorButtonControl } from './EditorButtonControl.js';
|
|
4
4
|
import { FAKE_ORIGINAL_FILTER } from './EditorSlider.js';
|
|
5
5
|
import { COMMON_OPERATIONS, transformationsToOperations } from './lib/transformationUtils.js';
|
|
6
|
-
import { preloadImage } from '
|
|
6
|
+
import { preloadImage } from '../../utils/preloadImage.js';
|
|
7
7
|
|
|
8
8
|
export class EditorFilterControl extends EditorButtonControl {
|
|
9
9
|
constructor() {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { CROP_PADDING } from './cropper-constants.js';
|
|
15
15
|
import { classNames } from './lib/classNames.js';
|
|
16
16
|
import { pick } from './lib/pick.js';
|
|
17
|
-
import { preloadImage } from '
|
|
17
|
+
import { preloadImage } from '../../utils/preloadImage.js';
|
|
18
18
|
import { viewerImageSrc } from './util.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -2,7 +2,7 @@ import { debounce } from '../../utils/debounce.js';
|
|
|
2
2
|
import { Block } from '../../../abstract/Block.js';
|
|
3
3
|
import { classNames } from './lib/classNames.js';
|
|
4
4
|
import { linspace } from './lib/linspace.js';
|
|
5
|
-
import { batchPreloadImages } from '
|
|
5
|
+
import { batchPreloadImages } from '../../utils/preloadImage.js';
|
|
6
6
|
import { COLOR_OPERATIONS_CONFIG } from './toolbar-constants.js';
|
|
7
7
|
import { viewerImageSrc } from './util.js';
|
|
8
8
|
|
|
@@ -5,7 +5,7 @@ import { EditorCropButtonControl } from './EditorCropButtonControl.js';
|
|
|
5
5
|
import { EditorFilterControl } from './EditorFilterControl.js';
|
|
6
6
|
import { EditorOperationControl } from './EditorOperationControl.js';
|
|
7
7
|
import { FAKE_ORIGINAL_FILTER } from './EditorSlider.js';
|
|
8
|
-
import { batchPreloadImages } from '
|
|
8
|
+
import { batchPreloadImages } from '../../utils/preloadImage.js';
|
|
9
9
|
import {
|
|
10
10
|
ALL_COLOR_OPERATIONS,
|
|
11
11
|
ALL_CROP_OPERATIONS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"AAiBA;IAIE,eAAe;IACf,sBAAsB;IAKpB;;;;;;;;;;;;;;;;;;;;;;;+CAVoB,gBAAU;mCAIlB,gBACR;6BAMM,2BAET;;wCAMC,wCACK;;;;;;MAqBN;IAGH,eAQC;IAED;;;OAGG;IACH,0BAUC;IAPC,qCAA2C;IAC3C,wCAA0C;IAQ5C,eAAe;IACf,wBAYG;IAEH,eAAe;IACf,iCAA0E;IAE1E,
|
|
1
|
+
{"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"AAiBA;IAIE,eAAe;IACf,sBAAsB;IAKpB;;;;;;;;;;;;;;;;;;;;;;;+CAVoB,gBAAU;mCAIlB,gBACR;6BAMM,2BAET;;wCAMC,wCACK;;;;;;MAqBN;IAGH,eAQC;IAED;;;OAGG;IACH,0BAUC;IAPC,qCAA2C;IAC3C,wCAA0C;IAQ5C,eAAe;IACf,wBAYG;IAEH,eAAe;IACf,iCAA0E;IAE1E,sCA4BE;IAEF;;;OAGG;IACH,uBAqCC;IAyDD,uCA+BE;IAaA,eAAe;IACf,kBAEE;IAUJ;;;MAEC;IAED;;;OAGG;IACH,uBAEC;IAED,0CAwGG;CACJ;;;;;+BA/Y8B,qBAAqB"}
|
|
@@ -106,17 +106,30 @@ export class FileItem extends FileItemConfig {
|
|
|
106
106
|
_updateHint = this._withEntry(
|
|
107
107
|
throttle((entry) => {
|
|
108
108
|
const source = entry.getValue('source');
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
const externalUrl = entry.getValue('externalUrl');
|
|
110
|
+
const noErrors = entry.getValue('errors').length === 0;
|
|
111
|
+
const noProgress = this.$.progressValue === 0;
|
|
112
|
+
const isUploading = this.$.state === FileItemState.UPLOADING;
|
|
113
|
+
const isQueued = entry.getValue('isQueued');
|
|
114
|
+
|
|
115
|
+
if (!noErrors || !isUploading || !noProgress) {
|
|
116
|
+
this.$.hint = '';
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (isQueued) {
|
|
121
|
+
const hint = this.l10n('queued');
|
|
122
|
+
this.$.hint = hint;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
116
125
|
|
|
117
|
-
|
|
126
|
+
if (externalUrl && source && source !== UploadSource.URL) {
|
|
127
|
+
const hint = this.l10n('waiting-for', { source: this.l10n(`src-type-${source}`) });
|
|
128
|
+
this.$.hint = hint;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
118
131
|
|
|
119
|
-
this.$.hint =
|
|
132
|
+
this.$.hint = '';
|
|
120
133
|
}, 100),
|
|
121
134
|
);
|
|
122
135
|
|
|
@@ -139,6 +152,10 @@ export class FileItem extends FileItemConfig {
|
|
|
139
152
|
this._updateHint();
|
|
140
153
|
});
|
|
141
154
|
|
|
155
|
+
this._subEntry('isQueued', () => {
|
|
156
|
+
this._updateHint();
|
|
157
|
+
});
|
|
158
|
+
|
|
142
159
|
this._subEntry('fileName', (name) => {
|
|
143
160
|
this.$.itemName = name || entry.getValue('externalUrl') || this.l10n('file-no-name');
|
|
144
161
|
this._debouncedCalculateState();
|
|
@@ -301,6 +318,7 @@ export class FileItem extends FileItemConfig {
|
|
|
301
318
|
entry.setMultipleValues({
|
|
302
319
|
isUploading: true,
|
|
303
320
|
errors: [],
|
|
321
|
+
isQueued: true,
|
|
304
322
|
});
|
|
305
323
|
|
|
306
324
|
try {
|
|
@@ -308,6 +326,7 @@ export class FileItem extends FileItemConfig {
|
|
|
308
326
|
entry.setValue('abortController', abortController);
|
|
309
327
|
|
|
310
328
|
const uploadTask = async () => {
|
|
329
|
+
entry.setValue('isQueued', false);
|
|
311
330
|
/** @type {Blob | File | null} */
|
|
312
331
|
let file = entry.getValue('file');
|
|
313
332
|
if (file && this.cfg.imageShrink) {
|
|
@@ -341,6 +360,7 @@ export class FileItem extends FileItemConfig {
|
|
|
341
360
|
let fileInfo = await this.$['*uploadQueue'].add(uploadTask);
|
|
342
361
|
entry.setMultipleValues({
|
|
343
362
|
fileInfo,
|
|
363
|
+
isQueued: false,
|
|
344
364
|
isUploading: false,
|
|
345
365
|
fileName: fileInfo.originalFilename,
|
|
346
366
|
fileSize: fileInfo.size,
|
package/blocks/Thumb/Thumb.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export class Thumb extends FileItemConfig {
|
|
|
7
7
|
*/
|
|
8
8
|
private _thumbRect;
|
|
9
9
|
_isIntersecting: boolean;
|
|
10
|
+
_firstViewMode: import("../UploadList/UploadList.js").FilesViewMode;
|
|
10
11
|
init$: {
|
|
11
12
|
thumbUrl: string;
|
|
12
13
|
badgeIcon: string;
|
|
@@ -25,8 +26,6 @@ export class Thumb extends FileItemConfig {
|
|
|
25
26
|
'*historyBack': null;
|
|
26
27
|
'*closeModal': () => void;
|
|
27
28
|
};
|
|
28
|
-
/** @param {string} imageUrl */
|
|
29
|
-
loadImage(imageUrl: string): Promise<any>;
|
|
30
29
|
_calculateThumbSize(force?: boolean): number;
|
|
31
30
|
/** @private */
|
|
32
31
|
private _generateThumbnail;
|
|
@@ -38,6 +37,11 @@ export class Thumb extends FileItemConfig {
|
|
|
38
37
|
* @param {IntersectionObserverEntry[]} entries
|
|
39
38
|
*/
|
|
40
39
|
private _observerCallback;
|
|
40
|
+
/**
|
|
41
|
+
* @private
|
|
42
|
+
* @param {String} id
|
|
43
|
+
*/
|
|
44
|
+
private _handleEntryId;
|
|
41
45
|
_observer: IntersectionObserver | undefined;
|
|
42
46
|
}
|
|
43
47
|
export namespace Thumb {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thumb.d.ts","sourceRoot":"","sources":["Thumb.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Thumb.d.ts","sourceRoot":"","sources":["Thumb.js"],"names":[],"mappings":"AASA;IACE,eAAe;IACf,0BAA0B;IAE1B;;;OAGG;IACH,mBAAkB;IAElB,yBAAwB;IAExB,oEAAwC;IAKtC;;;;;;;+CALyB,gBAAU;mCAOjC,gBAAK;6BAMe,2BACZ;;wCAK4B,wCAC5B;;;;;;MAVT;IAGH,6CAgBC;IAED,eAAe;IACf,2BAgDG;IAEH;;MAA4E;IAE5E;;;OAGG;IACH,0BAaC;IAED;;;OAGG;IACH,uBA0BC;IA8BC,4CAAuG;CAY1G;;;;+BAhM8B,+BAA+B"}
|
package/blocks/Thumb/Thumb.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//@ts-check
|
|
2
2
|
|
|
3
3
|
import { createCdnUrl, createCdnUrlModifiers, createOriginalUrl } from '../../utils/cdn-utils.js';
|
|
4
|
+
import { preloadImage } from '../utils/preloadImage.js';
|
|
4
5
|
import { FileItemConfig } from '../FileItem/FileItemConfig.js';
|
|
5
6
|
import { fileCssBg } from '../svg-backgrounds/svg-backgrounds.js';
|
|
6
7
|
import { debounce } from '../utils/debounce.js';
|
|
@@ -18,6 +19,8 @@ export class Thumb extends FileItemConfig {
|
|
|
18
19
|
|
|
19
20
|
_isIntersecting = false;
|
|
20
21
|
|
|
22
|
+
_firstViewMode = this.cfg.filesViewMode;
|
|
23
|
+
|
|
21
24
|
constructor() {
|
|
22
25
|
super();
|
|
23
26
|
|
|
@@ -29,24 +32,6 @@ export class Thumb extends FileItemConfig {
|
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
/** @param {string} imageUrl */
|
|
33
|
-
loadImage(imageUrl) {
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
const img = new Image();
|
|
36
|
-
img.onload = () => {
|
|
37
|
-
this.set$({ thumbUrl: `url(${imageUrl})` });
|
|
38
|
-
resolve(true);
|
|
39
|
-
img.remove();
|
|
40
|
-
};
|
|
41
|
-
img.onerror = () => {
|
|
42
|
-
console.error('Failed to load image:', imageUrl);
|
|
43
|
-
reject(new Error(`Failed to load image: ${imageUrl}`));
|
|
44
|
-
img.remove();
|
|
45
|
-
};
|
|
46
|
-
img.src = imageUrl;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
35
|
_calculateThumbSize(force = false) {
|
|
51
36
|
if (force) {
|
|
52
37
|
this._thumbRect = this.getBoundingClientRect();
|
|
@@ -80,13 +65,18 @@ export class Thumb extends FileItemConfig {
|
|
|
80
65
|
),
|
|
81
66
|
);
|
|
82
67
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
68
|
+
const { promise } = preloadImage(thumbUrl);
|
|
69
|
+
|
|
70
|
+
promise
|
|
71
|
+
.then(() => this.set$({ thumbUrl: `url(${thumbUrl})` }))
|
|
72
|
+
|
|
73
|
+
.finally(() => {
|
|
74
|
+
let currentThumbUrl = entry.getValue('thumbUrl');
|
|
75
|
+
if (currentThumbUrl !== thumbUrl) {
|
|
76
|
+
entry.setValue('thumbUrl', thumbUrl);
|
|
77
|
+
currentThumbUrl?.startsWith('blob:') && URL.revokeObjectURL(currentThumbUrl);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
90
80
|
|
|
91
81
|
return;
|
|
92
82
|
}
|
|
@@ -132,18 +122,16 @@ export class Thumb extends FileItemConfig {
|
|
|
132
122
|
}
|
|
133
123
|
}
|
|
134
124
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
this.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
this._entry = this.uploadCollection.read(value);
|
|
146
|
-
});
|
|
125
|
+
/**
|
|
126
|
+
* @private
|
|
127
|
+
* @param {String} id
|
|
128
|
+
*/
|
|
129
|
+
_handleEntryId(id) {
|
|
130
|
+
let entry = this.uploadCollection?.read(id);
|
|
131
|
+
this._entry = entry;
|
|
132
|
+
if (!entry) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
147
135
|
|
|
148
136
|
this._subEntry('fileInfo', (fileInfo) => {
|
|
149
137
|
if (fileInfo?.isImage && this._isIntersecting) {
|
|
@@ -161,9 +149,29 @@ export class Thumb extends FileItemConfig {
|
|
|
161
149
|
}
|
|
162
150
|
});
|
|
163
151
|
|
|
152
|
+
if (this._isIntersecting) {
|
|
153
|
+
this._debouncedGenerateThumb();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
initCallback() {
|
|
158
|
+
super.initCallback();
|
|
159
|
+
|
|
160
|
+
this.defineAccessor('badgeIcon', (/** @type {string} */ val) => (this.$.badgeIcon = val));
|
|
161
|
+
|
|
162
|
+
this.defineAccessor('uid', (/** @type {string} */ value) => {
|
|
163
|
+
this.set$({ uid: value });
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
this.sub('uid', (uid) => {
|
|
167
|
+
this._handleEntryId(uid);
|
|
168
|
+
});
|
|
169
|
+
|
|
164
170
|
this.subConfigValue('filesViewMode', (viewMode) => {
|
|
165
|
-
if (
|
|
166
|
-
this.
|
|
171
|
+
if (viewMode === 'grid' && !this._renderedGridOnce) {
|
|
172
|
+
if (this._firstViewMode === 'list') {
|
|
173
|
+
this._debouncedGenerateThumb(true);
|
|
174
|
+
}
|
|
167
175
|
this._renderedGridOnce = true;
|
|
168
176
|
}
|
|
169
177
|
});
|
|
@@ -120,6 +120,7 @@ export default {
|
|
|
120
120
|
failed: 'Fehlgeschlagen',
|
|
121
121
|
uploading: 'Hochladen',
|
|
122
122
|
idle: 'Leerlauf',
|
|
123
|
+
queued: 'In der Warteschlange',
|
|
123
124
|
'a11y-file-item-status': 'Datei {{fileName}} im Status {{status}}',
|
|
124
125
|
'waiting-for': 'Warten auf {{source}}',
|
|
125
126
|
};
|
|
@@ -120,6 +120,7 @@ export default {
|
|
|
120
120
|
failed: 'Απέτυχε',
|
|
121
121
|
uploading: 'Μεταφόρτωση',
|
|
122
122
|
idle: 'Αδράνεια',
|
|
123
|
+
queued: 'Σε ουρά',
|
|
123
124
|
'a11y-file-item-status': 'Το αρχείο {{fileName}} βρίσκεται στην κατάσταση {{status}}',
|
|
124
125
|
'waiting-for': 'Αναμονή για {{source}}',
|
|
125
126
|
};
|
|
@@ -117,6 +117,7 @@ export default {
|
|
|
117
117
|
failed: 'Epäonnistui',
|
|
118
118
|
uploading: 'Ladataan',
|
|
119
119
|
idle: 'Toimeton',
|
|
120
|
+
queued: 'Jonossa',
|
|
120
121
|
'a11y-file-item-status': 'Tiedosto {{fileName}} tilassa {{status}}',
|
|
121
122
|
'select-all': 'Valitse kaikki',
|
|
122
123
|
'deselect-all': 'Poista valinnat',
|
|
@@ -119,6 +119,7 @@ export default {
|
|
|
119
119
|
failed: 'Échoué',
|
|
120
120
|
uploading: 'Téléchargement',
|
|
121
121
|
idle: 'Inactif',
|
|
122
|
+
queued: 'En file',
|
|
122
123
|
'a11y-file-item-status': 'Le fichier {{fileName}} est en statut {{status}}',
|
|
123
124
|
'select-all': 'Tout sélectionner',
|
|
124
125
|
'deselect-all': 'Tout désélectionner',
|
|
@@ -116,6 +116,7 @@ export default {
|
|
|
116
116
|
failed: 'Չհաջողվեց',
|
|
117
117
|
uploading: 'Բեռնվում է',
|
|
118
118
|
idle: 'Անգործ',
|
|
119
|
+
queued: 'Հերթում',
|
|
119
120
|
'a11y-file-item-status': 'Ֆայլը {{fileName}} {{status}} կարգավիճակում է',
|
|
120
121
|
'select-all': 'Ընտրել բոլորը',
|
|
121
122
|
'deselect-all': 'Հրաժարվել բոլորից',
|
|
@@ -116,6 +116,7 @@ export default {
|
|
|
116
116
|
failed: 'Mistókst',
|
|
117
117
|
uploading: 'Hleður upp',
|
|
118
118
|
idle: 'Aðgerðalaus',
|
|
119
|
+
queued: 'Í biðröð',
|
|
119
120
|
'a11y-file-item-status': 'Skráin {{fileName}} er í stöðu {{status}}',
|
|
120
121
|
'select-all': 'Velja allt',
|
|
121
122
|
'deselect-all': 'Afvelja allt',
|
|
@@ -119,6 +119,7 @@ export default {
|
|
|
119
119
|
failed: 'Fallito',
|
|
120
120
|
uploading: 'Caricamento',
|
|
121
121
|
idle: 'Inattivo',
|
|
122
|
+
queued: 'In coda',
|
|
122
123
|
'a11y-file-item-status': 'Il file {{fileName}} è nello stato {{status}}',
|
|
123
124
|
'select-all': 'Seleziona tutto',
|
|
124
125
|
'deselect-all': 'Deseleziona tutto',
|