clickgo 3.16.26 → 3.16.28
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/README.md +1 -1
- package/dist/app/demo/app.js +4 -16
- package/dist/app/demo/config.json +4 -1
- package/dist/app/demo/form/control/arteditor/arteditor.js +7 -18
- package/dist/app/demo/form/control/button/button.js +2 -13
- package/dist/app/demo/form/control/check/check.js +3 -14
- package/dist/app/demo/form/control/content/content.js +3 -14
- package/dist/app/demo/form/control/daterange/daterange.js +1 -1
- package/dist/app/demo/form/control/delete/delete.js +3 -14
- package/dist/app/demo/form/control/dialog/dialog.js +2 -0
- package/dist/app/demo/form/control/dialog/dialog.xml +26 -12
- package/dist/app/demo/form/control/flow/flow.js +2 -13
- package/dist/app/demo/form/control/form/form.js +4 -15
- package/dist/app/demo/form/control/iconview/iconview.js +12 -29
- package/dist/app/demo/form/control/jodit/jodit.js +7 -18
- package/dist/app/demo/form/control/link/link.js +2 -13
- package/dist/app/demo/form/control/list/list.js +40 -52
- package/dist/app/demo/form/control/list/list.xml +20 -10
- package/dist/app/demo/form/control/map/map.js +17 -28
- package/dist/app/demo/form/control/menu/menu.js +6 -17
- package/dist/app/demo/form/control/mpegts/mpegts.js +1 -1
- package/dist/app/demo/form/control/nav/nav.js +6 -17
- package/dist/app/demo/form/control/novnc/novnc.js +75 -0
- package/dist/app/demo/form/control/novnc/novnc.xml +13 -0
- package/dist/app/demo/form/control/panel/panel.js +9 -20
- package/dist/app/demo/form/control/panel/test1.js +20 -41
- package/dist/app/demo/form/control/pdf/pdf.js +7 -20
- package/dist/app/demo/form/control/progress/progress.js +3 -12
- package/dist/app/demo/form/control/radio/radio.js +6 -17
- package/dist/app/demo/form/control/select/select.js +28 -41
- package/dist/app/demo/form/control/switch/switch.js +3 -14
- package/dist/app/demo/form/control/tab/tab.js +7 -18
- package/dist/app/demo/form/control/table/table.js +8 -23
- package/dist/app/demo/form/control/text/text.js +2 -13
- package/dist/app/demo/form/control/tuieditor/tuieditor.js +7 -18
- package/dist/app/demo/form/control/uploader/uploader.js +20 -31
- package/dist/app/demo/form/control/vflow/vflow.js +2 -13
- package/dist/app/demo/form/event/form/form.js +11 -22
- package/dist/app/demo/form/event/task/task.js +14 -29
- package/dist/app/demo/form/main.js +381 -387
- package/dist/app/demo/form/main.xml +3 -0
- package/dist/app/demo/form/method/acontrol/acontrol.js +2 -13
- package/dist/app/demo/form/method/aform/aform.js +41 -60
- package/dist/app/demo/form/method/aform/sd.js +3 -14
- package/dist/app/demo/form/method/core/core.js +25 -50
- package/dist/app/demo/form/method/dom/dom.js +35 -58
- package/dist/app/demo/form/method/form/form.js +106 -149
- package/dist/app/demo/form/method/fs/fs.js +126 -147
- package/dist/app/demo/form/method/native/native.js +44 -72
- package/dist/app/demo/form/method/storage/storage.js +9 -27
- package/dist/app/demo/form/method/system/system.js +16 -41
- package/dist/app/demo/form/method/task/task.js +18 -37
- package/dist/app/demo/form/method/theme/theme.js +39 -54
- package/dist/app/demo/form/method/tool/tool.js +22 -43
- package/dist/app/demo/form/method/tool/tool.xml +1 -1
- package/dist/app/demo/form/method/zip/zip.js +18 -29
- package/dist/app/demo/form/solution/backpanel/backpanel.js +10 -23
- package/dist/app/task/app.js +2 -13
- package/dist/app/task/form/bar/bar.js +32 -45
- package/dist/clickgo.js +1 -1
- package/dist/control/arteditor.cgc +0 -0
- package/dist/control/box.cgc +0 -0
- package/dist/control/captcha.cgc +0 -0
- package/dist/control/common.cgc +0 -0
- package/dist/control/desc.cgc +0 -0
- package/dist/control/drawer.cgc +0 -0
- package/dist/control/echarts.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/iconview.cgc +0 -0
- package/dist/control/jodit.cgc +0 -0
- package/dist/control/map.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/mpegts.cgc +0 -0
- package/dist/control/nav.cgc +0 -0
- package/dist/control/novnc.cgc +0 -0
- package/dist/control/page.cgc +0 -0
- package/dist/control/pdf.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/qrcode.cgc +0 -0
- package/dist/control/table.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/control/tplink.cgc +0 -0
- package/dist/control/tuieditor.cgc +0 -0
- package/dist/control/tuiviewer.cgc +0 -0
- package/dist/control/xterm.cgc +0 -0
- package/dist/index.js +59 -71
- package/dist/lib/control.js +213 -235
- package/dist/lib/core.js +356 -379
- package/dist/lib/dom.js +62 -91
- package/dist/lib/form.js +834 -906
- package/dist/lib/fs.js +834 -892
- package/dist/lib/native.js +32 -63
- package/dist/lib/storage.js +21 -33
- package/dist/lib/task.js +1054 -1098
- package/dist/lib/theme.js +102 -121
- package/dist/lib/tool.js +65 -98
- package/dist/lib/zip.js +27 -42
- package/dist/theme/blue.cgt +0 -0
- package/dist/theme/byterun.cgt +0 -0
- package/dist/theme/dark.cgt +0 -0
- package/dist/theme/light.cgt +0 -0
- package/package.json +1 -1
package/dist/lib/core.js
CHANGED
|
@@ -32,16 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var _a;
|
|
45
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
36
|
exports.boot = exports.AbstractApp = exports.global = exports.config = void 0;
|
|
47
37
|
exports.getCdn = getCdn;
|
|
@@ -84,7 +74,7 @@ exports.config = clickgo.vue.reactive({
|
|
|
84
74
|
'desktop.path': null,
|
|
85
75
|
'launcher.list': []
|
|
86
76
|
});
|
|
87
|
-
exports.global =
|
|
77
|
+
exports.global = window.clickgoGlobal ?? {};
|
|
88
78
|
class AbstractApp {
|
|
89
79
|
get filename() {
|
|
90
80
|
return '';
|
|
@@ -220,18 +210,16 @@ clickgo.vue.watch(exports.config, function () {
|
|
|
220
210
|
});
|
|
221
211
|
const modules = {
|
|
222
212
|
'monaco': {
|
|
223
|
-
func: function () {
|
|
224
|
-
return
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
reject(e);
|
|
234
|
-
});
|
|
213
|
+
func: async function () {
|
|
214
|
+
return new Promise(function (resolve, reject) {
|
|
215
|
+
fetch(loader.cdn + '/npm/monaco-editor@0.50.0/min/vs/loader.js').then(function (r) {
|
|
216
|
+
return r.blob();
|
|
217
|
+
}).then(function (b) {
|
|
218
|
+
return tool.blob2DataUrl(b);
|
|
219
|
+
}).then(function (d) {
|
|
220
|
+
resolve(d);
|
|
221
|
+
}).catch(function (e) {
|
|
222
|
+
reject(e);
|
|
235
223
|
});
|
|
236
224
|
});
|
|
237
225
|
},
|
|
@@ -240,201 +228,197 @@ const modules = {
|
|
|
240
228
|
'resolve': []
|
|
241
229
|
},
|
|
242
230
|
'xterm': {
|
|
243
|
-
func: function () {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return [window.Terminal, window.FitAddon.FitAddon, window.WebglAddon.WebglAddon];
|
|
258
|
-
});
|
|
231
|
+
func: async function () {
|
|
232
|
+
await loader.loadScripts([
|
|
233
|
+
loader.cdn + '/npm/xterm@5.3.0/lib/xterm.js',
|
|
234
|
+
loader.cdn + '/npm/xterm-addon-fit@0.8.0/lib/xterm-addon-fit.js',
|
|
235
|
+
loader.cdn + '/npm/xterm-addon-webgl@0.16.0/lib/xterm-addon-webgl.js'
|
|
236
|
+
]);
|
|
237
|
+
if (!window.Terminal) {
|
|
238
|
+
throw Error('Xterm load failed.');
|
|
239
|
+
}
|
|
240
|
+
await loader.loadLinks([
|
|
241
|
+
loader.cdn + '/npm/xterm@5.3.0/css/xterm.min.css'
|
|
242
|
+
]);
|
|
243
|
+
loader.loadStyle('.xterm-viewport::-webkit-scrollbar{display:none;}');
|
|
244
|
+
return [window.Terminal, window.FitAddon.FitAddon, window.WebglAddon.WebglAddon];
|
|
259
245
|
},
|
|
260
246
|
'obj': null,
|
|
261
247
|
'loading': false,
|
|
262
248
|
'resolve': []
|
|
263
249
|
},
|
|
264
250
|
'echarts': {
|
|
265
|
-
func: function () {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return window.echarts;
|
|
272
|
-
});
|
|
251
|
+
func: async function () {
|
|
252
|
+
await loader.loadScript(loader.cdn + '/npm/echarts@5.4.2/dist/echarts.min.js');
|
|
253
|
+
if (!window.echarts) {
|
|
254
|
+
throw Error('Echarts load failed.');
|
|
255
|
+
}
|
|
256
|
+
return window.echarts;
|
|
273
257
|
},
|
|
274
258
|
'obj': null,
|
|
275
259
|
'loading': false,
|
|
276
260
|
'resolve': []
|
|
277
261
|
},
|
|
278
262
|
'tuieditor': {
|
|
279
|
-
func: function () {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
return window.toastui.Editor;
|
|
304
|
-
});
|
|
263
|
+
func: async function () {
|
|
264
|
+
await loader.loadScripts([
|
|
265
|
+
__dirname + '/../ext/toastui-editor-all.min.js'
|
|
266
|
+
]);
|
|
267
|
+
if (!window.toastui.Editor) {
|
|
268
|
+
throw Error('Tuieditor load failed.');
|
|
269
|
+
}
|
|
270
|
+
await loader.loadScripts([
|
|
271
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/i18n/zh-cn.min.js',
|
|
272
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/i18n/zh-tw.min.js',
|
|
273
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/i18n/ja-jp.min.js',
|
|
274
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/i18n/ko-kr.min.js',
|
|
275
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/i18n/es-es.min.js',
|
|
276
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/i18n/de-de.min.js',
|
|
277
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/i18n/fr-fr.min.js',
|
|
278
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/i18n/pt-br.min.js',
|
|
279
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/i18n/ru-ru.min.js'
|
|
280
|
+
]);
|
|
281
|
+
await loader.loadLinks([
|
|
282
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/toastui-editor.min.css',
|
|
283
|
+
loader.cdn + '/npm/@toast-ui/editor@3.2.2/dist/theme/toastui-editor-dark.css'
|
|
284
|
+
]);
|
|
285
|
+
loader.loadStyle('.toastui-editor-defaultUI-toolbar,.ProseMirror{box-sizing:initial !important}.toastui-editor-main{background:var(--g-plain-background);border-radius:0 0 3px 3px}.ProseMirror{cursor:text}.jodit ::-webkit-scrollbar{width:6px;cursor:default;}.jodit ::-webkit-scrollbar-thumb{background:rgba(0,0,0,.1);border-radius:3px;}.jodit ::-webkit-scrollbar-thumb:hover{background: rgba(0,0,0,.2);}');
|
|
286
|
+
return window.toastui.Editor;
|
|
305
287
|
},
|
|
306
288
|
'obj': null,
|
|
307
289
|
'loading': false,
|
|
308
290
|
'resolve': []
|
|
309
291
|
},
|
|
310
292
|
'jodit': {
|
|
311
|
-
func: function () {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return window.Jodit;
|
|
321
|
-
});
|
|
293
|
+
func: async function () {
|
|
294
|
+
await loader.loadScripts([
|
|
295
|
+
loader.cdn + '/npm/jodit@4.2.27/es2015/jodit.fat.min.js'
|
|
296
|
+
]);
|
|
297
|
+
await loader.loadLinks([
|
|
298
|
+
loader.cdn + '/npm/jodit@4.2.27/es2015/jodit.fat.min.css'
|
|
299
|
+
]);
|
|
300
|
+
loader.loadStyle('.jodit-container:not(.jodit_inline){border:none;display:flex;flex-direction:column;}.jodit-container:not(.jodit_inline) .jodit-workplace{cursor:text;flex:1;}.jodit-wysiwyg a{color:unset;}');
|
|
301
|
+
return window.Jodit;
|
|
322
302
|
},
|
|
323
303
|
'obj': null,
|
|
324
304
|
'loading': false,
|
|
325
305
|
'resolve': []
|
|
326
306
|
},
|
|
327
307
|
'compressorjs': {
|
|
328
|
-
func: function () {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
return [window.Compressor];
|
|
337
|
-
});
|
|
308
|
+
func: async function () {
|
|
309
|
+
await loader.loadScripts([
|
|
310
|
+
loader.cdn + '/npm/compressorjs@1.2.1/dist/compressor.min.js'
|
|
311
|
+
]);
|
|
312
|
+
if (!window.Compressor) {
|
|
313
|
+
throw Error('Compressor load failed.');
|
|
314
|
+
}
|
|
315
|
+
return [window.Compressor];
|
|
338
316
|
},
|
|
339
317
|
'obj': null,
|
|
340
318
|
'loading': false,
|
|
341
319
|
'resolve': []
|
|
342
320
|
},
|
|
343
321
|
'pdfjs': {
|
|
344
|
-
func: function () {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
'module': true
|
|
350
|
-
});
|
|
351
|
-
if (!window.pdfjsLib) {
|
|
352
|
-
throw Error('pdf.js load failed.');
|
|
353
|
-
}
|
|
354
|
-
window.pdfjsLib.GlobalWorkerOptions.workerSrc = loader.cdn + '/npm/pdfjs-dist@4.7.76/build/pdf.worker.min.mjs';
|
|
355
|
-
return window.pdfjsLib;
|
|
322
|
+
func: async function () {
|
|
323
|
+
await loader.loadScripts([
|
|
324
|
+
loader.cdn + '/npm/pdfjs-dist@4.7.76/build/pdf.min.mjs'
|
|
325
|
+
], {
|
|
326
|
+
'module': true
|
|
356
327
|
});
|
|
328
|
+
if (!window.pdfjsLib) {
|
|
329
|
+
throw Error('pdf.js load failed.');
|
|
330
|
+
}
|
|
331
|
+
window.pdfjsLib.GlobalWorkerOptions.workerSrc = loader.cdn + '/npm/pdfjs-dist@4.7.76/build/pdf.worker.min.mjs';
|
|
332
|
+
return window.pdfjsLib;
|
|
357
333
|
},
|
|
358
334
|
'obj': null,
|
|
359
335
|
'loading': false,
|
|
360
336
|
'resolve': []
|
|
361
337
|
},
|
|
362
338
|
'qrcode': {
|
|
363
|
-
func: function () {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
return window.QRCode;
|
|
372
|
-
});
|
|
339
|
+
func: async function () {
|
|
340
|
+
await loader.loadScripts([
|
|
341
|
+
loader.cdn + '/npm/qrcode@1.5.1/build/qrcode.js'
|
|
342
|
+
]);
|
|
343
|
+
if (!window.QRCode) {
|
|
344
|
+
throw Error('QRCode load failed.');
|
|
345
|
+
}
|
|
346
|
+
return window.QRCode;
|
|
373
347
|
},
|
|
374
348
|
'obj': null,
|
|
375
349
|
'loading': false,
|
|
376
350
|
'resolve': []
|
|
377
351
|
},
|
|
378
352
|
'mpegts': {
|
|
379
|
-
func: function () {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
return window.mpegts;
|
|
389
|
-
});
|
|
353
|
+
func: async function () {
|
|
354
|
+
await loader.loadScripts([
|
|
355
|
+
loader.cdn + '/npm/mpegts.js@1.7.3/dist/mpegts.min.js'
|
|
356
|
+
]);
|
|
357
|
+
if (!window.mpegts) {
|
|
358
|
+
throw Error('mpegts load failed.');
|
|
359
|
+
}
|
|
360
|
+
window.mpegts.LoggingControl.enableAll = false;
|
|
361
|
+
return window.mpegts;
|
|
390
362
|
},
|
|
391
363
|
'obj': null,
|
|
392
364
|
'loading': false,
|
|
393
365
|
'resolve': []
|
|
394
366
|
},
|
|
395
367
|
'tplink': {
|
|
396
|
-
func: function () {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
return window.HDPluginControl;
|
|
405
|
-
});
|
|
368
|
+
func: async function () {
|
|
369
|
+
await loader.loadScripts([
|
|
370
|
+
__dirname + '/../ext/tplinkhd.min.js'
|
|
371
|
+
]);
|
|
372
|
+
if (!window.HDPluginControl) {
|
|
373
|
+
throw Error('Tplink load failed.');
|
|
374
|
+
}
|
|
375
|
+
return window.HDPluginControl;
|
|
406
376
|
},
|
|
407
377
|
'obj': null,
|
|
408
378
|
'loading': false,
|
|
409
379
|
'resolve': [],
|
|
410
380
|
},
|
|
411
381
|
'tcc': {
|
|
412
|
-
func: function () {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
return window.TencentCaptcha;
|
|
421
|
-
});
|
|
382
|
+
func: async function () {
|
|
383
|
+
await loader.loadScripts([
|
|
384
|
+
'https://turing.captcha.qcloud.com/TJCaptcha.js'
|
|
385
|
+
]);
|
|
386
|
+
if (!window.TencentCaptcha) {
|
|
387
|
+
throw Error('tcc load failed.');
|
|
388
|
+
}
|
|
389
|
+
return window.TencentCaptcha;
|
|
422
390
|
},
|
|
423
391
|
'obj': null,
|
|
424
392
|
'loading': false,
|
|
425
393
|
'resolve': [],
|
|
426
394
|
},
|
|
427
395
|
'cft': {
|
|
428
|
-
func: function () {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
396
|
+
func: async function () {
|
|
397
|
+
await loader.loadScripts([
|
|
398
|
+
'https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit'
|
|
399
|
+
]);
|
|
400
|
+
if (!window.turnstile) {
|
|
401
|
+
throw Error('cft load failed.');
|
|
402
|
+
}
|
|
403
|
+
return window.turnstile;
|
|
404
|
+
},
|
|
405
|
+
'obj': null,
|
|
406
|
+
'loading': false,
|
|
407
|
+
'resolve': [],
|
|
408
|
+
},
|
|
409
|
+
'novnc': {
|
|
410
|
+
func: async function () {
|
|
411
|
+
console.log('alpha, not use');
|
|
412
|
+
try {
|
|
413
|
+
console.log('xxx2');
|
|
414
|
+
const novnc = await Promise.resolve(`${loader.cdn + '/npm/@novnc/novnc@1.6.0/+esm'}`).then(s => __importStar(require(s)));
|
|
415
|
+
console.log('xxx', novnc);
|
|
416
|
+
return novnc.default.default;
|
|
417
|
+
}
|
|
418
|
+
catch (e) {
|
|
419
|
+
console.log('xxx222', e);
|
|
420
|
+
throw Error('novnc load failed.');
|
|
421
|
+
}
|
|
438
422
|
},
|
|
439
423
|
'obj': null,
|
|
440
424
|
'loading': false,
|
|
@@ -540,31 +524,30 @@ const globalEvents = {
|
|
|
540
524
|
}
|
|
541
525
|
};
|
|
542
526
|
function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '', param3 = true) {
|
|
543
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30;
|
|
544
527
|
const eventName = 'on' + name[0].toUpperCase() + name.slice(1);
|
|
545
528
|
switch (name) {
|
|
546
529
|
case 'error': {
|
|
547
530
|
if (typeof taskId !== 'number' || typeof formId !== 'number') {
|
|
548
531
|
break;
|
|
549
532
|
}
|
|
550
|
-
exports.boot
|
|
533
|
+
exports.boot?.[eventName](taskId, formId, param1, param2);
|
|
551
534
|
for (const tid in task.list) {
|
|
552
535
|
const t = task.list[tid];
|
|
553
|
-
|
|
536
|
+
t.class?.[eventName](taskId, formId, param1, param2);
|
|
554
537
|
for (const fid in t.forms) {
|
|
555
|
-
|
|
538
|
+
t.forms[fid].vroot[eventName]?.(taskId, formId, param1, param2);
|
|
556
539
|
}
|
|
557
540
|
}
|
|
558
541
|
break;
|
|
559
542
|
}
|
|
560
543
|
case 'screenResize': {
|
|
561
544
|
globalEvents.screenResize();
|
|
562
|
-
exports.boot
|
|
545
|
+
exports.boot?.[eventName]();
|
|
563
546
|
for (const tid in task.list) {
|
|
564
547
|
const t = task.list[tid];
|
|
565
|
-
|
|
548
|
+
t.class?.[eventName]();
|
|
566
549
|
for (const fid in t.forms) {
|
|
567
|
-
|
|
550
|
+
t.forms[fid].vroot[eventName]?.();
|
|
568
551
|
}
|
|
569
552
|
}
|
|
570
553
|
break;
|
|
@@ -573,38 +556,38 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '', param3
|
|
|
573
556
|
if ((typeof taskId !== 'string') || (typeof formId === 'number')) {
|
|
574
557
|
break;
|
|
575
558
|
}
|
|
576
|
-
exports.boot
|
|
559
|
+
exports.boot?.[eventName]();
|
|
577
560
|
for (const tid in task.list) {
|
|
578
561
|
const t = task.list[tid];
|
|
579
|
-
|
|
562
|
+
t.class?.[eventName](taskId, formId);
|
|
580
563
|
for (const fid in t.forms) {
|
|
581
|
-
|
|
564
|
+
t.forms[fid].vroot[eventName]?.(taskId, formId);
|
|
582
565
|
}
|
|
583
566
|
}
|
|
584
567
|
break;
|
|
585
568
|
}
|
|
586
569
|
case 'formCreated':
|
|
587
570
|
case 'formRemoved': {
|
|
588
|
-
|
|
589
|
-
exports.boot
|
|
571
|
+
globalEvents[name]?.(taskId, formId, param1, param2, param3);
|
|
572
|
+
exports.boot?.[eventName](taskId, formId, param1, param2, param3);
|
|
590
573
|
for (const tid in task.list) {
|
|
591
574
|
const t = task.list[tid];
|
|
592
|
-
|
|
575
|
+
t.class?.[eventName](taskId, formId, param1, param2, param3);
|
|
593
576
|
for (const fid in t.forms) {
|
|
594
|
-
|
|
577
|
+
t.forms[fid].vroot[eventName]?.(taskId, formId, param1, param2, param3);
|
|
595
578
|
}
|
|
596
579
|
}
|
|
597
580
|
break;
|
|
598
581
|
}
|
|
599
582
|
case 'formTitleChanged':
|
|
600
583
|
case 'formIconChanged': {
|
|
601
|
-
|
|
602
|
-
exports.boot
|
|
584
|
+
globalEvents[name]?.(taskId, formId, param1);
|
|
585
|
+
exports.boot?.[eventName](taskId, formId, param1);
|
|
603
586
|
for (const tid in task.list) {
|
|
604
587
|
const t = task.list[tid];
|
|
605
|
-
|
|
588
|
+
t.class?.[eventName](taskId, formId, param1);
|
|
606
589
|
for (const fid in t.forms) {
|
|
607
|
-
|
|
590
|
+
t.forms[fid].vroot[eventName]?.(taskId, formId, param1);
|
|
608
591
|
}
|
|
609
592
|
}
|
|
610
593
|
break;
|
|
@@ -612,13 +595,13 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '', param3
|
|
|
612
595
|
case 'formStateMinChanged':
|
|
613
596
|
case 'formStateMaxChanged':
|
|
614
597
|
case 'formShowChanged': {
|
|
615
|
-
|
|
616
|
-
exports.boot
|
|
598
|
+
globalEvents[name]?.(taskId, formId, param1);
|
|
599
|
+
exports.boot?.[eventName](taskId, formId, param1);
|
|
617
600
|
for (const tid in task.list) {
|
|
618
601
|
const t = task.list[tid];
|
|
619
|
-
|
|
602
|
+
t.class?.[eventName](taskId, formId, param1);
|
|
620
603
|
for (const fid in t.forms) {
|
|
621
|
-
|
|
604
|
+
t.forms[fid].vroot[eventName]?.(taskId, formId, param1);
|
|
622
605
|
}
|
|
623
606
|
}
|
|
624
607
|
break;
|
|
@@ -626,50 +609,50 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '', param3
|
|
|
626
609
|
case 'formFocused':
|
|
627
610
|
case 'formBlurred':
|
|
628
611
|
case 'formFlash': {
|
|
629
|
-
|
|
630
|
-
exports.boot
|
|
612
|
+
globalEvents[name]?.(taskId, formId);
|
|
613
|
+
exports.boot?.[eventName](taskId, formId);
|
|
631
614
|
for (const tid in task.list) {
|
|
632
615
|
const t = task.list[tid];
|
|
633
|
-
|
|
616
|
+
t.class?.[eventName](taskId, formId);
|
|
634
617
|
for (const fid in t.forms) {
|
|
635
|
-
|
|
618
|
+
t.forms[fid].vroot[eventName]?.(taskId, formId);
|
|
636
619
|
}
|
|
637
620
|
}
|
|
638
621
|
break;
|
|
639
622
|
}
|
|
640
623
|
case 'formShowInSystemTaskChange': {
|
|
641
|
-
|
|
642
|
-
exports.boot
|
|
624
|
+
globalEvents[name]?.(taskId, formId, param1);
|
|
625
|
+
exports.boot?.[eventName](taskId, formId, param1);
|
|
643
626
|
for (const tid in task.list) {
|
|
644
627
|
const t = task.list[tid];
|
|
645
|
-
|
|
628
|
+
t.class?.[eventName](taskId, formId, param1);
|
|
646
629
|
for (const fid in t.forms) {
|
|
647
|
-
|
|
630
|
+
t.forms[fid].vroot[eventName]?.(taskId, formId, param1);
|
|
648
631
|
}
|
|
649
632
|
}
|
|
650
633
|
break;
|
|
651
634
|
}
|
|
652
635
|
case 'formHashChange': {
|
|
653
|
-
|
|
654
|
-
exports.boot
|
|
636
|
+
globalEvents[name]?.(taskId, formId, param1, param2);
|
|
637
|
+
exports.boot?.[eventName](taskId, formId, param1, param2);
|
|
655
638
|
for (const tid in task.list) {
|
|
656
639
|
const t = task.list[tid];
|
|
657
|
-
|
|
640
|
+
t.class?.[eventName](taskId, formId, param1, param2);
|
|
658
641
|
for (const fid in t.forms) {
|
|
659
|
-
|
|
642
|
+
t.forms[fid].vroot[eventName]?.(taskId, formId, param1, param2);
|
|
660
643
|
}
|
|
661
644
|
}
|
|
662
645
|
break;
|
|
663
646
|
}
|
|
664
647
|
case 'taskStarted':
|
|
665
648
|
case 'taskEnded': {
|
|
666
|
-
|
|
667
|
-
exports.boot
|
|
649
|
+
globalEvents[name]?.(taskId, formId);
|
|
650
|
+
exports.boot?.[eventName](taskId, formId);
|
|
668
651
|
for (const tid in task.list) {
|
|
669
652
|
const t = task.list[tid];
|
|
670
|
-
|
|
653
|
+
t.class?.[eventName](taskId);
|
|
671
654
|
for (const fid in t.forms) {
|
|
672
|
-
|
|
655
|
+
t.forms[fid].vroot[eventName]?.(taskId);
|
|
673
656
|
}
|
|
674
657
|
}
|
|
675
658
|
break;
|
|
@@ -679,14 +662,14 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '', param3
|
|
|
679
662
|
break;
|
|
680
663
|
}
|
|
681
664
|
if (typeof taskId !== 'string') {
|
|
682
|
-
|
|
665
|
+
break;
|
|
683
666
|
}
|
|
684
|
-
exports.boot
|
|
667
|
+
exports.boot?.[eventName](taskId, formId);
|
|
685
668
|
for (const tid in task.list) {
|
|
686
669
|
const t = task.list[tid];
|
|
687
|
-
|
|
670
|
+
t.class?.[eventName](taskId, formId);
|
|
688
671
|
for (const fid in t.forms) {
|
|
689
|
-
|
|
672
|
+
t.forms[fid].vroot[eventName]?.(taskId, formId);
|
|
690
673
|
}
|
|
691
674
|
}
|
|
692
675
|
break;
|
|
@@ -695,220 +678,214 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '', param3
|
|
|
695
678
|
if (typeof taskId !== 'string') {
|
|
696
679
|
break;
|
|
697
680
|
}
|
|
698
|
-
exports.boot
|
|
681
|
+
exports.boot?.[eventName](taskId);
|
|
699
682
|
for (const tid in task.list) {
|
|
700
683
|
const t = task.list[tid];
|
|
701
|
-
|
|
684
|
+
t.class?.[eventName](taskId);
|
|
702
685
|
for (const fid in t.forms) {
|
|
703
|
-
|
|
686
|
+
t.forms[fid].vroot[eventName]?.(taskId);
|
|
704
687
|
}
|
|
705
688
|
}
|
|
706
689
|
break;
|
|
707
690
|
}
|
|
708
691
|
case 'keydown':
|
|
709
692
|
case 'keyup': {
|
|
710
|
-
|
|
711
|
-
exports.boot
|
|
693
|
+
globalEvents[name]?.(taskId);
|
|
694
|
+
exports.boot?.[eventName](taskId);
|
|
712
695
|
for (const tid in task.list) {
|
|
713
696
|
const t = task.list[tid];
|
|
714
|
-
|
|
697
|
+
t.class?.[eventName](taskId);
|
|
715
698
|
for (const fid in t.forms) {
|
|
716
|
-
|
|
699
|
+
t.forms[fid].vroot[eventName]?.(taskId);
|
|
717
700
|
}
|
|
718
701
|
}
|
|
719
702
|
break;
|
|
720
703
|
}
|
|
721
704
|
}
|
|
722
705
|
}
|
|
723
|
-
function readApp(blob) {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
'type': blob.type
|
|
736
|
-
});
|
|
737
|
-
const z = yield zip.get(nb);
|
|
738
|
-
if (!z) {
|
|
739
|
-
return false;
|
|
740
|
-
}
|
|
741
|
-
const files = {};
|
|
742
|
-
const configContent = yield z.getContent('/config.json');
|
|
743
|
-
if (!configContent) {
|
|
744
|
-
return false;
|
|
745
|
-
}
|
|
746
|
-
const config = JSON.parse(configContent);
|
|
747
|
-
const list = z.readDir('/', {
|
|
748
|
-
'hasChildren': true
|
|
749
|
-
});
|
|
750
|
-
for (const file of list) {
|
|
751
|
-
const mime = tool.getMimeByPath(file.name);
|
|
752
|
-
if (['txt', 'json', 'js', 'css', 'xml', 'html'].includes(mime.ext)) {
|
|
753
|
-
const fab = yield z.getContent(file.path + file.name, 'string');
|
|
754
|
-
if (!fab) {
|
|
755
|
-
continue;
|
|
756
|
-
}
|
|
757
|
-
files[file.path + file.name] = fab.replace(/^\ufeff/, '');
|
|
758
|
-
}
|
|
759
|
-
else {
|
|
760
|
-
const fab = yield z.getContent(file.path + file.name, 'arraybuffer');
|
|
761
|
-
if (!fab) {
|
|
762
|
-
continue;
|
|
763
|
-
}
|
|
764
|
-
files[file.path + file.name] = new Blob([fab], {
|
|
765
|
-
'type': mime.mime
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
return {
|
|
770
|
-
'type': 'app',
|
|
771
|
-
'config': config,
|
|
772
|
-
'files': files,
|
|
773
|
-
'icon': icon
|
|
774
|
-
};
|
|
706
|
+
async function readApp(blob) {
|
|
707
|
+
const head = await tool.blob2Text(blob.slice(0, 5));
|
|
708
|
+
if (head !== '-CGA-') {
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
const iconLength = parseInt(await blob.slice(21, 28).text());
|
|
712
|
+
if (Number.isNaN(iconLength)) {
|
|
713
|
+
return false;
|
|
714
|
+
}
|
|
715
|
+
const icon = iconLength ? await tool.blob2DataUrl(blob.slice(28, 28 + iconLength)) : '';
|
|
716
|
+
const nb = new Blob([blob.slice(5, 21), blob.slice(28 + iconLength)], {
|
|
717
|
+
'type': blob.type
|
|
775
718
|
});
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
719
|
+
const z = await zip.get(nb);
|
|
720
|
+
if (!z) {
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
const files = {};
|
|
724
|
+
const configContent = await z.getContent('/config.json');
|
|
725
|
+
if (!configContent) {
|
|
726
|
+
return false;
|
|
727
|
+
}
|
|
728
|
+
const config = JSON.parse(configContent);
|
|
729
|
+
const list = z.readDir('/', {
|
|
730
|
+
'hasChildren': true
|
|
731
|
+
});
|
|
732
|
+
for (const file of list) {
|
|
733
|
+
const mime = tool.getMimeByPath(file.name);
|
|
734
|
+
if (['txt', 'json', 'js', 'css', 'xml', 'html'].includes(mime.ext)) {
|
|
735
|
+
const fab = await z.getContent(file.path + file.name, 'string');
|
|
736
|
+
if (!fab) {
|
|
737
|
+
continue;
|
|
785
738
|
}
|
|
739
|
+
files[file.path + file.name] = fab.replace(/^\ufeff/, '');
|
|
786
740
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
!
|
|
790
|
-
|
|
791
|
-
!url.startsWith('/package/') &&
|
|
792
|
-
!url.startsWith('/current/') &&
|
|
793
|
-
!url.startsWith('http:') &&
|
|
794
|
-
!url.startsWith('https:') &&
|
|
795
|
-
!url.startsWith('file:')) {
|
|
796
|
-
url = tool.urlResolve(window.location.href, url);
|
|
797
|
-
}
|
|
798
|
-
if (cga) {
|
|
799
|
-
try {
|
|
800
|
-
const blob = yield fs.getContent(url, {
|
|
801
|
-
'progress': (loaded, total) => {
|
|
802
|
-
if (opt.notifyId) {
|
|
803
|
-
form.notifyProgress(opt.notifyId, loaded / total);
|
|
804
|
-
}
|
|
805
|
-
if (opt.progress) {
|
|
806
|
-
opt.progress(loaded, total);
|
|
807
|
-
}
|
|
808
|
-
},
|
|
809
|
-
'cache': opt.cache
|
|
810
|
-
}, taskId);
|
|
811
|
-
if ((blob === null) || typeof blob === 'string') {
|
|
812
|
-
return null;
|
|
813
|
-
}
|
|
814
|
-
if (opt.notifyId) {
|
|
815
|
-
form.notifyProgress(opt.notifyId, 1);
|
|
816
|
-
}
|
|
817
|
-
return (yield readApp(blob)) || null;
|
|
818
|
-
}
|
|
819
|
-
catch (_a) {
|
|
820
|
-
return null;
|
|
741
|
+
else {
|
|
742
|
+
const fab = await z.getContent(file.path + file.name, 'arraybuffer');
|
|
743
|
+
if (!fab) {
|
|
744
|
+
continue;
|
|
821
745
|
}
|
|
746
|
+
files[file.path + file.name] = new Blob([fab], {
|
|
747
|
+
'type': mime.mime
|
|
748
|
+
});
|
|
822
749
|
}
|
|
823
|
-
|
|
824
|
-
|
|
750
|
+
}
|
|
751
|
+
return {
|
|
752
|
+
'type': 'app',
|
|
753
|
+
'config': config,
|
|
754
|
+
'files': files,
|
|
755
|
+
'icon': icon
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
async function fetchApp(url, opt = {}, taskId) {
|
|
759
|
+
let cga = '';
|
|
760
|
+
if (!url.endsWith('/')) {
|
|
761
|
+
const lio = url.lastIndexOf('/');
|
|
762
|
+
cga = lio === -1 ? url : url.slice(lio + 1);
|
|
763
|
+
if (!cga.endsWith('.cga')) {
|
|
764
|
+
return null;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
if (!taskId &&
|
|
768
|
+
!url.startsWith('/clickgo/') &&
|
|
769
|
+
!url.startsWith('/storage/') &&
|
|
770
|
+
!url.startsWith('/mounted/') &&
|
|
771
|
+
!url.startsWith('/package/') &&
|
|
772
|
+
!url.startsWith('/current/') &&
|
|
773
|
+
!url.startsWith('http:') &&
|
|
774
|
+
!url.startsWith('https:') &&
|
|
775
|
+
!url.startsWith('file:')) {
|
|
776
|
+
url = tool.urlResolve(window.location.href, url);
|
|
777
|
+
}
|
|
778
|
+
if (cga) {
|
|
825
779
|
try {
|
|
826
|
-
const blob =
|
|
780
|
+
const blob = await fs.getContent(url, {
|
|
781
|
+
'progress': (loaded, total) => {
|
|
782
|
+
if (opt.notifyId) {
|
|
783
|
+
form.notifyProgress(opt.notifyId, loaded / total);
|
|
784
|
+
}
|
|
785
|
+
if (opt.progress) {
|
|
786
|
+
opt.progress(loaded, total);
|
|
787
|
+
}
|
|
788
|
+
},
|
|
827
789
|
'cache': opt.cache
|
|
828
790
|
}, taskId);
|
|
829
|
-
if (blob === null || typeof blob === 'string') {
|
|
791
|
+
if ((blob === null) || typeof blob === 'string') {
|
|
830
792
|
return null;
|
|
831
793
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}
|
|
837
|
-
const total = config.files.length;
|
|
838
|
-
let loaded = 0;
|
|
839
|
-
if (opt.progress) {
|
|
840
|
-
opt.progress(loaded + 1, total + 1);
|
|
841
|
-
}
|
|
842
|
-
for (const file of config.files) {
|
|
843
|
-
fs.getContent(url + file.slice(1), {
|
|
844
|
-
'cache': opt.cache
|
|
845
|
-
}, taskId).then(function (blob) {
|
|
846
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
847
|
-
if (blob === null || typeof blob === 'string') {
|
|
848
|
-
clickgo.form.notify({
|
|
849
|
-
'title': 'File not found',
|
|
850
|
-
'content': url + file.slice(1),
|
|
851
|
-
'type': 'danger'
|
|
852
|
-
});
|
|
853
|
-
return;
|
|
854
|
-
}
|
|
855
|
-
const mime = tool.getMimeByPath(file);
|
|
856
|
-
if (['txt', 'json', 'js', 'css', 'xml', 'html'].includes(mime.ext)) {
|
|
857
|
-
files[file] = (yield tool.blob2Text(blob)).replace(/^\ufeff/, '');
|
|
858
|
-
}
|
|
859
|
-
else {
|
|
860
|
-
files[file] = blob;
|
|
861
|
-
}
|
|
862
|
-
++loaded;
|
|
863
|
-
if (opt.notifyId) {
|
|
864
|
-
form.notifyProgress(opt.notifyId, loaded / total);
|
|
865
|
-
}
|
|
866
|
-
if (opt.progress) {
|
|
867
|
-
opt.progress(loaded + 1, total + 1);
|
|
868
|
-
}
|
|
869
|
-
if (loaded < total) {
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
resolve();
|
|
873
|
-
});
|
|
874
|
-
}).catch(function () {
|
|
875
|
-
++loaded;
|
|
876
|
-
if (opt.notifyId) {
|
|
877
|
-
form.notifyProgress(opt.notifyId, loaded / total);
|
|
878
|
-
}
|
|
879
|
-
if (opt.progress) {
|
|
880
|
-
opt.progress(loaded + 1, total + 1);
|
|
881
|
-
}
|
|
882
|
-
if (loaded < total) {
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
885
|
-
resolve();
|
|
886
|
-
});
|
|
887
|
-
}
|
|
888
|
-
});
|
|
794
|
+
if (opt.notifyId) {
|
|
795
|
+
form.notifyProgress(opt.notifyId, 1);
|
|
796
|
+
}
|
|
797
|
+
return await readApp(blob) || null;
|
|
889
798
|
}
|
|
890
|
-
catch
|
|
891
|
-
console.log('core.fetchApp', e);
|
|
892
|
-
trigger('error', 0, 0, e, e.message);
|
|
799
|
+
catch {
|
|
893
800
|
return null;
|
|
894
801
|
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
802
|
+
}
|
|
803
|
+
let config;
|
|
804
|
+
const files = {};
|
|
805
|
+
try {
|
|
806
|
+
const blob = await fs.getContent(url + 'config.json', {
|
|
807
|
+
'cache': opt.cache
|
|
808
|
+
}, taskId);
|
|
809
|
+
if (blob === null || typeof blob === 'string') {
|
|
810
|
+
return null;
|
|
898
811
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
if (
|
|
902
|
-
|
|
812
|
+
config = JSON.parse(await tool.blob2Text(blob));
|
|
813
|
+
await new Promise(function (resolve) {
|
|
814
|
+
if (!config.files) {
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
const total = config.files.length;
|
|
818
|
+
let loaded = 0;
|
|
819
|
+
if (opt.progress) {
|
|
820
|
+
opt.progress(loaded + 1, total + 1);
|
|
903
821
|
}
|
|
822
|
+
for (const file of config.files) {
|
|
823
|
+
fs.getContent(url + file.slice(1), {
|
|
824
|
+
'cache': opt.cache
|
|
825
|
+
}, taskId).then(async function (blob) {
|
|
826
|
+
if (blob === null || typeof blob === 'string') {
|
|
827
|
+
clickgo.form.notify({
|
|
828
|
+
'title': 'File not found',
|
|
829
|
+
'content': url + file.slice(1),
|
|
830
|
+
'type': 'danger'
|
|
831
|
+
});
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
const mime = tool.getMimeByPath(file);
|
|
835
|
+
if (['txt', 'json', 'js', 'css', 'xml', 'html'].includes(mime.ext)) {
|
|
836
|
+
files[file] = (await tool.blob2Text(blob)).replace(/^\ufeff/, '');
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
files[file] = blob;
|
|
840
|
+
}
|
|
841
|
+
++loaded;
|
|
842
|
+
if (opt.notifyId) {
|
|
843
|
+
form.notifyProgress(opt.notifyId, loaded / total);
|
|
844
|
+
}
|
|
845
|
+
if (opt.progress) {
|
|
846
|
+
opt.progress(loaded + 1, total + 1);
|
|
847
|
+
}
|
|
848
|
+
if (loaded < total) {
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
resolve();
|
|
852
|
+
}).catch(function () {
|
|
853
|
+
++loaded;
|
|
854
|
+
if (opt.notifyId) {
|
|
855
|
+
form.notifyProgress(opt.notifyId, loaded / total);
|
|
856
|
+
}
|
|
857
|
+
if (opt.progress) {
|
|
858
|
+
opt.progress(loaded + 1, total + 1);
|
|
859
|
+
}
|
|
860
|
+
if (loaded < total) {
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
resolve();
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
catch (e) {
|
|
869
|
+
console.log('core.fetchApp', e);
|
|
870
|
+
trigger('error', 0, 0, e, e.message);
|
|
871
|
+
return null;
|
|
872
|
+
}
|
|
873
|
+
let icon = '';
|
|
874
|
+
if (config.icon && (files[config.icon] instanceof Blob)) {
|
|
875
|
+
icon = await tool.blob2DataUrl(files[config.icon]);
|
|
876
|
+
}
|
|
877
|
+
if (icon === '') {
|
|
878
|
+
const iconBlob = await fs.getContent('/clickgo/icon.png', undefined, taskId);
|
|
879
|
+
if (iconBlob instanceof Blob) {
|
|
880
|
+
icon = await tool.blob2DataUrl(iconBlob);
|
|
904
881
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
}
|
|
882
|
+
}
|
|
883
|
+
return {
|
|
884
|
+
'type': 'app',
|
|
885
|
+
'config': config,
|
|
886
|
+
'files': files,
|
|
887
|
+
'icon': icon
|
|
888
|
+
};
|
|
912
889
|
}
|
|
913
890
|
function getAvailArea() {
|
|
914
891
|
if (Object.keys(form.simpleSystemTaskRoot.forms).length > 0) {
|