@uploadcare/file-uploader 1.15.0-alpha.4 → 1.15.0-alpha.6

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.
@@ -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
 
@@ -75,7 +75,7 @@ export const initialConfig = {
75
75
  maxVideoRecordingDuration: null,
76
76
  mediaRecorderOptions: null,
77
77
 
78
- filesViewMode: 'grid',
78
+ filesViewMode: 'list',
79
79
  gridShowFileNames: false,
80
80
  cloudImageEditorAutoOpen: false,
81
81
  };
@@ -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,0BAcC;IAXC,wCAA0C;IAa5C,eAAe;IACf,wBAgBC;IAED,eAAe;IACf,2BA2CC;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;;;;;8BAxc6B,iCAAiC;AAS/D;;;;;GAKG"}
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,0BAcC;IAXC,wCAA0C;IAa5C,eAAe;IACf,wBAgBC;IAED,eAAe;IACf,2BAuCC;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;;;;;8BApc6B,iCAAiC;AAS/D;;;;;GAKG"}
@@ -134,11 +134,7 @@ export class FileItem extends UploaderBlock {
134
134
  let entry = this._entry;
135
135
 
136
136
  if (entry.getValue('fileInfo') && entry.getValue('isImage')) {
137
- let size = Math.max(
138
- parseInt(String(this?._thumbRect?.height || 0)),
139
- parseInt(String(this?._thumbRect?.width || 0)),
140
- this.cfg.thumbSize,
141
- );
137
+ let size = this.cfg.thumbSize;
142
138
 
143
139
  let thumbUrl = await this.proxyUrl(
144
140
  createCdnUrl(
@@ -462,11 +458,8 @@ export class FileItem extends UploaderBlock {
462
458
 
463
459
  FileItem.template = /* HTML */ `
464
460
  <div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused">
465
- <div class="uc-thumb" set="style.backgroundImage: thumbUrl">
466
- <div class="uc-badge">
467
- <uc-icon set="@name: badgeIcon"></uc-icon>
468
- </div>
469
- </div>
461
+ <uc-thumb set="thumbUrl:thumbUrl;badgeIcon:badgeIcon"></uc-thumb>
462
+
470
463
  <div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;">
471
464
  <span class="uc-file-name" set="@hidden: isFileName">{{itemName}}</span>
472
465
  <span class="uc-file-error" set="@hidden: !errorText;">{{errorText}}</span>
@@ -1,8 +1,6 @@
1
1
  export class Modal extends Block {
2
2
  static StateConsumerScope: string;
3
3
  init$: {
4
- '*modalActive': boolean;
5
- isOpen: boolean;
6
4
  closeClicked: () => void;
7
5
  };
8
6
  _handleBackdropClick: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["Modal.js"],"names":[],"mappings":"AAIA;IAEE,kCAAoC;IAIlC;;;;MAKC;IAGH,iCAEE;IAEF,yBAME;IAEF,+BAEE;IAEF,uBAAuB;IACvB,4BADY,KAAK,UAIf;IAFA,eAAe;IACf,yBAAgC;IAGlC,uBAAuB;IACvB,0BADY,KAAK,UAKf;IAEF,aAWC;IAED,aAOC;CA8CF;;;;sBAhHqB,yBAAyB"}
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["Modal.js"],"names":[],"mappings":"AAIA;IAEE,kCAAoC;IAIlC;;MAGC;IAGH,iCAEE;IAEF,yBAME;IAEF,+BAEE;IAEF,uBAAuB;IACvB,4BADY,KAAK,UAIf;IAFA,eAAe;IACf,yBAAgC;IAGlC,uBAAuB;IACvB,0BADY,KAAK,UAKf;IAEF,aAWC;IAED,aAOC;CA8CF;;;;sBA9GqB,yBAAyB"}
@@ -10,8 +10,6 @@ export class Modal extends Block {
10
10
  super();
11
11
  this.init$ = {
12
12
  ...this.init$,
13
- '*modalActive': false,
14
- isOpen: false,
15
13
  closeClicked: this._handleDialogClose,
16
14
  };
17
15
  }
@@ -0,0 +1,24 @@
1
+ export class Thumb extends UploaderBlock {
2
+ init$: {
3
+ thumbUrl: string;
4
+ badgeIcon: string;
5
+ '*commonProgress': number;
6
+ '*uploadList': never[];
7
+ '*uploadQueue': import("@uploadcare/upload-client").Queue;
8
+ '*collectionErrors': any[];
9
+ '*collectionState': import("../../index.js").OutputCollectionState<import("../../index.js").OutputCollectionStatus, "maybe-has-group"> | null;
10
+ '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
11
+ '*uploadTrigger': Set<string>;
12
+ '*secureUploadsManager': import("../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
13
+ '*currentActivity': null;
14
+ '*currentActivityParams': {};
15
+ '*history': never[];
16
+ '*historyBack': null;
17
+ '*closeModal': () => void;
18
+ };
19
+ }
20
+ export namespace Thumb {
21
+ let template: string;
22
+ }
23
+ import { UploaderBlock } from '../../abstract/UploaderBlock.js';
24
+ //# sourceMappingURL=Thumb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Thumb.d.ts","sourceRoot":"","sources":["Thumb.js"],"names":[],"mappings":"AAIA;IAII;;;;;;;;;;;;;;;;MAIC;CAeJ;;;;8BAzB6B,iCAAiC"}
@@ -0,0 +1,45 @@
1
+ //@ts-check
2
+
3
+ import { UploaderBlock } from '../../abstract/UploaderBlock.js';
4
+
5
+ export class Thumb extends UploaderBlock {
6
+ constructor() {
7
+ super();
8
+
9
+ this.init$ = {
10
+ ...this.init$,
11
+ thumbUrl: '',
12
+ badgeIcon: '',
13
+ };
14
+ }
15
+
16
+ initCallback() {
17
+ super.initCallback();
18
+
19
+ this.defineAccessor('thumbUrl', (/** @type {string} */ val) => (this.$.thumbUrl = val));
20
+ this.defineAccessor('badgeIcon', (/** @type {string} */ val) => (this.$.badgeIcon = val));
21
+
22
+ this.setAttribute('role', 'img');
23
+ }
24
+
25
+ connectedCallback() {
26
+ super.connectedCallback();
27
+ }
28
+ }
29
+
30
+ Thumb.template = /* html */ `
31
+ <slot>
32
+ <div class="uc-thumb" set="style.backgroundImage: thumbUrl">
33
+ <div class="uc-badge">
34
+ <uc-icon set="@name: badgeIcon"></uc-icon>
35
+ </div>
36
+ </div>
37
+ </slot>
38
+ `;
39
+
40
+ Thumb.bindAttributes({
41
+ // @ts-expect-error TODO: fix types inside symbiote
42
+ thumbUrl: null,
43
+ // @ts-expect-error TODO: fix types inside symbiote
44
+ badgeIcon: null,
45
+ });
@@ -0,0 +1,4 @@
1
+ uc-thumb {
2
+ width: 100%;
3
+ height: 100%;
4
+ }
@@ -13,7 +13,7 @@
13
13
  display: none !important;
14
14
  }
15
15
 
16
- :where([uc-wgt-common]) [activity]:not([active]) {
16
+ :where([uc-wgt-common]) [activity]:not([active], .active) {
17
17
  display: none;
18
18
  }
19
19
 
@@ -31,6 +31,7 @@
31
31
  @import url('../../CloudImageEditorActivity/index.css');
32
32
  @import url('../../Select/select.css');
33
33
  @import url('../../Spinner/spinner.css');
34
+ @import url('../../Thumb/thumb.css');
34
35
 
35
36
  /* POST RESET */
36
37
  @import url('post-reset.css');
package/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export { ActivityHeader } from "./blocks/ActivityHeader/ActivityHeader.js";
28
28
  export { Select } from "./blocks/Select/Select.js";
29
29
  export { Copyright } from "./blocks/Copyright/Copyright.js";
30
30
  export { Spinner } from "./blocks/Spinner/Spinner.js";
31
+ export { Thumb } from "./blocks/Thumb/Thumb.js";
31
32
  export { FileUploaderRegular } from "./solutions/file-uploader/regular/FileUploaderRegular.js";
32
33
  export { FileUploaderMinimal } from "./solutions/file-uploader/minimal/FileUploaderMinimal.js";
33
34
  export { FileUploaderInline } from "./solutions/file-uploader/inline/FileUploaderInline.js";
package/index.js CHANGED
@@ -33,6 +33,7 @@ export { ActivityHeader } from './blocks/ActivityHeader/ActivityHeader.js';
33
33
  export { Select } from './blocks/Select/Select.js';
34
34
  export { Copyright } from './blocks/Copyright/Copyright.js';
35
35
  export { Spinner } from './blocks/Spinner/Spinner.js';
36
+ export { Thumb } from './blocks/Thumb/Thumb.js';
36
37
 
37
38
  // Solutions:
38
39
  export { FileUploaderRegular } from './solutions/file-uploader/regular/FileUploaderRegular.js';
package/index.ssr.d.ts CHANGED
@@ -765,6 +765,57 @@ export const StartFrom: {
765
765
  is: string;
766
766
  bindAttributes: () => void;
767
767
  };
768
+ export const Thumb: {
769
+ new (): {};
770
+ template: string;
771
+ observedAttributes: string[];
772
+ extSrcList: {
773
+ FACEBOOK: string;
774
+ DROPBOX: string;
775
+ GDRIVE: string;
776
+ GPHOTOS: string;
777
+ FLICKR: string;
778
+ VK: string;
779
+ EVERNOTE: string;
780
+ BOX: string;
781
+ ONEDRIVE: string;
782
+ HUDDLE: string;
783
+ };
784
+ sourceTypes: {
785
+ LOCAL: string;
786
+ DROP_AREA: string;
787
+ CAMERA: string;
788
+ EXTERNAL: string;
789
+ API: string;
790
+ URL: string;
791
+ DRAW: string;
792
+ MOBILE_VIDEO_CAMERA: string;
793
+ MOBILE_PHOTO_CAMERA: string;
794
+ FACEBOOK: string;
795
+ DROPBOX: string;
796
+ GDRIVE: string;
797
+ GPHOTOS: string;
798
+ FLICKR: string;
799
+ VK: string;
800
+ EVERNOTE: string;
801
+ BOX: string;
802
+ ONEDRIVE: string;
803
+ HUDDLE: string;
804
+ };
805
+ activities: {
806
+ START_FROM: string;
807
+ CAMERA: string;
808
+ DRAW: string;
809
+ UPLOAD_LIST: string;
810
+ URL: string;
811
+ CLOUD_IMG_EDIT: string;
812
+ EXTERNAL: string;
813
+ };
814
+ reg: () => void;
815
+ styleAttrs: any[];
816
+ is: string;
817
+ bindAttributes: () => void;
818
+ };
768
819
  export const UID: {
769
820
  new (): {};
770
821
  generate: () => void;
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4IE;AACF;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;;;;;;;;;;;;;;;;;;;EA+CE;AACF;;;;;;;;EAWE;AACF;;;;;;EAwBE;AACF;;;;;;;EAUE;AACF;;;;;;;;EAWE;AACF,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyDE;AACF;;;;;;;;;;;;EAWE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EE;AACK,yCAAiC;AACjC,qCAA6B;AAC7B,6CAAqC;AACrC,oCAA4B"}
package/index.ssr.js CHANGED
@@ -840,11 +840,8 @@ export const ExternalUploadSource = {
840
840
  export const FileItem = class {
841
841
  static template = `
842
842
  <div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused">
843
- <div class="uc-thumb" set="style.backgroundImage: thumbUrl">
844
- <div class="uc-badge">
845
- <uc-icon set="@name: badgeIcon"></uc-icon>
846
- </div>
847
- </div>
843
+ <uc-thumb set="thumbUrl:thumbUrl;badgeIcon:badgeIcon"></uc-thumb>
844
+
848
845
  <div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;">
849
846
  <span class="uc-file-name" set="@hidden: isFileName">{{itemName}}</span>
850
847
  <span class="uc-file-error" set="@hidden: !errorText;">{{errorText}}</span>
@@ -1292,6 +1289,64 @@ export const StartFrom = class {
1292
1289
  static is = `sym-1`;
1293
1290
  static bindAttributes = () => {};
1294
1291
  };
1292
+ export const Thumb = class {
1293
+ static template = `
1294
+ <slot>
1295
+ <div class="uc-thumb" set="style.backgroundImage: thumbUrl">
1296
+ <div class="uc-badge">
1297
+ <uc-icon set="@name: badgeIcon"></uc-icon>
1298
+ </div>
1299
+ </div>
1300
+ </slot>
1301
+ `;
1302
+ static observedAttributes = ["thumbUrl", "badgeIcon"];
1303
+ static extSrcList = {
1304
+ FACEBOOK: "facebook",
1305
+ DROPBOX: "dropbox",
1306
+ GDRIVE: "gdrive",
1307
+ GPHOTOS: "gphotos",
1308
+ FLICKR: "flickr",
1309
+ VK: "vk",
1310
+ EVERNOTE: "evernote",
1311
+ BOX: "box",
1312
+ ONEDRIVE: "onedrive",
1313
+ HUDDLE: "huddle",
1314
+ };
1315
+ static sourceTypes = {
1316
+ LOCAL: "local",
1317
+ DROP_AREA: "drop-area",
1318
+ CAMERA: "camera",
1319
+ EXTERNAL: "external",
1320
+ API: "js-api",
1321
+ URL: "url",
1322
+ DRAW: "draw",
1323
+ MOBILE_VIDEO_CAMERA: "mobile-video-camera",
1324
+ MOBILE_PHOTO_CAMERA: "mobile-photo-camera",
1325
+ FACEBOOK: "facebook",
1326
+ DROPBOX: "dropbox",
1327
+ GDRIVE: "gdrive",
1328
+ GPHOTOS: "gphotos",
1329
+ FLICKR: "flickr",
1330
+ VK: "vk",
1331
+ EVERNOTE: "evernote",
1332
+ BOX: "box",
1333
+ ONEDRIVE: "onedrive",
1334
+ HUDDLE: "huddle",
1335
+ };
1336
+ static activities = {
1337
+ START_FROM: "start-from",
1338
+ CAMERA: "camera",
1339
+ DRAW: "draw",
1340
+ UPLOAD_LIST: "upload-list",
1341
+ URL: "url",
1342
+ CLOUD_IMG_EDIT: "cloud-image-edit",
1343
+ EXTERNAL: "external",
1344
+ };
1345
+ static reg = () => {};
1346
+ static styleAttrs = [];
1347
+ static is = `sym-1`;
1348
+ static bindAttributes = () => {};
1349
+ };
1295
1350
  export const UID = class {
1296
1351
  static generate = () => {};
1297
1352
  static apply = () => {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.15.0-alpha.4",
3
+ "version": "1.15.0-alpha.6",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -1,6 +1,9 @@
1
1
  export class FileUploaderMinimal extends SolutionBlock {
2
2
  init$: {
3
3
  singleUpload: boolean;
4
+ isHiddenStartFrom: boolean;
5
+ classUploadList: string;
6
+ classStartFrom: string;
4
7
  '*commonProgress': number;
5
8
  '*uploadList': never[];
6
9
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;;;;;;;;;;MAGC;CAwDJ;;;;8BApE6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAQA;IAMI;;;;;;;;;;;;;;;;;;MAMC;CA0FJ;;;;8BA5G6B,oCAAoC"}
@@ -1,7 +1,11 @@
1
+ //@ts-check
1
2
  import { ActivityBlock } from '../../../abstract/ActivityBlock.js';
2
3
  import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
3
4
  import { ModalEvents } from '../../../abstract/ModalManager.js';
4
5
 
6
+ const ACTIVE_CLASS = 'active';
7
+ const EMPTY_CLASS = '';
8
+
5
9
  export class FileUploaderMinimal extends SolutionBlock {
6
10
  static styleAttrs = [...super.styleAttrs, 'uc-file-uploader-minimal'];
7
11
 
@@ -11,6 +15,9 @@ export class FileUploaderMinimal extends SolutionBlock {
11
15
  this.init$ = {
12
16
  ...this.init$,
13
17
  singleUpload: false,
18
+ isHiddenStartFrom: false,
19
+ classUploadList: EMPTY_CLASS,
20
+ classStartFrom: EMPTY_CLASS,
14
21
  };
15
22
  }
16
23
 
@@ -32,7 +39,13 @@ export class FileUploaderMinimal extends SolutionBlock {
32
39
  this.sub('*uploadList', (list) => {
33
40
  if (list?.length > 0) {
34
41
  this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
42
+ this.set$({
43
+ classStartFrom: EMPTY_CLASS,
44
+ });
35
45
  } else {
46
+ this.set$({
47
+ classUploadList: EMPTY_CLASS,
48
+ });
36
49
  this.$['*currentActivity'] = uBlock.initActivity || ActivityBlock.activities.START_FROM;
37
50
  }
38
51
  });
@@ -57,24 +70,52 @@ export class FileUploaderMinimal extends SolutionBlock {
57
70
  this.$.singleUpload = !multiple;
58
71
  });
59
72
 
60
- this.modalManager.subscribe(ModalEvents.CLOSE, (e) => {
61
- if (e.id === this.$['*currentActivity']) {
62
- this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
73
+ this.modalManager.subscribe(ModalEvents.OPEN, () => {
74
+ if (this.$['*currentActivity'] === ActivityBlock.activities.UPLOAD_LIST) {
75
+ this.set$({
76
+ classUploadList: ACTIVE_CLASS,
77
+ isHiddenStartFrom: true,
78
+ });
63
79
  }
64
80
 
65
- if (e.id === ActivityBlock.activities.CLOUD_IMG_EDIT) {
66
- this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
81
+ if (this.$['*uploadList']?.length <= 0) {
82
+ this.set$({
83
+ classStartFrom: ACTIVE_CLASS,
84
+ });
67
85
  }
68
86
  });
87
+
88
+ this.modalManager.subscribe(
89
+ ModalEvents.CLOSE,
90
+ (
91
+ /**
92
+ * @type {{
93
+ * id: import('../../../abstract/ModalManager.js').ModalId;
94
+ * modal: import('../../../abstract/ModalManager.js').ModalNode;
95
+ * }}
96
+ */ e,
97
+ ) => {
98
+ if (e.id === this.$['*currentActivity']) {
99
+ this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
100
+ this.set$({
101
+ isHiddenStartFrom: false,
102
+ });
103
+ }
104
+
105
+ if (e.id === ActivityBlock.activities.CLOUD_IMG_EDIT) {
106
+ this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
107
+ }
108
+ },
109
+ );
69
110
  }
70
111
  }
71
112
 
72
113
  FileUploaderMinimal.template = /* HTML */ `
73
- <uc-start-from>
114
+ <uc-start-from set="@hidden: isHiddenStartFrom; @class:classStartFrom">
74
115
  <uc-drop-area set="@single:singleUpload;" initflow clickable tabindex="0" l10n="choose-file"></uc-drop-area>
75
116
  <uc-copyright></uc-copyright>
76
117
  </uc-start-from>
77
- <uc-upload-list ref="uBlock"></uc-upload-list>
118
+ <uc-upload-list set="@class:classUploadList" ref="uBlock"></uc-upload-list>
78
119
 
79
120
  <uc-modal id="start-from" strokes block-body-scrolling>
80
121
  <uc-start-from>