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/task.js
CHANGED
|
@@ -32,15 +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
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
36
|
exports.systemTaskInfo = exports.lastId = exports.list = void 0;
|
|
46
37
|
exports.setFocus = setFocus;
|
|
@@ -78,7 +69,7 @@ exports.list = {};
|
|
|
78
69
|
exports.lastId = 0;
|
|
79
70
|
let focusId = null;
|
|
80
71
|
function setFocus(id) {
|
|
81
|
-
focusId = id
|
|
72
|
+
focusId = id ?? null;
|
|
82
73
|
}
|
|
83
74
|
function getFocus() {
|
|
84
75
|
return focusId;
|
|
@@ -124,7 +115,6 @@ const localeData = {
|
|
|
124
115
|
let frameTimer = 0;
|
|
125
116
|
const frameMaps = {};
|
|
126
117
|
function onFrame(fun, opt = {}) {
|
|
127
|
-
var _a;
|
|
128
118
|
const taskId = opt.taskId;
|
|
129
119
|
const formId = opt.formId;
|
|
130
120
|
if (!taskId) {
|
|
@@ -138,17 +128,17 @@ function onFrame(fun, opt = {}) {
|
|
|
138
128
|
return 0;
|
|
139
129
|
}
|
|
140
130
|
const ft = ++frameTimer;
|
|
141
|
-
const count =
|
|
131
|
+
const count = opt.count ?? 0;
|
|
142
132
|
let c = 0;
|
|
143
133
|
let timer;
|
|
144
|
-
const timerHandler = () =>
|
|
134
|
+
const timerHandler = async () => {
|
|
145
135
|
++c;
|
|
146
136
|
if (formId && task.forms[formId] === undefined) {
|
|
147
137
|
delete task.timers['1x' + ft.toString()];
|
|
148
138
|
delete frameMaps[ft];
|
|
149
139
|
return;
|
|
150
140
|
}
|
|
151
|
-
|
|
141
|
+
await fun();
|
|
152
142
|
if (task.timers['1x' + ft.toString()] == undefined) {
|
|
153
143
|
return;
|
|
154
144
|
}
|
|
@@ -179,14 +169,14 @@ function onFrame(fun, opt = {}) {
|
|
|
179
169
|
});
|
|
180
170
|
frameMaps[ft] = timer;
|
|
181
171
|
}
|
|
182
|
-
}
|
|
172
|
+
};
|
|
183
173
|
timer = requestAnimationFrame(function () {
|
|
184
174
|
timerHandler().catch(function (e) {
|
|
185
175
|
console.log('task.onFrame: -1', e);
|
|
186
176
|
});
|
|
187
177
|
});
|
|
188
178
|
frameMaps[ft] = timer;
|
|
189
|
-
task.timers['1x' + ft.toString()] = formId
|
|
179
|
+
task.timers['1x' + ft.toString()] = formId ?? 0;
|
|
190
180
|
return ft;
|
|
191
181
|
}
|
|
192
182
|
function offFrame(ft, opt = {}) {
|
|
@@ -241,1046 +231,1020 @@ function getList() {
|
|
|
241
231
|
}
|
|
242
232
|
return rtn;
|
|
243
233
|
}
|
|
244
|
-
function run(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if (!url.endsWith('/') && !url.endsWith('.cga')) {
|
|
250
|
-
return 0;
|
|
251
|
-
}
|
|
252
|
-
let icon = __dirname + '/../icon.png';
|
|
253
|
-
if (opt.icon) {
|
|
254
|
-
icon = opt.icon;
|
|
255
|
-
}
|
|
256
|
-
(_a = opt.notify) !== null && _a !== void 0 ? _a : (opt.notify = true);
|
|
257
|
-
const notifyId = opt.notify ? form.notify({
|
|
258
|
-
'title': (_c = (_b = localeData[core.config.locale]) === null || _b === void 0 ? void 0 : _b.loading) !== null && _c !== void 0 ? _c : localeData['en'].loading,
|
|
259
|
-
'content': url,
|
|
260
|
-
'icon': icon,
|
|
261
|
-
'timeout': 0,
|
|
262
|
-
'progress': true
|
|
263
|
-
}) : undefined;
|
|
264
|
-
if (!ntid &&
|
|
265
|
-
!url.startsWith('/clickgo/') &&
|
|
266
|
-
!url.startsWith('/storage/') &&
|
|
267
|
-
!url.startsWith('/mounted/') &&
|
|
268
|
-
!url.startsWith('/package/') &&
|
|
269
|
-
!url.startsWith('/current/')) {
|
|
270
|
-
url = tool.urlResolve(location.href, url);
|
|
271
|
-
}
|
|
272
|
-
app = yield core.fetchApp(url, {
|
|
273
|
-
'notifyId': notifyId,
|
|
274
|
-
'progress': opt.progress,
|
|
275
|
-
'cache': opt.cache
|
|
276
|
-
}, ntid);
|
|
277
|
-
if (notifyId) {
|
|
278
|
-
setTimeout(function () {
|
|
279
|
-
form.hideNotify(notifyId);
|
|
280
|
-
}, 3000);
|
|
281
|
-
}
|
|
234
|
+
async function run(url, opt = {}, ntid) {
|
|
235
|
+
let app = null;
|
|
236
|
+
if (typeof url === 'string') {
|
|
237
|
+
if (!url.endsWith('/') && !url.endsWith('.cga')) {
|
|
238
|
+
return 0;
|
|
282
239
|
}
|
|
283
|
-
|
|
284
|
-
|
|
240
|
+
let icon = __dirname + '/../icon.png';
|
|
241
|
+
if (opt.icon) {
|
|
242
|
+
icon = opt.icon;
|
|
285
243
|
}
|
|
286
|
-
|
|
287
|
-
|
|
244
|
+
opt.notify ??= true;
|
|
245
|
+
const notifyId = opt.notify ? form.notify({
|
|
246
|
+
'title': localeData[core.config.locale]?.loading ?? localeData['en'].loading,
|
|
247
|
+
'content': url,
|
|
248
|
+
'icon': icon,
|
|
249
|
+
'timeout': 0,
|
|
250
|
+
'progress': true
|
|
251
|
+
}) : undefined;
|
|
252
|
+
if (!ntid &&
|
|
253
|
+
!url.startsWith('/clickgo/') &&
|
|
254
|
+
!url.startsWith('/storage/') &&
|
|
255
|
+
!url.startsWith('/mounted/') &&
|
|
256
|
+
!url.startsWith('/package/') &&
|
|
257
|
+
!url.startsWith('/current/')) {
|
|
258
|
+
url = tool.urlResolve(location.href, url);
|
|
288
259
|
}
|
|
289
|
-
|
|
290
|
-
|
|
260
|
+
app = await core.fetchApp(url, {
|
|
261
|
+
'notifyId': notifyId,
|
|
262
|
+
'progress': opt.progress,
|
|
263
|
+
'cache': opt.cache
|
|
264
|
+
}, ntid);
|
|
265
|
+
if (notifyId) {
|
|
266
|
+
setTimeout(function () {
|
|
267
|
+
form.hideNotify(notifyId);
|
|
268
|
+
}, 3000);
|
|
291
269
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
270
|
+
}
|
|
271
|
+
else if (url.type !== 'app') {
|
|
272
|
+
return -1;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
app = url;
|
|
276
|
+
}
|
|
277
|
+
if (!app) {
|
|
278
|
+
return -1;
|
|
279
|
+
}
|
|
280
|
+
const taskId = ++exports.lastId;
|
|
281
|
+
const blocks = ['document', 'localStorage'];
|
|
282
|
+
const invoke = {};
|
|
283
|
+
const ks = Object.getOwnPropertyNames(window);
|
|
284
|
+
invoke.window = {};
|
|
285
|
+
for (const k of ks) {
|
|
286
|
+
if (blocks.includes(k)) {
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
invoke.window[k] = window[k];
|
|
290
|
+
}
|
|
291
|
+
for (const block of blocks) {
|
|
292
|
+
invoke[block] = undefined;
|
|
293
|
+
}
|
|
294
|
+
invoke.console = {
|
|
295
|
+
assert: function (condition, ...data) {
|
|
296
|
+
console.assert(condition, ...data);
|
|
297
|
+
},
|
|
298
|
+
clear: function () {
|
|
299
|
+
console.clear();
|
|
300
|
+
},
|
|
301
|
+
count: function (label) {
|
|
302
|
+
console.count(label);
|
|
303
|
+
},
|
|
304
|
+
countReset: function (label) {
|
|
305
|
+
console.countReset(label);
|
|
306
|
+
},
|
|
307
|
+
debug: function (...data) {
|
|
308
|
+
console.debug(...data);
|
|
309
|
+
},
|
|
310
|
+
dir: function (item, options) {
|
|
311
|
+
console.dir(item, options);
|
|
312
|
+
},
|
|
313
|
+
dirxml: function (...data) {
|
|
314
|
+
console.dirxml(...data);
|
|
315
|
+
},
|
|
316
|
+
error: function (...data) {
|
|
317
|
+
console.error(...data);
|
|
318
|
+
},
|
|
319
|
+
group: function (...data) {
|
|
320
|
+
console.group(...data);
|
|
321
|
+
},
|
|
322
|
+
groupCollapsed: function (...data) {
|
|
323
|
+
console.groupCollapsed(...data);
|
|
324
|
+
},
|
|
325
|
+
groupEnd: function () {
|
|
326
|
+
console.groupEnd();
|
|
327
|
+
},
|
|
328
|
+
info: function (...data) {
|
|
329
|
+
console.info(...data);
|
|
330
|
+
},
|
|
331
|
+
log: function (...data) {
|
|
332
|
+
console.log(...data);
|
|
333
|
+
},
|
|
334
|
+
table: function (tabularData, properties) {
|
|
335
|
+
console.table(tabularData, properties);
|
|
336
|
+
},
|
|
337
|
+
time: function (label) {
|
|
338
|
+
console.time(label);
|
|
339
|
+
},
|
|
340
|
+
timeEnd: function (label) {
|
|
341
|
+
console.timeEnd(label);
|
|
342
|
+
},
|
|
343
|
+
timeLog: function (label, ...data) {
|
|
344
|
+
console.timeLog(label, ...data);
|
|
345
|
+
},
|
|
346
|
+
timeStamp: function (label) {
|
|
347
|
+
console.timeStamp(label);
|
|
348
|
+
},
|
|
349
|
+
trace: function (...data) {
|
|
350
|
+
console.trace(...data);
|
|
351
|
+
},
|
|
352
|
+
warn: function (...data) {
|
|
353
|
+
console.warn(...data);
|
|
302
354
|
}
|
|
303
|
-
|
|
304
|
-
|
|
355
|
+
};
|
|
356
|
+
invoke.loader = {
|
|
357
|
+
require: function (paths, files, opt) {
|
|
358
|
+
return loader.require(paths, files, opt);
|
|
305
359
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
360
|
+
};
|
|
361
|
+
invoke.invokeClickgo = {
|
|
362
|
+
getVersion: () => {
|
|
363
|
+
return clickgo.getVersion();
|
|
364
|
+
},
|
|
365
|
+
isNative: () => {
|
|
366
|
+
return clickgo.isNative();
|
|
367
|
+
},
|
|
368
|
+
getPlatform: () => {
|
|
369
|
+
return clickgo.getPlatform();
|
|
370
|
+
},
|
|
371
|
+
getDevice: () => {
|
|
372
|
+
return clickgo.getDevice();
|
|
373
|
+
},
|
|
374
|
+
isImmersion: () => {
|
|
375
|
+
return clickgo.isImmersion();
|
|
376
|
+
},
|
|
377
|
+
hasFrame: () => {
|
|
378
|
+
return clickgo.hasFrame();
|
|
379
|
+
},
|
|
380
|
+
'control': {
|
|
381
|
+
'AbstractControl': class extends control.AbstractControl {
|
|
382
|
+
get taskId() {
|
|
383
|
+
return taskId;
|
|
384
|
+
}
|
|
309
385
|
},
|
|
310
|
-
|
|
311
|
-
|
|
386
|
+
read: function (blob) {
|
|
387
|
+
return control.read(blob);
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
'core': {
|
|
391
|
+
'config': clickgo.core.config,
|
|
392
|
+
'global': clickgo.tool.clone(clickgo.core.global),
|
|
393
|
+
'AbstractApp': class extends core.AbstractApp {
|
|
394
|
+
async main() {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
get taskId() {
|
|
398
|
+
return taskId;
|
|
399
|
+
}
|
|
312
400
|
},
|
|
313
|
-
|
|
314
|
-
|
|
401
|
+
getCdn: function () {
|
|
402
|
+
return core.getCdn();
|
|
315
403
|
},
|
|
316
|
-
|
|
317
|
-
|
|
404
|
+
getModule: function (name) {
|
|
405
|
+
return core.getModule(name);
|
|
318
406
|
},
|
|
319
|
-
|
|
320
|
-
|
|
407
|
+
readApp: function (blob) {
|
|
408
|
+
return core.readApp(blob);
|
|
321
409
|
},
|
|
322
|
-
|
|
323
|
-
|
|
410
|
+
getAvailArea: function () {
|
|
411
|
+
return core.getAvailArea();
|
|
324
412
|
},
|
|
325
|
-
|
|
326
|
-
|
|
413
|
+
hash: function (hash) {
|
|
414
|
+
return core.hash(hash, taskId);
|
|
327
415
|
},
|
|
328
|
-
|
|
329
|
-
|
|
416
|
+
getHash: function () {
|
|
417
|
+
return core.getHash();
|
|
330
418
|
},
|
|
331
|
-
|
|
332
|
-
|
|
419
|
+
getHost: function () {
|
|
420
|
+
return core.getHost();
|
|
333
421
|
},
|
|
334
|
-
|
|
335
|
-
|
|
422
|
+
location: function (url) {
|
|
423
|
+
return core.location(url, taskId);
|
|
336
424
|
},
|
|
337
|
-
|
|
338
|
-
|
|
425
|
+
getLocation: function () {
|
|
426
|
+
return core.getLocation();
|
|
339
427
|
},
|
|
340
|
-
|
|
341
|
-
|
|
428
|
+
back: function () {
|
|
429
|
+
return core.back(taskId);
|
|
342
430
|
},
|
|
343
|
-
|
|
344
|
-
|
|
431
|
+
open: function (url) {
|
|
432
|
+
core.open(url);
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
'dom': {
|
|
436
|
+
inPage: function (el) {
|
|
437
|
+
return dom.inPage(el);
|
|
345
438
|
},
|
|
346
|
-
|
|
347
|
-
|
|
439
|
+
'dpi': dom.dpi,
|
|
440
|
+
setGlobalCursor: function (type) {
|
|
441
|
+
dom.setGlobalCursor(type);
|
|
348
442
|
},
|
|
349
|
-
|
|
350
|
-
|
|
443
|
+
hasTouchButMouse: function (e) {
|
|
444
|
+
return dom.hasTouchButMouse(e);
|
|
351
445
|
},
|
|
352
|
-
|
|
353
|
-
|
|
446
|
+
getStyleCount: function (taskId, type) {
|
|
447
|
+
return dom.getStyleCount(taskId, type);
|
|
354
448
|
},
|
|
355
|
-
|
|
356
|
-
|
|
449
|
+
watchPosition: function (el, cb, immediate = false) {
|
|
450
|
+
return dom.watchPosition(el, cb, immediate);
|
|
357
451
|
},
|
|
358
|
-
|
|
359
|
-
|
|
452
|
+
unwatchPosition: function (el) {
|
|
453
|
+
dom.unwatchPosition(el);
|
|
360
454
|
},
|
|
361
|
-
|
|
362
|
-
|
|
455
|
+
isWatchPosition: function (el) {
|
|
456
|
+
return dom.isWatchPosition(el);
|
|
363
457
|
},
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
458
|
+
getWatchSizeCount: function (taskId) {
|
|
459
|
+
return dom.getWatchSizeCount(taskId);
|
|
460
|
+
},
|
|
461
|
+
watchSize: function (el, cb, immediate = false) {
|
|
462
|
+
return dom.watchSize(el, cb, immediate, taskId);
|
|
463
|
+
},
|
|
464
|
+
unwatchSize: function (el) {
|
|
465
|
+
dom.unwatchSize(el, taskId);
|
|
466
|
+
},
|
|
467
|
+
isWatchSize: function (el) {
|
|
468
|
+
return dom.isWatchSize(el);
|
|
469
|
+
},
|
|
470
|
+
getWatchCount: function (taskId) {
|
|
471
|
+
return dom.getWatchCount(taskId);
|
|
472
|
+
},
|
|
473
|
+
watch: function (el, cb, mode = 'default', immediate = false) {
|
|
474
|
+
dom.watch(el, cb, mode, immediate, taskId);
|
|
475
|
+
},
|
|
476
|
+
unwatch: function (el) {
|
|
477
|
+
dom.unwatch(el, taskId);
|
|
478
|
+
},
|
|
479
|
+
isWatch(el) {
|
|
480
|
+
return dom.isWatch(el);
|
|
481
|
+
},
|
|
482
|
+
watchStyle: function (el, name, cb, immediate = false) {
|
|
483
|
+
dom.watchStyle(el, name, cb, immediate);
|
|
484
|
+
},
|
|
485
|
+
isWatchStyle: function (el) {
|
|
486
|
+
return dom.isWatchStyle(el);
|
|
487
|
+
},
|
|
488
|
+
watchProperty: function (el, name, cb, immediate = false) {
|
|
489
|
+
dom.watchProperty(el, name, cb, immediate);
|
|
490
|
+
},
|
|
491
|
+
isWatchProperty(el) {
|
|
492
|
+
return dom.isWatchProperty(el);
|
|
493
|
+
},
|
|
494
|
+
getWatchInfo: function () {
|
|
495
|
+
return dom.getWatchInfo();
|
|
496
|
+
},
|
|
497
|
+
bindClick: function (e, handler) {
|
|
498
|
+
dom.bindClick(e, handler);
|
|
499
|
+
},
|
|
500
|
+
bindDblClick: function (e, handler) {
|
|
501
|
+
dom.bindDblClick(e, handler);
|
|
502
|
+
},
|
|
503
|
+
bindDown: function (oe, opt) {
|
|
504
|
+
dom.bindDown(oe, opt);
|
|
505
|
+
},
|
|
506
|
+
bindScale: function (oe, handler) {
|
|
507
|
+
dom.bindScale(oe, handler);
|
|
508
|
+
},
|
|
509
|
+
bindGesture: function (oe, before, handler) {
|
|
510
|
+
dom.bindGesture(oe, before, handler);
|
|
511
|
+
},
|
|
512
|
+
bindLong: function (e, long) {
|
|
513
|
+
dom.bindLong(e, long);
|
|
514
|
+
},
|
|
515
|
+
setDragData(data) {
|
|
516
|
+
dom.setDragData(data);
|
|
517
|
+
},
|
|
518
|
+
bindDrag: function (e, opt) {
|
|
519
|
+
dom.bindDrag(e, opt);
|
|
520
|
+
},
|
|
521
|
+
'is': dom.is,
|
|
522
|
+
bindMove: function (e, opt) {
|
|
523
|
+
return dom.bindMove(e, opt);
|
|
524
|
+
},
|
|
525
|
+
bindResize: function (e, opt) {
|
|
526
|
+
dom.bindResize(e, opt);
|
|
527
|
+
},
|
|
528
|
+
findParentByData: function (el, name, value) {
|
|
529
|
+
return dom.findParentByData(el, name, value);
|
|
530
|
+
},
|
|
531
|
+
findParentByClass: function (el, name) {
|
|
532
|
+
return dom.findParentByClass(el, name);
|
|
533
|
+
},
|
|
534
|
+
findParentByTag: function (el, name) {
|
|
535
|
+
return dom.findParentByTag(el, name);
|
|
536
|
+
},
|
|
537
|
+
index: function (el) {
|
|
538
|
+
return dom.index(el);
|
|
539
|
+
},
|
|
540
|
+
siblings: function (el) {
|
|
541
|
+
return dom.siblings(el);
|
|
542
|
+
},
|
|
543
|
+
siblingsData: function (el, name) {
|
|
544
|
+
return dom.siblingsData(el, name);
|
|
545
|
+
},
|
|
546
|
+
fullscreen: function () {
|
|
547
|
+
return dom.fullscreen();
|
|
548
|
+
},
|
|
549
|
+
exitFullscreen: function () {
|
|
550
|
+
return dom.exitFullscreen();
|
|
551
|
+
},
|
|
552
|
+
createElement: function (tagName) {
|
|
553
|
+
return dom.createElement(tagName);
|
|
371
554
|
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
555
|
+
},
|
|
556
|
+
'form': {
|
|
557
|
+
'AbstractPanel': class extends form.AbstractPanel {
|
|
558
|
+
get taskId() {
|
|
559
|
+
return taskId;
|
|
560
|
+
}
|
|
376
561
|
},
|
|
377
|
-
|
|
378
|
-
|
|
562
|
+
'AbstractForm': class extends form.AbstractForm {
|
|
563
|
+
get taskId() {
|
|
564
|
+
return taskId;
|
|
565
|
+
}
|
|
379
566
|
},
|
|
380
|
-
|
|
381
|
-
return
|
|
567
|
+
min: function (fid) {
|
|
568
|
+
return form.min(fid);
|
|
382
569
|
},
|
|
383
|
-
|
|
384
|
-
return
|
|
570
|
+
max: function max(fid) {
|
|
571
|
+
return form.max(fid);
|
|
385
572
|
},
|
|
386
|
-
|
|
387
|
-
return
|
|
573
|
+
close: function (fid) {
|
|
574
|
+
return form.close(fid);
|
|
388
575
|
},
|
|
389
|
-
|
|
390
|
-
|
|
576
|
+
bindResize: function (e, border) {
|
|
577
|
+
form.bindResize(e, border);
|
|
391
578
|
},
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
579
|
+
bindDrag: function (e) {
|
|
580
|
+
form.bindDrag(e);
|
|
581
|
+
},
|
|
582
|
+
getTaskId: function (fid) {
|
|
583
|
+
return form.getTaskId(fid);
|
|
584
|
+
},
|
|
585
|
+
get: function (fid) {
|
|
586
|
+
return form.get(fid);
|
|
587
|
+
},
|
|
588
|
+
getList: function (tid) {
|
|
589
|
+
return form.getList(tid);
|
|
590
|
+
},
|
|
591
|
+
getFocus: function () {
|
|
592
|
+
return form.getFocus();
|
|
593
|
+
},
|
|
594
|
+
getActivePanel: function (formId) {
|
|
595
|
+
return form.getActivePanel(formId);
|
|
596
|
+
},
|
|
597
|
+
removeActivePanel: function (panelId, formId) {
|
|
598
|
+
return form.removeActivePanel(panelId, formId, taskId);
|
|
599
|
+
},
|
|
600
|
+
setActivePanel: function (panelId, formId) {
|
|
601
|
+
return form.setActivePanel(panelId, formId, taskId);
|
|
602
|
+
},
|
|
603
|
+
hash: function (hash, formId) {
|
|
604
|
+
return form.hash(hash, formId);
|
|
605
|
+
},
|
|
606
|
+
getHash: function (formId) {
|
|
607
|
+
return form.getHash(formId);
|
|
608
|
+
},
|
|
609
|
+
hashBack: function (formId) {
|
|
610
|
+
return form.hashBack(formId);
|
|
611
|
+
},
|
|
612
|
+
changeFocus: function (fid = 0) {
|
|
613
|
+
form.changeFocus(fid);
|
|
614
|
+
},
|
|
615
|
+
getMaxZIndexID: function (out) {
|
|
616
|
+
return form.getMaxZIndexID(out);
|
|
617
|
+
},
|
|
618
|
+
getRectByBorder: function (border) {
|
|
619
|
+
return form.getRectByBorder(border);
|
|
620
|
+
},
|
|
621
|
+
showCircular: function (x, y) {
|
|
622
|
+
form.showCircular(x, y);
|
|
623
|
+
},
|
|
624
|
+
moveRectangle: function (border) {
|
|
625
|
+
form.moveRectangle(border);
|
|
626
|
+
},
|
|
627
|
+
showRectangle: function (x, y, border) {
|
|
628
|
+
form.showRectangle(x, y, border);
|
|
629
|
+
},
|
|
630
|
+
hideRectangle: function () {
|
|
631
|
+
form.hideRectangle();
|
|
632
|
+
},
|
|
633
|
+
showDrag: function () {
|
|
634
|
+
form.showDrag();
|
|
635
|
+
},
|
|
636
|
+
moveDrag: function (opt) {
|
|
637
|
+
form.moveDrag(opt);
|
|
638
|
+
},
|
|
639
|
+
hideDrag: function () {
|
|
640
|
+
form.hideDrag();
|
|
641
|
+
},
|
|
642
|
+
alert: function (content, type) {
|
|
643
|
+
return form.alert(content, type);
|
|
644
|
+
},
|
|
645
|
+
notify: function (opt) {
|
|
646
|
+
return form.notify(opt);
|
|
647
|
+
},
|
|
648
|
+
notifyProgress: function (notifyId, per) {
|
|
649
|
+
form.notifyProgress(notifyId, per);
|
|
650
|
+
},
|
|
651
|
+
notifyContent: function (notifyId, opt) {
|
|
652
|
+
form.notifyContent(notifyId, opt);
|
|
653
|
+
},
|
|
654
|
+
hideNotify: function (notifyId) {
|
|
655
|
+
form.hideNotify(notifyId);
|
|
656
|
+
},
|
|
657
|
+
showPop: function (el, pop, direction, opt = {}) {
|
|
658
|
+
form.showPop(el, pop, direction, opt);
|
|
659
|
+
},
|
|
660
|
+
hidePop: function (pop) {
|
|
661
|
+
form.hidePop(pop);
|
|
662
|
+
},
|
|
663
|
+
isJustPop: function (el) {
|
|
664
|
+
return form.isJustPop(el);
|
|
665
|
+
},
|
|
666
|
+
doFocusAndPopEvent: function (e) {
|
|
667
|
+
form.doFocusAndPopEvent(e);
|
|
668
|
+
},
|
|
669
|
+
removePanel(id, vapp, el) {
|
|
670
|
+
return form.removePanel(id, vapp, el);
|
|
671
|
+
},
|
|
672
|
+
createPanel(rootPanel, cls, opt) {
|
|
673
|
+
return form.createPanel(rootPanel, cls, opt, taskId);
|
|
674
|
+
},
|
|
675
|
+
create: function (cls, data, opt) {
|
|
676
|
+
return form.create(cls, data, opt, taskId);
|
|
677
|
+
},
|
|
678
|
+
dialog: function (opt) {
|
|
679
|
+
if (typeof opt === 'string') {
|
|
680
|
+
opt = {
|
|
681
|
+
'content': opt
|
|
682
|
+
};
|
|
400
683
|
}
|
|
684
|
+
opt.taskId = taskId;
|
|
685
|
+
return form.dialog(opt);
|
|
401
686
|
},
|
|
402
|
-
|
|
403
|
-
'
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
408
|
-
return;
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
get taskId() {
|
|
412
|
-
return taskId;
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
getCdn: function () {
|
|
416
|
-
return core.getCdn();
|
|
417
|
-
},
|
|
418
|
-
getModule: function (name) {
|
|
419
|
-
return core.getModule(name);
|
|
420
|
-
},
|
|
421
|
-
readApp: function (blob) {
|
|
422
|
-
return core.readApp(blob);
|
|
423
|
-
},
|
|
424
|
-
getAvailArea: function () {
|
|
425
|
-
return core.getAvailArea();
|
|
426
|
-
},
|
|
427
|
-
hash: function (hash) {
|
|
428
|
-
return core.hash(hash, taskId);
|
|
429
|
-
},
|
|
430
|
-
getHash: function () {
|
|
431
|
-
return core.getHash();
|
|
432
|
-
},
|
|
433
|
-
getHost: function () {
|
|
434
|
-
return core.getHost();
|
|
435
|
-
},
|
|
436
|
-
location: function (url) {
|
|
437
|
-
return core.location(url, taskId);
|
|
438
|
-
},
|
|
439
|
-
getLocation: function () {
|
|
440
|
-
return core.getLocation();
|
|
441
|
-
},
|
|
442
|
-
back: function () {
|
|
443
|
-
return core.back(taskId);
|
|
444
|
-
},
|
|
445
|
-
open: function (url) {
|
|
446
|
-
core.open(url);
|
|
687
|
+
confirm: function (opt) {
|
|
688
|
+
if (typeof opt === 'string') {
|
|
689
|
+
opt = {
|
|
690
|
+
'content': opt
|
|
691
|
+
};
|
|
447
692
|
}
|
|
693
|
+
opt.taskId = taskId;
|
|
694
|
+
return form.confirm(opt);
|
|
448
695
|
},
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
setGlobalCursor: function (type) {
|
|
455
|
-
dom.setGlobalCursor(type);
|
|
456
|
-
},
|
|
457
|
-
hasTouchButMouse: function (e) {
|
|
458
|
-
return dom.hasTouchButMouse(e);
|
|
459
|
-
},
|
|
460
|
-
getStyleCount: function (taskId, type) {
|
|
461
|
-
return dom.getStyleCount(taskId, type);
|
|
462
|
-
},
|
|
463
|
-
watchPosition: function (el, cb, immediate = false) {
|
|
464
|
-
return dom.watchPosition(el, cb, immediate);
|
|
465
|
-
},
|
|
466
|
-
unwatchPosition: function (el) {
|
|
467
|
-
dom.unwatchPosition(el);
|
|
468
|
-
},
|
|
469
|
-
isWatchPosition: function (el) {
|
|
470
|
-
return dom.isWatchPosition(el);
|
|
471
|
-
},
|
|
472
|
-
getWatchSizeCount: function (taskId) {
|
|
473
|
-
return dom.getWatchSizeCount(taskId);
|
|
474
|
-
},
|
|
475
|
-
watchSize: function (el, cb, immediate = false) {
|
|
476
|
-
return dom.watchSize(el, cb, immediate, taskId);
|
|
477
|
-
},
|
|
478
|
-
unwatchSize: function (el) {
|
|
479
|
-
dom.unwatchSize(el, taskId);
|
|
480
|
-
},
|
|
481
|
-
isWatchSize: function (el) {
|
|
482
|
-
return dom.isWatchSize(el);
|
|
483
|
-
},
|
|
484
|
-
getWatchCount: function (taskId) {
|
|
485
|
-
return dom.getWatchCount(taskId);
|
|
486
|
-
},
|
|
487
|
-
watch: function (el, cb, mode = 'default', immediate = false) {
|
|
488
|
-
dom.watch(el, cb, mode, immediate, taskId);
|
|
489
|
-
},
|
|
490
|
-
unwatch: function (el) {
|
|
491
|
-
dom.unwatch(el, taskId);
|
|
492
|
-
},
|
|
493
|
-
isWatch(el) {
|
|
494
|
-
return dom.isWatch(el);
|
|
495
|
-
},
|
|
496
|
-
watchStyle: function (el, name, cb, immediate = false) {
|
|
497
|
-
dom.watchStyle(el, name, cb, immediate);
|
|
498
|
-
},
|
|
499
|
-
isWatchStyle: function (el) {
|
|
500
|
-
return dom.isWatchStyle(el);
|
|
501
|
-
},
|
|
502
|
-
watchProperty: function (el, name, cb, immediate = false) {
|
|
503
|
-
dom.watchProperty(el, name, cb, immediate);
|
|
504
|
-
},
|
|
505
|
-
isWatchProperty(el) {
|
|
506
|
-
return dom.isWatchProperty(el);
|
|
507
|
-
},
|
|
508
|
-
getWatchInfo: function () {
|
|
509
|
-
return dom.getWatchInfo();
|
|
510
|
-
},
|
|
511
|
-
bindClick: function (e, handler) {
|
|
512
|
-
dom.bindClick(e, handler);
|
|
513
|
-
},
|
|
514
|
-
bindDblClick: function (e, handler) {
|
|
515
|
-
dom.bindDblClick(e, handler);
|
|
516
|
-
},
|
|
517
|
-
bindDown: function (oe, opt) {
|
|
518
|
-
dom.bindDown(oe, opt);
|
|
519
|
-
},
|
|
520
|
-
bindScale: function (oe, handler) {
|
|
521
|
-
dom.bindScale(oe, handler);
|
|
522
|
-
},
|
|
523
|
-
bindGesture: function (oe, before, handler) {
|
|
524
|
-
dom.bindGesture(oe, before, handler);
|
|
525
|
-
},
|
|
526
|
-
bindLong: function (e, long) {
|
|
527
|
-
dom.bindLong(e, long);
|
|
528
|
-
},
|
|
529
|
-
setDragData(data) {
|
|
530
|
-
dom.setDragData(data);
|
|
531
|
-
},
|
|
532
|
-
bindDrag: function (e, opt) {
|
|
533
|
-
dom.bindDrag(e, opt);
|
|
534
|
-
},
|
|
535
|
-
'is': dom.is,
|
|
536
|
-
bindMove: function (e, opt) {
|
|
537
|
-
return dom.bindMove(e, opt);
|
|
538
|
-
},
|
|
539
|
-
bindResize: function (e, opt) {
|
|
540
|
-
dom.bindResize(e, opt);
|
|
541
|
-
},
|
|
542
|
-
findParentByData: function (el, name, value) {
|
|
543
|
-
return dom.findParentByData(el, name, value);
|
|
544
|
-
},
|
|
545
|
-
findParentByClass: function (el, name) {
|
|
546
|
-
return dom.findParentByClass(el, name);
|
|
547
|
-
},
|
|
548
|
-
findParentByTag: function (el, name) {
|
|
549
|
-
return dom.findParentByTag(el, name);
|
|
550
|
-
},
|
|
551
|
-
index: function (el) {
|
|
552
|
-
return dom.index(el);
|
|
553
|
-
},
|
|
554
|
-
siblings: function (el) {
|
|
555
|
-
return dom.siblings(el);
|
|
556
|
-
},
|
|
557
|
-
siblingsData: function (el, name) {
|
|
558
|
-
return dom.siblingsData(el, name);
|
|
559
|
-
},
|
|
560
|
-
fullscreen: function () {
|
|
561
|
-
return dom.fullscreen();
|
|
562
|
-
},
|
|
563
|
-
exitFullscreen: function () {
|
|
564
|
-
return dom.exitFullscreen();
|
|
565
|
-
},
|
|
566
|
-
createElement: function (tagName) {
|
|
567
|
-
return dom.createElement(tagName);
|
|
696
|
+
prompt: function (opt) {
|
|
697
|
+
if (typeof opt === 'string') {
|
|
698
|
+
opt = {
|
|
699
|
+
'content': opt
|
|
700
|
+
};
|
|
568
701
|
}
|
|
702
|
+
opt.taskId = taskId;
|
|
703
|
+
return form.prompt(opt);
|
|
569
704
|
},
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
notify: function (opt) {
|
|
660
|
-
return form.notify(opt);
|
|
661
|
-
},
|
|
662
|
-
notifyProgress: function (notifyId, per) {
|
|
663
|
-
form.notifyProgress(notifyId, per);
|
|
664
|
-
},
|
|
665
|
-
notifyContent: function (notifyId, opt) {
|
|
666
|
-
form.notifyContent(notifyId, opt);
|
|
667
|
-
},
|
|
668
|
-
hideNotify: function (notifyId) {
|
|
669
|
-
form.hideNotify(notifyId);
|
|
670
|
-
},
|
|
671
|
-
showPop: function (el, pop, direction, opt = {}) {
|
|
672
|
-
form.showPop(el, pop, direction, opt);
|
|
673
|
-
},
|
|
674
|
-
hidePop: function (pop) {
|
|
675
|
-
form.hidePop(pop);
|
|
676
|
-
},
|
|
677
|
-
isJustPop: function (el) {
|
|
678
|
-
return form.isJustPop(el);
|
|
679
|
-
},
|
|
680
|
-
doFocusAndPopEvent: function (e) {
|
|
681
|
-
form.doFocusAndPopEvent(e);
|
|
682
|
-
},
|
|
683
|
-
removePanel(id, vapp, el) {
|
|
684
|
-
return form.removePanel(id, vapp, el);
|
|
685
|
-
},
|
|
686
|
-
createPanel(rootPanel, cls, opt) {
|
|
687
|
-
return form.createPanel(rootPanel, cls, opt, taskId);
|
|
688
|
-
},
|
|
689
|
-
create: function (cls, data, opt) {
|
|
690
|
-
return form.create(cls, data, opt, taskId);
|
|
691
|
-
},
|
|
692
|
-
dialog: function (opt) {
|
|
693
|
-
if (typeof opt === 'string') {
|
|
694
|
-
opt = {
|
|
695
|
-
'content': opt
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
opt.taskId = taskId;
|
|
699
|
-
return form.dialog(opt);
|
|
700
|
-
},
|
|
701
|
-
confirm: function (opt) {
|
|
702
|
-
if (typeof opt === 'string') {
|
|
703
|
-
opt = {
|
|
704
|
-
'content': opt
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
opt.taskId = taskId;
|
|
708
|
-
return form.confirm(opt);
|
|
709
|
-
},
|
|
710
|
-
prompt: function (opt) {
|
|
711
|
-
if (typeof opt === 'string') {
|
|
712
|
-
opt = {
|
|
713
|
-
'content': opt
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
opt.taskId = taskId;
|
|
717
|
-
return form.prompt(opt);
|
|
718
|
-
},
|
|
719
|
-
flash: function (fid) {
|
|
720
|
-
form.flash(fid, taskId);
|
|
721
|
-
},
|
|
722
|
-
showLauncher: function () {
|
|
723
|
-
form.showLauncher();
|
|
724
|
-
},
|
|
725
|
-
hideLauncher: function () {
|
|
726
|
-
form.hideLauncher();
|
|
705
|
+
flash: function (fid) {
|
|
706
|
+
form.flash(fid, taskId);
|
|
707
|
+
},
|
|
708
|
+
showLauncher: function () {
|
|
709
|
+
form.showLauncher();
|
|
710
|
+
},
|
|
711
|
+
hideLauncher: function () {
|
|
712
|
+
form.hideLauncher();
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
'fs': {
|
|
716
|
+
mount: function (name, handler) {
|
|
717
|
+
return clickgo.fs.mount(name, handler, taskId);
|
|
718
|
+
},
|
|
719
|
+
unmount: function (name) {
|
|
720
|
+
return clickgo.fs.unmount(name);
|
|
721
|
+
},
|
|
722
|
+
getContent: function (path, options = {}) {
|
|
723
|
+
return fs.getContent(path, options, taskId);
|
|
724
|
+
},
|
|
725
|
+
putContent: function (path, data, options = {}) {
|
|
726
|
+
return fs.putContent(path, data, options, taskId);
|
|
727
|
+
},
|
|
728
|
+
readLink: function (path, options = {}) {
|
|
729
|
+
return fs.readLink(path, options, taskId);
|
|
730
|
+
},
|
|
731
|
+
symlink: function (fPath, linkPath, options = {}) {
|
|
732
|
+
return fs.symlink(fPath, linkPath, options, taskId);
|
|
733
|
+
},
|
|
734
|
+
unlink: function (path) {
|
|
735
|
+
return fs.unlink(path, taskId);
|
|
736
|
+
},
|
|
737
|
+
stats: function (path) {
|
|
738
|
+
return fs.stats(path, taskId);
|
|
739
|
+
},
|
|
740
|
+
isDir: function (path) {
|
|
741
|
+
return fs.isDir(path, taskId);
|
|
742
|
+
},
|
|
743
|
+
isFile: function (path) {
|
|
744
|
+
return fs.isFile(path, taskId);
|
|
745
|
+
},
|
|
746
|
+
mkdir: function (path, mode) {
|
|
747
|
+
return fs.mkdir(path, mode, taskId);
|
|
748
|
+
},
|
|
749
|
+
rmdir: function (path) {
|
|
750
|
+
return fs.rmdir(path, taskId);
|
|
751
|
+
},
|
|
752
|
+
rmdirDeep: function (path) {
|
|
753
|
+
return fs.rmdirDeep(path, taskId);
|
|
754
|
+
},
|
|
755
|
+
chmod: function (path, mod) {
|
|
756
|
+
return fs.chmod(path, mod, taskId);
|
|
757
|
+
},
|
|
758
|
+
rename(oldPath, newPath) {
|
|
759
|
+
return fs.rename(oldPath, newPath, taskId);
|
|
760
|
+
},
|
|
761
|
+
readDir(path, encoding) {
|
|
762
|
+
return fs.readDir(path, encoding, taskId);
|
|
763
|
+
},
|
|
764
|
+
copyFolder(from, to, options = {}) {
|
|
765
|
+
return fs.copyFolder(from, to, options, taskId);
|
|
766
|
+
},
|
|
767
|
+
copyFile(src, dest) {
|
|
768
|
+
return fs.copyFile(src, dest, taskId);
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
'native': {
|
|
772
|
+
on(name, handler, once = false, formId) {
|
|
773
|
+
native.on(name, handler, once, formId, taskId);
|
|
774
|
+
},
|
|
775
|
+
once(name, handler, formId) {
|
|
776
|
+
native.once(name, handler, formId, taskId);
|
|
777
|
+
},
|
|
778
|
+
off(name, formId) {
|
|
779
|
+
native.off(name, formId, taskId);
|
|
780
|
+
},
|
|
781
|
+
clear(formId, taskId) {
|
|
782
|
+
native.clear(formId, taskId);
|
|
783
|
+
},
|
|
784
|
+
getListenerList(taskId) {
|
|
785
|
+
return native.getListenerList(taskId);
|
|
786
|
+
},
|
|
787
|
+
invoke: function (name, ...param) {
|
|
788
|
+
return native.invoke(name, ...param);
|
|
789
|
+
},
|
|
790
|
+
size: async function (width, height) {
|
|
791
|
+
const rtn = await checkPermission('native.form', false, undefined, taskId);
|
|
792
|
+
if (!rtn[0]) {
|
|
793
|
+
return;
|
|
727
794
|
}
|
|
795
|
+
await native.size(width, height);
|
|
728
796
|
},
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
unmount: function (name) {
|
|
734
|
-
return clickgo.fs.unmount(name);
|
|
735
|
-
},
|
|
736
|
-
getContent: function (path, options = {}) {
|
|
737
|
-
return fs.getContent(path, options, taskId);
|
|
738
|
-
},
|
|
739
|
-
putContent: function (path, data, options = {}) {
|
|
740
|
-
return fs.putContent(path, data, options, taskId);
|
|
741
|
-
},
|
|
742
|
-
readLink: function (path, options = {}) {
|
|
743
|
-
return fs.readLink(path, options, taskId);
|
|
744
|
-
},
|
|
745
|
-
symlink: function (fPath, linkPath, options = {}) {
|
|
746
|
-
return fs.symlink(fPath, linkPath, options, taskId);
|
|
747
|
-
},
|
|
748
|
-
unlink: function (path) {
|
|
749
|
-
return fs.unlink(path, taskId);
|
|
750
|
-
},
|
|
751
|
-
stats: function (path) {
|
|
752
|
-
return fs.stats(path, taskId);
|
|
753
|
-
},
|
|
754
|
-
isDir: function (path) {
|
|
755
|
-
return fs.isDir(path, taskId);
|
|
756
|
-
},
|
|
757
|
-
isFile: function (path) {
|
|
758
|
-
return fs.isFile(path, taskId);
|
|
759
|
-
},
|
|
760
|
-
mkdir: function (path, mode) {
|
|
761
|
-
return fs.mkdir(path, mode, taskId);
|
|
762
|
-
},
|
|
763
|
-
rmdir: function (path) {
|
|
764
|
-
return fs.rmdir(path, taskId);
|
|
765
|
-
},
|
|
766
|
-
rmdirDeep: function (path) {
|
|
767
|
-
return fs.rmdirDeep(path, taskId);
|
|
768
|
-
},
|
|
769
|
-
chmod: function (path, mod) {
|
|
770
|
-
return fs.chmod(path, mod, taskId);
|
|
771
|
-
},
|
|
772
|
-
rename(oldPath, newPath) {
|
|
773
|
-
return fs.rename(oldPath, newPath, taskId);
|
|
774
|
-
},
|
|
775
|
-
readDir(path, encoding) {
|
|
776
|
-
return fs.readDir(path, encoding, taskId);
|
|
777
|
-
},
|
|
778
|
-
copyFolder(from, to, options = {}) {
|
|
779
|
-
return fs.copyFolder(from, to, options, taskId);
|
|
780
|
-
},
|
|
781
|
-
copyFile(src, dest) {
|
|
782
|
-
return fs.copyFile(src, dest, taskId);
|
|
797
|
+
max: async function () {
|
|
798
|
+
const rtn = await checkPermission('native.form', false, undefined, taskId);
|
|
799
|
+
if (!rtn[0]) {
|
|
800
|
+
return;
|
|
783
801
|
}
|
|
802
|
+
await native.max();
|
|
784
803
|
},
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
once(name, handler, formId) {
|
|
790
|
-
native.once(name, handler, formId, taskId);
|
|
791
|
-
},
|
|
792
|
-
off(name, formId) {
|
|
793
|
-
native.off(name, formId, taskId);
|
|
794
|
-
},
|
|
795
|
-
clear(formId, taskId) {
|
|
796
|
-
native.clear(formId, taskId);
|
|
797
|
-
},
|
|
798
|
-
getListenerList(taskId) {
|
|
799
|
-
return native.getListenerList(taskId);
|
|
800
|
-
},
|
|
801
|
-
invoke: function (name, ...param) {
|
|
802
|
-
return native.invoke(name, ...param);
|
|
803
|
-
},
|
|
804
|
-
size: function (width, height) {
|
|
805
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
806
|
-
const rtn = yield checkPermission('native.form', false, undefined, taskId);
|
|
807
|
-
if (!rtn[0]) {
|
|
808
|
-
return;
|
|
809
|
-
}
|
|
810
|
-
yield native.size(width, height);
|
|
811
|
-
});
|
|
812
|
-
},
|
|
813
|
-
max: function () {
|
|
814
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
815
|
-
const rtn = yield checkPermission('native.form', false, undefined, taskId);
|
|
816
|
-
if (!rtn[0]) {
|
|
817
|
-
return;
|
|
818
|
-
}
|
|
819
|
-
yield native.max();
|
|
820
|
-
});
|
|
821
|
-
},
|
|
822
|
-
min: function () {
|
|
823
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
824
|
-
const rtn = yield checkPermission('native.form', false, undefined, taskId);
|
|
825
|
-
if (!rtn[0]) {
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
yield native.min();
|
|
829
|
-
});
|
|
830
|
-
},
|
|
831
|
-
restore: function () {
|
|
832
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
833
|
-
const rtn = yield checkPermission('native.form', false, undefined, taskId);
|
|
834
|
-
if (!rtn[0]) {
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
yield native.restore();
|
|
838
|
-
});
|
|
839
|
-
},
|
|
840
|
-
activate: function () {
|
|
841
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
842
|
-
const rtn = yield checkPermission('native.form', false, undefined, taskId);
|
|
843
|
-
if (!rtn[0]) {
|
|
844
|
-
return;
|
|
845
|
-
}
|
|
846
|
-
yield native.activate();
|
|
847
|
-
});
|
|
848
|
-
},
|
|
849
|
-
maximizable: function (val) {
|
|
850
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
851
|
-
const rtn = yield checkPermission('native.form', false, undefined, taskId);
|
|
852
|
-
if (!rtn[0]) {
|
|
853
|
-
return;
|
|
854
|
-
}
|
|
855
|
-
yield native.maximizable(val);
|
|
856
|
-
});
|
|
857
|
-
},
|
|
858
|
-
open: function (options) {
|
|
859
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
860
|
-
const rtn = yield checkPermission('native.form', false, undefined, taskId);
|
|
861
|
-
if (!rtn[0]) {
|
|
862
|
-
return null;
|
|
863
|
-
}
|
|
864
|
-
return native.open(options);
|
|
865
|
-
});
|
|
866
|
-
},
|
|
867
|
-
save: function (options) {
|
|
868
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
869
|
-
const rtn = yield checkPermission('native.form', false, undefined, taskId);
|
|
870
|
-
if (!rtn[0]) {
|
|
871
|
-
return null;
|
|
872
|
-
}
|
|
873
|
-
return native.save(options);
|
|
874
|
-
});
|
|
875
|
-
},
|
|
876
|
-
dialog: function (options) {
|
|
877
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
878
|
-
const rtn = yield checkPermission('native.form', false, undefined, taskId);
|
|
879
|
-
if (!rtn[0]) {
|
|
880
|
-
return -1;
|
|
881
|
-
}
|
|
882
|
-
return native.dialog(options);
|
|
883
|
-
});
|
|
884
|
-
},
|
|
885
|
-
ping: function (val) {
|
|
886
|
-
return native.ping(val);
|
|
887
|
-
},
|
|
888
|
-
isMax: function () {
|
|
889
|
-
return native.isMax();
|
|
890
|
-
},
|
|
891
|
-
},
|
|
892
|
-
'storage': {
|
|
893
|
-
get: function (key) {
|
|
894
|
-
return clickgo.storage.get(key, taskId);
|
|
895
|
-
},
|
|
896
|
-
set: function (key, val) {
|
|
897
|
-
return clickgo.storage.set(key, val, taskId);
|
|
898
|
-
},
|
|
899
|
-
remove: function (key) {
|
|
900
|
-
return clickgo.storage.remove(key, taskId);
|
|
901
|
-
},
|
|
902
|
-
list: function () {
|
|
903
|
-
return clickgo.storage.list(taskId);
|
|
904
|
-
},
|
|
905
|
-
all: function () {
|
|
906
|
-
return clickgo.storage.all();
|
|
907
|
-
},
|
|
908
|
-
clear: function (path) {
|
|
909
|
-
return clickgo.storage.clear(path);
|
|
804
|
+
min: async function () {
|
|
805
|
+
const rtn = await checkPermission('native.form', false, undefined, taskId);
|
|
806
|
+
if (!rtn[0]) {
|
|
807
|
+
return;
|
|
910
808
|
}
|
|
809
|
+
await native.min();
|
|
911
810
|
},
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
onFrame: function (fun, opt = {}) {
|
|
917
|
-
opt.taskId = taskId;
|
|
918
|
-
return onFrame(fun, opt);
|
|
919
|
-
},
|
|
920
|
-
offFrame: function (ft, opt = {}) {
|
|
921
|
-
opt.taskId = taskId;
|
|
922
|
-
offFrame(ft, opt);
|
|
923
|
-
},
|
|
924
|
-
get: function (tid) {
|
|
925
|
-
return get(tid);
|
|
926
|
-
},
|
|
927
|
-
getPermissions: function (tid) {
|
|
928
|
-
return getPermissions(tid);
|
|
929
|
-
},
|
|
930
|
-
getList: function () {
|
|
931
|
-
return getList();
|
|
932
|
-
},
|
|
933
|
-
run: function (url, opt = {}) {
|
|
934
|
-
var _a;
|
|
935
|
-
if (opt.permissions) {
|
|
936
|
-
if (!((_a = exports.list[taskId]) === null || _a === void 0 ? void 0 : _a.runtime.permissions.includes('root'))) {
|
|
937
|
-
opt.permissions = undefined;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
return run(url, opt, taskId);
|
|
941
|
-
},
|
|
942
|
-
checkPermission: function (vals, apply = false, applyHandler) {
|
|
943
|
-
return checkPermission(vals, apply, applyHandler, taskId);
|
|
944
|
-
},
|
|
945
|
-
end: function (tid) {
|
|
946
|
-
return end(tid !== null && tid !== void 0 ? tid : taskId);
|
|
947
|
-
},
|
|
948
|
-
loadLocaleData: function (lang, data, pre = '') {
|
|
949
|
-
loadLocaleData(lang, data, pre, taskId);
|
|
950
|
-
},
|
|
951
|
-
loadLocale: function (lang, path) {
|
|
952
|
-
return loadLocale(lang, path, taskId);
|
|
953
|
-
},
|
|
954
|
-
clearLocale: function () {
|
|
955
|
-
clearLocale(taskId);
|
|
956
|
-
},
|
|
957
|
-
setLocale: function (lang, path) {
|
|
958
|
-
return setLocale(lang, path, taskId);
|
|
959
|
-
},
|
|
960
|
-
setLocaleLang: function (lang) {
|
|
961
|
-
setLocaleLang(lang, taskId);
|
|
962
|
-
},
|
|
963
|
-
clearLocaleLang: function () {
|
|
964
|
-
clearLocaleLang(taskId);
|
|
965
|
-
},
|
|
966
|
-
createTimer: function (fun, delay, opt = {}) {
|
|
967
|
-
opt.taskId = taskId;
|
|
968
|
-
return createTimer(fun, delay, opt);
|
|
969
|
-
},
|
|
970
|
-
removeTimer: function (timer) {
|
|
971
|
-
removeTimer(timer, taskId);
|
|
972
|
-
},
|
|
973
|
-
sleep: function (fun, delay) {
|
|
974
|
-
return sleep(fun, delay, taskId);
|
|
975
|
-
},
|
|
976
|
-
'systemTaskInfo': clickgo.task.systemTaskInfo,
|
|
977
|
-
setSystem: function (fid) {
|
|
978
|
-
return setSystem(fid, taskId);
|
|
979
|
-
},
|
|
980
|
-
clearSystem: function () {
|
|
981
|
-
return clearSystem(taskId);
|
|
811
|
+
restore: async function () {
|
|
812
|
+
const rtn = await checkPermission('native.form', false, undefined, taskId);
|
|
813
|
+
if (!rtn[0]) {
|
|
814
|
+
return;
|
|
982
815
|
}
|
|
816
|
+
await native.restore();
|
|
983
817
|
},
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
load: function (theme) {
|
|
989
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
990
|
-
if (!theme) {
|
|
991
|
-
return false;
|
|
992
|
-
}
|
|
993
|
-
return clickgo.theme.load(theme, taskId);
|
|
994
|
-
});
|
|
995
|
-
},
|
|
996
|
-
remove: function (name) {
|
|
997
|
-
return clickgo.theme.remove(name, taskId);
|
|
998
|
-
},
|
|
999
|
-
clear: function () {
|
|
1000
|
-
return clickgo.theme.clear(taskId);
|
|
1001
|
-
},
|
|
1002
|
-
setGlobal: function (theme) {
|
|
1003
|
-
return clickgo.theme.setGlobal(theme);
|
|
1004
|
-
},
|
|
1005
|
-
clearGlobal: function () {
|
|
1006
|
-
clickgo.theme.clearGlobal();
|
|
818
|
+
activate: async function () {
|
|
819
|
+
const rtn = await checkPermission('native.form', false, undefined, taskId);
|
|
820
|
+
if (!rtn[0]) {
|
|
821
|
+
return;
|
|
1007
822
|
}
|
|
823
|
+
await native.activate();
|
|
1008
824
|
},
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
blob2ArrayBuffer: function (blob) {
|
|
1014
|
-
return tool.blob2ArrayBuffer(blob);
|
|
1015
|
-
},
|
|
1016
|
-
sizeFormat: function (size, spliter = ' ') {
|
|
1017
|
-
return tool.sizeFormat(size, spliter);
|
|
1018
|
-
},
|
|
1019
|
-
weightFormat: function (weight, spliter = ' ') {
|
|
1020
|
-
return tool.weightFormat(weight, spliter);
|
|
1021
|
-
},
|
|
1022
|
-
clone: function (obj) {
|
|
1023
|
-
return tool.clone(obj);
|
|
1024
|
-
},
|
|
1025
|
-
sleep: function (ms = 0) {
|
|
1026
|
-
return tool.sleep(ms);
|
|
1027
|
-
},
|
|
1028
|
-
nextFrame() {
|
|
1029
|
-
return tool.nextFrame();
|
|
1030
|
-
},
|
|
1031
|
-
sleepFrame(count) {
|
|
1032
|
-
return tool.sleepFrame(count);
|
|
1033
|
-
},
|
|
1034
|
-
purify: function (text) {
|
|
1035
|
-
return tool.purify(text);
|
|
1036
|
-
},
|
|
1037
|
-
match: function (str, regs) {
|
|
1038
|
-
return tool.match(str, regs);
|
|
1039
|
-
},
|
|
1040
|
-
layoutAddTagClassAndReTagName: function (layout, retagname) {
|
|
1041
|
-
return tool.layoutAddTagClassAndReTagName(layout, retagname);
|
|
1042
|
-
},
|
|
1043
|
-
layoutClassPrepend: function (layout, preps) {
|
|
1044
|
-
return tool.layoutClassPrepend(layout, preps);
|
|
1045
|
-
},
|
|
1046
|
-
stylePrepend: function (style, prep = '') {
|
|
1047
|
-
return tool.stylePrepend(style, prep);
|
|
1048
|
-
},
|
|
1049
|
-
rand: function (min, max) {
|
|
1050
|
-
return tool.rand(min, max);
|
|
1051
|
-
},
|
|
1052
|
-
'RANDOM_N': tool.RANDOM_N,
|
|
1053
|
-
'RANDOM_U': tool.RANDOM_U,
|
|
1054
|
-
'RANDOM_L': tool.RANDOM_L,
|
|
1055
|
-
'RANDOM_UN': tool.RANDOM_UN,
|
|
1056
|
-
'RANDOM_LN': tool.RANDOM_LN,
|
|
1057
|
-
'RANDOM_LU': tool.RANDOM_LU,
|
|
1058
|
-
'RANDOM_LUN': tool.RANDOM_LUN,
|
|
1059
|
-
'RANDOM_V': tool.RANDOM_V,
|
|
1060
|
-
'RANDOM_LUNS': tool.RANDOM_LUNS,
|
|
1061
|
-
random: function (length = 8, source = tool.RANDOM_LN, block = '') {
|
|
1062
|
-
return tool.random(length, source, block);
|
|
1063
|
-
},
|
|
1064
|
-
getBoolean: function (param) {
|
|
1065
|
-
return tool.getBoolean(param);
|
|
1066
|
-
},
|
|
1067
|
-
getNumber: function (param) {
|
|
1068
|
-
return tool.getNumber(param);
|
|
1069
|
-
},
|
|
1070
|
-
getArray(param) {
|
|
1071
|
-
return tool.getArray(param);
|
|
1072
|
-
},
|
|
1073
|
-
escapeHTML: function (html) {
|
|
1074
|
-
return tool.escapeHTML(html);
|
|
1075
|
-
},
|
|
1076
|
-
formatColor: function (color) {
|
|
1077
|
-
return tool.formatColor(color);
|
|
1078
|
-
},
|
|
1079
|
-
rgb2hex: function (r, g, b, a = 1) {
|
|
1080
|
-
return tool.rgb2hex(r, g, b, a);
|
|
1081
|
-
},
|
|
1082
|
-
hex2rgb: function (hex) {
|
|
1083
|
-
return tool.hex2rgb(hex);
|
|
1084
|
-
},
|
|
1085
|
-
rgb2hsl: function (r, g, b, a = 1, decimal = false) {
|
|
1086
|
-
return tool.rgb2hsl(r, g, b, a, decimal);
|
|
1087
|
-
},
|
|
1088
|
-
hsl2rgb: function (h, s, l, a = 1, decimal = false) {
|
|
1089
|
-
return tool.hsl2rgb(h, s, l, a, decimal);
|
|
1090
|
-
},
|
|
1091
|
-
request: function (url, opt) {
|
|
1092
|
-
return tool.request(url, opt);
|
|
1093
|
-
},
|
|
1094
|
-
fetch: function (url, init) {
|
|
1095
|
-
return tool.fetch(url, init);
|
|
1096
|
-
},
|
|
1097
|
-
get: function (url, opt) {
|
|
1098
|
-
return tool.get(url, opt);
|
|
1099
|
-
},
|
|
1100
|
-
post: function (url, data, opt) {
|
|
1101
|
-
return tool.post(url, data, opt);
|
|
1102
|
-
},
|
|
1103
|
-
getResponseJson: function (url, opt) {
|
|
1104
|
-
return tool.getResponseJson(url, opt);
|
|
1105
|
-
},
|
|
1106
|
-
postResponseJson: function (url, data, opt) {
|
|
1107
|
-
return tool.postResponseJson(url, data, opt);
|
|
1108
|
-
},
|
|
1109
|
-
parseUrl: function (url) {
|
|
1110
|
-
return tool.parseUrl(url);
|
|
1111
|
-
},
|
|
1112
|
-
urlResolve: function (from, to) {
|
|
1113
|
-
return tool.urlResolve(from, to);
|
|
1114
|
-
},
|
|
1115
|
-
urlAtom: function (url) {
|
|
1116
|
-
return tool.urlAtom(url);
|
|
1117
|
-
},
|
|
1118
|
-
blob2Text: function (blob) {
|
|
1119
|
-
return tool.blob2Text(blob);
|
|
1120
|
-
},
|
|
1121
|
-
blob2DataUrl: function (blob) {
|
|
1122
|
-
return tool.blob2DataUrl(blob);
|
|
1123
|
-
},
|
|
1124
|
-
execCommand: function (ac) {
|
|
1125
|
-
tool.execCommand(ac);
|
|
1126
|
-
},
|
|
1127
|
-
compar: function (before, after) {
|
|
1128
|
-
return tool.compar(before, after);
|
|
1129
|
-
},
|
|
1130
|
-
formatSecond: function (second) {
|
|
1131
|
-
return tool.formatSecond(second);
|
|
1132
|
-
},
|
|
1133
|
-
formatTime: function (ts, tz) {
|
|
1134
|
-
return tool.formatTime(ts, tz);
|
|
1135
|
-
},
|
|
1136
|
-
isMs: function (time) {
|
|
1137
|
-
return tool.isMs(time);
|
|
1138
|
-
},
|
|
1139
|
-
queryStringify: function (query) {
|
|
1140
|
-
return tool.queryStringify(query);
|
|
1141
|
-
},
|
|
1142
|
-
queryParse: function (query) {
|
|
1143
|
-
return tool.queryParse(query);
|
|
825
|
+
maximizable: async function (val) {
|
|
826
|
+
const rtn = await checkPermission('native.form', false, undefined, taskId);
|
|
827
|
+
if (!rtn[0]) {
|
|
828
|
+
return;
|
|
1144
829
|
}
|
|
830
|
+
await native.maximizable(val);
|
|
1145
831
|
},
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
832
|
+
open: async function (options) {
|
|
833
|
+
const rtn = await checkPermission('native.form', false, undefined, taskId);
|
|
834
|
+
if (!rtn[0]) {
|
|
835
|
+
return null;
|
|
1149
836
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
'title': 'Error',
|
|
1157
|
-
'content': `The "eval" is prohibited.\nFile: "${path}".`,
|
|
1158
|
-
'type': 'danger'
|
|
1159
|
-
});
|
|
1160
|
-
return '';
|
|
1161
|
-
}
|
|
1162
|
-
code = code.replace(/extends[\s\S]+?\.\s*(AbstractApp|AbstractForm|AbstractPanel)\s*{/, (t) => {
|
|
1163
|
-
return t + 'get filename() {return __filename;}';
|
|
1164
|
-
});
|
|
1165
|
-
return code;
|
|
1166
|
-
};
|
|
1167
|
-
app.files['/invoke/clickgo.js'] = `module.exports = invokeClickgo;`;
|
|
1168
|
-
const path = (_d = opt.path) !== null && _d !== void 0 ? _d : ((typeof url === 'string') ? url : '/runtime/' + tool.random(8, tool.RANDOM_LUN) + '.cga');
|
|
1169
|
-
const lio = path.endsWith('.cga') ? path.lastIndexOf('/') : path.slice(0, -1).lastIndexOf('/');
|
|
1170
|
-
const current = path.slice(0, lio);
|
|
1171
|
-
exports.list[taskId] = {
|
|
1172
|
-
'id': taskId,
|
|
1173
|
-
'app': app,
|
|
1174
|
-
'customTheme': false,
|
|
1175
|
-
'locale': clickgo.vue.reactive({
|
|
1176
|
-
'lang': '',
|
|
1177
|
-
'data': {}
|
|
1178
|
-
}),
|
|
1179
|
-
'path': path,
|
|
1180
|
-
'current': current,
|
|
1181
|
-
'runtime': clickgo.vue.reactive({
|
|
1182
|
-
'dialogFormIds': [],
|
|
1183
|
-
'permissions': (_e = opt.permissions) !== null && _e !== void 0 ? _e : []
|
|
1184
|
-
}),
|
|
1185
|
-
'forms': {},
|
|
1186
|
-
'controls': {},
|
|
1187
|
-
'timers': {},
|
|
1188
|
-
'invoke': invoke
|
|
1189
|
-
};
|
|
1190
|
-
if (app.config.locales) {
|
|
1191
|
-
for (let path in app.config.locales) {
|
|
1192
|
-
const locale = app.config.locales[path];
|
|
1193
|
-
if (!path.endsWith('.json')) {
|
|
1194
|
-
path += '.json';
|
|
837
|
+
return native.open(options);
|
|
838
|
+
},
|
|
839
|
+
save: async function (options) {
|
|
840
|
+
const rtn = await checkPermission('native.form', false, undefined, taskId);
|
|
841
|
+
if (!rtn[0]) {
|
|
842
|
+
return null;
|
|
1195
843
|
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
if (!
|
|
1201
|
-
|
|
844
|
+
return native.save(options);
|
|
845
|
+
},
|
|
846
|
+
dialog: async function (options) {
|
|
847
|
+
const rtn = await checkPermission('native.form', false, undefined, taskId);
|
|
848
|
+
if (!rtn[0]) {
|
|
849
|
+
return -1;
|
|
1202
850
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
851
|
+
return native.dialog(options);
|
|
852
|
+
},
|
|
853
|
+
ping: function (val) {
|
|
854
|
+
return native.ping(val);
|
|
855
|
+
},
|
|
856
|
+
isMax: function () {
|
|
857
|
+
return native.isMax();
|
|
858
|
+
},
|
|
859
|
+
},
|
|
860
|
+
'storage': {
|
|
861
|
+
get: function (key) {
|
|
862
|
+
return clickgo.storage.get(key, taskId);
|
|
863
|
+
},
|
|
864
|
+
set: function (key, val) {
|
|
865
|
+
return clickgo.storage.set(key, val, taskId);
|
|
866
|
+
},
|
|
867
|
+
remove: function (key) {
|
|
868
|
+
return clickgo.storage.remove(key, taskId);
|
|
869
|
+
},
|
|
870
|
+
list: function () {
|
|
871
|
+
return clickgo.storage.list(taskId);
|
|
872
|
+
},
|
|
873
|
+
all: function () {
|
|
874
|
+
return clickgo.storage.all();
|
|
875
|
+
},
|
|
876
|
+
clear: function (path) {
|
|
877
|
+
return clickgo.storage.clear(path);
|
|
878
|
+
}
|
|
879
|
+
},
|
|
880
|
+
'task': {
|
|
881
|
+
getFocus: function () {
|
|
882
|
+
return focusId;
|
|
883
|
+
},
|
|
884
|
+
onFrame: function (fun, opt = {}) {
|
|
885
|
+
opt.taskId = taskId;
|
|
886
|
+
return onFrame(fun, opt);
|
|
887
|
+
},
|
|
888
|
+
offFrame: function (ft, opt = {}) {
|
|
889
|
+
opt.taskId = taskId;
|
|
890
|
+
offFrame(ft, opt);
|
|
891
|
+
},
|
|
892
|
+
get: function (tid) {
|
|
893
|
+
return get(tid);
|
|
894
|
+
},
|
|
895
|
+
getPermissions: function (tid) {
|
|
896
|
+
return getPermissions(tid);
|
|
897
|
+
},
|
|
898
|
+
getList: function () {
|
|
899
|
+
return getList();
|
|
900
|
+
},
|
|
901
|
+
run: function (url, opt = {}) {
|
|
902
|
+
if (opt.permissions) {
|
|
903
|
+
if (!exports.list[taskId]?.runtime.permissions.includes('root')) {
|
|
904
|
+
opt.permissions = undefined;
|
|
905
|
+
}
|
|
1206
906
|
}
|
|
1207
|
-
|
|
907
|
+
return run(url, opt, taskId);
|
|
908
|
+
},
|
|
909
|
+
checkPermission: function (vals, apply = false, applyHandler) {
|
|
910
|
+
return checkPermission(vals, apply, applyHandler, taskId);
|
|
911
|
+
},
|
|
912
|
+
end: function (tid) {
|
|
913
|
+
return end(tid ?? taskId);
|
|
914
|
+
},
|
|
915
|
+
loadLocaleData: function (lang, data, pre = '') {
|
|
916
|
+
loadLocaleData(lang, data, pre, taskId);
|
|
917
|
+
},
|
|
918
|
+
loadLocale: function (lang, path) {
|
|
919
|
+
return loadLocale(lang, path, taskId);
|
|
920
|
+
},
|
|
921
|
+
clearLocale: function () {
|
|
922
|
+
clearLocale(taskId);
|
|
923
|
+
},
|
|
924
|
+
setLocale: function (lang, path) {
|
|
925
|
+
return setLocale(lang, path, taskId);
|
|
926
|
+
},
|
|
927
|
+
setLocaleLang: function (lang) {
|
|
928
|
+
setLocaleLang(lang, taskId);
|
|
929
|
+
},
|
|
930
|
+
clearLocaleLang: function () {
|
|
931
|
+
clearLocaleLang(taskId);
|
|
932
|
+
},
|
|
933
|
+
createTimer: function (fun, delay, opt = {}) {
|
|
934
|
+
opt.taskId = taskId;
|
|
935
|
+
return createTimer(fun, delay, opt);
|
|
936
|
+
},
|
|
937
|
+
removeTimer: function (timer) {
|
|
938
|
+
removeTimer(timer, taskId);
|
|
939
|
+
},
|
|
940
|
+
sleep: function (fun, delay) {
|
|
941
|
+
return sleep(fun, delay, taskId);
|
|
942
|
+
},
|
|
943
|
+
'systemTaskInfo': clickgo.task.systemTaskInfo,
|
|
944
|
+
setSystem: function (fid) {
|
|
945
|
+
return setSystem(fid, taskId);
|
|
946
|
+
},
|
|
947
|
+
clearSystem: function () {
|
|
948
|
+
return clearSystem(taskId);
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
'theme': {
|
|
952
|
+
read: function (blob) {
|
|
953
|
+
return clickgo.theme.read(blob);
|
|
954
|
+
},
|
|
955
|
+
load: async function (theme) {
|
|
956
|
+
if (!theme) {
|
|
957
|
+
return false;
|
|
1208
958
|
}
|
|
959
|
+
return clickgo.theme.load(theme, taskId);
|
|
960
|
+
},
|
|
961
|
+
remove: function (name) {
|
|
962
|
+
return clickgo.theme.remove(name, taskId);
|
|
963
|
+
},
|
|
964
|
+
clear: function () {
|
|
965
|
+
return clickgo.theme.clear(taskId);
|
|
966
|
+
},
|
|
967
|
+
setGlobal: function (theme) {
|
|
968
|
+
return clickgo.theme.setGlobal(theme);
|
|
969
|
+
},
|
|
970
|
+
clearGlobal: function () {
|
|
971
|
+
clickgo.theme.clearGlobal();
|
|
1209
972
|
}
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
973
|
+
},
|
|
974
|
+
'tool': {
|
|
975
|
+
compressor: function (file, options = {}) {
|
|
976
|
+
return tool.compressor(file, options);
|
|
977
|
+
},
|
|
978
|
+
blob2ArrayBuffer: function (blob) {
|
|
979
|
+
return tool.blob2ArrayBuffer(blob);
|
|
980
|
+
},
|
|
981
|
+
sizeFormat: function (size, spliter = ' ') {
|
|
982
|
+
return tool.sizeFormat(size, spliter);
|
|
983
|
+
},
|
|
984
|
+
weightFormat: function (weight, spliter = ' ') {
|
|
985
|
+
return tool.weightFormat(weight, spliter);
|
|
986
|
+
},
|
|
987
|
+
clone: function (obj) {
|
|
988
|
+
return tool.clone(obj);
|
|
989
|
+
},
|
|
990
|
+
sleep: function (ms = 0) {
|
|
991
|
+
return tool.sleep(ms);
|
|
992
|
+
},
|
|
993
|
+
nextFrame() {
|
|
994
|
+
return tool.nextFrame();
|
|
995
|
+
},
|
|
996
|
+
sleepFrame(count) {
|
|
997
|
+
return tool.sleepFrame(count);
|
|
998
|
+
},
|
|
999
|
+
purify: function (text) {
|
|
1000
|
+
return tool.purify(text);
|
|
1001
|
+
},
|
|
1002
|
+
match: function (str, regs) {
|
|
1003
|
+
return tool.match(str, regs);
|
|
1004
|
+
},
|
|
1005
|
+
layoutAddTagClassAndReTagName: function (layout, retagname) {
|
|
1006
|
+
return tool.layoutAddTagClassAndReTagName(layout, retagname);
|
|
1007
|
+
},
|
|
1008
|
+
layoutClassPrepend: function (layout, preps) {
|
|
1009
|
+
return tool.layoutClassPrepend(layout, preps);
|
|
1010
|
+
},
|
|
1011
|
+
stylePrepend: function (style, prep = '') {
|
|
1012
|
+
return tool.stylePrepend(style, prep);
|
|
1013
|
+
},
|
|
1014
|
+
rand: function (min, max) {
|
|
1015
|
+
return tool.rand(min, max);
|
|
1016
|
+
},
|
|
1017
|
+
'RANDOM_N': tool.RANDOM_N,
|
|
1018
|
+
'RANDOM_U': tool.RANDOM_U,
|
|
1019
|
+
'RANDOM_L': tool.RANDOM_L,
|
|
1020
|
+
'RANDOM_UN': tool.RANDOM_UN,
|
|
1021
|
+
'RANDOM_LN': tool.RANDOM_LN,
|
|
1022
|
+
'RANDOM_LU': tool.RANDOM_LU,
|
|
1023
|
+
'RANDOM_LUN': tool.RANDOM_LUN,
|
|
1024
|
+
'RANDOM_V': tool.RANDOM_V,
|
|
1025
|
+
'RANDOM_LUNS': tool.RANDOM_LUNS,
|
|
1026
|
+
random: function (length = 8, source = tool.RANDOM_LN, block = '') {
|
|
1027
|
+
return tool.random(length, source, block);
|
|
1028
|
+
},
|
|
1029
|
+
getBoolean: function (param) {
|
|
1030
|
+
return tool.getBoolean(param);
|
|
1031
|
+
},
|
|
1032
|
+
getNumber: function (param) {
|
|
1033
|
+
return tool.getNumber(param);
|
|
1034
|
+
},
|
|
1035
|
+
getArray(param) {
|
|
1036
|
+
return tool.getArray(param);
|
|
1037
|
+
},
|
|
1038
|
+
escapeHTML: function (html) {
|
|
1039
|
+
return tool.escapeHTML(html);
|
|
1040
|
+
},
|
|
1041
|
+
formatColor: function (color) {
|
|
1042
|
+
return tool.formatColor(color);
|
|
1043
|
+
},
|
|
1044
|
+
rgb2hex: function (r, g, b, a = 1) {
|
|
1045
|
+
return tool.rgb2hex(r, g, b, a);
|
|
1046
|
+
},
|
|
1047
|
+
hex2rgb: function (hex) {
|
|
1048
|
+
return tool.hex2rgb(hex);
|
|
1049
|
+
},
|
|
1050
|
+
rgb2hsl: function (r, g, b, a = 1, decimal = false) {
|
|
1051
|
+
return tool.rgb2hsl(r, g, b, a, decimal);
|
|
1052
|
+
},
|
|
1053
|
+
hsl2rgb: function (h, s, l, a = 1, decimal = false) {
|
|
1054
|
+
return tool.hsl2rgb(h, s, l, a, decimal);
|
|
1055
|
+
},
|
|
1056
|
+
request: function (url, opt) {
|
|
1057
|
+
return tool.request(url, opt);
|
|
1058
|
+
},
|
|
1059
|
+
fetch: function (url, init) {
|
|
1060
|
+
return tool.fetch(url, init);
|
|
1061
|
+
},
|
|
1062
|
+
get: function (url, opt) {
|
|
1063
|
+
return tool.get(url, opt);
|
|
1064
|
+
},
|
|
1065
|
+
post: function (url, data, opt) {
|
|
1066
|
+
return tool.post(url, data, opt);
|
|
1067
|
+
},
|
|
1068
|
+
getResponseJson: function (url, opt) {
|
|
1069
|
+
return tool.getResponseJson(url, opt);
|
|
1070
|
+
},
|
|
1071
|
+
postResponseJson: function (url, data, opt) {
|
|
1072
|
+
return tool.postResponseJson(url, data, opt);
|
|
1073
|
+
},
|
|
1074
|
+
parseUrl: function (url) {
|
|
1075
|
+
return tool.parseUrl(url);
|
|
1076
|
+
},
|
|
1077
|
+
urlResolve: function (from, to) {
|
|
1078
|
+
return tool.urlResolve(from, to);
|
|
1079
|
+
},
|
|
1080
|
+
urlAtom: function (url) {
|
|
1081
|
+
return tool.urlAtom(url);
|
|
1082
|
+
},
|
|
1083
|
+
blob2Text: function (blob) {
|
|
1084
|
+
return tool.blob2Text(blob);
|
|
1085
|
+
},
|
|
1086
|
+
blob2DataUrl: function (blob) {
|
|
1087
|
+
return tool.blob2DataUrl(blob);
|
|
1088
|
+
},
|
|
1089
|
+
execCommand: function (ac) {
|
|
1090
|
+
tool.execCommand(ac);
|
|
1091
|
+
},
|
|
1092
|
+
compar: function (before, after) {
|
|
1093
|
+
return tool.compar(before, after);
|
|
1094
|
+
},
|
|
1095
|
+
formatSecond: function (second) {
|
|
1096
|
+
return tool.formatSecond(second);
|
|
1097
|
+
},
|
|
1098
|
+
formatTime: function (ts, tz) {
|
|
1099
|
+
return tool.formatTime(ts, tz);
|
|
1100
|
+
},
|
|
1101
|
+
isMs: function (time) {
|
|
1102
|
+
return tool.isMs(time);
|
|
1103
|
+
},
|
|
1104
|
+
queryStringify: function (query) {
|
|
1105
|
+
return tool.queryStringify(query);
|
|
1106
|
+
},
|
|
1107
|
+
queryParse: function (query) {
|
|
1108
|
+
return tool.queryParse(query);
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
'zip': {
|
|
1112
|
+
get: function (data) {
|
|
1113
|
+
return clickgo.zip.get(data);
|
|
1218
1114
|
}
|
|
1219
|
-
expo = loader.require('/app.js', app.files, {
|
|
1220
|
-
'dir': '/',
|
|
1221
|
-
'invoke': invoke,
|
|
1222
|
-
'preprocess': preprocess,
|
|
1223
|
-
'map': map
|
|
1224
|
-
})[0];
|
|
1225
1115
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1116
|
+
};
|
|
1117
|
+
const preprocess = function (code, path) {
|
|
1118
|
+
const exec = /eval\W/.exec(code);
|
|
1119
|
+
if (exec) {
|
|
1120
|
+
form.notify({
|
|
1121
|
+
'title': 'Error',
|
|
1122
|
+
'content': `The "eval" is prohibited.\nFile: "${path}".`,
|
|
1123
|
+
'type': 'danger'
|
|
1124
|
+
});
|
|
1125
|
+
return '';
|
|
1230
1126
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1127
|
+
code = code.replace(/extends[\s\S]+?\.\s*(AbstractApp|AbstractForm|AbstractPanel)\s*{/, (t) => {
|
|
1128
|
+
return t + 'get filename() {return __filename;}';
|
|
1129
|
+
});
|
|
1130
|
+
return code;
|
|
1131
|
+
};
|
|
1132
|
+
app.files['/invoke/clickgo.js'] = `module.exports = invokeClickgo;`;
|
|
1133
|
+
const path = opt.path ?? ((typeof url === 'string') ? url : '/runtime/' + tool.random(8, tool.RANDOM_LUN) + '.cga');
|
|
1134
|
+
const lio = path.endsWith('.cga') ? path.lastIndexOf('/') : path.slice(0, -1).lastIndexOf('/');
|
|
1135
|
+
const current = path.slice(0, lio);
|
|
1136
|
+
exports.list[taskId] = {
|
|
1137
|
+
'id': taskId,
|
|
1138
|
+
'app': app,
|
|
1139
|
+
'customTheme': false,
|
|
1140
|
+
'locale': clickgo.vue.reactive({
|
|
1141
|
+
'lang': '',
|
|
1142
|
+
'data': {}
|
|
1143
|
+
}),
|
|
1144
|
+
'path': path,
|
|
1145
|
+
'current': current,
|
|
1146
|
+
'runtime': clickgo.vue.reactive({
|
|
1147
|
+
'dialogFormIds': [],
|
|
1148
|
+
'permissions': opt.permissions ?? []
|
|
1149
|
+
}),
|
|
1150
|
+
'forms': {},
|
|
1151
|
+
'controls': {},
|
|
1152
|
+
'timers': {},
|
|
1153
|
+
'invoke': invoke
|
|
1154
|
+
};
|
|
1155
|
+
if (app.config.locales) {
|
|
1156
|
+
for (let path in app.config.locales) {
|
|
1157
|
+
const locale = app.config.locales[path];
|
|
1158
|
+
if (!path.endsWith('.json')) {
|
|
1159
|
+
path += '.json';
|
|
1160
|
+
}
|
|
1161
|
+
await opt.initProgress?.('Load local ' + path + ' ...');
|
|
1162
|
+
const lcontent = await fs.getContent(path, {
|
|
1163
|
+
'encoding': 'utf8'
|
|
1164
|
+
}, taskId);
|
|
1165
|
+
if (!lcontent) {
|
|
1166
|
+
continue;
|
|
1167
|
+
}
|
|
1168
|
+
try {
|
|
1169
|
+
const data = JSON.parse(lcontent);
|
|
1170
|
+
loadLocaleData(locale, data, '', taskId);
|
|
1171
|
+
}
|
|
1172
|
+
catch {
|
|
1173
|
+
}
|
|
1234
1174
|
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1175
|
+
}
|
|
1176
|
+
let expo = [];
|
|
1177
|
+
try {
|
|
1178
|
+
const map = {
|
|
1179
|
+
'clickgo': '/invoke/clickgo'
|
|
1180
|
+
};
|
|
1181
|
+
if (app.config.map) {
|
|
1182
|
+
Object.assign(map, app.config.map);
|
|
1242
1183
|
}
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1184
|
+
expo = loader.require('/app.js', app.files, {
|
|
1185
|
+
'dir': '/',
|
|
1186
|
+
'invoke': invoke,
|
|
1187
|
+
'preprocess': preprocess,
|
|
1188
|
+
'map': map
|
|
1189
|
+
})[0];
|
|
1190
|
+
}
|
|
1191
|
+
catch (e) {
|
|
1192
|
+
delete exports.list[taskId];
|
|
1193
|
+
core.trigger('error', taskId, 0, e, e.message + '(-1)');
|
|
1194
|
+
return -2;
|
|
1195
|
+
}
|
|
1196
|
+
if (!expo?.default) {
|
|
1197
|
+
delete exports.list[taskId];
|
|
1198
|
+
return -3;
|
|
1199
|
+
}
|
|
1200
|
+
dom.createToStyleList(taskId);
|
|
1201
|
+
await opt.initProgress?.('Control initialization ...');
|
|
1202
|
+
const r = await control.init(taskId, invoke, opt.cache);
|
|
1203
|
+
if (r < 0) {
|
|
1204
|
+
dom.removeFromStyleList(taskId);
|
|
1205
|
+
delete exports.list[taskId];
|
|
1206
|
+
return -400 + r;
|
|
1207
|
+
}
|
|
1208
|
+
if (app.config.themes?.length) {
|
|
1209
|
+
for (let path of app.config.themes) {
|
|
1210
|
+
path += '.cgt';
|
|
1211
|
+
path = tool.urlResolve('/', path);
|
|
1212
|
+
await opt.initProgress?.('Load theme ' + path + ' ...');
|
|
1213
|
+
const file = await fs.getContent(path, undefined, taskId);
|
|
1214
|
+
if (file && typeof file !== 'string') {
|
|
1215
|
+
const th = await theme.read(file);
|
|
1216
|
+
if (th) {
|
|
1217
|
+
await theme.load(th, taskId);
|
|
1254
1218
|
}
|
|
1255
1219
|
}
|
|
1256
1220
|
}
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
}
|
|
1263
|
-
if (app.config.style) {
|
|
1264
|
-
const style = yield fs.getContent(app.config.style + '.css', {
|
|
1265
|
-
'encoding': 'utf8'
|
|
1266
|
-
}, taskId);
|
|
1267
|
-
if (style) {
|
|
1268
|
-
const r = tool.stylePrepend(style, 'cg-task' + taskId.toString() + '_');
|
|
1269
|
-
yield ((_l = opt.initProgress) === null || _l === void 0 ? void 0 : _l.call(opt, 'Style initialization ...'));
|
|
1270
|
-
dom.pushStyle(taskId, yield tool.styleUrl2DataUrl(app.config.style, r.style, app.files));
|
|
1271
|
-
}
|
|
1221
|
+
}
|
|
1222
|
+
else {
|
|
1223
|
+
if (theme.global) {
|
|
1224
|
+
await opt.initProgress?.('Load global theme ...');
|
|
1225
|
+
await theme.load(undefined, taskId);
|
|
1272
1226
|
}
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1227
|
+
}
|
|
1228
|
+
if (app.config.style) {
|
|
1229
|
+
const style = await fs.getContent(app.config.style + '.css', {
|
|
1230
|
+
'encoding': 'utf8'
|
|
1231
|
+
}, taskId);
|
|
1232
|
+
if (style) {
|
|
1233
|
+
const r = tool.stylePrepend(style, 'cg-task' + taskId.toString() + '_');
|
|
1234
|
+
await opt.initProgress?.('Style initialization ...');
|
|
1235
|
+
dom.pushStyle(taskId, await tool.styleUrl2DataUrl(app.config.style, r.style, app.files));
|
|
1277
1236
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
}
|
|
1237
|
+
}
|
|
1238
|
+
core.trigger('taskStarted', taskId);
|
|
1239
|
+
if (app.config.permissions) {
|
|
1240
|
+
await opt.initProgress?.('Style initialization ...');
|
|
1241
|
+
await checkPermission(app.config.permissions, true, undefined, taskId);
|
|
1242
|
+
}
|
|
1243
|
+
const appCls = new expo.default();
|
|
1244
|
+
exports.list[taskId].class = appCls;
|
|
1245
|
+
await opt.initProgress?.('Starting ...');
|
|
1246
|
+
await appCls.main(opt.data ?? {});
|
|
1247
|
+
return taskId;
|
|
1284
1248
|
}
|
|
1285
1249
|
const locale = {
|
|
1286
1250
|
'sc': {
|
|
@@ -1404,102 +1368,98 @@ const locale = {
|
|
|
1404
1368
|
'read-write': 'Đọc/ghi'
|
|
1405
1369
|
}
|
|
1406
1370
|
};
|
|
1407
|
-
function checkPermission(
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1371
|
+
async function checkPermission(vals, apply = false, applyHandler, taskId) {
|
|
1372
|
+
if (!taskId) {
|
|
1373
|
+
return [false];
|
|
1374
|
+
}
|
|
1375
|
+
const task = exports.list[taskId];
|
|
1376
|
+
if (!task) {
|
|
1377
|
+
return [false];
|
|
1378
|
+
}
|
|
1379
|
+
if (typeof vals === 'string') {
|
|
1380
|
+
vals = [vals];
|
|
1381
|
+
}
|
|
1382
|
+
const rtn = [];
|
|
1383
|
+
const applyList = [];
|
|
1384
|
+
for (const val of vals) {
|
|
1385
|
+
if (task.runtime.permissions.includes('root')) {
|
|
1386
|
+
rtn.push(true);
|
|
1387
|
+
continue;
|
|
1419
1388
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
for (const v of task.runtime.permissions) {
|
|
1431
|
-
if (!v.startsWith('fs.')) {
|
|
1389
|
+
if (val.startsWith('fs.')) {
|
|
1390
|
+
let yes = false;
|
|
1391
|
+
const path = val.slice(3, -1);
|
|
1392
|
+
for (const v of task.runtime.permissions) {
|
|
1393
|
+
if (!v.startsWith('fs.')) {
|
|
1394
|
+
continue;
|
|
1395
|
+
}
|
|
1396
|
+
const pa = v.slice(3, -1);
|
|
1397
|
+
if (pa.endsWith('/')) {
|
|
1398
|
+
if (!path.startsWith(pa)) {
|
|
1432
1399
|
continue;
|
|
1433
1400
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
else if (pa !== path) {
|
|
1401
|
+
}
|
|
1402
|
+
else if (pa !== path) {
|
|
1403
|
+
continue;
|
|
1404
|
+
}
|
|
1405
|
+
if (val.endsWith('w')) {
|
|
1406
|
+
if (v.endsWith('r')) {
|
|
1441
1407
|
continue;
|
|
1442
1408
|
}
|
|
1443
|
-
if (val.endsWith('w')) {
|
|
1444
|
-
if (v.endsWith('r')) {
|
|
1445
|
-
continue;
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
yes = true;
|
|
1449
|
-
break;
|
|
1450
1409
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
applyList.push(val);
|
|
1454
|
-
}
|
|
1455
|
-
continue;
|
|
1410
|
+
yes = true;
|
|
1411
|
+
break;
|
|
1456
1412
|
}
|
|
1457
|
-
|
|
1458
|
-
if (!
|
|
1413
|
+
rtn.push(yes);
|
|
1414
|
+
if (!yes && apply) {
|
|
1459
1415
|
applyList.push(val);
|
|
1460
1416
|
}
|
|
1461
|
-
|
|
1417
|
+
continue;
|
|
1462
1418
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
const lang = (_k = (_j = locale[core.config.locale]) === null || _j === void 0 ? void 0 : _j[item]) !== null && _k !== void 0 ? _k : locale['en'][item];
|
|
1419
|
+
const result = task.runtime.permissions.includes(val);
|
|
1420
|
+
if (!result && apply) {
|
|
1421
|
+
applyList.push(val);
|
|
1422
|
+
}
|
|
1423
|
+
rtn.push(result);
|
|
1424
|
+
}
|
|
1425
|
+
if (applyList.length) {
|
|
1426
|
+
let html = '<div>"' + tool.escapeHTML(task.app.config.name) + '" ' + ((locale[core.config.locale]?.['apply-permission'] ?? locale['en']['apply-permission']) + ':') + '</div>';
|
|
1427
|
+
for (const item of applyList) {
|
|
1428
|
+
if (item.startsWith('fs.')) {
|
|
1429
|
+
const path = item.slice(3, -1);
|
|
1475
1430
|
html += '<div style="margin-top: 10px;">' +
|
|
1476
|
-
(
|
|
1431
|
+
(locale[core.config.locale]?.fs ?? locale['en'].fs) + ' ' + tool.escapeHTML(path) + ' ' + (item.endsWith('r') ? (locale[core.config.locale]?.readonly ?? locale['en'].readonly) : (locale[core.config.locale]?.['read-write'] ?? locale['en']['read-write'])) +
|
|
1477
1432
|
'<div style="color: hsl(0,0%,60%);">' + tool.escapeHTML(item) + '</div>' +
|
|
1478
1433
|
'</div>';
|
|
1434
|
+
continue;
|
|
1479
1435
|
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
try {
|
|
1491
|
-
applyHandler === null || applyHandler === void 0 ? void 0 : applyHandler(applyList);
|
|
1492
|
-
}
|
|
1493
|
-
catch (e) {
|
|
1494
|
-
console.log('task.checkPermission', e);
|
|
1436
|
+
const lang = locale[core.config.locale]?.[item] ?? locale['en'][item];
|
|
1437
|
+
html += '<div style="margin-top: 10px;">' +
|
|
1438
|
+
(lang ?? locale[core.config.locale]?.unknown ?? locale['en'].unknown) +
|
|
1439
|
+
'<div style="color: hsl(0,0%,60%);">' + tool.escapeHTML(item) + '</div>' +
|
|
1440
|
+
'</div>';
|
|
1441
|
+
}
|
|
1442
|
+
if (await form.superConfirm(html)) {
|
|
1443
|
+
for (let i = 0; i < rtn.length; ++i) {
|
|
1444
|
+
if (rtn[i]) {
|
|
1445
|
+
continue;
|
|
1495
1446
|
}
|
|
1447
|
+
rtn[i] = true;
|
|
1448
|
+
}
|
|
1449
|
+
for (const item of applyList) {
|
|
1450
|
+
task.runtime.permissions.push(item);
|
|
1451
|
+
}
|
|
1452
|
+
try {
|
|
1453
|
+
applyHandler?.(applyList);
|
|
1454
|
+
}
|
|
1455
|
+
catch (e) {
|
|
1456
|
+
console.log('task.checkPermission', e);
|
|
1496
1457
|
}
|
|
1497
1458
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1459
|
+
}
|
|
1460
|
+
return rtn;
|
|
1500
1461
|
}
|
|
1501
1462
|
function end(taskId) {
|
|
1502
|
-
var _a;
|
|
1503
1463
|
if (typeof taskId === 'string') {
|
|
1504
1464
|
taskId = parseInt(taskId);
|
|
1505
1465
|
}
|
|
@@ -1535,7 +1495,7 @@ function end(taskId) {
|
|
|
1535
1495
|
console.log('Form Unmount Error', msg, err);
|
|
1536
1496
|
}
|
|
1537
1497
|
f.vapp._container.remove();
|
|
1538
|
-
|
|
1498
|
+
form.elements.popList.querySelector('[data-form-id="' + f.id.toString() + '"]')?.remove();
|
|
1539
1499
|
dom.clearWatchStyle(fid);
|
|
1540
1500
|
dom.clearWatchProperty(fid);
|
|
1541
1501
|
dom.clearWatchPosition(fid);
|
|
@@ -1581,30 +1541,28 @@ function loadLocaleData(lang, data, pre = '', taskId) {
|
|
|
1581
1541
|
}
|
|
1582
1542
|
}
|
|
1583
1543
|
}
|
|
1584
|
-
function loadLocale(lang, path, taskId) {
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1544
|
+
async function loadLocale(lang, path, taskId) {
|
|
1545
|
+
if (!taskId) {
|
|
1546
|
+
return false;
|
|
1547
|
+
}
|
|
1548
|
+
const task = exports.list[taskId];
|
|
1549
|
+
if (!task) {
|
|
1550
|
+
return false;
|
|
1551
|
+
}
|
|
1552
|
+
const fcontent = await fs.getContent(path + '.json', {
|
|
1553
|
+
'encoding': 'utf8'
|
|
1554
|
+
}, taskId);
|
|
1555
|
+
if (!fcontent) {
|
|
1556
|
+
return false;
|
|
1557
|
+
}
|
|
1558
|
+
try {
|
|
1559
|
+
const data = JSON.parse(fcontent);
|
|
1560
|
+
loadLocaleData(lang, data, '', task.id);
|
|
1561
|
+
return true;
|
|
1562
|
+
}
|
|
1563
|
+
catch {
|
|
1564
|
+
return false;
|
|
1565
|
+
}
|
|
1608
1566
|
}
|
|
1609
1567
|
function clearLocale(taskId) {
|
|
1610
1568
|
if (!taskId) {
|
|
@@ -1641,7 +1599,6 @@ function clearLocaleLang(taskId) {
|
|
|
1641
1599
|
task.locale.lang = '';
|
|
1642
1600
|
}
|
|
1643
1601
|
function createTimer(fun, delay, opt = {}) {
|
|
1644
|
-
var _a;
|
|
1645
1602
|
const taskId = opt.taskId;
|
|
1646
1603
|
const formId = opt.formId;
|
|
1647
1604
|
if (!taskId) {
|
|
@@ -1654,7 +1611,7 @@ function createTimer(fun, delay, opt = {}) {
|
|
|
1654
1611
|
if (formId && !task.forms[formId]) {
|
|
1655
1612
|
return 0;
|
|
1656
1613
|
}
|
|
1657
|
-
const count =
|
|
1614
|
+
const count = opt.count ?? 0;
|
|
1658
1615
|
let c = 0;
|
|
1659
1616
|
if (opt.immediate) {
|
|
1660
1617
|
const r = fun();
|
|
@@ -1694,7 +1651,7 @@ function createTimer(fun, delay, opt = {}) {
|
|
|
1694
1651
|
else {
|
|
1695
1652
|
timer = window.setInterval(timerHandler, delay);
|
|
1696
1653
|
}
|
|
1697
|
-
task.timers[timer] = formId
|
|
1654
|
+
task.timers[timer] = formId ?? 0;
|
|
1698
1655
|
return timer;
|
|
1699
1656
|
}
|
|
1700
1657
|
function removeTimer(timer, taskId) {
|
|
@@ -1723,7 +1680,6 @@ exports.systemTaskInfo = clickgo.vue.reactive({
|
|
|
1723
1680
|
'length': 0
|
|
1724
1681
|
});
|
|
1725
1682
|
clickgo.vue.watch(exports.systemTaskInfo, function (n, o) {
|
|
1726
|
-
var _a, _b;
|
|
1727
1683
|
const originKeys = ['taskId', 'formId', 'length'];
|
|
1728
1684
|
for (const key of originKeys) {
|
|
1729
1685
|
if (exports.systemTaskInfo[key] !== undefined) {
|
|
@@ -1734,7 +1690,7 @@ clickgo.vue.watch(exports.systemTaskInfo, function (n, o) {
|
|
|
1734
1690
|
'content': 'There is a software that maliciously removed the system task info item.\nKey: ' + key,
|
|
1735
1691
|
'type': 'warning'
|
|
1736
1692
|
});
|
|
1737
|
-
exports.systemTaskInfo[key] =
|
|
1693
|
+
exports.systemTaskInfo[key] = o[key] ?? 0;
|
|
1738
1694
|
}
|
|
1739
1695
|
for (const key in exports.systemTaskInfo) {
|
|
1740
1696
|
if (!['taskId', 'formId', 'length'].includes(key)) {
|
|
@@ -1754,7 +1710,7 @@ clickgo.vue.watch(exports.systemTaskInfo, function (n, o) {
|
|
|
1754
1710
|
'content': 'There is a software that maliciously modifies the system task info item.\nKey: ' + key,
|
|
1755
1711
|
'type': 'warning'
|
|
1756
1712
|
});
|
|
1757
|
-
exports.systemTaskInfo[key] =
|
|
1713
|
+
exports.systemTaskInfo[key] = o[key] ?? 0;
|
|
1758
1714
|
}
|
|
1759
1715
|
}, {
|
|
1760
1716
|
'deep': true
|