@uploadcare/file-uploader 1.15.0-alpha.5 → 1.15.0-alpha.7
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/ActivityBlock.js +2 -2
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +9 -6
- package/blocks/Thumb/Thumb.d.ts +1 -0
- package/blocks/Thumb/Thumb.d.ts.map +1 -1
- package/blocks/Thumb/Thumb.js +3 -0
- package/index.ssr.js +1 -1
- package/package.json +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +1 -0
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.js +17 -4
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.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
|
@@ -187,8 +187,8 @@ export class ActivityBlock extends Block {
|
|
|
187
187
|
couldOpenActivity = /** @type {ActivityBlock} */ (nextActivityBlock)?.couldOpenActivity ?? false;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
// TODO: Возможно стоит обработать поведение activity start-from для minimal mode
|
|
191
|
-
console.log({ nextActivity });
|
|
190
|
+
// // TODO: Возможно стоит обработать поведение activity start-from для minimal mode
|
|
191
|
+
// console.log({ nextActivity });
|
|
192
192
|
|
|
193
193
|
nextActivity = couldOpenActivity ? nextActivity : undefined;
|
|
194
194
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"AAoBA;IAIE,eAAe;IACf,mBAAuB;IACvB;;;OAGG;IACH,eAAc;IACd,eAAe;IACf,wBAAwB;IACxB,eAAe;IACf,gCAA4E;IAC5E,eAAe;IACf,iCAA0E;IAE1E,eAAe;IACf,sBAAsB;IAKpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BC;IAGH,eASC;IAED;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"AAoBA;IAIE,eAAe;IACf,mBAAuB;IACvB;;;OAGG;IACH,eAAc;IACd,eAAe;IACf,wBAAwB;IACxB,eAAe;IACf,gCAA4E;IAC5E,eAAe;IACf,iCAA0E;IAE1E,eAAe;IACf,sBAAsB;IAKpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BC;IAGH,eASC;IAED;;;OAGG;IACH,0BAeC;IAXC,wCAA0C;IAa5C,eAAe;IACf,wBAgBC;IAED,eAAe;IACf,2BAyCC;IAED;;;;OAIG;IACH,kBAUC;IAED;;MAaQ;IAER;;;OAGG;IACH,uBAmDC;IA+CD,wEAAwE;IACxE,oBADY,CAAC,oBAAoB,CAAC,CAAC,MAAM,oBAAoB,CAAC,QA0B7D;IAaC,eAAe;IACf,kBAEE;IAWJ;;;MAEC;IAED;;;OAGG;IACH,uBAEC;IAED,wBAsFC;CACF;;;;;8BAvc6B,iCAAiC;AAS/D;;;;;GAKG"}
|
|
@@ -93,6 +93,7 @@ export class FileItem extends UploaderBlock {
|
|
|
93
93
|
*/
|
|
94
94
|
_observerCallback(entries) {
|
|
95
95
|
let [entry] = entries;
|
|
96
|
+
|
|
96
97
|
this._isIntersecting = entry.isIntersecting;
|
|
97
98
|
this._thumbRect = entry.boundingClientRect;
|
|
98
99
|
|
|
@@ -103,7 +104,7 @@ export class FileItem extends UploaderBlock {
|
|
|
103
104
|
if (entry.intersectionRatio === 0) {
|
|
104
105
|
this._debouncedGenerateThumb.cancel();
|
|
105
106
|
} else {
|
|
106
|
-
this._debouncedGenerateThumb();
|
|
107
|
+
if (!this.$.thumbUrl) this._debouncedGenerateThumb();
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -133,8 +134,14 @@ export class FileItem extends UploaderBlock {
|
|
|
133
134
|
}
|
|
134
135
|
let entry = this._entry;
|
|
135
136
|
|
|
137
|
+
console.log('_generateThumbnail');
|
|
138
|
+
|
|
136
139
|
if (entry.getValue('fileInfo') && entry.getValue('isImage')) {
|
|
137
|
-
let size =
|
|
140
|
+
let size = Math.max(
|
|
141
|
+
parseInt(String(this?._thumbRect?.height || 0)),
|
|
142
|
+
parseInt(String(this?._thumbRect?.width || 0)),
|
|
143
|
+
this.cfg.thumbSize,
|
|
144
|
+
);
|
|
138
145
|
|
|
139
146
|
let thumbUrl = await this.proxyUrl(
|
|
140
147
|
createCdnUrl(
|
|
@@ -150,10 +157,6 @@ export class FileItem extends UploaderBlock {
|
|
|
150
157
|
return;
|
|
151
158
|
}
|
|
152
159
|
|
|
153
|
-
if (entry.getValue('thumbUrl')) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
160
|
if (entry.getValue('file')?.type.includes('image')) {
|
|
158
161
|
try {
|
|
159
162
|
let thumbUrl = await generateThumb(entry.getValue('file'), this.cfg.thumbSize);
|
package/blocks/Thumb/Thumb.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thumb.d.ts","sourceRoot":"","sources":["Thumb.js"],"names":[],"mappings":"AAIA;IAII
|
|
1
|
+
{"version":3,"file":"Thumb.d.ts","sourceRoot":"","sources":["Thumb.js"],"names":[],"mappings":"AAIA;IAII;;;;;;;;;;;;;;;;;MAKC;CAeJ;;;;8BA1B6B,iCAAiC"}
|
package/blocks/Thumb/Thumb.js
CHANGED
|
@@ -10,6 +10,7 @@ export class Thumb extends UploaderBlock {
|
|
|
10
10
|
...this.init$,
|
|
11
11
|
thumbUrl: '',
|
|
12
12
|
badgeIcon: '',
|
|
13
|
+
uid: '',
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -42,4 +43,6 @@ Thumb.bindAttributes({
|
|
|
42
43
|
thumbUrl: null,
|
|
43
44
|
// @ts-expect-error TODO: fix types inside symbiote
|
|
44
45
|
badgeIcon: null,
|
|
46
|
+
// @ts-expect-error TODO: fix types inside symbiote
|
|
47
|
+
id: null,
|
|
45
48
|
});
|
package/index.ssr.js
CHANGED
|
@@ -1299,7 +1299,7 @@ export const Thumb = class {
|
|
|
1299
1299
|
</div>
|
|
1300
1300
|
</slot>
|
|
1301
1301
|
`;
|
|
1302
|
-
static observedAttributes = ["thumbUrl", "badgeIcon"];
|
|
1302
|
+
static observedAttributes = ["thumbUrl", "badgeIcon", "id"];
|
|
1303
1303
|
static extSrcList = {
|
|
1304
1304
|
FACEBOOK: "facebook",
|
|
1305
1305
|
DROPBOX: "dropbox",
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ export class FileUploaderMinimal extends SolutionBlock {
|
|
|
3
3
|
singleUpload: boolean;
|
|
4
4
|
isHiddenStartFrom: boolean;
|
|
5
5
|
classUploadList: string;
|
|
6
|
+
classStartFrom: string;
|
|
6
7
|
'*commonProgress': number;
|
|
7
8
|
'*uploadList': never[];
|
|
8
9
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAQA;IAMI;;;;;;;;;;;;;;;;;;MAMC;CA0FJ;;;;8BA5G6B,oCAAoC"}
|
|
@@ -3,6 +3,9 @@ import { ActivityBlock } from '../../../abstract/ActivityBlock.js';
|
|
|
3
3
|
import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
|
|
4
4
|
import { ModalEvents } from '../../../abstract/ModalManager.js';
|
|
5
5
|
|
|
6
|
+
const ACTIVE_CLASS = 'active';
|
|
7
|
+
const EMPTY_CLASS = '';
|
|
8
|
+
|
|
6
9
|
export class FileUploaderMinimal extends SolutionBlock {
|
|
7
10
|
static styleAttrs = [...super.styleAttrs, 'uc-file-uploader-minimal'];
|
|
8
11
|
|
|
@@ -13,7 +16,8 @@ export class FileUploaderMinimal extends SolutionBlock {
|
|
|
13
16
|
...this.init$,
|
|
14
17
|
singleUpload: false,
|
|
15
18
|
isHiddenStartFrom: false,
|
|
16
|
-
classUploadList:
|
|
19
|
+
classUploadList: EMPTY_CLASS,
|
|
20
|
+
classStartFrom: EMPTY_CLASS,
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
23
|
|
|
@@ -35,9 +39,12 @@ export class FileUploaderMinimal extends SolutionBlock {
|
|
|
35
39
|
this.sub('*uploadList', (list) => {
|
|
36
40
|
if (list?.length > 0) {
|
|
37
41
|
this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
|
|
42
|
+
this.set$({
|
|
43
|
+
classStartFrom: EMPTY_CLASS,
|
|
44
|
+
});
|
|
38
45
|
} else {
|
|
39
46
|
this.set$({
|
|
40
|
-
classUploadList:
|
|
47
|
+
classUploadList: EMPTY_CLASS,
|
|
41
48
|
});
|
|
42
49
|
this.$['*currentActivity'] = uBlock.initActivity || ActivityBlock.activities.START_FROM;
|
|
43
50
|
}
|
|
@@ -66,10 +73,16 @@ export class FileUploaderMinimal extends SolutionBlock {
|
|
|
66
73
|
this.modalManager.subscribe(ModalEvents.OPEN, () => {
|
|
67
74
|
if (this.$['*currentActivity'] === ActivityBlock.activities.UPLOAD_LIST) {
|
|
68
75
|
this.set$({
|
|
69
|
-
classUploadList:
|
|
76
|
+
classUploadList: ACTIVE_CLASS,
|
|
70
77
|
isHiddenStartFrom: true,
|
|
71
78
|
});
|
|
72
79
|
}
|
|
80
|
+
|
|
81
|
+
if (this.$['*uploadList']?.length <= 0) {
|
|
82
|
+
this.set$({
|
|
83
|
+
classStartFrom: ACTIVE_CLASS,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
73
86
|
});
|
|
74
87
|
|
|
75
88
|
this.modalManager.subscribe(
|
|
@@ -98,7 +111,7 @@ export class FileUploaderMinimal extends SolutionBlock {
|
|
|
98
111
|
}
|
|
99
112
|
|
|
100
113
|
FileUploaderMinimal.template = /* HTML */ `
|
|
101
|
-
<uc-start-from set="@hidden: isHiddenStartFrom">
|
|
114
|
+
<uc-start-from set="@hidden: isHiddenStartFrom; @class:classStartFrom">
|
|
102
115
|
<uc-drop-area set="@single:singleUpload;" initflow clickable tabindex="0" l10n="choose-file"></uc-drop-area>
|
|
103
116
|
<uc-copyright></uc-copyright>
|
|
104
117
|
</uc-start-from>
|