clickgo 3.1.1-dev10 → 3.1.3-dev12
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/dist/app/demo/app.js +0 -72
- package/dist/app/demo/config.json +109 -0
- package/dist/app/demo/form/control/button/button.js +12 -11
- package/dist/app/demo/form/control/button/button.xml +6 -6
- package/dist/app/demo/form/control/check/check.js +14 -10
- package/dist/app/demo/form/control/file/file.js +15 -13
- package/dist/app/demo/form/control/{overflow/overflow.css → flow/flow.css} +0 -0
- package/dist/app/demo/form/control/flow/flow.js +64 -0
- package/dist/app/demo/form/control/{overflow/overflow.scss → flow/flow.scss} +0 -0
- package/dist/app/demo/form/control/flow/flow.xml +101 -0
- package/dist/app/demo/form/control/form/form.js +1 -1
- package/dist/app/demo/form/control/form/form.xml +3 -3
- package/dist/app/demo/form/control/img/img.xml +2 -2
- package/dist/app/demo/form/control/list/list.js +95 -75
- package/dist/app/demo/form/control/list/list.xml +15 -11
- package/dist/app/demo/form/control/marquee/marquee.js +12 -10
- package/dist/app/demo/form/control/menu/menu.js +10 -6
- package/dist/app/demo/form/control/monaco/monaco.js +50 -60
- package/dist/app/demo/form/control/monaco/monaco.xml +6 -5
- package/dist/app/demo/form/control/property/property.js +131 -127
- package/dist/app/demo/form/control/radio/radio.js +9 -5
- package/dist/app/demo/form/control/scroll/scroll.js +16 -12
- package/dist/app/demo/form/control/scroll/scroll.xml +10 -10
- package/dist/app/demo/form/control/select/select.js +132 -71
- package/dist/app/demo/form/control/select/select.xml +69 -67
- package/dist/app/demo/form/control/tab/tab.js +21 -20
- package/dist/app/demo/form/control/tab/tab.xml +2 -2
- package/dist/app/demo/form/control/text/text.js +53 -45
- package/dist/app/demo/form/control/text/text.xml +3 -3
- package/dist/app/demo/form/control/{greatview/greatview.css → vflow/vflow.css} +0 -0
- package/dist/app/demo/form/control/vflow/vflow.js +79 -0
- package/dist/app/demo/form/control/{greatview/greatview.scss → vflow/vflow.scss} +0 -0
- package/dist/app/demo/form/control/{greatview/greatview.xml → vflow/vflow.xml} +25 -25
- package/dist/app/demo/form/event/form/form.js +58 -56
- package/dist/app/demo/form/event/form/form.xml +3 -3
- package/dist/app/demo/form/event/screen/screen.js +30 -28
- package/dist/app/demo/form/event/screen/screen.xml +2 -2
- package/dist/app/demo/form/event/task/task.js +31 -31
- package/dist/app/demo/form/event/task/task.xml +3 -3
- package/dist/app/demo/form/main.js +166 -5
- package/dist/app/demo/form/main.xml +37 -35
- package/dist/app/demo/form/method/aform/aform.js +57 -0
- package/dist/app/demo/form/method/aform/aform.xml +35 -0
- package/dist/app/demo/form/method/aform/test.xml +6 -0
- package/dist/app/demo/form/method/core/core.js +11 -8
- package/dist/app/demo/form/method/core/core.xml +2 -1
- package/dist/app/demo/form/method/dom/dom.js +91 -99
- package/dist/app/demo/form/method/dom/dom.xml +6 -7
- package/dist/app/demo/form/method/form/form.js +10 -28
- package/dist/app/demo/form/method/form/form.xml +8 -15
- package/dist/app/demo/form/method/fs/fs.js +34 -33
- package/dist/app/demo/form/method/fs/fs.xml +1 -1
- package/dist/app/demo/form/method/fs/text.js +12 -12
- package/dist/app/demo/form/method/native/native.js +50 -0
- package/dist/app/demo/form/method/native/native.xml +12 -0
- package/dist/app/demo/form/method/system/system.js +50 -0
- package/dist/app/demo/form/method/system/system.xml +11 -0
- package/dist/app/demo/form/method/task/task.js +59 -61
- package/dist/app/demo/form/method/task/task.xml +4 -6
- package/dist/app/demo/form/method/theme/theme.js +14 -14
- package/dist/app/demo/form/method/tool/tool.js +29 -28
- package/dist/app/demo/form/method/tool/tool.xml +3 -3
- package/dist/app/demo/form/method/zip/zip.js +46 -41
- package/dist/app/demo/form/method/zip/zip.xml +1 -1
- package/dist/app/task/app.js +0 -25
- package/dist/app/task/config.json +29 -0
- package/dist/app/task/form/bar/bar.js +2 -2
- package/dist/app/task/form/bar/bar.xml +1 -1
- package/dist/clickgo.js +17 -5
- package/dist/clickgo.ts +22 -3
- package/dist/control/common.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/global.css +1 -1
- package/dist/index.js +28 -8
- package/dist/index.ts +33 -7
- package/dist/lib/control.js +75 -105
- package/dist/lib/control.ts +102 -124
- package/dist/lib/core.js +108 -252
- package/dist/lib/core.ts +122 -268
- package/dist/lib/dom.js +564 -483
- package/dist/lib/dom.ts +703 -546
- package/dist/lib/form.js +170 -153
- package/dist/lib/form.ts +132 -99
- package/dist/lib/fs.js +1 -1
- package/dist/lib/fs.ts +1 -1
- package/dist/lib/native.js +135 -8
- package/dist/lib/native.ts +176 -12
- package/dist/lib/task.js +301 -175
- package/dist/lib/task.ts +330 -207
- package/dist/lib/tool.js +48 -1
- package/dist/lib/tool.ts +61 -0
- package/dist/lib/zip.ts +2 -0
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +1 -1
- package/types/index.d.ts +26 -29
- package/dist/app/demo/form/control/greatview/greatview.js +0 -92
- package/dist/app/demo/form/control/overflow/overflow.js +0 -70
- package/dist/app/demo/form/control/overflow/overflow.xml +0 -98
- package/dist/app/demo/form/control/view/view.css +0 -1
- package/dist/app/demo/form/control/view/view.js +0 -73
- package/dist/app/demo/form/control/view/view.scss +0 -18
- package/dist/app/demo/form/control/view/view.xml +0 -94
- package/dist/app/demo/form/method/form/test.xml +0 -5
package/dist/lib/task.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.refreshSystemPosition = exports.clearSystem = exports.setSystem = exports.systemTaskInfo = exports.sleep = exports.removeTimer = exports.createTimer = exports.clearLocaleLang = exports.setLocaleLang = exports.setLocale = exports.clearLocale = exports.loadLocale = exports.loadLocaleData = exports.end = exports.run = exports.getList = exports.get = exports.offFrame = exports.onFrame = exports.
|
|
12
|
+
exports.refreshSystemPosition = exports.clearSystem = exports.setSystem = exports.systemTaskInfo = exports.sleep = exports.removeTimer = exports.createTimer = exports.clearLocaleLang = exports.setLocaleLang = exports.setLocale = exports.clearLocale = exports.loadLocale = exports.loadLocaleData = exports.end = exports.run = exports.getList = exports.get = exports.offFrame = exports.onFrame = exports.getFocus = exports.setFocus = exports.lastId = exports.list = void 0;
|
|
13
13
|
const clickgo = require("../clickgo");
|
|
14
14
|
const core = require("./core");
|
|
15
15
|
const dom = require("./dom");
|
|
@@ -17,22 +17,19 @@ const tool = require("./tool");
|
|
|
17
17
|
const form = require("./form");
|
|
18
18
|
const control = require("./control");
|
|
19
19
|
const fs = require("./fs");
|
|
20
|
+
const theme = require("./theme");
|
|
20
21
|
const native = require("./native");
|
|
21
22
|
exports.list = {};
|
|
22
23
|
exports.lastId = 0;
|
|
23
|
-
let
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
mainTaskId = taskId;
|
|
29
|
-
return true;
|
|
24
|
+
let focusId = null;
|
|
25
|
+
function setFocus(id) {
|
|
26
|
+
focusId = id !== null && id !== void 0 ? id : null;
|
|
30
27
|
}
|
|
31
|
-
exports.
|
|
32
|
-
function
|
|
33
|
-
return
|
|
28
|
+
exports.setFocus = setFocus;
|
|
29
|
+
function getFocus() {
|
|
30
|
+
return focusId;
|
|
34
31
|
}
|
|
35
|
-
exports.
|
|
32
|
+
exports.getFocus = getFocus;
|
|
36
33
|
const localeData = {
|
|
37
34
|
'en': {
|
|
38
35
|
'loading': 'Loading...',
|
|
@@ -138,7 +135,7 @@ function get(tid) {
|
|
|
138
135
|
return null;
|
|
139
136
|
}
|
|
140
137
|
return {
|
|
141
|
-
'name': exports.list[tid].config.name,
|
|
138
|
+
'name': exports.list[tid].app.config.name,
|
|
142
139
|
'locale': exports.list[tid].locale.lang,
|
|
143
140
|
'customTheme': exports.list[tid].customTheme,
|
|
144
141
|
'formCount': Object.keys(exports.list[tid].forms).length,
|
|
@@ -153,7 +150,7 @@ function getList() {
|
|
|
153
150
|
for (const tid in exports.list) {
|
|
154
151
|
const item = exports.list[tid];
|
|
155
152
|
rtn[tid] = {
|
|
156
|
-
'name': item.config.name,
|
|
153
|
+
'name': item.app.config.name,
|
|
157
154
|
'locale': item.locale.lang,
|
|
158
155
|
'customTheme': item.customTheme,
|
|
159
156
|
'formCount': Object.keys(item.forms).length,
|
|
@@ -194,27 +191,41 @@ function run(url, opt = {}) {
|
|
|
194
191
|
'current': ntask ? ntask.current : undefined,
|
|
195
192
|
'progress': opt.progress
|
|
196
193
|
});
|
|
197
|
-
if (
|
|
198
|
-
if (notifyId) {
|
|
199
|
-
setTimeout(function () {
|
|
200
|
-
form.hideNotify(notifyId);
|
|
201
|
-
}, 2000);
|
|
202
|
-
}
|
|
203
|
-
return -1;
|
|
204
|
-
}
|
|
205
|
-
if (notifyId && !app.net) {
|
|
194
|
+
if (notifyId) {
|
|
206
195
|
setTimeout(function () {
|
|
207
196
|
form.hideNotify(notifyId);
|
|
208
197
|
}, 2000);
|
|
209
198
|
}
|
|
199
|
+
if (!app) {
|
|
200
|
+
return -1;
|
|
201
|
+
}
|
|
210
202
|
const taskId = ++exports.lastId;
|
|
211
|
-
const unblock =
|
|
203
|
+
const unblock = opt.unblock ? tool.clone(opt.unblock) : [];
|
|
204
|
+
const unblockSys = [
|
|
205
|
+
'require',
|
|
206
|
+
'__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Error', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch'
|
|
207
|
+
];
|
|
208
|
+
for (const name of unblockSys) {
|
|
209
|
+
if (unblock.includes(name)) {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
unblock.push(name);
|
|
213
|
+
}
|
|
212
214
|
const invoke = {};
|
|
213
215
|
if (!unblock.includes('window')) {
|
|
214
|
-
invoke.window =
|
|
216
|
+
invoke.window = {};
|
|
217
|
+
for (const name of unblock) {
|
|
218
|
+
if (window[name] === undefined) {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
invoke.window[name] = window[name];
|
|
222
|
+
}
|
|
215
223
|
}
|
|
216
224
|
const ks = Object.getOwnPropertyNames(window);
|
|
217
225
|
for (const k of ks) {
|
|
226
|
+
if (k.includes('window')) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
218
229
|
if (k.includes('Event')) {
|
|
219
230
|
continue;
|
|
220
231
|
}
|
|
@@ -224,12 +235,6 @@ function run(url, opt = {}) {
|
|
|
224
235
|
if (/^[0-9]+$/.test(k)) {
|
|
225
236
|
continue;
|
|
226
237
|
}
|
|
227
|
-
if ([
|
|
228
|
-
'require',
|
|
229
|
-
'__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch'
|
|
230
|
-
].includes(k)) {
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
238
|
if (unblock.includes(k)) {
|
|
234
239
|
continue;
|
|
235
240
|
}
|
|
@@ -269,12 +274,18 @@ function run(url, opt = {}) {
|
|
|
269
274
|
getVersion: function () {
|
|
270
275
|
return clickgo.getVersion();
|
|
271
276
|
},
|
|
272
|
-
|
|
273
|
-
return clickgo.
|
|
277
|
+
isNative() {
|
|
278
|
+
return clickgo.isNative();
|
|
274
279
|
},
|
|
275
280
|
getPlatform() {
|
|
276
281
|
return clickgo.getPlatform();
|
|
277
282
|
},
|
|
283
|
+
isImmersion() {
|
|
284
|
+
return clickgo.isImmersion();
|
|
285
|
+
},
|
|
286
|
+
hasFrame() {
|
|
287
|
+
return clickgo.hasFrame();
|
|
288
|
+
},
|
|
278
289
|
'control': {
|
|
279
290
|
'AbstractControl': class extends control.AbstractControl {
|
|
280
291
|
get taskId() {
|
|
@@ -300,89 +311,92 @@ function run(url, opt = {}) {
|
|
|
300
311
|
getCdn: function () {
|
|
301
312
|
return core.getCdn();
|
|
302
313
|
},
|
|
303
|
-
initModules: function (names) {
|
|
304
|
-
return clickgo.core.initModules(names);
|
|
305
|
-
},
|
|
306
314
|
getModule: function (name) {
|
|
307
|
-
return
|
|
315
|
+
return core.getModule(name);
|
|
308
316
|
},
|
|
309
317
|
readApp: function (blob) {
|
|
310
|
-
return
|
|
318
|
+
return core.readApp(blob);
|
|
311
319
|
},
|
|
312
320
|
getAvailArea: function () {
|
|
313
|
-
return
|
|
321
|
+
return core.getAvailArea();
|
|
314
322
|
}
|
|
315
323
|
},
|
|
316
324
|
'dom': {
|
|
317
325
|
setGlobalCursor: function (type) {
|
|
318
|
-
|
|
326
|
+
dom.setGlobalCursor(type);
|
|
319
327
|
},
|
|
320
328
|
hasTouchButMouse: function (e) {
|
|
321
|
-
return
|
|
329
|
+
return dom.hasTouchButMouse(e);
|
|
322
330
|
},
|
|
323
331
|
getStyleCount: function (taskId, type) {
|
|
324
|
-
return
|
|
325
|
-
},
|
|
326
|
-
getSize: function (el) {
|
|
327
|
-
return clickgo.dom.getSize(el);
|
|
332
|
+
return dom.getStyleCount(taskId, type);
|
|
328
333
|
},
|
|
329
334
|
watchSize: function (el, cb, immediate = false) {
|
|
330
|
-
return
|
|
335
|
+
return dom.watchSize(el, cb, immediate, taskId);
|
|
331
336
|
},
|
|
332
337
|
unwatchSize: function (el) {
|
|
333
|
-
|
|
338
|
+
dom.unwatchSize(el, taskId);
|
|
334
339
|
},
|
|
335
|
-
|
|
336
|
-
|
|
340
|
+
isWatchSize(el) {
|
|
341
|
+
return dom.isWatchSize(el);
|
|
337
342
|
},
|
|
338
343
|
watch: function (el, cb, mode = 'default', immediate = false) {
|
|
339
|
-
|
|
344
|
+
dom.watch(el, cb, mode, immediate, taskId);
|
|
340
345
|
},
|
|
341
346
|
unwatch: function (el) {
|
|
342
|
-
|
|
347
|
+
dom.unwatch(el, taskId);
|
|
343
348
|
},
|
|
344
|
-
|
|
345
|
-
|
|
349
|
+
isWatch(el) {
|
|
350
|
+
return dom.isWatch(el);
|
|
346
351
|
},
|
|
347
352
|
watchStyle: function (el, name, cb, immediate = false) {
|
|
348
|
-
|
|
353
|
+
dom.watchStyle(el, name, cb, immediate);
|
|
349
354
|
},
|
|
350
355
|
isWatchStyle: function (el) {
|
|
351
|
-
return
|
|
356
|
+
return dom.isWatchStyle(el);
|
|
357
|
+
},
|
|
358
|
+
watchProperty(el, name, cb, immediate = false) {
|
|
359
|
+
dom.watchProperty(el, name, cb, immediate);
|
|
360
|
+
},
|
|
361
|
+
isWatchProperty(el) {
|
|
362
|
+
return dom.isWatchProperty(el);
|
|
363
|
+
},
|
|
364
|
+
bindClick(e, handler) {
|
|
365
|
+
dom.bindClick(e, handler);
|
|
352
366
|
},
|
|
353
367
|
bindDown: function (oe, opt) {
|
|
354
|
-
|
|
368
|
+
dom.bindDown(oe, opt);
|
|
355
369
|
},
|
|
356
|
-
bindGesture: function (
|
|
357
|
-
|
|
370
|
+
bindGesture: function (oe, before, handler) {
|
|
371
|
+
dom.bindGesture(oe, before, handler);
|
|
358
372
|
},
|
|
359
373
|
bindLong: function (e, long) {
|
|
360
|
-
|
|
374
|
+
dom.bindLong(e, long);
|
|
361
375
|
},
|
|
362
376
|
bindDrag: function (e, opt) {
|
|
363
|
-
|
|
377
|
+
dom.bindDrag(e, opt);
|
|
364
378
|
},
|
|
365
|
-
'is':
|
|
379
|
+
'is': dom.is,
|
|
366
380
|
bindMove: function (e, opt) {
|
|
367
|
-
return
|
|
381
|
+
return dom.bindMove(e, opt);
|
|
368
382
|
},
|
|
369
383
|
bindResize: function (e, opt) {
|
|
370
|
-
|
|
384
|
+
dom.bindResize(e, opt);
|
|
371
385
|
},
|
|
372
386
|
findParentByData: function (el, name) {
|
|
373
|
-
return
|
|
387
|
+
return dom.findParentByData(el, name);
|
|
374
388
|
},
|
|
375
389
|
findParentByClass: function (el, name) {
|
|
376
|
-
return
|
|
390
|
+
return dom.findParentByClass(el, name);
|
|
377
391
|
},
|
|
378
392
|
siblings: function (el) {
|
|
379
|
-
return
|
|
393
|
+
return dom.siblings(el);
|
|
380
394
|
},
|
|
381
395
|
siblingsData: function (el, name) {
|
|
382
|
-
return
|
|
396
|
+
return dom.siblingsData(el, name);
|
|
383
397
|
},
|
|
384
398
|
fullscreen: function () {
|
|
385
|
-
return
|
|
399
|
+
return dom.fullscreen();
|
|
386
400
|
}
|
|
387
401
|
},
|
|
388
402
|
'form': {
|
|
@@ -392,73 +406,76 @@ function run(url, opt = {}) {
|
|
|
392
406
|
}
|
|
393
407
|
},
|
|
394
408
|
min: function (fid) {
|
|
395
|
-
return
|
|
409
|
+
return form.min(fid);
|
|
396
410
|
},
|
|
397
411
|
max: function max(fid) {
|
|
398
|
-
return
|
|
412
|
+
return form.max(fid);
|
|
399
413
|
},
|
|
400
414
|
close: function (fid) {
|
|
401
|
-
return
|
|
415
|
+
return form.close(fid);
|
|
402
416
|
},
|
|
403
417
|
bindResize: function (e, border) {
|
|
404
|
-
|
|
418
|
+
form.bindResize(e, border);
|
|
405
419
|
},
|
|
406
420
|
bindDrag: function (e) {
|
|
407
|
-
|
|
421
|
+
form.bindDrag(e);
|
|
408
422
|
},
|
|
409
423
|
getTaskId: function (fid) {
|
|
410
|
-
return
|
|
424
|
+
return form.getTaskId(fid);
|
|
411
425
|
},
|
|
412
426
|
get: function (fid) {
|
|
413
|
-
return
|
|
427
|
+
return form.get(fid);
|
|
414
428
|
},
|
|
415
429
|
getList: function (tid) {
|
|
416
|
-
return
|
|
430
|
+
return form.getList(tid);
|
|
431
|
+
},
|
|
432
|
+
getFocus: function () {
|
|
433
|
+
return form.getFocus();
|
|
417
434
|
},
|
|
418
435
|
changeFocus: function (fid = 0) {
|
|
419
|
-
|
|
436
|
+
form.changeFocus(fid);
|
|
420
437
|
},
|
|
421
438
|
getMaxZIndexID: function (out) {
|
|
422
|
-
return
|
|
439
|
+
return form.getMaxZIndexID(out);
|
|
423
440
|
},
|
|
424
441
|
getRectByBorder: function (border) {
|
|
425
|
-
return
|
|
442
|
+
return form.getRectByBorder(border);
|
|
426
443
|
},
|
|
427
444
|
showCircular: function (x, y) {
|
|
428
|
-
|
|
445
|
+
form.showCircular(x, y);
|
|
429
446
|
},
|
|
430
447
|
moveRectangle: function (border) {
|
|
431
|
-
|
|
448
|
+
form.moveRectangle(border);
|
|
432
449
|
},
|
|
433
450
|
showRectangle: function (x, y, border) {
|
|
434
|
-
|
|
451
|
+
form.showRectangle(x, y, border);
|
|
435
452
|
},
|
|
436
453
|
hideRectangle: function () {
|
|
437
|
-
|
|
454
|
+
form.hideRectangle();
|
|
438
455
|
},
|
|
439
456
|
showDrag: function () {
|
|
440
|
-
|
|
457
|
+
form.showDrag();
|
|
441
458
|
},
|
|
442
459
|
moveDrag: function (opt) {
|
|
443
|
-
|
|
460
|
+
form.moveDrag(opt);
|
|
444
461
|
},
|
|
445
462
|
hideDrag: function () {
|
|
446
|
-
|
|
463
|
+
form.hideDrag();
|
|
447
464
|
},
|
|
448
465
|
notify: function (opt) {
|
|
449
|
-
return
|
|
466
|
+
return form.notify(opt);
|
|
450
467
|
},
|
|
451
468
|
notifyProgress: function (notifyId, per) {
|
|
452
|
-
|
|
469
|
+
form.notifyProgress(notifyId, per);
|
|
453
470
|
},
|
|
454
471
|
hideNotify: function (notifyId) {
|
|
455
|
-
|
|
472
|
+
form.hideNotify(notifyId);
|
|
456
473
|
},
|
|
457
474
|
showPop: function (el, pop, direction, opt = {}) {
|
|
458
|
-
|
|
475
|
+
form.showPop(el, pop, direction, opt);
|
|
459
476
|
},
|
|
460
477
|
hidePop: function (pop) {
|
|
461
|
-
|
|
478
|
+
form.hidePop(pop);
|
|
462
479
|
},
|
|
463
480
|
dialog: function (opt) {
|
|
464
481
|
if (typeof opt === 'string') {
|
|
@@ -467,7 +484,7 @@ function run(url, opt = {}) {
|
|
|
467
484
|
};
|
|
468
485
|
}
|
|
469
486
|
opt.taskId = taskId;
|
|
470
|
-
return
|
|
487
|
+
return form.dialog(opt);
|
|
471
488
|
},
|
|
472
489
|
confirm: function (opt) {
|
|
473
490
|
if (typeof opt === 'string') {
|
|
@@ -476,16 +493,16 @@ function run(url, opt = {}) {
|
|
|
476
493
|
};
|
|
477
494
|
}
|
|
478
495
|
opt.taskId = taskId;
|
|
479
|
-
return
|
|
496
|
+
return form.confirm(opt);
|
|
480
497
|
},
|
|
481
498
|
flash: function (fid) {
|
|
482
|
-
|
|
499
|
+
form.flash(fid, taskId);
|
|
483
500
|
},
|
|
484
501
|
showLauncher: function () {
|
|
485
|
-
|
|
502
|
+
form.showLauncher();
|
|
486
503
|
},
|
|
487
504
|
hideLauncher: function () {
|
|
488
|
-
|
|
505
|
+
form.hideLauncher();
|
|
489
506
|
}
|
|
490
507
|
},
|
|
491
508
|
'fs': {
|
|
@@ -496,31 +513,31 @@ function run(url, opt = {}) {
|
|
|
496
513
|
if (!options.current) {
|
|
497
514
|
options.current = exports.list[taskId].current;
|
|
498
515
|
}
|
|
499
|
-
return
|
|
516
|
+
return fs.getContent(path, options);
|
|
500
517
|
},
|
|
501
518
|
putContent: function (path, data, options = {}) {
|
|
502
519
|
if (!options.current) {
|
|
503
520
|
options.current = exports.list[taskId].current;
|
|
504
521
|
}
|
|
505
|
-
return
|
|
522
|
+
return fs.putContent(path, data, options);
|
|
506
523
|
},
|
|
507
524
|
readLink: function (path, options = {}) {
|
|
508
525
|
if (!options.current) {
|
|
509
526
|
options.current = exports.list[taskId].current;
|
|
510
527
|
}
|
|
511
|
-
return
|
|
528
|
+
return fs.readLink(path, options);
|
|
512
529
|
},
|
|
513
530
|
symlink: function (fPath, linkPath, options = {}) {
|
|
514
531
|
if (!options.current) {
|
|
515
532
|
options.current = exports.list[taskId].current;
|
|
516
533
|
}
|
|
517
|
-
return
|
|
534
|
+
return fs.symlink(fPath, linkPath, options);
|
|
518
535
|
},
|
|
519
536
|
unlink: function (path, options = {}) {
|
|
520
537
|
if (!options.current) {
|
|
521
538
|
options.current = exports.list[taskId].current;
|
|
522
539
|
}
|
|
523
|
-
return
|
|
540
|
+
return fs.unlink(path, options);
|
|
524
541
|
},
|
|
525
542
|
stats: function (path, options = {}) {
|
|
526
543
|
if (!options.files) {
|
|
@@ -529,7 +546,7 @@ function run(url, opt = {}) {
|
|
|
529
546
|
if (!options.current) {
|
|
530
547
|
options.current = exports.list[taskId].current;
|
|
531
548
|
}
|
|
532
|
-
return
|
|
549
|
+
return fs.stats(path, options);
|
|
533
550
|
},
|
|
534
551
|
isDir: function (path, options = {}) {
|
|
535
552
|
if (!options.files) {
|
|
@@ -538,7 +555,7 @@ function run(url, opt = {}) {
|
|
|
538
555
|
if (!options.current) {
|
|
539
556
|
options.current = exports.list[taskId].current;
|
|
540
557
|
}
|
|
541
|
-
return
|
|
558
|
+
return fs.isDir(path, options);
|
|
542
559
|
},
|
|
543
560
|
isFile: function (path, options = {}) {
|
|
544
561
|
if (!options.files) {
|
|
@@ -547,37 +564,37 @@ function run(url, opt = {}) {
|
|
|
547
564
|
if (!options.current) {
|
|
548
565
|
options.current = exports.list[taskId].current;
|
|
549
566
|
}
|
|
550
|
-
return
|
|
567
|
+
return fs.isFile(path, options);
|
|
551
568
|
},
|
|
552
569
|
mkdir: function (path, mode, options = {}) {
|
|
553
570
|
if (!options.current) {
|
|
554
571
|
options.current = exports.list[taskId].current;
|
|
555
572
|
}
|
|
556
|
-
return
|
|
573
|
+
return fs.mkdir(path, mode, options);
|
|
557
574
|
},
|
|
558
575
|
rmdir: function (path, options = {}) {
|
|
559
576
|
if (!options.current) {
|
|
560
577
|
options.current = exports.list[taskId].current;
|
|
561
578
|
}
|
|
562
|
-
return
|
|
579
|
+
return fs.rmdir(path, options);
|
|
563
580
|
},
|
|
564
581
|
rmdirDeep: function (path, options = {}) {
|
|
565
582
|
if (!options.current) {
|
|
566
583
|
options.current = exports.list[taskId].current;
|
|
567
584
|
}
|
|
568
|
-
return
|
|
585
|
+
return fs.rmdirDeep(path, options);
|
|
569
586
|
},
|
|
570
587
|
chmod: function (path, mod, options = {}) {
|
|
571
588
|
if (!options.current) {
|
|
572
589
|
options.current = exports.list[taskId].current;
|
|
573
590
|
}
|
|
574
|
-
return
|
|
591
|
+
return fs.chmod(path, mod, options);
|
|
575
592
|
},
|
|
576
593
|
rename(oldPath, newPath, options = {}) {
|
|
577
594
|
if (!options.current) {
|
|
578
595
|
options.current = exports.list[taskId].current;
|
|
579
596
|
}
|
|
580
|
-
return
|
|
597
|
+
return fs.rename(oldPath, newPath, options);
|
|
581
598
|
},
|
|
582
599
|
readDir(path, options = {}) {
|
|
583
600
|
if (!options.files) {
|
|
@@ -586,98 +603,136 @@ function run(url, opt = {}) {
|
|
|
586
603
|
if (!options.current) {
|
|
587
604
|
options.current = exports.list[taskId].current;
|
|
588
605
|
}
|
|
589
|
-
return
|
|
606
|
+
return fs.readDir(path, options);
|
|
590
607
|
},
|
|
591
608
|
copyFolder(from, to, options = {}) {
|
|
592
609
|
if (!options.current) {
|
|
593
610
|
options.current = exports.list[taskId].current;
|
|
594
611
|
}
|
|
595
|
-
return
|
|
612
|
+
return fs.copyFolder(from, to, options);
|
|
596
613
|
},
|
|
597
614
|
copyFile(src, dest, options = {}) {
|
|
598
615
|
if (!options.current) {
|
|
599
616
|
options.current = exports.list[taskId].current;
|
|
600
617
|
}
|
|
601
|
-
return
|
|
618
|
+
return fs.copyFile(src, dest, options);
|
|
602
619
|
}
|
|
603
620
|
},
|
|
604
621
|
'native': {
|
|
622
|
+
on(name, handler, once = false, formId) {
|
|
623
|
+
native.on(name, handler, once, formId, taskId);
|
|
624
|
+
},
|
|
625
|
+
once(name, handler, formId) {
|
|
626
|
+
native.once(name, handler, formId, taskId);
|
|
627
|
+
},
|
|
628
|
+
off(name, formId) {
|
|
629
|
+
native.off(name, formId, taskId);
|
|
630
|
+
},
|
|
631
|
+
clear(formId, taskId) {
|
|
632
|
+
native.clear(formId, taskId);
|
|
633
|
+
},
|
|
634
|
+
getListenerList(taskId) {
|
|
635
|
+
return native.getListenerList(taskId);
|
|
636
|
+
},
|
|
605
637
|
invoke: function (name, ...param) {
|
|
606
|
-
return
|
|
638
|
+
return native.invoke(name, ...param);
|
|
607
639
|
},
|
|
608
640
|
max: function () {
|
|
609
|
-
|
|
641
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
642
|
+
yield native.max();
|
|
643
|
+
});
|
|
610
644
|
},
|
|
611
645
|
min: function () {
|
|
612
|
-
|
|
646
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
647
|
+
yield native.min();
|
|
648
|
+
});
|
|
613
649
|
},
|
|
614
650
|
restore: function () {
|
|
615
|
-
|
|
651
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
652
|
+
yield native.restore();
|
|
653
|
+
});
|
|
616
654
|
},
|
|
617
655
|
size: function (width, height) {
|
|
618
|
-
|
|
656
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
657
|
+
yield native.size(width, height);
|
|
658
|
+
});
|
|
659
|
+
},
|
|
660
|
+
ping: function (val) {
|
|
661
|
+
return native.ping(val);
|
|
662
|
+
},
|
|
663
|
+
isMax: function () {
|
|
664
|
+
return native.isMax();
|
|
619
665
|
}
|
|
620
666
|
},
|
|
621
667
|
'task': {
|
|
622
|
-
|
|
623
|
-
return
|
|
668
|
+
getFocus() {
|
|
669
|
+
return focusId;
|
|
624
670
|
},
|
|
625
671
|
onFrame: function (fun, opt = {}) {
|
|
626
672
|
opt.taskId = taskId;
|
|
627
|
-
return
|
|
673
|
+
return onFrame(fun, opt);
|
|
628
674
|
},
|
|
629
675
|
offFrame: function (ft, opt = {}) {
|
|
630
676
|
opt.taskId = taskId;
|
|
631
|
-
|
|
677
|
+
offFrame(ft, opt);
|
|
632
678
|
},
|
|
633
679
|
get: function (tid) {
|
|
634
|
-
return
|
|
680
|
+
return get(tid);
|
|
635
681
|
},
|
|
636
682
|
getList: function () {
|
|
637
|
-
return
|
|
683
|
+
return getList();
|
|
638
684
|
},
|
|
639
685
|
run: function (url, opt = {}) {
|
|
640
686
|
opt.taskId = taskId;
|
|
641
|
-
opt.
|
|
642
|
-
|
|
687
|
+
if (opt.unblock) {
|
|
688
|
+
const inUnblock = [];
|
|
689
|
+
for (const item of opt.unblock) {
|
|
690
|
+
if (!unblock.includes(item)) {
|
|
691
|
+
continue;
|
|
692
|
+
}
|
|
693
|
+
inUnblock.push(item);
|
|
694
|
+
}
|
|
695
|
+
opt.unblock = inUnblock;
|
|
696
|
+
}
|
|
697
|
+
return run(url, opt);
|
|
643
698
|
},
|
|
644
699
|
end: function (tid) {
|
|
645
|
-
return
|
|
700
|
+
return end(tid !== null && tid !== void 0 ? tid : taskId);
|
|
646
701
|
},
|
|
647
702
|
loadLocaleData: function (lang, data, pre = '') {
|
|
648
|
-
|
|
703
|
+
loadLocaleData(lang, data, pre, taskId);
|
|
649
704
|
},
|
|
650
705
|
loadLocale: function (lang, path) {
|
|
651
|
-
return
|
|
706
|
+
return loadLocale(lang, path, taskId);
|
|
652
707
|
},
|
|
653
708
|
clearLocale: function () {
|
|
654
|
-
|
|
709
|
+
clearLocale(taskId);
|
|
655
710
|
},
|
|
656
711
|
setLocale: function (lang, path) {
|
|
657
|
-
return
|
|
712
|
+
return setLocale(lang, path, taskId);
|
|
658
713
|
},
|
|
659
714
|
setLocaleLang: function (lang) {
|
|
660
|
-
|
|
715
|
+
setLocaleLang(lang, taskId);
|
|
661
716
|
},
|
|
662
717
|
clearLocaleLang: function () {
|
|
663
|
-
|
|
718
|
+
clearLocaleLang(taskId);
|
|
664
719
|
},
|
|
665
720
|
createTimer: function (fun, delay, opt = {}) {
|
|
666
721
|
opt.taskId = taskId;
|
|
667
|
-
return
|
|
722
|
+
return createTimer(fun, delay, opt);
|
|
668
723
|
},
|
|
669
724
|
removeTimer: function (timer) {
|
|
670
|
-
|
|
725
|
+
removeTimer(timer, taskId);
|
|
671
726
|
},
|
|
672
727
|
sleep: function (fun, delay) {
|
|
673
|
-
return
|
|
728
|
+
return sleep(fun, delay, taskId);
|
|
674
729
|
},
|
|
675
|
-
systemTaskInfo: clickgo.task.systemTaskInfo,
|
|
730
|
+
'systemTaskInfo': clickgo.task.systemTaskInfo,
|
|
676
731
|
setSystem: function (fid) {
|
|
677
|
-
return
|
|
732
|
+
return setSystem(fid, taskId);
|
|
678
733
|
},
|
|
679
734
|
clearSystem: function () {
|
|
680
|
-
return
|
|
735
|
+
return clearSystem(taskId);
|
|
681
736
|
}
|
|
682
737
|
},
|
|
683
738
|
'theme': {
|
|
@@ -707,58 +762,67 @@ function run(url, opt = {}) {
|
|
|
707
762
|
},
|
|
708
763
|
'tool': {
|
|
709
764
|
blob2ArrayBuffer: function (blob) {
|
|
710
|
-
return
|
|
765
|
+
return tool.blob2ArrayBuffer(blob);
|
|
711
766
|
},
|
|
712
767
|
clone: function (obj) {
|
|
713
|
-
return
|
|
768
|
+
return tool.clone(obj);
|
|
714
769
|
},
|
|
715
770
|
sleep: function (ms = 0) {
|
|
716
|
-
return
|
|
771
|
+
return tool.sleep(ms);
|
|
772
|
+
},
|
|
773
|
+
nextFrame() {
|
|
774
|
+
return tool.nextFrame();
|
|
775
|
+
},
|
|
776
|
+
sleepFrame(count) {
|
|
777
|
+
return tool.sleepFrame(count);
|
|
717
778
|
},
|
|
718
779
|
purify: function (text) {
|
|
719
|
-
return
|
|
780
|
+
return tool.purify(text);
|
|
720
781
|
},
|
|
721
782
|
rand: function (min, max) {
|
|
722
|
-
return
|
|
723
|
-
},
|
|
724
|
-
'RANDOM_N':
|
|
725
|
-
'RANDOM_U':
|
|
726
|
-
'RANDOM_L':
|
|
727
|
-
'RANDOM_UN':
|
|
728
|
-
'RANDOM_LN':
|
|
729
|
-
'RANDOM_LU':
|
|
730
|
-
'RANDOM_LUN':
|
|
731
|
-
'RANDOM_V':
|
|
732
|
-
'RANDOM_LUNS':
|
|
733
|
-
random: function (length = 8, source =
|
|
734
|
-
return
|
|
783
|
+
return tool.rand(min, max);
|
|
784
|
+
},
|
|
785
|
+
'RANDOM_N': tool.RANDOM_N,
|
|
786
|
+
'RANDOM_U': tool.RANDOM_U,
|
|
787
|
+
'RANDOM_L': tool.RANDOM_L,
|
|
788
|
+
'RANDOM_UN': tool.RANDOM_UN,
|
|
789
|
+
'RANDOM_LN': tool.RANDOM_LN,
|
|
790
|
+
'RANDOM_LU': tool.RANDOM_LU,
|
|
791
|
+
'RANDOM_LUN': tool.RANDOM_LUN,
|
|
792
|
+
'RANDOM_V': tool.RANDOM_V,
|
|
793
|
+
'RANDOM_LUNS': tool.RANDOM_LUNS,
|
|
794
|
+
random: function (length = 8, source = tool.RANDOM_LN, block = '') {
|
|
795
|
+
return tool.random(length, source, block);
|
|
735
796
|
},
|
|
736
797
|
getBoolean: function (param) {
|
|
737
|
-
return
|
|
798
|
+
return tool.getBoolean(param);
|
|
738
799
|
},
|
|
739
800
|
getNumber: function (param) {
|
|
740
|
-
return
|
|
801
|
+
return tool.getNumber(param);
|
|
802
|
+
},
|
|
803
|
+
getArray(param) {
|
|
804
|
+
return tool.getArray(param);
|
|
741
805
|
},
|
|
742
806
|
escapeHTML: function (html) {
|
|
743
|
-
return
|
|
807
|
+
return tool.escapeHTML(html);
|
|
744
808
|
},
|
|
745
809
|
request: function (url, opt) {
|
|
746
|
-
return
|
|
810
|
+
return tool.request(url, opt);
|
|
747
811
|
},
|
|
748
812
|
parseUrl: function (url) {
|
|
749
|
-
return
|
|
813
|
+
return tool.parseUrl(url);
|
|
750
814
|
},
|
|
751
815
|
urlResolve: function (from, to) {
|
|
752
|
-
return
|
|
816
|
+
return tool.urlResolve(from, to);
|
|
753
817
|
},
|
|
754
818
|
blob2Text: function (blob) {
|
|
755
|
-
return
|
|
819
|
+
return tool.blob2Text(blob);
|
|
756
820
|
},
|
|
757
821
|
blob2DataUrl: function (blob) {
|
|
758
|
-
return
|
|
822
|
+
return tool.blob2DataUrl(blob);
|
|
759
823
|
},
|
|
760
824
|
execCommand: function (ac) {
|
|
761
|
-
|
|
825
|
+
tool.execCommand(ac);
|
|
762
826
|
}
|
|
763
827
|
},
|
|
764
828
|
'zip': {
|
|
@@ -805,6 +869,28 @@ function run(url, opt = {}) {
|
|
|
805
869
|
'timers': {},
|
|
806
870
|
'invoke': invoke
|
|
807
871
|
};
|
|
872
|
+
if (app.config.locales) {
|
|
873
|
+
for (let path in app.config.locales) {
|
|
874
|
+
const locale = app.config.locales[path];
|
|
875
|
+
if (!path.endsWith('.json')) {
|
|
876
|
+
path += '.json';
|
|
877
|
+
}
|
|
878
|
+
const lcontent = yield fs.getContent(path, {
|
|
879
|
+
'encoding': 'utf8',
|
|
880
|
+
'files': app.files,
|
|
881
|
+
'current': current
|
|
882
|
+
});
|
|
883
|
+
if (!lcontent) {
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
try {
|
|
887
|
+
const data = JSON.parse(lcontent);
|
|
888
|
+
loadLocaleData(locale, data, '', taskId);
|
|
889
|
+
}
|
|
890
|
+
catch (_d) {
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
808
894
|
let expo = [];
|
|
809
895
|
try {
|
|
810
896
|
expo = loader.require('/app.js', app.files, {
|
|
@@ -826,27 +912,62 @@ function run(url, opt = {}) {
|
|
|
826
912
|
return -3;
|
|
827
913
|
}
|
|
828
914
|
dom.createToStyleList(taskId);
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
if (!exports.list[taskId].class) {
|
|
832
|
-
delete exports.list[taskId];
|
|
915
|
+
const r = yield control.init(taskId, invoke);
|
|
916
|
+
if (r < 0) {
|
|
833
917
|
dom.removeFromStyleList(taskId);
|
|
834
|
-
|
|
918
|
+
delete exports.list[taskId];
|
|
919
|
+
return -400 + r;
|
|
920
|
+
}
|
|
921
|
+
if ((_c = app.config.themes) === null || _c === void 0 ? void 0 : _c.length) {
|
|
922
|
+
for (let path of app.config.themes) {
|
|
923
|
+
path += '.cgt';
|
|
924
|
+
path = tool.urlResolve('/', path);
|
|
925
|
+
const file = yield fs.getContent(path, {
|
|
926
|
+
'files': app.files,
|
|
927
|
+
'current': current
|
|
928
|
+
});
|
|
929
|
+
if (file && typeof file !== 'string') {
|
|
930
|
+
const th = yield theme.read(file);
|
|
931
|
+
if (th) {
|
|
932
|
+
yield theme.load(th, taskId);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
else {
|
|
938
|
+
if (theme.global) {
|
|
939
|
+
yield theme.load(undefined, taskId);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
if (app.config.style) {
|
|
943
|
+
const style = yield fs.getContent(app.config.style + '.css', {
|
|
944
|
+
'encoding': 'utf8',
|
|
945
|
+
'files': app.files,
|
|
946
|
+
'current': current
|
|
947
|
+
});
|
|
948
|
+
if (style) {
|
|
949
|
+
const r = tool.stylePrepend(style, 'cg-task' + taskId.toString() + '_');
|
|
950
|
+
dom.pushStyle(taskId, yield tool.styleUrl2DataUrl(app.config.style, r.style, app.files));
|
|
951
|
+
}
|
|
835
952
|
}
|
|
836
953
|
core.trigger('taskStarted', taskId);
|
|
837
954
|
if (taskId === 1) {
|
|
838
|
-
native.invoke('cg-init', native.getToken());
|
|
955
|
+
yield native.invoke('cg-init', native.getToken());
|
|
839
956
|
}
|
|
957
|
+
const appCls = new expo.default();
|
|
958
|
+
exports.list[taskId].class = appCls;
|
|
959
|
+
yield appCls.main();
|
|
840
960
|
return taskId;
|
|
841
961
|
});
|
|
842
962
|
}
|
|
843
963
|
exports.run = run;
|
|
844
964
|
function end(taskId) {
|
|
965
|
+
var _a;
|
|
845
966
|
const task = exports.list[taskId];
|
|
846
967
|
if (!task) {
|
|
847
968
|
return true;
|
|
848
969
|
}
|
|
849
|
-
if (clickgo.
|
|
970
|
+
if (clickgo.isNative() && (taskId === 1)) {
|
|
850
971
|
native.invoke('cg-close', native.getToken());
|
|
851
972
|
}
|
|
852
973
|
const fid = form.getMaxZIndexID({
|
|
@@ -860,22 +981,25 @@ function end(taskId) {
|
|
|
860
981
|
}
|
|
861
982
|
for (const fid in task.forms) {
|
|
862
983
|
const f = task.forms[fid];
|
|
863
|
-
core.trigger('formRemoved', taskId, f.id, f.vroot.$refs.form.title, f.vroot.$refs.form.
|
|
984
|
+
core.trigger('formRemoved', taskId, f.id, f.vroot.$refs.form.title, f.vroot.$refs.form.iconDataUrl);
|
|
864
985
|
try {
|
|
865
986
|
f.vapp.unmount();
|
|
866
987
|
}
|
|
867
988
|
catch (err) {
|
|
868
989
|
const msg = `Message: ${err.message}\nTask id: ${task.id}\nForm id: ${fid}\nFunction: task.end, unmount.`;
|
|
869
990
|
form.notify({
|
|
870
|
-
'title': '
|
|
991
|
+
'title': 'Form Unmount Error',
|
|
871
992
|
'content': msg,
|
|
872
993
|
'type': 'danger'
|
|
873
994
|
});
|
|
874
|
-
console.log('
|
|
995
|
+
console.log('Form Unmount Error', msg, err);
|
|
875
996
|
}
|
|
876
997
|
f.vapp._container.remove();
|
|
998
|
+
(_a = form.elements.popList.querySelector('[data-form-id="' + f.id.toString() + '"]')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
999
|
+
dom.clearWatchStyle(fid);
|
|
1000
|
+
dom.clearWatchProperty(fid);
|
|
877
1001
|
}
|
|
878
|
-
const flist =
|
|
1002
|
+
const flist = form.elements.list.querySelectorAll('.cg-form-wrap[data-task-id="' + taskId.toString() + '"]');
|
|
879
1003
|
for (const f of flist) {
|
|
880
1004
|
f.remove();
|
|
881
1005
|
}
|
|
@@ -891,6 +1015,8 @@ function end(taskId) {
|
|
|
891
1015
|
}
|
|
892
1016
|
}
|
|
893
1017
|
dom.clearWatchSize(taskId);
|
|
1018
|
+
dom.clearWatch(taskId);
|
|
1019
|
+
native.clear(undefined, taskId);
|
|
894
1020
|
delete exports.list[taskId];
|
|
895
1021
|
core.trigger('taskEnded', taskId);
|
|
896
1022
|
clearSystem(taskId);
|