@uploadcare/file-uploader 1.13.3-alpha.0 → 1.15.0-alpha.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/ActivityBlock.d.ts.map +1 -1
- package/abstract/ActivityBlock.js +10 -15
- package/abstract/Block.d.ts +6 -0
- package/abstract/Block.d.ts.map +1 -1
- package/abstract/Block.js +15 -0
- package/abstract/CTX.d.ts.map +1 -1
- package/abstract/CTX.js +3 -1
- package/abstract/ModalManager.d.ts +113 -0
- package/abstract/ModalManager.d.ts.map +1 -0
- package/abstract/ModalManager.js +220 -0
- package/abstract/UploaderBlock.d.ts +2 -1
- package/abstract/UploaderBlock.d.ts.map +1 -1
- package/abstract/UploaderBlock.js +1 -8
- package/abstract/UploaderPublicApi.d.ts.map +1 -1
- package/abstract/UploaderPublicApi.js +38 -9
- package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
- package/blocks/CameraSource/CameraSource.js +1 -0
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +1 -1
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +2 -0
- package/blocks/Config/Config.d.ts +1 -1
- package/blocks/Config/Config.d.ts.map +1 -1
- package/blocks/Config/initialConfig.d.ts.map +1 -1
- package/blocks/Config/initialConfig.js +3 -0
- package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
- package/blocks/Config/normalizeConfigValue.js +4 -0
- package/blocks/DropArea/DropArea.d.ts.map +1 -1
- package/blocks/DropArea/DropArea.js +2 -1
- package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
- package/blocks/ExternalSource/ExternalSource.js +3 -1
- package/blocks/FileItem/FileItem.d.ts +2 -0
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +18 -3
- package/blocks/FileItem/file-item.css +60 -0
- package/blocks/Modal/Modal.d.ts.map +1 -1
- package/blocks/Modal/Modal.js +28 -17
- package/blocks/SourceBtn/SourceBtn.d.ts +5 -2
- package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -1
- package/blocks/SourceBtn/SourceBtn.js +29 -15
- package/blocks/SourceList/SourceList.d.ts.map +1 -1
- package/blocks/SourceList/SourceList.js +17 -11
- package/blocks/StartFrom/StartFrom.js +1 -1
- package/blocks/UploadList/UploadList.d.ts.map +1 -1
- package/blocks/UploadList/UploadList.js +14 -1
- package/blocks/UploadList/upload-list.css +22 -0
- package/blocks/UrlSource/UrlSource.d.ts.map +1 -1
- package/blocks/UrlSource/UrlSource.js +1 -0
- package/blocks/themes/uc-basic/svg-sprite.d.ts +1 -1
- package/blocks/themes/uc-basic/svg-sprite.js +1 -1
- package/blocks/themes/uc-basic/theme.css +13 -0
- package/blocks/utils/UploadSource.d.ts +6 -1
- package/blocks/utils/UploadSource.d.ts.map +1 -1
- package/blocks/utils/UploadSource.js +7 -1
- package/blocks/utils/supportCapture.d.ts +2 -0
- package/blocks/utils/supportCapture.d.ts.map +1 -0
- package/blocks/utils/supportCapture.js +3 -0
- package/env.d.ts +1 -1
- package/env.js +1 -1
- package/index.ssr.d.ts +29 -15
- package/index.ssr.d.ts.map +1 -1
- package/index.ssr.js +45 -18
- package/locales/file-uploader/ar.d.ts +2 -0
- package/locales/file-uploader/ar.js +2 -0
- package/locales/file-uploader/az.d.ts +2 -0
- package/locales/file-uploader/az.js +2 -0
- package/locales/file-uploader/ca.d.ts +2 -0
- package/locales/file-uploader/ca.js +2 -0
- package/locales/file-uploader/cs.d.ts +2 -0
- package/locales/file-uploader/cs.js +2 -0
- package/locales/file-uploader/da.d.ts +2 -0
- package/locales/file-uploader/da.js +2 -0
- package/locales/file-uploader/de.d.ts +2 -0
- package/locales/file-uploader/de.js +2 -0
- package/locales/file-uploader/el.d.ts +2 -0
- package/locales/file-uploader/el.js +2 -0
- package/locales/file-uploader/en.d.ts +2 -1
- package/locales/file-uploader/en.js +2 -1
- package/locales/file-uploader/es.d.ts +2 -0
- package/locales/file-uploader/es.js +2 -0
- package/locales/file-uploader/et.d.ts +2 -0
- package/locales/file-uploader/et.js +2 -0
- package/locales/file-uploader/fi.d.ts +2 -0
- package/locales/file-uploader/fi.js +2 -0
- package/locales/file-uploader/fr.d.ts +2 -0
- package/locales/file-uploader/fr.js +2 -0
- package/locales/file-uploader/he.d.ts +2 -0
- package/locales/file-uploader/he.js +2 -0
- package/locales/file-uploader/hy.d.ts +2 -0
- package/locales/file-uploader/hy.js +2 -0
- package/locales/file-uploader/is.d.ts +2 -0
- package/locales/file-uploader/is.js +2 -0
- package/locales/file-uploader/it.d.ts +2 -0
- package/locales/file-uploader/it.js +2 -0
- package/locales/file-uploader/ja.d.ts +2 -0
- package/locales/file-uploader/ja.js +2 -0
- package/locales/file-uploader/ka.d.ts +2 -0
- package/locales/file-uploader/ka.js +2 -0
- package/locales/file-uploader/kk.d.ts +2 -0
- package/locales/file-uploader/kk.js +2 -0
- package/locales/file-uploader/ko.d.ts +2 -0
- package/locales/file-uploader/ko.js +2 -0
- package/locales/file-uploader/lv.d.ts +2 -0
- package/locales/file-uploader/lv.js +2 -0
- package/locales/file-uploader/nb.d.ts +2 -0
- package/locales/file-uploader/nb.js +2 -0
- package/locales/file-uploader/nl.d.ts +2 -0
- package/locales/file-uploader/nl.js +2 -0
- package/locales/file-uploader/pl.d.ts +2 -0
- package/locales/file-uploader/pl.js +2 -0
- package/locales/file-uploader/pt.d.ts +2 -0
- package/locales/file-uploader/pt.js +2 -0
- package/locales/file-uploader/ro.d.ts +2 -0
- package/locales/file-uploader/ro.js +2 -0
- package/locales/file-uploader/ru.d.ts +2 -0
- package/locales/file-uploader/ru.js +2 -0
- package/locales/file-uploader/sk.d.ts +2 -0
- package/locales/file-uploader/sk.js +2 -0
- package/locales/file-uploader/sr.d.ts +2 -0
- package/locales/file-uploader/sr.js +2 -0
- package/locales/file-uploader/sv.d.ts +2 -0
- package/locales/file-uploader/sv.js +2 -0
- package/locales/file-uploader/tr.d.ts +2 -0
- package/locales/file-uploader/tr.js +2 -0
- package/locales/file-uploader/uk.d.ts +2 -0
- package/locales/file-uploader/uk.js +2 -0
- package/locales/file-uploader/vi.d.ts +2 -0
- package/locales/file-uploader/vi.js +2 -0
- package/locales/file-uploader/zh-TW.d.ts +2 -0
- package/locales/file-uploader/zh-TW.js +2 -0
- package/locales/file-uploader/zh.d.ts +2 -0
- package/locales/file-uploader/zh.js +2 -0
- package/package.json +4 -2
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.js +23 -0
- package/solutions/file-uploader/minimal/index.css +20 -1
- package/solutions/file-uploader/minimal/index.d.ts +3 -0
- package/solutions/file-uploader/minimal/index.js +5 -0
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +2 -2
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.js +16 -1
- package/types/exported.d.ts +4 -0
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.min.css +1 -1
- package/web/uc-cloud-image-editor.min.css +1 -1
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.css +1 -1
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.css +1 -1
- package/web/uc-file-uploader-minimal.min.js +4 -3
- package/web/uc-file-uploader-regular.min.css +1 -1
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +1 -1
- package/blocks/utils/checkDevice.d.ts +0 -9
- package/blocks/utils/checkDevice.d.ts.map +0 -1
- package/blocks/utils/checkDevice.js +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityBlock.d.ts","sourceRoot":"","sources":["ActivityBlock.js"],"names":[],"mappings":"AASA;;;;;GAKG;AAEH;
|
|
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"}
|
|
@@ -49,11 +49,6 @@ export class ActivityBlock extends Block {
|
|
|
49
49
|
/** @protected */
|
|
50
50
|
initCallback() {
|
|
51
51
|
super.initCallback();
|
|
52
|
-
if (this.hasAttribute('current-activity')) {
|
|
53
|
-
this.sub('*currentActivity', (/** @type {String} */ val) => {
|
|
54
|
-
this.setAttribute('current-activity', val);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
52
|
|
|
58
53
|
// TODO: rename activityType to activityId
|
|
59
54
|
if (this.activityType) {
|
|
@@ -76,14 +71,6 @@ export class ActivityBlock extends Block {
|
|
|
76
71
|
this.$['*history'] = [];
|
|
77
72
|
}
|
|
78
73
|
});
|
|
79
|
-
|
|
80
|
-
if (this.has('*modalActive')) {
|
|
81
|
-
this.sub('*modalActive', (modalActive) => {
|
|
82
|
-
if (!modalActive && this.activityType === this.$['*currentActivity']) {
|
|
83
|
-
this.$['*currentActivity'] = null;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
74
|
}
|
|
88
75
|
}
|
|
89
76
|
|
|
@@ -160,7 +147,7 @@ export class ActivityBlock extends Block {
|
|
|
160
147
|
|
|
161
148
|
if (!hasCurrentActivityInCtx) {
|
|
162
149
|
this.$['*currentActivity'] = null;
|
|
163
|
-
this.setOrAddState('*modalActive', false);
|
|
150
|
+
// this.setOrAddState('*modalActive', false);
|
|
164
151
|
}
|
|
165
152
|
}
|
|
166
153
|
|
|
@@ -186,21 +173,29 @@ export class ActivityBlock extends Block {
|
|
|
186
173
|
historyBack() {
|
|
187
174
|
/** @type {String[]} */
|
|
188
175
|
let history = this.$['*history'];
|
|
176
|
+
|
|
189
177
|
if (history) {
|
|
190
178
|
let nextActivity = history.pop();
|
|
179
|
+
|
|
191
180
|
while (nextActivity === this.activityType) {
|
|
192
181
|
nextActivity = history.pop();
|
|
193
182
|
}
|
|
183
|
+
|
|
194
184
|
let couldOpenActivity = !!nextActivity;
|
|
195
185
|
if (nextActivity) {
|
|
196
186
|
const nextActivityBlock = [...this.blocksRegistry].find((block) => block.activityType === nextActivity);
|
|
197
187
|
couldOpenActivity = /** @type {ActivityBlock} */ (nextActivityBlock)?.couldOpenActivity ?? false;
|
|
198
188
|
}
|
|
189
|
+
|
|
199
190
|
nextActivity = couldOpenActivity ? nextActivity : undefined;
|
|
191
|
+
|
|
192
|
+
if (nextActivity) this.modalManager.open(nextActivity);
|
|
193
|
+
|
|
200
194
|
this.$['*currentActivity'] = nextActivity;
|
|
201
195
|
this.$['*history'] = history;
|
|
196
|
+
|
|
202
197
|
if (!nextActivity) {
|
|
203
|
-
this.
|
|
198
|
+
this.modalManager.closeAll();
|
|
204
199
|
}
|
|
205
200
|
}
|
|
206
201
|
}
|
package/abstract/Block.d.ts
CHANGED
|
@@ -58,6 +58,11 @@ export class Block extends BaseComponent<any> {
|
|
|
58
58
|
* @param {any} newVal
|
|
59
59
|
*/
|
|
60
60
|
setOrAddState(prop: string, newVal: any): void;
|
|
61
|
+
/**
|
|
62
|
+
* @returns {ModalManager}
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
public get modalManager(): ModalManager;
|
|
61
66
|
/**
|
|
62
67
|
* @private
|
|
63
68
|
* @returns {LocaleManager | null}
|
|
@@ -97,5 +102,6 @@ export class Block extends BaseComponent<any> {
|
|
|
97
102
|
}
|
|
98
103
|
export { BaseComponent };
|
|
99
104
|
import { BaseComponent } from '@symbiotejs/symbiote';
|
|
105
|
+
import { ModalManager } from './ModalManager.js';
|
|
100
106
|
import { A11y } from './a11y.js';
|
|
101
107
|
//# sourceMappingURL=Block.d.ts.map
|
package/abstract/Block.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["Block.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["Block.js"],"names":[],"mappings":"AAoBA;IACE,4BAA4B;IAC5B,2BADW,MAAM,GAAG,IAAI,CACS;IAEjC,uBAAuB;IACvB,mBADW,MAAM,EAAE,CACI;IAoUvB,6BAA6B;IAC7B,4CAQC;IAzRD,cAMC;IAxDD,iBAAiB;IACjB,kCAAuB;IAEvB,wDAAwD;IACxD,cADW,OAAO,oBAAoB,EAAE,YAAY,CAChC;IAEpB,UAAmB;IAEnB;;;;OAIG;IACH;;eAcC;IAED;;;;;OAKG;IACH,kBAIC;IAED;;;;OAIG;IACH,wBAJW,MAAM,YACN,MAAM,IAAI,QAKpB;IAIC,uDAAuD;IACvD,mBADW,IAAI,MAAM,EAAE,IAAI;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC,CACjB;IAKpC;;;;OAIG;IACH,WAJW;;qBAAuF,CAAC,CAAC,YACzF;;qBAAuF,CAAC,CAAC,YACzF;;qBAAuF,CAAC,CAAC,QASnG;IAED;;;OAGG;IACH,gCAHmB,KAAK,KAAK,OAAO,WAUnC;IAED;;;OAGG;IACH,oCAFW,GAAG,QASb;IAsED;;;OAGG;IACH,wCAEC;IAED;;;OAGG;IACH,4BAEC;IAED;;;OAGG;IACH,kCAEC;IAED,yBAAyB;IACzB,iCAEC;IAwBD;;;;OAIG;IACH,qCAMC;IAED;;;;OAIG;IACH,iCAHa,eAAe,CA6B3B;IAED,iDAAiD;IACjD,yCA8BC;IA3BG,eAAe;IACf,mBAuBE;IAKN;;;;OAIG;IACH,6HAFwD,IAAI,QAQ3D;IAED,8BAA8B;IAC9B,oBADY,OAAO,EAAE,QAWpB;CAYF;;8BAtWmC,sBAAsB;6BAc7B,mBAAmB;qBAD3B,WAAW"}
|
package/abstract/Block.js
CHANGED
|
@@ -13,6 +13,7 @@ import { LocaleManager, localeStateKey } from './LocaleManager.js';
|
|
|
13
13
|
import { l10nProcessor } from './l10nProcessor.js';
|
|
14
14
|
import { sharedConfigKey } from './sharedConfigKey.js';
|
|
15
15
|
import { A11y } from './a11y.js';
|
|
16
|
+
import { ModalManager } from './ModalManager.js';
|
|
16
17
|
|
|
17
18
|
const TAG_PREFIX = 'uc-';
|
|
18
19
|
|
|
@@ -180,12 +181,24 @@ export class Block extends BaseComponent {
|
|
|
180
181
|
this.add('*a11y', new A11y());
|
|
181
182
|
}
|
|
182
183
|
|
|
184
|
+
if (!this.has('*modalManager')) {
|
|
185
|
+
this.add('*modalManager', new ModalManager(this));
|
|
186
|
+
}
|
|
187
|
+
|
|
183
188
|
this.sub(localeStateKey('locale-id'), (localeId) => {
|
|
184
189
|
const direction = getLocaleDirection(localeId);
|
|
185
190
|
this.style.direction = direction === 'ltr' ? '' : direction;
|
|
186
191
|
});
|
|
187
192
|
}
|
|
188
193
|
|
|
194
|
+
/**
|
|
195
|
+
* @returns {ModalManager}
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
get modalManager() {
|
|
199
|
+
return this.has('*modalManager') && this.$['*modalManager'];
|
|
200
|
+
}
|
|
201
|
+
|
|
189
202
|
/**
|
|
190
203
|
* @private
|
|
191
204
|
* @returns {LocaleManager | null}
|
|
@@ -238,6 +251,8 @@ export class Block extends BaseComponent {
|
|
|
238
251
|
Data.deleteCtx(this.ctxName);
|
|
239
252
|
|
|
240
253
|
this.localeManager?.destroy();
|
|
254
|
+
|
|
255
|
+
this.modalManager?.destroy();
|
|
241
256
|
}
|
|
242
257
|
|
|
243
258
|
/**
|
package/abstract/CTX.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CTX.d.ts","sourceRoot":"","sources":["CTX.js"],"names":[],"mappings":"AAGO,+BAA2B;AAG3B,wCADK,OAAO,SAAS,EAAE,KAAK;;;;;;
|
|
1
|
+
{"version":3,"file":"CTX.d.ts","sourceRoot":"","sources":["CTX.js"],"names":[],"mappings":"AAGO,+BAA2B;AAG3B,wCADK,OAAO,SAAS,EAAE,KAAK;;;;;;EAejC;AAGK,wCADK,OAAO,SAAS,EAAE,KAAK;;;;IAMjC,qEAAqE;yBAA1D,WAAW,OAAO,UAAU,EAAE,qBAAqB,CAAC,EAAE;IAEjE,8DAA8D;wBAAnD,OAAO,UAAU,EAAE,qBAAqB,GAAG,IAAI;IAE1D,yEAAyE;kBAA9D,OAAO,2BAA2B,EAAE,eAAe,GAAG,IAAI;IAErE,0BAA0B;sBAAf,IAAI,MAAM,CAAC;IAEtB,8EAA8E;6BAAnE,OAAO,2BAA2B,EAAE,oBAAoB,GAAG,IAAI;;;;;;EAE1E;sBArCoB,2BAA2B"}
|
package/abstract/CTX.js
CHANGED
|
@@ -8,12 +8,14 @@ export const activityBlockCtx = (fnCtx) => ({
|
|
|
8
8
|
...blockCtx(),
|
|
9
9
|
'*currentActivity': null,
|
|
10
10
|
'*currentActivityParams': {},
|
|
11
|
+
|
|
11
12
|
'*history': [],
|
|
12
13
|
'*historyBack': null,
|
|
13
14
|
'*closeModal': () => {
|
|
15
|
+
fnCtx.modalManager.closeAll();
|
|
16
|
+
|
|
14
17
|
fnCtx.set$({
|
|
15
18
|
'*currentActivity': null,
|
|
16
|
-
'*modalActive': false,
|
|
17
19
|
});
|
|
18
20
|
},
|
|
19
21
|
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/** @typedef {string} ModalId */
|
|
2
|
+
/** @typedef {import('../blocks/Modal/Modal.js').Modal} ModalNode */
|
|
3
|
+
export const ModalEvents: Readonly<{
|
|
4
|
+
ADD: "modal:add";
|
|
5
|
+
DELETE: "modal:delete";
|
|
6
|
+
OPEN: "modal:open";
|
|
7
|
+
CLOSE: "modal:close";
|
|
8
|
+
CLOSE_ALL: "modal:closeAll";
|
|
9
|
+
DESTROY: "modal:destroy";
|
|
10
|
+
}>;
|
|
11
|
+
export class ModalManager {
|
|
12
|
+
/** @param {import('./Block.js').Block} block */
|
|
13
|
+
constructor(block: import('./Block.js').Block);
|
|
14
|
+
/**
|
|
15
|
+
* @private
|
|
16
|
+
* @type {Map<ModalId, ModalNode>}
|
|
17
|
+
*/
|
|
18
|
+
private _modals;
|
|
19
|
+
/**
|
|
20
|
+
* @private
|
|
21
|
+
* @type {Set<ModalId>}
|
|
22
|
+
*/
|
|
23
|
+
private _activeModals;
|
|
24
|
+
_subscribers: Map<any, any>;
|
|
25
|
+
_block: import("./Block.js").Block;
|
|
26
|
+
/**
|
|
27
|
+
* @private
|
|
28
|
+
* @param {unknown[]} args
|
|
29
|
+
*/
|
|
30
|
+
private _debugPrint;
|
|
31
|
+
/**
|
|
32
|
+
* Register a modal with the manager
|
|
33
|
+
*
|
|
34
|
+
* @param {ModalId} id - Unique identifier for the modal
|
|
35
|
+
* @param {ModalNode} modal - Modal component instance
|
|
36
|
+
*/
|
|
37
|
+
registerModal(id: ModalId, modal: ModalNode): void;
|
|
38
|
+
/** @param {ModalId} id - Unique identifier for the modal */
|
|
39
|
+
deleteModal(id: ModalId): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Open a modal by its ID
|
|
42
|
+
*
|
|
43
|
+
* @param {ModalId} id - The ID of the modal to open
|
|
44
|
+
* @returns {boolean} - Success status
|
|
45
|
+
*/
|
|
46
|
+
open(id: ModalId): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Close a specific modal by ID
|
|
49
|
+
*
|
|
50
|
+
* @param {ModalId} id - The ID of the modal to close
|
|
51
|
+
* @returns {boolean} - Success status
|
|
52
|
+
*/
|
|
53
|
+
close(id: ModalId): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Toggle a modal - open if closed, close if open
|
|
56
|
+
*
|
|
57
|
+
* @param {ModalId} id - The ID of the modal to toggle
|
|
58
|
+
* @returns {boolean} - Success status
|
|
59
|
+
*/
|
|
60
|
+
toggle(id: ModalId): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Check if any modals are currently active/open
|
|
63
|
+
*
|
|
64
|
+
* @returns {boolean} - True if there are any active modals
|
|
65
|
+
*/
|
|
66
|
+
get hasActiveModals(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Close the most recently opened modal and return to the previous one
|
|
69
|
+
*
|
|
70
|
+
* @returns {boolean} - Success status
|
|
71
|
+
*/
|
|
72
|
+
back(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Close all open modals
|
|
75
|
+
*
|
|
76
|
+
* @returns {number} - Number of modals closed
|
|
77
|
+
*/
|
|
78
|
+
closeAll(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Subscribe to modal events
|
|
81
|
+
*
|
|
82
|
+
* @param {string} event
|
|
83
|
+
* @param {() => void} callback
|
|
84
|
+
* @returns {() => void}
|
|
85
|
+
*/
|
|
86
|
+
subscribe(event: string, callback: () => void): () => void;
|
|
87
|
+
/**
|
|
88
|
+
* Unsubscribe from modal events
|
|
89
|
+
*
|
|
90
|
+
* @param {string} event
|
|
91
|
+
* @param {() => void} callback
|
|
92
|
+
*/
|
|
93
|
+
unsubscribe(event: string, callback: () => void): void;
|
|
94
|
+
/**
|
|
95
|
+
* Notify all subscribers of a modal event
|
|
96
|
+
*
|
|
97
|
+
* @private
|
|
98
|
+
* @param {string} event - Event name
|
|
99
|
+
* @param {{
|
|
100
|
+
* id?: ModalId | ModalId[];
|
|
101
|
+
* modal?: ModalNode | ModalNode[];
|
|
102
|
+
* }
|
|
103
|
+
* | {
|
|
104
|
+
* modalIds: ModalId[];
|
|
105
|
+
* }} data
|
|
106
|
+
*/
|
|
107
|
+
private _notify;
|
|
108
|
+
/** Destroy the modal manager, clean up resources */
|
|
109
|
+
destroy(): void;
|
|
110
|
+
}
|
|
111
|
+
export type ModalId = string;
|
|
112
|
+
export type ModalNode = import('../blocks/Modal/Modal.js').Modal;
|
|
113
|
+
//# sourceMappingURL=ModalManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalManager.d.ts","sourceRoot":"","sources":["ModalManager.js"],"names":[],"mappings":"AAEA,gCAAgC;AAEhC,oEAAoE;AAEpE;;;;;;;GAOG;AAEH;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,QAInB;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,MAAM,YACN,MAAM,IAAI,GACR,MAAM,IAAI,CAStB;IAED;;;;;OAKG;IACH,mBAHW,MAAM,YACN,MAAM,IAAI,QAMpB;IAED;;;;;;;;;;;;OAYG;IACH,gBAUC;IAED,oDAAoD;IACpD,gBAKC;CACF;sBAzNa,MAAM;wBAEN,OAAO,0BAA0B,EAAE,KAAK"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
//@ts-check
|
|
2
|
+
|
|
3
|
+
/** @typedef {string} ModalId */
|
|
4
|
+
|
|
5
|
+
/** @typedef {import('../blocks/Modal/Modal.js').Modal} ModalNode */
|
|
6
|
+
|
|
7
|
+
export const ModalEvents = Object.freeze({
|
|
8
|
+
ADD: 'modal:add',
|
|
9
|
+
DELETE: 'modal:delete',
|
|
10
|
+
OPEN: 'modal:open',
|
|
11
|
+
CLOSE: 'modal:close',
|
|
12
|
+
CLOSE_ALL: 'modal:closeAll',
|
|
13
|
+
DESTROY: 'modal:destroy',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export class ModalManager {
|
|
17
|
+
/**
|
|
18
|
+
* @private
|
|
19
|
+
* @type {Map<ModalId, ModalNode>}
|
|
20
|
+
*/
|
|
21
|
+
_modals = new Map();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @private
|
|
25
|
+
* @type {Set<ModalId>}
|
|
26
|
+
*/
|
|
27
|
+
_activeModals = new Set();
|
|
28
|
+
|
|
29
|
+
_subscribers = new Map();
|
|
30
|
+
|
|
31
|
+
/** @param {import('./Block.js').Block} block */
|
|
32
|
+
constructor(block) {
|
|
33
|
+
this._block = block;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @private
|
|
38
|
+
* @param {unknown[]} args
|
|
39
|
+
*/
|
|
40
|
+
_debugPrint(...args) {
|
|
41
|
+
this._block.debugPrint('[modal-manager]', ...args);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Register a modal with the manager
|
|
46
|
+
*
|
|
47
|
+
* @param {ModalId} id - Unique identifier for the modal
|
|
48
|
+
* @param {ModalNode} modal - Modal component instance
|
|
49
|
+
*/
|
|
50
|
+
registerModal(id, modal) {
|
|
51
|
+
this._modals.set(id, modal);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** @param {ModalId} id - Unique identifier for the modal */
|
|
55
|
+
deleteModal(id) {
|
|
56
|
+
if (!this._modals.has(id)) return false;
|
|
57
|
+
|
|
58
|
+
const modal = this._modals.get(id);
|
|
59
|
+
this._modals.delete(id);
|
|
60
|
+
this._activeModals.delete(id);
|
|
61
|
+
this._notify(ModalEvents.DELETE, { id, modal });
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Open a modal by its ID
|
|
67
|
+
*
|
|
68
|
+
* @param {ModalId} id - The ID of the modal to open
|
|
69
|
+
* @returns {boolean} - Success status
|
|
70
|
+
*/
|
|
71
|
+
open(id) {
|
|
72
|
+
if (!this._modals.has(id)) {
|
|
73
|
+
this._debugPrint(`Modal with ID "${id}" not found`);
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const modal = this._modals.get(id);
|
|
78
|
+
|
|
79
|
+
this._activeModals.add(id);
|
|
80
|
+
this._notify(ModalEvents.OPEN, { modal, id });
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Close a specific modal by ID
|
|
86
|
+
*
|
|
87
|
+
* @param {ModalId} id - The ID of the modal to close
|
|
88
|
+
* @returns {boolean} - Success status
|
|
89
|
+
*/
|
|
90
|
+
close(id) {
|
|
91
|
+
if (!this._modals.has(id) || !this._activeModals.has(id)) {
|
|
92
|
+
this._debugPrint(`Modal with ID "${id}" not found or not active`);
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const modal = this._modals.get(id);
|
|
97
|
+
|
|
98
|
+
this._activeModals.delete(id);
|
|
99
|
+
this._notify(ModalEvents.CLOSE, { id, modal });
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Toggle a modal - open if closed, close if open
|
|
105
|
+
*
|
|
106
|
+
* @param {ModalId} id - The ID of the modal to toggle
|
|
107
|
+
* @returns {boolean} - Success status
|
|
108
|
+
*/
|
|
109
|
+
toggle(id) {
|
|
110
|
+
if (!this._modals.has(id)) {
|
|
111
|
+
this._debugPrint(`Modal with ID "${id}" not found`);
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (this._activeModals.has(id)) {
|
|
116
|
+
return this.close(id);
|
|
117
|
+
} else {
|
|
118
|
+
return this.open(id);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Check if any modals are currently active/open
|
|
124
|
+
*
|
|
125
|
+
* @returns {boolean} - True if there are any active modals
|
|
126
|
+
*/
|
|
127
|
+
get hasActiveModals() {
|
|
128
|
+
return this._activeModals.size > 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Close the most recently opened modal and return to the previous one
|
|
133
|
+
*
|
|
134
|
+
* @returns {boolean} - Success status
|
|
135
|
+
*/
|
|
136
|
+
back() {
|
|
137
|
+
if (this._activeModals.size === 0) {
|
|
138
|
+
this._debugPrint('No active modals to go back from');
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Get the last opened modal
|
|
143
|
+
const lastModalId = Array.from(this._activeModals).pop();
|
|
144
|
+
return this.close(/** @type {string} */ (lastModalId));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Close all open modals
|
|
149
|
+
*
|
|
150
|
+
* @returns {number} - Number of modals closed
|
|
151
|
+
*/
|
|
152
|
+
closeAll() {
|
|
153
|
+
const count = this._activeModals.size;
|
|
154
|
+
|
|
155
|
+
this._activeModals.clear();
|
|
156
|
+
this._notify(ModalEvents.CLOSE_ALL, {});
|
|
157
|
+
return count;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Subscribe to modal events
|
|
162
|
+
*
|
|
163
|
+
* @param {string} event
|
|
164
|
+
* @param {() => void} callback
|
|
165
|
+
* @returns {() => void}
|
|
166
|
+
*/
|
|
167
|
+
subscribe(event, callback) {
|
|
168
|
+
if (!this._subscribers.has(event)) {
|
|
169
|
+
this._subscribers.set(event, new Set());
|
|
170
|
+
}
|
|
171
|
+
this._subscribers.get(event).add(callback);
|
|
172
|
+
|
|
173
|
+
return () => this.unsubscribe(event, callback);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Unsubscribe from modal events
|
|
178
|
+
*
|
|
179
|
+
* @param {string} event
|
|
180
|
+
* @param {() => void} callback
|
|
181
|
+
*/
|
|
182
|
+
unsubscribe(event, callback) {
|
|
183
|
+
if (this._subscribers.has(event)) {
|
|
184
|
+
this._subscribers.get(event).delete(callback);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Notify all subscribers of a modal event
|
|
190
|
+
*
|
|
191
|
+
* @private
|
|
192
|
+
* @param {string} event - Event name
|
|
193
|
+
* @param {{
|
|
194
|
+
* id?: ModalId | ModalId[];
|
|
195
|
+
* modal?: ModalNode | ModalNode[];
|
|
196
|
+
* }
|
|
197
|
+
* | {
|
|
198
|
+
* modalIds: ModalId[];
|
|
199
|
+
* }} data
|
|
200
|
+
*/
|
|
201
|
+
_notify(event, data) {
|
|
202
|
+
if (this._subscribers.has(event)) {
|
|
203
|
+
for (const callback of this._subscribers.get(event)) {
|
|
204
|
+
try {
|
|
205
|
+
callback(data);
|
|
206
|
+
} catch (error) {
|
|
207
|
+
this._debugPrint('Error in modal subscriber:', error);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Destroy the modal manager, clean up resources */
|
|
214
|
+
destroy() {
|
|
215
|
+
this.closeAll();
|
|
216
|
+
this._modals.clear();
|
|
217
|
+
this._subscribers.clear();
|
|
218
|
+
this._notify(ModalEvents.DESTROY, {});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -97,10 +97,11 @@ export namespace UploaderBlock {
|
|
|
97
97
|
BOX: "box";
|
|
98
98
|
ONEDRIVE: "onedrive";
|
|
99
99
|
HUDDLE: "huddle";
|
|
100
|
+
MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
101
|
+
MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
100
102
|
LOCAL: "local";
|
|
101
103
|
DROP_AREA: "drop-area";
|
|
102
104
|
CAMERA: "camera";
|
|
103
|
-
VIDEO_CAMERA: "video-camera";
|
|
104
105
|
EXTERNAL: "external";
|
|
105
106
|
API: "js-api";
|
|
106
107
|
URL: "url";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploaderBlock.d.ts","sourceRoot":"","sources":["UploaderBlock.js"],"names":[],"mappings":"AAmBA;IACE,iBAAiB;IACjB,mCAAwB;IAExB,eAAe;IACf,mBAAmB;IAEnB;;;;;;;;;;;;;;MAA+B;IAE/B,eAAe;IACf,0BAOC;IA2BD;;;OAGG;IACH,qDAKC;IAED,mCAAmC;IACnC,6BAKC;IAED,4BAEC;IAED,iCAAiC;IACjC,wCAKC;IAYD,eAAe;IACf,
|
|
1
|
+
{"version":3,"file":"UploaderBlock.d.ts","sourceRoot":"","sources":["UploaderBlock.js"],"names":[],"mappings":"AAmBA;IACE,iBAAiB;IACjB,mCAAwB;IAExB,eAAe;IACf,mBAAmB;IAEnB;;;;;;;;;;;;;;MAA+B;IAE/B,eAAe;IACf,0BAOC;IA2BD;;;OAGG;IACH,qDAKC;IAED,mCAAmC;IACnC,6BAKC;IAED,4BAEC;IAED,iCAAiC;IACjC,wCAKC;IAYD,eAAe;IACf,qBAkBC;IAfC,eAAe;IACf,6BAAiG;IAEjG,eAAe;IACf,uCAEC;IAWH;;;OAGG;IACH,qBAkBC;IAED,eAAe;IACf,0BAYQ;IAER;;;;OAIG;IACH,gCAiCE;IAEF;;;OAGG;IACH,0CAyFE;IAEF,eAAe;IACf,mCAoBE;IAEF,eAAe;IACf,uBAwCC;IAED;;;OAGG;IACH,kCAHW,MAAM,qEAWhB;IAED;;;OAGG;IACH,oCAHa,QAAQ,OAAO,2BAA2B,EAAE,eAAe,CAAC,CA2BxE;IAED,kEAAkE;IAClE,iBADc,OAAO,sBAAsB,EAAE,eAAe,EAAE,CAK7D;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA9Z6B,oBAAoB;qCAWb,2BAA2B;kCAG9B,wBAAwB;kCADxB,wBAAwB;gCAD1B,sBAAsB"}
|
|
@@ -121,14 +121,6 @@ export class UploaderBlock extends ActivityBlock {
|
|
|
121
121
|
if (!this.$['*secureUploadsManager']) {
|
|
122
122
|
this.$['*secureUploadsManager'] = new SecureUploadsManager(this);
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
if (this.has('*modalActive')) {
|
|
126
|
-
this.sub('*modalActive', (modalActive) => {
|
|
127
|
-
if (modalActive && !this.$['*currentActivity']) {
|
|
128
|
-
this.$['*modalActive'] = false;
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
124
|
}
|
|
133
125
|
|
|
134
126
|
/**
|
|
@@ -364,6 +356,7 @@ export class UploaderBlock extends ActivityBlock {
|
|
|
364
356
|
this.$['*currentActivityParams'] = {
|
|
365
357
|
internalId: entry.uid,
|
|
366
358
|
};
|
|
359
|
+
this.modalManager.open(ActivityBlock.activities.CLOUD_IMG_EDIT);
|
|
367
360
|
this.$['*currentActivity'] = ActivityBlock.activities.CLOUD_IMG_EDIT;
|
|
368
361
|
}
|
|
369
362
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploaderPublicApi.d.ts","sourceRoot":"","sources":["UploaderPublicApi.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UploaderPublicApi.d.ts","sourceRoot":"","sources":["UploaderPublicApi.js"],"names":[],"mappings":"AAeA;IAOE,8DAA8D;IAC9D,iBADY,OAAO,oBAAoB,EAAE,aAAa,EAGrD;IATD;;;OAGG;IACH,aAAK;IAOL,eAAe;IACf,gCAEC;IAED,yCAEC;IAED;;iBAEC;IAED;;;;;;OAMG;IACH,sBAJW,MAAM;;;;sBAEJ,OAAO,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAUrD;IAEF;;;;OAIG;IACH,wBAJW,MAAM;;;;sBAEJ,OAAO,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAUrD;IAEF;;;;OAIG;IACH,4BAJW,MAAM;;;;sBAEJ,OAAO,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAgBrD;IAEF;;;;OAIG;IACH,0BAJW,IAAI;;;;;sBAEF,OAAO,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAcrD;IAEF,iCAAiC;IACjC,qCADY,MAAM,UAMhB;IAEF,uBAEC;IAED,sBAeE;IAEF,8HAA8H;IAC9H,6BADY;QAAE,aAAa,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,qCAAqC,EAAE,cAAc,CAAA;KAAE,UAyDhH;IAEF;;;;OAIG;IACH,8EAHW,MAAM,iDA8Cf;IAEF,oEAAoE;IACpE,oKAIE;IAEF,+BAA+B;IAC/B,gDA6DE;IAEF,qBAQE;IAEF;;;;;;;;;OASG;IACH,uTAFQ,IAAI,CAWV;IAEF,2DAA2D;IAC3D,0BADc,OAAO,oBAAoB,EAAE,YAAY,CAGrD;IAEF,8BAA8B;IAC9B,wBADY,OAAO,UAYjB;IAEF;;;OAGG;IACH,0BAOC;CACF"}
|
|
@@ -11,6 +11,7 @@ import { buildOutputCollectionState } from './buildOutputCollectionState.js';
|
|
|
11
11
|
import { stringToArray } from '../utils/stringToArray.js';
|
|
12
12
|
import { calcCameraModes } from '../blocks/CameraSource/calcCameraModes.js';
|
|
13
13
|
import { CameraSourceTypes } from '../blocks/CameraSource/constants.js';
|
|
14
|
+
import { isSupportCapture } from '../blocks/utils/supportCapture.js';
|
|
14
15
|
|
|
15
16
|
export class UploaderPublicApi {
|
|
16
17
|
/**
|
|
@@ -160,10 +161,10 @@ export class UploaderPublicApi {
|
|
|
160
161
|
|
|
161
162
|
if (options.modeCamera === CameraSourceTypes.PHOTO && isPhotoEnabled) {
|
|
162
163
|
fileInput.accept = 'image/*';
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (options.modeCamera === CameraSourceTypes.VIDEO && isVideoRecordingEnabled) {
|
|
164
|
+
} else if (options.modeCamera === CameraSourceTypes.VIDEO && isVideoRecordingEnabled) {
|
|
166
165
|
fileInput.accept = 'video/*';
|
|
166
|
+
} else {
|
|
167
|
+
fileInput.accept = ['image/*', isVideoRecordingEnabled && 'video/*'].filter(Boolean).join(',');
|
|
167
168
|
}
|
|
168
169
|
} else {
|
|
169
170
|
fileInput.accept = accept;
|
|
@@ -178,8 +179,8 @@ export class UploaderPublicApi {
|
|
|
178
179
|
this.addFileFromObject(file, { source: options.captureCamera ? UploadSource.CAMERA : UploadSource.LOCAL }),
|
|
179
180
|
);
|
|
180
181
|
// To call uploadTrigger UploadList should draw file items first:
|
|
182
|
+
this._ctx.modalManager.open(ActivityBlock.activities.UPLOAD_LIST);
|
|
181
183
|
this._ctx.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
|
|
182
|
-
this._ctx.setOrAddState('*modalActive', true);
|
|
183
184
|
fileInput.remove();
|
|
184
185
|
},
|
|
185
186
|
{
|
|
@@ -257,10 +258,10 @@ export class UploaderPublicApi {
|
|
|
257
258
|
/** @param {Boolean} [force] */
|
|
258
259
|
initFlow = (force = false) => {
|
|
259
260
|
if (this._uploadCollection.size > 0 && !force) {
|
|
261
|
+
this._ctx.modalManager?.open(ActivityBlock.activities.UPLOAD_LIST);
|
|
260
262
|
this._ctx.set$({
|
|
261
263
|
'*currentActivity': ActivityBlock.activities.UPLOAD_LIST,
|
|
262
264
|
});
|
|
263
|
-
this._ctx.setOrAddState('*modalActive', true);
|
|
264
265
|
} else {
|
|
265
266
|
if (this._sourceList?.length === 1) {
|
|
266
267
|
const srcKey = this._sourceList[0];
|
|
@@ -272,6 +273,28 @@ export class UploaderPublicApi {
|
|
|
272
273
|
return;
|
|
273
274
|
}
|
|
274
275
|
|
|
276
|
+
if (srcKey === 'camera' && isSupportCapture()) {
|
|
277
|
+
const { isPhotoEnabled, isVideoRecordingEnabled } = calcCameraModes(this.cfg);
|
|
278
|
+
|
|
279
|
+
if (isPhotoEnabled && isVideoRecordingEnabled) {
|
|
280
|
+
this._ctx.set$({
|
|
281
|
+
'*currentActivity': ActivityBlock.activities.START_FROM,
|
|
282
|
+
});
|
|
283
|
+
return;
|
|
284
|
+
} else if (isPhotoEnabled || isVideoRecordingEnabled) {
|
|
285
|
+
this.openSystemDialog({
|
|
286
|
+
captureCamera: true,
|
|
287
|
+
modeCamera: isPhotoEnabled ? CameraSourceTypes.PHOTO : CameraSourceTypes.VIDEO,
|
|
288
|
+
});
|
|
289
|
+
return;
|
|
290
|
+
} else {
|
|
291
|
+
this.openSystemDialog({
|
|
292
|
+
captureCamera: true,
|
|
293
|
+
modeCamera: CameraSourceTypes.PHOTO,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
275
298
|
/** @type {Set<import('./Block').Block>} */
|
|
276
299
|
const blocksRegistry = this._ctx.$['*blocksRegistry'];
|
|
277
300
|
/**
|
|
@@ -282,15 +305,16 @@ export class UploaderPublicApi {
|
|
|
282
305
|
const sourceBtnBlock = [...blocksRegistry].find(isSourceBtn);
|
|
283
306
|
// TODO: This is weird that we have this logic inside UI component, we should consider to move it somewhere else
|
|
284
307
|
sourceBtnBlock?.activate();
|
|
308
|
+
|
|
285
309
|
if (this._ctx.$['*currentActivity']) {
|
|
286
|
-
this._ctx.
|
|
310
|
+
this._ctx.modalManager?.open(this._ctx.$['*currentActivity']);
|
|
287
311
|
}
|
|
288
312
|
} else {
|
|
289
313
|
// Multiple sources case:
|
|
314
|
+
this._ctx.modalManager?.open(ActivityBlock.activities.START_FROM);
|
|
290
315
|
this._ctx.set$({
|
|
291
316
|
'*currentActivity': ActivityBlock.activities.START_FROM,
|
|
292
317
|
});
|
|
293
|
-
this._ctx.setOrAddState('*modalActive', true);
|
|
294
318
|
}
|
|
295
319
|
}
|
|
296
320
|
};
|
|
@@ -301,7 +325,7 @@ export class UploaderPublicApi {
|
|
|
301
325
|
'*history': this._ctx.doneActivity ? [this._ctx.doneActivity] : [],
|
|
302
326
|
});
|
|
303
327
|
if (!this._ctx.$['*currentActivity']) {
|
|
304
|
-
this._ctx.
|
|
328
|
+
this._ctx.modalManager.closeAll();
|
|
305
329
|
}
|
|
306
330
|
};
|
|
307
331
|
|
|
@@ -337,7 +361,12 @@ export class UploaderPublicApi {
|
|
|
337
361
|
console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);
|
|
338
362
|
return;
|
|
339
363
|
}
|
|
340
|
-
|
|
364
|
+
|
|
365
|
+
if (opened) {
|
|
366
|
+
this._ctx.modalManager?.open(this._ctx.$['*currentActivity']);
|
|
367
|
+
} else {
|
|
368
|
+
this._ctx.modalManager?.close(this._ctx.$['*currentActivity']);
|
|
369
|
+
}
|
|
341
370
|
};
|
|
342
371
|
|
|
343
372
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraSource.d.ts","sourceRoot":"","sources":["CameraSource.js"],"names":[],"mappings":"AAyCA,8CAA8C;AAE9C,kGAAkG;AAElG;IAEE,uBAA+C;IAE/C,eAAe;IACf,0BAAyB;IAEzB,yBAAyB;IACzB,SADW,QAAQ,EAAE,CACR;IAEb,mCAAmC;IACnC,gBADW,aAAa,GAAG,IAAI,CACT;IAEtB,iCAAiC;IACjC,SADW,WAAW,GAAG,IAAI,CACd;IAEf,4BAA4B;IAC5B,kBADW,MAAM,GAAG,IAAI,CACA;IAExB,4BAA4B;IAC5B,mBADW,MAAM,GAAG,IAAI,CACC;IAKvB;;;;;;;;;;;;;;;;;;;;;;;;QAiCE,qBAAqB;;QAErB,qBAAqB;;;;QAMrB,uBAAuB;kCAAX,KAAK;QAMjB,uBAAuB;iCAAX,KAAK;;;;QAcjB,iDAAiD;;;;;;;;QAejD,4BAA4B;wBAAhB,UAAU;;;;;;;;;;;;;;MAKvB;IAGH,oCAaE;IAEF,yBAkBE;IADA,sCAAiE;IAGnE,wBAKE;IAEF,uBAEE;IAEF,2BAOE;IAEF,0BAEE;IAEF,4BAiCE;IA9BE;;;;;kBAEC;IA8BL,eAAe;IACf,uBAWE;IAEF,2DAA2D;IAC3D,6BAQE;IAEF,+BAOE;IAEF;;;;OAIG;IACH,sBA6BE;IAEF,oBAUE;IAEF,oBAoBE;IAEF,mCAAmC;IACnC,uBADY,YAAY,UAqBtB;IAEF,mCAAmC;IACnC,uBADY,YAAY,UAwCtB;IAEF;;;OAGG;IACH,wBAmBE;IAEF,eAAe;IACf,cAoBC;IAjBC,uCAA+C;IAC/C,kDAAyC;IAkB3C;;;OAGG;IACH,yBAwBE;IADA,mCAAuB;IAGzB;;;;;OAKG;IACH,oBALW,QAAQ,GAAG,OAAO,OAClB,MAAM,GAAG,MAAM,wBAEf,IAAI,UAYb;IAEF,uCAAuC;IACvC,4BADY,SAAS,SAAS,OAmC7B;IAED;;;;OAIG;IACH,gBAFW,IAAI,
|
|
1
|
+
{"version":3,"file":"CameraSource.d.ts","sourceRoot":"","sources":["CameraSource.js"],"names":[],"mappings":"AAyCA,8CAA8C;AAE9C,kGAAkG;AAElG;IAEE,uBAA+C;IAE/C,eAAe;IACf,0BAAyB;IAEzB,yBAAyB;IACzB,SADW,QAAQ,EAAE,CACR;IAEb,mCAAmC;IACnC,gBADW,aAAa,GAAG,IAAI,CACT;IAEtB,iCAAiC;IACjC,SADW,WAAW,GAAG,IAAI,CACd;IAEf,4BAA4B;IAC5B,kBADW,MAAM,GAAG,IAAI,CACA;IAExB,4BAA4B;IAC5B,mBADW,MAAM,GAAG,IAAI,CACC;IAKvB;;;;;;;;;;;;;;;;;;;;;;;;QAiCE,qBAAqB;;QAErB,qBAAqB;;;;QAMrB,uBAAuB;kCAAX,KAAK;QAMjB,uBAAuB;iCAAX,KAAK;;;;QAcjB,iDAAiD;;;;;;;;QAejD,4BAA4B;wBAAhB,UAAU;;;;;;;;;;;;;;MAKvB;IAGH,oCAaE;IAEF,yBAkBE;IADA,sCAAiE;IAGnE,wBAKE;IAEF,uBAEE;IAEF,2BAOE;IAEF,0BAEE;IAEF,4BAiCE;IA9BE;;;;;kBAEC;IA8BL,eAAe;IACf,uBAWE;IAEF,2DAA2D;IAC3D,6BAQE;IAEF,+BAOE;IAEF;;;;OAIG;IACH,sBA6BE;IAEF,oBAUE;IAEF,oBAoBE;IAEF,mCAAmC;IACnC,uBADY,YAAY,UAqBtB;IAEF,mCAAmC;IACnC,uBADY,YAAY,UAwCtB;IAEF;;;OAGG;IACH,wBAmBE;IAEF,eAAe;IACf,cAoBC;IAjBC,uCAA+C;IAC/C,kDAAyC;IAkB3C;;;OAGG;IACH,yBAwBE;IADA,mCAAuB;IAGzB;;;;;OAKG;IACH,oBALW,QAAQ,GAAG,OAAO,OAClB,MAAM,GAAG,MAAM,wBAEf,IAAI,UAYb;IAEF,uCAAuC;IACvC,4BADY,SAAS,SAAS,OAmC7B;IAED;;;;OAIG;IACH,gBAFW,IAAI,UAQb;IAEF,eAAe;IACf,2BAEC;IAED;;;OAGG;IACH,6BA+CQ;IAER,6CAQE;IAEF,yBAWE;IAFE,gCAAuB;IAI3B,8BAyCE;IAEF,qCAEE;IAEF,uCAYE;IAEF,2BAA0B;IAE1B,0CASE;IAEF,iCAsCE;IAlCE;;;oBAKK;IAEL;;;oBAOO;IAsBX,iCAME;IAEF,mCAYE;IAEF,wCAAwC;IACxC,kCADY,UAAU,EAAE,UAStB;IAyBF,iBAMC;IAED,iCAIC;CACF;;;;yBAlxBa,OAAO,GAAG,OAAO;2BAEjB,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ;8BAzCnD,iCAAiC"}
|