@uploadcare/file-uploader 1.15.0-alpha.7 → 1.15.0-alpha.9
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.d.ts.map +1 -1
- package/abstract/ActivityBlock.js +0 -3
- package/abstract/Block.js +1 -1
- package/abstract/ModalManager.d.ts +23 -9
- package/abstract/ModalManager.d.ts.map +1 -1
- package/abstract/ModalManager.js +13 -9
- package/blocks/FileItem/FileItem.d.ts +1 -1
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +20 -11
- package/blocks/Modal/Modal.d.ts +21 -0
- package/blocks/Modal/Modal.d.ts.map +1 -1
- package/blocks/Modal/Modal.js +37 -16
- package/blocks/Thumb/Thumb.d.ts +1 -0
- package/blocks/Thumb/Thumb.d.ts.map +1 -1
- package/blocks/Thumb/Thumb.js +20 -1
- package/index.ssr.js +4 -4
- package/package.json +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +16 -0
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.js +53 -44
- package/web/file-uploader.iife.min.js +3 -3
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityBlock.d.ts","sourceRoot":"","sources":["ActivityBlock.js"],"names":[],"mappings":"AASA;;;;;GAKG;AAEH;IA+EE;;;;;;OAMG;IACH,kCAAsC;IArFtC,iBAAiB;IACjB,kCAAuB;IAEvB;;;;;;MAA+B;IAE/B;;MAAqE;IAErE,eAAe;IACf,oBAKC;IAED,eAAe;IACf,kBAaC;IA8BD,eAAe;IACf,sBAWC;IAED,eAAe;IACf,8BAEC;IAWD,4CAEC;IAED,iCAEC;IAED;;;;;;;OAOG;IACH;4BAHiB,IAAI;8BACJ,IAAI;yBAQpB;IAED,2BAKC;IAoBD,0BAEC;IAED,yDAAyD;IACzD,oLAEC;IAED,qBAAqB;IACrB,2BAEC;IAED,qBAAqB;IACrB,2BAEC;IAED,
|
|
1
|
+
{"version":3,"file":"ActivityBlock.d.ts","sourceRoot":"","sources":["ActivityBlock.js"],"names":[],"mappings":"AASA;;;;;GAKG;AAEH;IA+EE;;;;;;OAMG;IACH,kCAAsC;IArFtC,iBAAiB;IACjB,kCAAuB;IAEvB;;;;;;MAA+B;IAE/B;;MAAqE;IAErE,eAAe;IACf,oBAKC;IAED,eAAe;IACf,kBAaC;IA8BD,eAAe;IACf,sBAWC;IAED,eAAe;IACf,8BAEC;IAWD,4CAEC;IAED,iCAEC;IAED;;;;;;;OAOG;IACH;4BAHiB,IAAI;8BACJ,IAAI;yBAQpB;IAED,2BAKC;IAoBD,0BAEC;IAED,yDAAyD;IACzD,oLAEC;IAED,qBAAqB;IACrB,2BAEC;IAED,qBAAqB;IACrB,2BAEC;IAED,oBA4BC;IA7KC,8CAAyB;CA8K5B;;;;;;;;;;;;gCA/LY;IACZ,kBAAsB,EAAE,OAAO,gEAAgE,EAAE,cAAc,CAAC;IAChH,UAAc,OAAO,4CAA4C,EAAE,cAAc,CAAC;CAC/E;qCAwMU,CAAC,oBAAoB,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,YAAY,CAAC,CAAC;2BAChF,sBAAsB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI;sBAnNrC,YAAY"}
|
|
@@ -187,9 +187,6 @@ 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 });
|
|
192
|
-
|
|
193
190
|
nextActivity = couldOpenActivity ? nextActivity : undefined;
|
|
194
191
|
|
|
195
192
|
if (nextActivity) this.modalManager.open(nextActivity);
|
package/abstract/Block.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** @typedef {string} ModalId */
|
|
2
|
-
/** @typedef {import('../blocks/Modal/Modal.js').Modal} ModalNode */
|
|
3
1
|
export const ModalEvents: Readonly<{
|
|
4
2
|
ADD: "modal:add";
|
|
5
3
|
DELETE: "modal:delete";
|
|
@@ -8,6 +6,10 @@ export const ModalEvents: Readonly<{
|
|
|
8
6
|
CLOSE_ALL: "modal:closeAll";
|
|
9
7
|
DESTROY: "modal:destroy";
|
|
10
8
|
}>;
|
|
9
|
+
/** @typedef {string} ModalId */
|
|
10
|
+
/** @typedef {import('../blocks/Modal/Modal.js').Modal} ModalNode */
|
|
11
|
+
/** @typedef {(data: { id: ModalId; modal?: ModalNode }) => void} ModalCb */
|
|
12
|
+
/** @typedef {(typeof ModalEvents)[keyof ModalEvents]} ModalEventType */
|
|
11
13
|
export class ModalManager {
|
|
12
14
|
/** @param {import('./Block.js').Block} block */
|
|
13
15
|
constructor(block: import('./Block.js').Block);
|
|
@@ -79,23 +81,23 @@ export class ModalManager {
|
|
|
79
81
|
/**
|
|
80
82
|
* Subscribe to modal events
|
|
81
83
|
*
|
|
82
|
-
* @param {
|
|
83
|
-
* @param {
|
|
84
|
+
* @param {ModalEventType} event
|
|
85
|
+
* @param {ModalCb} callback
|
|
84
86
|
* @returns {() => void}
|
|
85
87
|
*/
|
|
86
|
-
subscribe(event:
|
|
88
|
+
subscribe(event: ModalEventType, callback: ModalCb): () => void;
|
|
87
89
|
/**
|
|
88
90
|
* Unsubscribe from modal events
|
|
89
91
|
*
|
|
90
|
-
* @param {
|
|
91
|
-
* @param {
|
|
92
|
+
* @param {ModalEventType} event
|
|
93
|
+
* @param {ModalCb | undefined} callback
|
|
92
94
|
*/
|
|
93
|
-
unsubscribe(event:
|
|
95
|
+
unsubscribe(event: ModalEventType, callback: ModalCb | undefined): void;
|
|
94
96
|
/**
|
|
95
97
|
* Notify all subscribers of a modal event
|
|
96
98
|
*
|
|
97
99
|
* @private
|
|
98
|
-
* @param {
|
|
100
|
+
* @param {ModalEventType} event - Event name
|
|
99
101
|
* @param {{
|
|
100
102
|
* id?: ModalId | ModalId[];
|
|
101
103
|
* modal?: ModalNode | ModalNode[];
|
|
@@ -110,4 +112,16 @@ export class ModalManager {
|
|
|
110
112
|
}
|
|
111
113
|
export type ModalId = string;
|
|
112
114
|
export type ModalNode = import('../blocks/Modal/Modal.js').Modal;
|
|
115
|
+
export type ModalCb = (data: {
|
|
116
|
+
id: ModalId;
|
|
117
|
+
modal?: ModalNode;
|
|
118
|
+
}) => void;
|
|
119
|
+
export type ModalEventType = (typeof ModalEvents)[keyof {
|
|
120
|
+
readonly ADD: "modal:add";
|
|
121
|
+
readonly DELETE: "modal:delete";
|
|
122
|
+
readonly OPEN: "modal:open";
|
|
123
|
+
readonly CLOSE: "modal:close";
|
|
124
|
+
readonly CLOSE_ALL: "modal:closeAll";
|
|
125
|
+
readonly DESTROY: "modal:destroy";
|
|
126
|
+
}];
|
|
113
127
|
//# sourceMappingURL=ModalManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalManager.d.ts","sourceRoot":"","sources":["ModalManager.js"],"names":[],"mappings":"AAEA,gCAAgC;AAEhC,oEAAoE;AAEpE
|
|
1
|
+
{"version":3,"file":"ModalManager.d.ts","sourceRoot":"","sources":["ModalManager.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,gCAAgC;AAEhC,oEAAoE;AAEpE,4EAA4E;AAE5E,wEAAwE;AAExE;IAeE,gDAAgD;IAChD,mBADY,OAAO,YAAY,EAAE,KAAK,EAGrC;IAjBD;;;OAGG;IACH,gBAAoB;IAEpB;;;OAGG;IACH,sBAA0B;IAE1B,4BAAyB;IAIvB,mCAAmB;IAGrB;;;OAGG;IACH,oBAEC;IAED;;;;;OAKG;IACH,kBAHW,OAAO,SACP,SAAS,QAKnB;IAED,4DAA4D;IAC5D,gBADY,OAAO,WASlB;IAED;;;;;OAKG;IACH,SAHW,OAAO,GACL,OAAO,CAanB;IAED;;;;;OAKG;IACH,UAHW,OAAO,GACL,OAAO,CAanB;IAED;;;;;OAKG;IACH,WAHW,OAAO,GACL,OAAO,CAanB;IAED;;;;OAIG;IACH,+BAEC;IAED;;;;OAIG;IACH,QAFa,OAAO,CAWnB;IAED;;;;OAIG;IACH,YAFa,MAAM,CAQlB;IAED;;;;;;OAMG;IACH,iBAJW,cAAc,YACd,OAAO,GACL,MAAM,IAAI,CAStB;IAED;;;;;OAKG;IACH,mBAHW,cAAc,YACd,OAAO,GAAG,SAAS,QAM7B;IAED;;;;;;;;;;;;OAYG;IACH,gBAUC;IAED,oDAAoD;IACpD,gBAKC;CACF;sBArNa,MAAM;wBAEN,OAAO,0BAA0B,EAAE,KAAK;6BAEjC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,KAAK,IAAI;6BAElD,CAAC,kBAAkB,CAAC,CAAC;;;;;;;CAAiB,CAAC"}
|
package/abstract/ModalManager.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
//@ts-check
|
|
2
2
|
|
|
3
|
-
/** @typedef {string} ModalId */
|
|
4
|
-
|
|
5
|
-
/** @typedef {import('../blocks/Modal/Modal.js').Modal} ModalNode */
|
|
6
|
-
|
|
7
3
|
export const ModalEvents = Object.freeze({
|
|
8
4
|
ADD: 'modal:add',
|
|
9
5
|
DELETE: 'modal:delete',
|
|
@@ -13,6 +9,14 @@ export const ModalEvents = Object.freeze({
|
|
|
13
9
|
DESTROY: 'modal:destroy',
|
|
14
10
|
});
|
|
15
11
|
|
|
12
|
+
/** @typedef {string} ModalId */
|
|
13
|
+
|
|
14
|
+
/** @typedef {import('../blocks/Modal/Modal.js').Modal} ModalNode */
|
|
15
|
+
|
|
16
|
+
/** @typedef {(data: { id: ModalId; modal?: ModalNode }) => void} ModalCb */
|
|
17
|
+
|
|
18
|
+
/** @typedef {(typeof ModalEvents)[keyof ModalEvents]} ModalEventType */
|
|
19
|
+
|
|
16
20
|
export class ModalManager {
|
|
17
21
|
/**
|
|
18
22
|
* @private
|
|
@@ -161,8 +165,8 @@ export class ModalManager {
|
|
|
161
165
|
/**
|
|
162
166
|
* Subscribe to modal events
|
|
163
167
|
*
|
|
164
|
-
* @param {
|
|
165
|
-
* @param {
|
|
168
|
+
* @param {ModalEventType} event
|
|
169
|
+
* @param {ModalCb} callback
|
|
166
170
|
* @returns {() => void}
|
|
167
171
|
*/
|
|
168
172
|
subscribe(event, callback) {
|
|
@@ -177,8 +181,8 @@ export class ModalManager {
|
|
|
177
181
|
/**
|
|
178
182
|
* Unsubscribe from modal events
|
|
179
183
|
*
|
|
180
|
-
* @param {
|
|
181
|
-
* @param {
|
|
184
|
+
* @param {ModalEventType} event
|
|
185
|
+
* @param {ModalCb | undefined} callback
|
|
182
186
|
*/
|
|
183
187
|
unsubscribe(event, callback) {
|
|
184
188
|
if (this._subscribers.has(event)) {
|
|
@@ -190,7 +194,7 @@ export class ModalManager {
|
|
|
190
194
|
* Notify all subscribers of a modal event
|
|
191
195
|
*
|
|
192
196
|
* @private
|
|
193
|
-
* @param {
|
|
197
|
+
* @param {ModalEventType} event - Event name
|
|
194
198
|
* @param {{
|
|
195
199
|
* id?: ModalId | ModalId[];
|
|
196
200
|
* modal?: ModalNode | ModalNode[];
|
|
@@ -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,0BAgBC;IAZC,wCAA0C;IAc5C,eAAe;IACf,wBAgBC;IAED,eAAe;IACf,2BAuCC;IAED;;;;OAIG;IACH,kBAUC;IAED;;MAaQ;IAER;;;OAGG;IACH,uBAmDC;IAyDD,wEAAwE;IACxE,oBADY,CAAC,oBAAoB,CAAC,CAAC,MAAM,oBAAoB,CAAC,QA0B7D;IAaC,eAAe;IACf,kBAEE;IAWJ;;;MAEC;IAED;;;OAGG;IACH,uBAEC;IAED,wBAsFC;CACF;;;;;8BAhd6B,iCAAiC;AAS/D;;;;;GAKG"}
|
|
@@ -57,7 +57,7 @@ export class FileItem extends UploaderBlock {
|
|
|
57
57
|
isUploading: false,
|
|
58
58
|
isFocused: false,
|
|
59
59
|
isEditable: false,
|
|
60
|
-
|
|
60
|
+
showFileNames: false,
|
|
61
61
|
state: FileItemState.IDLE,
|
|
62
62
|
ariaLabelStatusFile: '',
|
|
63
63
|
onEdit: () => {
|
|
@@ -104,7 +104,8 @@ export class FileItem extends UploaderBlock {
|
|
|
104
104
|
if (entry.intersectionRatio === 0) {
|
|
105
105
|
this._debouncedGenerateThumb.cancel();
|
|
106
106
|
} else {
|
|
107
|
-
|
|
107
|
+
this._debouncedGenerateThumb();
|
|
108
|
+
// this?._observer.disconnect();
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -134,8 +135,6 @@ export class FileItem extends UploaderBlock {
|
|
|
134
135
|
}
|
|
135
136
|
let entry = this._entry;
|
|
136
137
|
|
|
137
|
-
console.log('_generateThumbnail');
|
|
138
|
-
|
|
139
138
|
if (entry.getValue('fileInfo') && entry.getValue('isImage')) {
|
|
140
139
|
let size = Math.max(
|
|
141
140
|
parseInt(String(this?._thumbRect?.height || 0)),
|
|
@@ -273,15 +272,25 @@ export class FileItem extends UploaderBlock {
|
|
|
273
272
|
|
|
274
273
|
this.subConfigValue('useCloudImageEditor', () => this._debouncedCalculateState());
|
|
275
274
|
this.subConfigValue('filesViewMode', (mode) => {
|
|
276
|
-
if (
|
|
277
|
-
this
|
|
278
|
-
}
|
|
279
|
-
|
|
275
|
+
if (this.cfg.filesViewMode === 'grid') {
|
|
276
|
+
this.$.showFileNames = this.cfg.gridShowFileNames;
|
|
277
|
+
}
|
|
278
|
+
if (this.cfg.filesViewMode === 'list') {
|
|
279
|
+
this.$.showFileNames = true;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
this.setAttribute('mode', mode);
|
|
283
283
|
});
|
|
284
284
|
|
|
285
|
+
this.subConfigValue('gridShowFileNames', (value) => {
|
|
286
|
+
if (this.cfg.filesViewMode === 'grid') {
|
|
287
|
+
this.$.showFileNames = value;
|
|
288
|
+
}
|
|
289
|
+
if (this.cfg.filesViewMode === 'list') {
|
|
290
|
+
this.$.showFileNames = true;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
|
|
285
294
|
this.onclick = () => {
|
|
286
295
|
FileItem.activeInstances.forEach((inst) => {
|
|
287
296
|
if (inst === this) {
|
|
@@ -461,10 +470,10 @@ export class FileItem extends UploaderBlock {
|
|
|
461
470
|
|
|
462
471
|
FileItem.template = /* HTML */ `
|
|
463
472
|
<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused">
|
|
464
|
-
<uc-thumb set="thumbUrl:thumbUrl;badgeIcon:badgeIcon"></uc-thumb>
|
|
473
|
+
<uc-thumb set="uid:uid;thumbUrl:thumbUrl;badgeIcon:badgeIcon"></uc-thumb>
|
|
465
474
|
|
|
466
475
|
<div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;">
|
|
467
|
-
<span class="uc-file-name" set="@hidden:
|
|
476
|
+
<span class="uc-file-name" set="@hidden: !showFileNames">{{itemName}}</span>
|
|
468
477
|
<span class="uc-file-error" set="@hidden: !errorText;">{{errorText}}</span>
|
|
469
478
|
<span class="uc-file-hint" set="@hidden: !hint">{{hint}}</span>
|
|
470
479
|
</div>
|
|
@@ -491,7 +500,7 @@ FileItem.template = /* HTML */ `
|
|
|
491
500
|
</div>
|
|
492
501
|
<uc-progress-bar
|
|
493
502
|
class="uc-progress-bar"
|
|
494
|
-
set="value: progressValue; visible: progressVisible; @hasFileName:
|
|
503
|
+
set="value: progressValue; visible: progressVisible; @hasFileName: showFileNames"
|
|
495
504
|
>
|
|
496
505
|
</uc-progress-bar>
|
|
497
506
|
</div>
|
package/blocks/Modal/Modal.d.ts
CHANGED
|
@@ -14,6 +14,27 @@ export class Modal extends Block {
|
|
|
14
14
|
_handleDialogMouseUp: (e: Event) => void;
|
|
15
15
|
show(): void;
|
|
16
16
|
hide(): void;
|
|
17
|
+
/**
|
|
18
|
+
* @private
|
|
19
|
+
* @type {import('../../abstract/ModalManager.js').ModalCb}
|
|
20
|
+
*/
|
|
21
|
+
private _handleModalOpen;
|
|
22
|
+
/**
|
|
23
|
+
* @private
|
|
24
|
+
* @type {import('../../abstract/ModalManager.js').ModalCb}
|
|
25
|
+
*/
|
|
26
|
+
private _handleModalClose;
|
|
27
|
+
/** @private */
|
|
28
|
+
private _handleModalCloseAll;
|
|
29
|
+
handleModalOpen: ((data: {
|
|
30
|
+
id: string;
|
|
31
|
+
modal?: Modal | undefined;
|
|
32
|
+
}) => void) | undefined;
|
|
33
|
+
handleModalClose: ((data: {
|
|
34
|
+
id: string;
|
|
35
|
+
modal?: Modal | undefined;
|
|
36
|
+
}) => void) | undefined;
|
|
37
|
+
handleModalCloseAll: (() => void) | undefined;
|
|
17
38
|
}
|
|
18
39
|
export namespace Modal {
|
|
19
40
|
let template: string;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;IAED;;;OAGG;IACH,yBAMC;IAED;;;OAGG;IACH,0BAIC;IAED,eAAe;IACf,6BAEC;IAmBC;;;4BAAuD;IACvD;;;4BAAyD;IACzD,8CAA+D;CAmBlE;;;;sBAnIqB,yBAAyB"}
|
package/blocks/Modal/Modal.js
CHANGED
|
@@ -65,6 +65,33 @@ export class Modal extends Block {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* @private
|
|
70
|
+
* @type {import('../../abstract/ModalManager.js').ModalCb}
|
|
71
|
+
*/
|
|
72
|
+
_handleModalOpen({ id }) {
|
|
73
|
+
if (id === this.id) {
|
|
74
|
+
this.show();
|
|
75
|
+
} else {
|
|
76
|
+
this.hide();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @private
|
|
82
|
+
* @type {import('../../abstract/ModalManager.js').ModalCb}
|
|
83
|
+
*/
|
|
84
|
+
_handleModalClose({ id }) {
|
|
85
|
+
if (id === this.id) {
|
|
86
|
+
this.hide();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** @private */
|
|
91
|
+
_handleModalCloseAll() {
|
|
92
|
+
this.hide();
|
|
93
|
+
}
|
|
94
|
+
|
|
68
95
|
initCallback() {
|
|
69
96
|
super.initCallback();
|
|
70
97
|
|
|
@@ -82,23 +109,13 @@ export class Modal extends Block {
|
|
|
82
109
|
}
|
|
83
110
|
});
|
|
84
111
|
|
|
85
|
-
this.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
} else {
|
|
89
|
-
this.hide();
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
this.modalManager.subscribe(ModalEvents.CLOSE, (/** @type {{ id: string }} */ { id }) => {
|
|
94
|
-
if (id === this.id) {
|
|
95
|
-
this.hide();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
112
|
+
this.handleModalOpen = this._handleModalOpen.bind(this);
|
|
113
|
+
this.handleModalClose = this._handleModalClose.bind(this);
|
|
114
|
+
this.handleModalCloseAll = this._handleModalCloseAll.bind(this);
|
|
98
115
|
|
|
99
|
-
this.modalManager.subscribe(ModalEvents.
|
|
100
|
-
|
|
101
|
-
|
|
116
|
+
this.modalManager.subscribe(ModalEvents.OPEN, this.handleModalOpen);
|
|
117
|
+
this.modalManager.subscribe(ModalEvents.CLOSE, this.handleModalClose);
|
|
118
|
+
this.modalManager.subscribe(ModalEvents.CLOSE_ALL, this.handleModalCloseAll);
|
|
102
119
|
}
|
|
103
120
|
|
|
104
121
|
destroyCallback() {
|
|
@@ -108,6 +125,10 @@ export class Modal extends Block {
|
|
|
108
125
|
this.ref.dialog.removeEventListener('close', this._handleDialogClose);
|
|
109
126
|
this.ref.dialog.removeEventListener('mousedown', this._handleDialogMouseDown);
|
|
110
127
|
this.ref.dialog.removeEventListener('mouseup', this._handleDialogMouseUp);
|
|
128
|
+
|
|
129
|
+
this.modalManager.unsubscribe(ModalEvents.OPEN, this.handleModalOpen);
|
|
130
|
+
this.modalManager.unsubscribe(ModalEvents.CLOSE, this.handleModalClose);
|
|
131
|
+
this.modalManager.unsubscribe(ModalEvents.CLOSE_ALL, this.handleModalCloseAll);
|
|
111
132
|
}
|
|
112
133
|
}
|
|
113
134
|
|
package/blocks/Thumb/Thumb.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thumb.d.ts","sourceRoot":"","sources":["Thumb.js"],"names":[],"mappings":"AAIA;IAII;;;;;;;;;;;;;;;;;MAKC;
|
|
1
|
+
{"version":3,"file":"Thumb.d.ts","sourceRoot":"","sources":["Thumb.js"],"names":[],"mappings":"AAIA;IAII;;;;;;;;;;;;;;;;;MAKC;IAeD,eASC;CAUJ;;;;8BA7C6B,iCAAiC"}
|
package/blocks/Thumb/Thumb.js
CHANGED
|
@@ -25,6 +25,25 @@ export class Thumb extends UploaderBlock {
|
|
|
25
25
|
|
|
26
26
|
connectedCallback() {
|
|
27
27
|
super.connectedCallback();
|
|
28
|
+
|
|
29
|
+
this._observer = new IntersectionObserver(
|
|
30
|
+
(entries) => {
|
|
31
|
+
const [entry] = entries;
|
|
32
|
+
if (entry.isIntersecting) {
|
|
33
|
+
this.setAttribute('aria-hidden', 'true');
|
|
34
|
+
this._observer.disconnect(); // Stop observing after the first intersection
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{ threshold: 0.1 },
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
this._observer.observe(this);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
super.disconnectedCallback();
|
|
45
|
+
|
|
46
|
+
this._observer.disconnect();
|
|
28
47
|
}
|
|
29
48
|
}
|
|
30
49
|
|
|
@@ -44,5 +63,5 @@ Thumb.bindAttributes({
|
|
|
44
63
|
// @ts-expect-error TODO: fix types inside symbiote
|
|
45
64
|
badgeIcon: null,
|
|
46
65
|
// @ts-expect-error TODO: fix types inside symbiote
|
|
47
|
-
|
|
66
|
+
uid: null,
|
|
48
67
|
});
|
package/index.ssr.js
CHANGED
|
@@ -840,10 +840,10 @@ 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
|
-
<uc-thumb set="thumbUrl:thumbUrl;badgeIcon:badgeIcon"></uc-thumb>
|
|
843
|
+
<uc-thumb set="uid:uid;thumbUrl:thumbUrl;badgeIcon:badgeIcon"></uc-thumb>
|
|
844
844
|
|
|
845
845
|
<div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;">
|
|
846
|
-
<span class="uc-file-name" set="@hidden:
|
|
846
|
+
<span class="uc-file-name" set="@hidden: !showFileNames">{{itemName}}</span>
|
|
847
847
|
<span class="uc-file-error" set="@hidden: !errorText;">{{errorText}}</span>
|
|
848
848
|
<span class="uc-file-hint" set="@hidden: !hint">{{hint}}</span>
|
|
849
849
|
</div>
|
|
@@ -870,7 +870,7 @@ export const FileItem = class {
|
|
|
870
870
|
</div>
|
|
871
871
|
<uc-progress-bar
|
|
872
872
|
class="uc-progress-bar"
|
|
873
|
-
set="value: progressValue; visible: progressVisible; @hasFileName:
|
|
873
|
+
set="value: progressValue; visible: progressVisible; @hasFileName: showFileNames"
|
|
874
874
|
>
|
|
875
875
|
</uc-progress-bar>
|
|
876
876
|
</div>
|
|
@@ -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", "uid"];
|
|
1303
1303
|
static extSrcList = {
|
|
1304
1304
|
FACEBOOK: "facebook",
|
|
1305
1305
|
DROPBOX: "dropbox",
|
package/package.json
CHANGED
|
@@ -18,6 +18,22 @@ export class FileUploaderMinimal extends SolutionBlock {
|
|
|
18
18
|
'*historyBack': null;
|
|
19
19
|
'*closeModal': () => void;
|
|
20
20
|
};
|
|
21
|
+
_handleModalOpen(data: {
|
|
22
|
+
id: string;
|
|
23
|
+
modal?: import("./index.js").Modal | undefined;
|
|
24
|
+
}): void;
|
|
25
|
+
_handleModalClose(data: {
|
|
26
|
+
id: string;
|
|
27
|
+
modal?: import("./index.js").Modal | undefined;
|
|
28
|
+
}): void;
|
|
29
|
+
handleModalOpen: ((data: {
|
|
30
|
+
id: string;
|
|
31
|
+
modal?: import("./index.js").Modal | undefined;
|
|
32
|
+
}) => void) | undefined;
|
|
33
|
+
handleModalClose: ((data: {
|
|
34
|
+
id: string;
|
|
35
|
+
modal?: import("./index.js").Modal | undefined;
|
|
36
|
+
}) => void) | undefined;
|
|
21
37
|
}
|
|
22
38
|
export namespace FileUploaderMinimal {
|
|
23
39
|
let template: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAQA;IAMI;;;;;;;;;;;;;;;;;;MAMC;
|
|
1
|
+
{"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAQA;IAMI;;;;;;;;;;;;;;;;;;MAMC;IAXF;;;aAAkD;IAAlD;;;aAAkD;IAkGjD;;;4BAAuD;IACvD;;;4BAAyD;CAW5D;;;;8BArH6B,oCAAoC"}
|
|
@@ -21,6 +21,36 @@ export class FileUploaderMinimal extends SolutionBlock {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/** @type {import('../../../abstract/ModalManager.js').ModalCb} */
|
|
25
|
+
_handleModalOpen() {
|
|
26
|
+
if (this.$['*currentActivity'] === ActivityBlock.activities.UPLOAD_LIST) {
|
|
27
|
+
this.set$({
|
|
28
|
+
classUploadList: ACTIVE_CLASS,
|
|
29
|
+
isHiddenStartFrom: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (this.$['*uploadList']?.length <= 0) {
|
|
34
|
+
this.set$({
|
|
35
|
+
classStartFrom: ACTIVE_CLASS,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** @type {import('../../../abstract/ModalManager.js').ModalCb} */
|
|
41
|
+
_handleModalClose(e) {
|
|
42
|
+
if (e.id === this.$['*currentActivity']) {
|
|
43
|
+
this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
|
|
44
|
+
this.set$({
|
|
45
|
+
isHiddenStartFrom: false,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (e.id === ActivityBlock.activities.CLOUD_IMG_EDIT) {
|
|
50
|
+
this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
24
54
|
initCallback() {
|
|
25
55
|
super.initCallback();
|
|
26
56
|
|
|
@@ -58,55 +88,34 @@ export class FileUploaderMinimal extends SolutionBlock {
|
|
|
58
88
|
|
|
59
89
|
this.subConfigValue('filesViewMode', (mode) => {
|
|
60
90
|
this.setAttribute('mode', mode);
|
|
61
|
-
});
|
|
62
91
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
92
|
+
this.subConfigValue('multiple', (multiple) => {
|
|
93
|
+
if (mode === 'grid') {
|
|
94
|
+
if (multiple) {
|
|
95
|
+
this.style.removeProperty('--uc-grid-col');
|
|
96
|
+
} else {
|
|
97
|
+
this.style.setProperty('--uc-grid-col', '1');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this.$.singleUpload = !multiple;
|
|
101
|
+
} else {
|
|
102
|
+
this.style.removeProperty('--uc-grid-col');
|
|
103
|
+
this.$.singleUpload = false;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
71
106
|
});
|
|
72
107
|
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
this.set$({
|
|
76
|
-
classUploadList: ACTIVE_CLASS,
|
|
77
|
-
isHiddenStartFrom: true,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (this.$['*uploadList']?.length <= 0) {
|
|
82
|
-
this.set$({
|
|
83
|
-
classStartFrom: ACTIVE_CLASS,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
});
|
|
108
|
+
this.handleModalOpen = this._handleModalOpen.bind(this);
|
|
109
|
+
this.handleModalClose = this._handleModalClose.bind(this);
|
|
87
110
|
|
|
88
|
-
this.modalManager.subscribe(
|
|
89
|
-
|
|
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
|
-
}
|
|
111
|
+
this.modalManager.subscribe(ModalEvents.OPEN, this.handleModalOpen);
|
|
112
|
+
this.modalManager.subscribe(ModalEvents.CLOSE, this.handleModalClose);
|
|
113
|
+
}
|
|
104
114
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
);
|
|
115
|
+
destroyCallback() {
|
|
116
|
+
super.destroyCallback();
|
|
117
|
+
this.modalManager.unsubscribe(ModalEvents.OPEN, this.handleModalOpen);
|
|
118
|
+
this.modalManager.unsubscribe(ModalEvents.CLOSE, this.handleModalClose);
|
|
110
119
|
}
|
|
111
120
|
}
|
|
112
121
|
|