clickgo 3.1.2-dev11 → 3.1.4-dev13

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.
Files changed (110) hide show
  1. package/README.md +1 -1
  2. package/dist/app/demo/app.js +0 -73
  3. package/dist/app/demo/config.json +113 -0
  4. package/dist/app/demo/form/control/button/button.js +12 -11
  5. package/dist/app/demo/form/control/button/button.xml +6 -6
  6. package/dist/app/demo/form/control/check/check.js +14 -10
  7. package/dist/app/demo/form/control/file/file.js +15 -13
  8. package/dist/app/demo/form/control/{overflow/overflow.css → flow/flow.css} +0 -0
  9. package/dist/app/demo/form/control/flow/flow.js +64 -0
  10. package/dist/app/demo/form/control/{overflow/overflow.scss → flow/flow.scss} +0 -0
  11. package/dist/app/demo/form/control/flow/flow.xml +101 -0
  12. package/dist/app/demo/form/control/form/form.js +1 -1
  13. package/dist/app/demo/form/control/form/form.xml +3 -3
  14. package/dist/app/demo/form/control/img/img.xml +2 -2
  15. package/dist/app/demo/form/control/list/list.js +95 -75
  16. package/dist/app/demo/form/control/list/list.xml +15 -11
  17. package/dist/app/demo/form/control/marquee/marquee.js +12 -10
  18. package/dist/app/demo/form/control/menu/menu.js +10 -6
  19. package/dist/app/demo/form/control/monaco/monaco.js +50 -60
  20. package/dist/app/demo/form/control/monaco/monaco.xml +6 -5
  21. package/dist/app/demo/form/control/property/property.js +131 -127
  22. package/dist/app/demo/form/control/radio/radio.js +9 -5
  23. package/dist/app/demo/form/control/scroll/scroll.js +16 -12
  24. package/dist/app/demo/form/control/scroll/scroll.xml +10 -10
  25. package/dist/app/demo/form/control/select/select.js +132 -71
  26. package/dist/app/demo/form/control/select/select.xml +69 -67
  27. package/dist/app/demo/form/control/tab/tab.js +21 -20
  28. package/dist/app/demo/form/control/tab/tab.xml +2 -2
  29. package/dist/app/demo/form/control/text/text.js +53 -45
  30. package/dist/app/demo/form/control/text/text.xml +3 -3
  31. package/dist/app/demo/form/control/{greatview/greatview.css → vflow/vflow.css} +0 -0
  32. package/dist/app/demo/form/control/vflow/vflow.js +79 -0
  33. package/dist/app/demo/form/control/{greatview/greatview.scss → vflow/vflow.scss} +0 -0
  34. package/dist/app/demo/form/control/{greatview/greatview.xml → vflow/vflow.xml} +25 -25
  35. package/dist/app/demo/form/event/form/form.js +58 -56
  36. package/dist/app/demo/form/event/form/form.xml +3 -3
  37. package/dist/app/demo/form/event/other/other.js +29 -0
  38. package/dist/app/demo/form/event/other/other.xml +5 -0
  39. package/dist/app/demo/form/event/screen/screen.js +30 -28
  40. package/dist/app/demo/form/event/screen/screen.xml +2 -2
  41. package/dist/app/demo/form/event/task/task.js +31 -31
  42. package/dist/app/demo/form/event/task/task.xml +3 -3
  43. package/dist/app/demo/form/main.js +166 -5
  44. package/dist/app/demo/form/main.xml +37 -35
  45. package/dist/app/demo/form/method/aform/aform.js +2 -1
  46. package/dist/app/demo/form/method/aform/aform.xml +3 -2
  47. package/dist/app/demo/form/method/aform/sd.js +28 -0
  48. package/dist/app/demo/form/method/aform/sd.xml +7 -0
  49. package/dist/app/demo/form/method/aform/test.xml +4 -5
  50. package/dist/app/demo/form/method/core/core.js +23 -8
  51. package/dist/app/demo/form/method/core/core.xml +6 -1
  52. package/dist/app/demo/form/method/dom/dom.js +91 -99
  53. package/dist/app/demo/form/method/dom/dom.xml +6 -7
  54. package/dist/app/demo/form/method/form/form.js +8 -8
  55. package/dist/app/demo/form/method/form/form.xml +4 -4
  56. package/dist/app/demo/form/method/fs/fs.js +34 -33
  57. package/dist/app/demo/form/method/fs/fs.xml +1 -1
  58. package/dist/app/demo/form/method/fs/text.js +12 -12
  59. package/dist/app/demo/form/method/native/native.js +50 -0
  60. package/dist/app/demo/form/method/native/native.xml +12 -0
  61. package/dist/app/demo/form/method/system/system.js +50 -0
  62. package/dist/app/demo/form/method/system/system.xml +11 -0
  63. package/dist/app/demo/form/method/task/task.js +68 -62
  64. package/dist/app/demo/form/method/task/task.xml +5 -6
  65. package/dist/app/demo/form/method/theme/theme.js +14 -14
  66. package/dist/app/demo/form/method/tool/tool.js +29 -28
  67. package/dist/app/demo/form/method/tool/tool.xml +3 -3
  68. package/dist/app/demo/form/method/zip/zip.js +46 -41
  69. package/dist/app/demo/form/method/zip/zip.xml +1 -1
  70. package/dist/app/task/app.js +0 -25
  71. package/dist/app/task/config.json +29 -0
  72. package/dist/app/task/form/bar/bar.js +1 -1
  73. package/dist/app/task/form/bar/bar.xml +1 -1
  74. package/dist/clickgo.js +1 -1
  75. package/dist/clickgo.ts +1 -1
  76. package/dist/control/common.cgc +0 -0
  77. package/dist/control/form.cgc +0 -0
  78. package/dist/control/monaco.cgc +0 -0
  79. package/dist/control/property.cgc +0 -0
  80. package/dist/control/task.cgc +0 -0
  81. package/dist/global.css +1 -1
  82. package/dist/index.js +6 -3
  83. package/dist/index.ts +9 -3
  84. package/dist/lib/control.js +70 -104
  85. package/dist/lib/control.ts +97 -123
  86. package/dist/lib/core.js +163 -253
  87. package/dist/lib/core.ts +185 -268
  88. package/dist/lib/dom.js +565 -484
  89. package/dist/lib/dom.ts +704 -547
  90. package/dist/lib/form.js +211 -159
  91. package/dist/lib/form.ts +196 -121
  92. package/dist/lib/fs.js +107 -12
  93. package/dist/lib/fs.ts +111 -20
  94. package/dist/lib/native.js +142 -8
  95. package/dist/lib/native.ts +181 -11
  96. package/dist/lib/task.js +526 -164
  97. package/dist/lib/task.ts +598 -179
  98. package/dist/lib/tool.js +48 -1
  99. package/dist/lib/tool.ts +61 -0
  100. package/dist/lib/zip.ts +2 -0
  101. package/dist/theme/familiar.cgt +0 -0
  102. package/package.json +2 -2
  103. package/types/index.d.ts +83 -39
  104. package/dist/app/demo/form/control/greatview/greatview.js +0 -92
  105. package/dist/app/demo/form/control/overflow/overflow.js +0 -70
  106. package/dist/app/demo/form/control/overflow/overflow.xml +0 -98
  107. package/dist/app/demo/form/control/view/view.css +0 -1
  108. package/dist/app/demo/form/control/view/view.js +0 -73
  109. package/dist/app/demo/form/control/view/view.scss +0 -18
  110. package/dist/app/demo/form/control/view/view.xml +0 -94
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.lastId = exports.list = void 0;
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.checkPermission = 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,9 +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;
24
+ let focusId = null;
25
+ function setFocus(id) {
26
+ focusId = id !== null && id !== void 0 ? id : null;
27
+ }
28
+ exports.setFocus = setFocus;
29
+ function getFocus() {
30
+ return focusId;
31
+ }
32
+ exports.getFocus = getFocus;
23
33
  const localeData = {
24
34
  'en': {
25
35
  'loading': 'Loading...',
@@ -125,7 +135,7 @@ function get(tid) {
125
135
  return null;
126
136
  }
127
137
  return {
128
- 'name': exports.list[tid].config.name,
138
+ 'name': exports.list[tid].app.config.name,
129
139
  'locale': exports.list[tid].locale.lang,
130
140
  'customTheme': exports.list[tid].customTheme,
131
141
  'formCount': Object.keys(exports.list[tid].forms).length,
@@ -140,7 +150,7 @@ function getList() {
140
150
  for (const tid in exports.list) {
141
151
  const item = exports.list[tid];
142
152
  rtn[tid] = {
143
- 'name': item.config.name,
153
+ 'name': item.app.config.name,
144
154
  'locale': item.locale.lang,
145
155
  'customTheme': item.customTheme,
146
156
  'formCount': Object.keys(item.forms).length,
@@ -153,7 +163,7 @@ function getList() {
153
163
  }
154
164
  exports.getList = getList;
155
165
  function run(url, opt = {}) {
156
- var _a, _b, _c;
166
+ var _a, _b, _c, _d;
157
167
  return __awaiter(this, void 0, void 0, function* () {
158
168
  let ntask = null;
159
169
  if (opt.taskId) {
@@ -181,27 +191,41 @@ function run(url, opt = {}) {
181
191
  'current': ntask ? ntask.current : undefined,
182
192
  'progress': opt.progress
183
193
  });
184
- if (!app) {
185
- if (notifyId) {
186
- setTimeout(function () {
187
- form.hideNotify(notifyId);
188
- }, 2000);
189
- }
190
- return -1;
191
- }
192
- if (notifyId && !app.net) {
194
+ if (notifyId) {
193
195
  setTimeout(function () {
194
196
  form.hideNotify(notifyId);
195
197
  }, 2000);
196
198
  }
199
+ if (!app) {
200
+ return -1;
201
+ }
197
202
  const taskId = ++exports.lastId;
198
- const unblock = (_c = opt.unblock) !== null && _c !== void 0 ? _c : [];
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', 'Number'
207
+ ];
208
+ for (const name of unblockSys) {
209
+ if (unblock.includes(name)) {
210
+ continue;
211
+ }
212
+ unblock.push(name);
213
+ }
199
214
  const invoke = {};
200
215
  if (!unblock.includes('window')) {
201
- invoke.window = undefined;
216
+ invoke.window = {};
217
+ for (const name of unblock) {
218
+ if (window[name] === undefined) {
219
+ continue;
220
+ }
221
+ invoke.window[name] = window[name];
222
+ }
202
223
  }
203
224
  const ks = Object.getOwnPropertyNames(window);
204
225
  for (const k of ks) {
226
+ if (k.includes('window')) {
227
+ continue;
228
+ }
205
229
  if (k.includes('Event')) {
206
230
  continue;
207
231
  }
@@ -211,20 +235,71 @@ function run(url, opt = {}) {
211
235
  if (/^[0-9]+$/.test(k)) {
212
236
  continue;
213
237
  }
214
- if ([
215
- 'require',
216
- '__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch'
217
- ].includes(k)) {
218
- continue;
219
- }
220
238
  if (unblock.includes(k)) {
221
239
  continue;
222
240
  }
223
241
  invoke[k] = undefined;
224
242
  }
225
243
  invoke.console = {
226
- log: function (message, ...optionalParams) {
227
- console.log(message, ...optionalParams);
244
+ assert: function (condition, ...data) {
245
+ console.assert(condition, ...data);
246
+ },
247
+ clear: function () {
248
+ console.clear();
249
+ },
250
+ count: function (label) {
251
+ console.count(label);
252
+ },
253
+ countReset: function (label) {
254
+ console.countReset(label);
255
+ },
256
+ debug: function (...data) {
257
+ console.debug(...data);
258
+ },
259
+ dir: function (item, options) {
260
+ console.dir(item, options);
261
+ },
262
+ dirxml: function (...data) {
263
+ console.dirxml(...data);
264
+ },
265
+ error: function (...data) {
266
+ console.error(...data);
267
+ },
268
+ group: function (...data) {
269
+ console.group(...data);
270
+ },
271
+ groupCollapsed: function (...data) {
272
+ console.groupCollapsed(...data);
273
+ },
274
+ groupEnd: function () {
275
+ console.groupEnd();
276
+ },
277
+ info: function (...data) {
278
+ console.info(...data);
279
+ },
280
+ log: function (...data) {
281
+ console.log(...data);
282
+ },
283
+ table: function (tabularData, properties) {
284
+ console.table(tabularData, properties);
285
+ },
286
+ time: function (label) {
287
+ console.time(label);
288
+ },
289
+ timeEnd: function (label) {
290
+ console.timeEnd(label);
291
+ },
292
+ timeLog: function (label, ...data) {
293
+ console.timeLog(label, ...data);
294
+ },
295
+ timeStamp: function (label) {
296
+ console.timeStamp(label);
297
+ },
298
+ trace: function (...data) {
299
+ console.trace(...data);
300
+ },
301
+ warn: function (...data) {
302
+ console.warn(...data);
228
303
  }
229
304
  };
230
305
  invoke.loader = {
@@ -293,89 +368,95 @@ function run(url, opt = {}) {
293
368
  getCdn: function () {
294
369
  return core.getCdn();
295
370
  },
296
- initModules: function (names) {
297
- return clickgo.core.initModules(names);
298
- },
299
371
  getModule: function (name) {
300
- return clickgo.core.getModule(name);
372
+ return core.getModule(name);
301
373
  },
302
374
  readApp: function (blob) {
303
- return clickgo.core.readApp(blob);
375
+ return core.readApp(blob);
304
376
  },
305
377
  getAvailArea: function () {
306
- return clickgo.core.getAvailArea();
378
+ return core.getAvailArea();
379
+ },
380
+ hash: function (hash) {
381
+ return core.hash(hash, taskId);
307
382
  }
308
383
  },
309
384
  'dom': {
310
385
  setGlobalCursor: function (type) {
311
- clickgo.dom.setGlobalCursor(type);
386
+ dom.setGlobalCursor(type);
312
387
  },
313
388
  hasTouchButMouse: function (e) {
314
- return clickgo.dom.hasTouchButMouse(e);
389
+ return dom.hasTouchButMouse(e);
315
390
  },
316
391
  getStyleCount: function (taskId, type) {
317
- return clickgo.dom.getStyleCount(taskId, type);
318
- },
319
- getSize: function (el) {
320
- return clickgo.dom.getSize(el);
392
+ return dom.getStyleCount(taskId, type);
321
393
  },
322
394
  watchSize: function (el, cb, immediate = false) {
323
- return clickgo.dom.watchSize(el, cb, immediate, taskId);
395
+ return dom.watchSize(el, cb, immediate, taskId);
324
396
  },
325
397
  unwatchSize: function (el) {
326
- clickgo.dom.unwatchSize(el, taskId);
398
+ dom.unwatchSize(el, taskId);
327
399
  },
328
- clearWatchSize() {
329
- clickgo.dom.clearWatchSize(taskId);
400
+ isWatchSize(el) {
401
+ return dom.isWatchSize(el);
330
402
  },
331
403
  watch: function (el, cb, mode = 'default', immediate = false) {
332
- clickgo.dom.watch(el, cb, mode, immediate, taskId);
404
+ dom.watch(el, cb, mode, immediate, taskId);
333
405
  },
334
406
  unwatch: function (el) {
335
- clickgo.dom.unwatch(el, taskId);
407
+ dom.unwatch(el, taskId);
336
408
  },
337
- clearWatch: function () {
338
- clickgo.dom.clearWatch(taskId);
409
+ isWatch(el) {
410
+ return dom.isWatch(el);
339
411
  },
340
412
  watchStyle: function (el, name, cb, immediate = false) {
341
- clickgo.dom.watchStyle(el, name, cb, immediate);
413
+ dom.watchStyle(el, name, cb, immediate);
342
414
  },
343
415
  isWatchStyle: function (el) {
344
- return clickgo.dom.isWatchStyle(el);
416
+ return dom.isWatchStyle(el);
417
+ },
418
+ watchProperty(el, name, cb, immediate = false) {
419
+ dom.watchProperty(el, name, cb, immediate);
420
+ },
421
+ isWatchProperty(el) {
422
+ return dom.isWatchProperty(el);
423
+ },
424
+ bindClick(e, handler) {
425
+ dom.bindClick(e, handler);
345
426
  },
346
427
  bindDown: function (oe, opt) {
347
- clickgo.dom.bindDown(oe, opt);
428
+ dom.bindDown(oe, opt);
348
429
  },
349
- bindGesture: function (e, opt) {
350
- clickgo.dom.bindGesture(e, opt);
430
+ bindGesture: function (oe, before, handler) {
431
+ dom.bindGesture(oe, before, handler);
351
432
  },
352
433
  bindLong: function (e, long) {
353
- clickgo.dom.bindLong(e, long);
434
+ dom.bindLong(e, long);
354
435
  },
355
436
  bindDrag: function (e, opt) {
356
- clickgo.dom.bindDrag(e, opt);
437
+ dom.bindDrag(e, opt);
357
438
  },
358
- 'is': clickgo.dom.is,
439
+ 'is': dom.is,
359
440
  bindMove: function (e, opt) {
360
- return clickgo.dom.bindMove(e, opt);
441
+ return dom.bindMove(e, opt);
361
442
  },
362
443
  bindResize: function (e, opt) {
363
- clickgo.dom.bindResize(e, opt);
444
+ dom.bindResize(e, opt);
364
445
  },
365
446
  findParentByData: function (el, name) {
366
- return clickgo.dom.findParentByData(el, name);
447
+ return dom.findParentByData(el, name);
367
448
  },
368
449
  findParentByClass: function (el, name) {
369
- return clickgo.dom.findParentByClass(el, name);
450
+ return dom.findParentByClass(el, name);
370
451
  },
371
452
  siblings: function (el) {
372
- return clickgo.dom.siblings(el);
453
+ return dom.siblings(el);
373
454
  },
374
455
  siblingsData: function (el, name) {
375
- return clickgo.dom.siblingsData(el, name);
456
+ return dom.siblingsData(el, name);
376
457
  },
377
458
  fullscreen: function () {
378
- return clickgo.dom.fullscreen();
459
+ return dom.fullscreen();
379
460
  }
380
461
  },
381
462
  'form': {
@@ -385,73 +466,76 @@ function run(url, opt = {}) {
385
466
  }
386
467
  },
387
468
  min: function (fid) {
388
- return clickgo.form.min(fid);
469
+ return form.min(fid);
389
470
  },
390
471
  max: function max(fid) {
391
- return clickgo.form.max(fid);
472
+ return form.max(fid);
392
473
  },
393
474
  close: function (fid) {
394
- return clickgo.form.close(fid);
475
+ return form.close(fid);
395
476
  },
396
477
  bindResize: function (e, border) {
397
- clickgo.form.bindResize(e, border);
478
+ form.bindResize(e, border);
398
479
  },
399
480
  bindDrag: function (e) {
400
- clickgo.form.bindDrag(e);
481
+ form.bindDrag(e);
401
482
  },
402
483
  getTaskId: function (fid) {
403
- return clickgo.form.getTaskId(fid);
484
+ return form.getTaskId(fid);
404
485
  },
405
486
  get: function (fid) {
406
- return clickgo.form.get(fid);
487
+ return form.get(fid);
407
488
  },
408
489
  getList: function (tid) {
409
- return clickgo.form.getList(tid);
490
+ return form.getList(tid);
491
+ },
492
+ getFocus: function () {
493
+ return form.getFocus();
410
494
  },
411
495
  changeFocus: function (fid = 0) {
412
- clickgo.form.changeFocus(fid);
496
+ form.changeFocus(fid);
413
497
  },
414
498
  getMaxZIndexID: function (out) {
415
- return clickgo.form.getMaxZIndexID(out);
499
+ return form.getMaxZIndexID(out);
416
500
  },
417
501
  getRectByBorder: function (border) {
418
- return clickgo.form.getRectByBorder(border);
502
+ return form.getRectByBorder(border);
419
503
  },
420
504
  showCircular: function (x, y) {
421
- clickgo.form.showCircular(x, y);
505
+ form.showCircular(x, y);
422
506
  },
423
507
  moveRectangle: function (border) {
424
- clickgo.form.moveRectangle(border);
508
+ form.moveRectangle(border);
425
509
  },
426
510
  showRectangle: function (x, y, border) {
427
- clickgo.form.showRectangle(x, y, border);
511
+ form.showRectangle(x, y, border);
428
512
  },
429
513
  hideRectangle: function () {
430
- clickgo.form.hideRectangle();
514
+ form.hideRectangle();
431
515
  },
432
516
  showDrag: function () {
433
- clickgo.form.showDrag();
517
+ form.showDrag();
434
518
  },
435
519
  moveDrag: function (opt) {
436
- clickgo.form.moveDrag(opt);
520
+ form.moveDrag(opt);
437
521
  },
438
522
  hideDrag: function () {
439
- clickgo.form.hideDrag();
523
+ form.hideDrag();
440
524
  },
441
525
  notify: function (opt) {
442
- return clickgo.form.notify(opt);
526
+ return form.notify(opt);
443
527
  },
444
528
  notifyProgress: function (notifyId, per) {
445
- clickgo.form.notifyProgress(notifyId, per);
529
+ form.notifyProgress(notifyId, per);
446
530
  },
447
531
  hideNotify: function (notifyId) {
448
- clickgo.form.hideNotify(notifyId);
532
+ form.hideNotify(notifyId);
449
533
  },
450
534
  showPop: function (el, pop, direction, opt = {}) {
451
- clickgo.form.showPop(el, pop, direction, opt);
535
+ form.showPop(el, pop, direction, opt);
452
536
  },
453
537
  hidePop: function (pop) {
454
- clickgo.form.hidePop(pop);
538
+ form.hidePop(pop);
455
539
  },
456
540
  dialog: function (opt) {
457
541
  if (typeof opt === 'string') {
@@ -460,7 +544,7 @@ function run(url, opt = {}) {
460
544
  };
461
545
  }
462
546
  opt.taskId = taskId;
463
- return clickgo.form.dialog(opt);
547
+ return form.dialog(opt);
464
548
  },
465
549
  confirm: function (opt) {
466
550
  if (typeof opt === 'string') {
@@ -469,16 +553,16 @@ function run(url, opt = {}) {
469
553
  };
470
554
  }
471
555
  opt.taskId = taskId;
472
- return clickgo.form.confirm(opt);
556
+ return form.confirm(opt);
473
557
  },
474
558
  flash: function (fid) {
475
- clickgo.form.flash(fid, taskId);
559
+ form.flash(fid, taskId);
476
560
  },
477
561
  showLauncher: function () {
478
- clickgo.form.showLauncher();
562
+ form.showLauncher();
479
563
  },
480
564
  hideLauncher: function () {
481
- clickgo.form.hideLauncher();
565
+ form.hideLauncher();
482
566
  }
483
567
  },
484
568
  'fs': {
@@ -489,31 +573,31 @@ function run(url, opt = {}) {
489
573
  if (!options.current) {
490
574
  options.current = exports.list[taskId].current;
491
575
  }
492
- return clickgo.fs.getContent(path, options);
576
+ return fs.getContent(path, options);
493
577
  },
494
578
  putContent: function (path, data, options = {}) {
495
579
  if (!options.current) {
496
580
  options.current = exports.list[taskId].current;
497
581
  }
498
- return clickgo.fs.putContent(path, data, options);
582
+ return fs.putContent(path, data, options);
499
583
  },
500
584
  readLink: function (path, options = {}) {
501
585
  if (!options.current) {
502
586
  options.current = exports.list[taskId].current;
503
587
  }
504
- return clickgo.fs.readLink(path, options);
588
+ return fs.readLink(path, options);
505
589
  },
506
590
  symlink: function (fPath, linkPath, options = {}) {
507
591
  if (!options.current) {
508
592
  options.current = exports.list[taskId].current;
509
593
  }
510
- return clickgo.fs.symlink(fPath, linkPath, options);
594
+ return fs.symlink(fPath, linkPath, options);
511
595
  },
512
596
  unlink: function (path, options = {}) {
513
597
  if (!options.current) {
514
598
  options.current = exports.list[taskId].current;
515
599
  }
516
- return clickgo.fs.unlink(path, options);
600
+ return fs.unlink(path, options);
517
601
  },
518
602
  stats: function (path, options = {}) {
519
603
  if (!options.files) {
@@ -522,7 +606,7 @@ function run(url, opt = {}) {
522
606
  if (!options.current) {
523
607
  options.current = exports.list[taskId].current;
524
608
  }
525
- return clickgo.fs.stats(path, options);
609
+ return fs.stats(path, options);
526
610
  },
527
611
  isDir: function (path, options = {}) {
528
612
  if (!options.files) {
@@ -531,7 +615,7 @@ function run(url, opt = {}) {
531
615
  if (!options.current) {
532
616
  options.current = exports.list[taskId].current;
533
617
  }
534
- return clickgo.fs.isDir(path, options);
618
+ return fs.isDir(path, options);
535
619
  },
536
620
  isFile: function (path, options = {}) {
537
621
  if (!options.files) {
@@ -540,37 +624,37 @@ function run(url, opt = {}) {
540
624
  if (!options.current) {
541
625
  options.current = exports.list[taskId].current;
542
626
  }
543
- return clickgo.fs.isFile(path, options);
627
+ return fs.isFile(path, options);
544
628
  },
545
629
  mkdir: function (path, mode, options = {}) {
546
630
  if (!options.current) {
547
631
  options.current = exports.list[taskId].current;
548
632
  }
549
- return clickgo.fs.mkdir(path, mode, options);
633
+ return fs.mkdir(path, mode, options);
550
634
  },
551
635
  rmdir: function (path, options = {}) {
552
636
  if (!options.current) {
553
637
  options.current = exports.list[taskId].current;
554
638
  }
555
- return clickgo.fs.rmdir(path, options);
639
+ return fs.rmdir(path, options);
556
640
  },
557
641
  rmdirDeep: function (path, options = {}) {
558
642
  if (!options.current) {
559
643
  options.current = exports.list[taskId].current;
560
644
  }
561
- return clickgo.fs.rmdirDeep(path, options);
645
+ return fs.rmdirDeep(path, options);
562
646
  },
563
647
  chmod: function (path, mod, options = {}) {
564
648
  if (!options.current) {
565
649
  options.current = exports.list[taskId].current;
566
650
  }
567
- return clickgo.fs.chmod(path, mod, options);
651
+ return fs.chmod(path, mod, options);
568
652
  },
569
653
  rename(oldPath, newPath, options = {}) {
570
654
  if (!options.current) {
571
655
  options.current = exports.list[taskId].current;
572
656
  }
573
- return clickgo.fs.rename(oldPath, newPath, options);
657
+ return fs.rename(oldPath, newPath, options);
574
658
  },
575
659
  readDir(path, options = {}) {
576
660
  if (!options.files) {
@@ -579,94 +663,169 @@ function run(url, opt = {}) {
579
663
  if (!options.current) {
580
664
  options.current = exports.list[taskId].current;
581
665
  }
582
- return clickgo.fs.readDir(path, options);
666
+ return fs.readDir(path, options);
583
667
  },
584
668
  copyFolder(from, to, options = {}) {
585
669
  if (!options.current) {
586
670
  options.current = exports.list[taskId].current;
587
671
  }
588
- return clickgo.fs.copyFolder(from, to, options);
672
+ return fs.copyFolder(from, to, options);
589
673
  },
590
674
  copyFile(src, dest, options = {}) {
591
675
  if (!options.current) {
592
676
  options.current = exports.list[taskId].current;
593
677
  }
594
- return clickgo.fs.copyFile(src, dest, options);
678
+ return fs.copyFile(src, dest, options);
595
679
  }
596
680
  },
597
681
  'native': {
682
+ on(name, handler, once = false, formId) {
683
+ native.on(name, handler, once, formId, taskId);
684
+ },
685
+ once(name, handler, formId) {
686
+ native.once(name, handler, formId, taskId);
687
+ },
688
+ off(name, formId) {
689
+ native.off(name, formId, taskId);
690
+ },
691
+ clear(formId, taskId) {
692
+ native.clear(formId, taskId);
693
+ },
694
+ getListenerList(taskId) {
695
+ return native.getListenerList(taskId);
696
+ },
598
697
  invoke: function (name, ...param) {
599
- return clickgo.native.invoke(name, ...param);
698
+ return native.invoke(name, ...param);
600
699
  },
601
700
  max: function () {
602
- clickgo.native.max();
701
+ return __awaiter(this, void 0, void 0, function* () {
702
+ const rtn = yield checkPermission('native.form', false, undefined, taskId);
703
+ if (!rtn[0]) {
704
+ return;
705
+ }
706
+ yield native.max();
707
+ });
603
708
  },
604
709
  min: function () {
605
- clickgo.native.min();
710
+ return __awaiter(this, void 0, void 0, function* () {
711
+ const rtn = yield checkPermission('native.form', false, undefined, taskId);
712
+ if (!rtn[0]) {
713
+ return;
714
+ }
715
+ yield native.min();
716
+ });
606
717
  },
607
718
  restore: function () {
608
- clickgo.native.restore();
719
+ return __awaiter(this, void 0, void 0, function* () {
720
+ const rtn = yield checkPermission('native.form', false, undefined, taskId);
721
+ if (!rtn[0]) {
722
+ return;
723
+ }
724
+ yield native.restore();
725
+ });
609
726
  },
610
727
  size: function (width, height) {
611
- clickgo.native.size(width, height);
728
+ return __awaiter(this, void 0, void 0, function* () {
729
+ const rtn = yield checkPermission('native.form', false, undefined, taskId);
730
+ if (!rtn[0]) {
731
+ return;
732
+ }
733
+ yield native.size(width, height);
734
+ });
735
+ },
736
+ maximizable: function (val) {
737
+ return __awaiter(this, void 0, void 0, function* () {
738
+ const rtn = yield checkPermission('native.form', false, undefined, taskId);
739
+ if (!rtn[0]) {
740
+ return;
741
+ }
742
+ yield native.maximizable(val);
743
+ });
744
+ },
745
+ ping: function (val) {
746
+ return native.ping(val);
747
+ },
748
+ isMax: function () {
749
+ return native.isMax();
612
750
  }
613
751
  },
614
752
  'task': {
753
+ getFocus() {
754
+ return focusId;
755
+ },
615
756
  onFrame: function (fun, opt = {}) {
616
757
  opt.taskId = taskId;
617
- return clickgo.task.onFrame(fun, opt);
758
+ return onFrame(fun, opt);
618
759
  },
619
760
  offFrame: function (ft, opt = {}) {
620
761
  opt.taskId = taskId;
621
- clickgo.task.offFrame(ft, opt);
762
+ offFrame(ft, opt);
622
763
  },
623
764
  get: function (tid) {
624
- return clickgo.task.get(tid);
765
+ return get(tid);
625
766
  },
626
767
  getList: function () {
627
- return clickgo.task.getList();
768
+ return getList();
628
769
  },
629
770
  run: function (url, opt = {}) {
630
771
  opt.taskId = taskId;
631
- return clickgo.task.run(url, opt);
772
+ if (opt.unblock) {
773
+ const inUnblock = [];
774
+ for (const item of opt.unblock) {
775
+ if (!unblock.includes(item)) {
776
+ continue;
777
+ }
778
+ inUnblock.push(item);
779
+ }
780
+ opt.unblock = inUnblock;
781
+ }
782
+ if (opt.permissions) {
783
+ if (ntask && !ntask.runtime.permissions.includes('root')) {
784
+ opt.permissions = undefined;
785
+ }
786
+ }
787
+ return run(url, opt);
788
+ },
789
+ checkPermission: function (vals, apply = false, applyHandler) {
790
+ return checkPermission(vals, apply, applyHandler, taskId);
632
791
  },
633
792
  end: function (tid) {
634
- return clickgo.task.end(tid !== null && tid !== void 0 ? tid : taskId);
793
+ return end(tid !== null && tid !== void 0 ? tid : taskId);
635
794
  },
636
795
  loadLocaleData: function (lang, data, pre = '') {
637
- clickgo.task.loadLocaleData(lang, data, pre, taskId);
796
+ loadLocaleData(lang, data, pre, taskId);
638
797
  },
639
798
  loadLocale: function (lang, path) {
640
- return clickgo.task.loadLocale(lang, path, taskId);
799
+ return loadLocale(lang, path, taskId);
641
800
  },
642
801
  clearLocale: function () {
643
- clickgo.task.clearLocale(taskId);
802
+ clearLocale(taskId);
644
803
  },
645
804
  setLocale: function (lang, path) {
646
- return clickgo.task.setLocale(lang, path, taskId);
805
+ return setLocale(lang, path, taskId);
647
806
  },
648
807
  setLocaleLang: function (lang) {
649
- clickgo.task.setLocaleLang(lang, taskId);
808
+ setLocaleLang(lang, taskId);
650
809
  },
651
810
  clearLocaleLang: function () {
652
- clickgo.task.clearLocaleLang(taskId);
811
+ clearLocaleLang(taskId);
653
812
  },
654
813
  createTimer: function (fun, delay, opt = {}) {
655
814
  opt.taskId = taskId;
656
- return clickgo.task.createTimer(fun, delay, opt);
815
+ return createTimer(fun, delay, opt);
657
816
  },
658
817
  removeTimer: function (timer) {
659
- clickgo.task.removeTimer(timer, taskId);
818
+ removeTimer(timer, taskId);
660
819
  },
661
820
  sleep: function (fun, delay) {
662
- return clickgo.task.sleep(fun, delay, taskId);
821
+ return sleep(fun, delay, taskId);
663
822
  },
664
- systemTaskInfo: clickgo.task.systemTaskInfo,
823
+ 'systemTaskInfo': clickgo.task.systemTaskInfo,
665
824
  setSystem: function (fid) {
666
- return clickgo.task.setSystem(fid, taskId);
825
+ return setSystem(fid, taskId);
667
826
  },
668
827
  clearSystem: function () {
669
- return clickgo.task.clearSystem(taskId);
828
+ return clearSystem(taskId);
670
829
  }
671
830
  },
672
831
  'theme': {
@@ -696,58 +855,67 @@ function run(url, opt = {}) {
696
855
  },
697
856
  'tool': {
698
857
  blob2ArrayBuffer: function (blob) {
699
- return clickgo.tool.blob2ArrayBuffer(blob);
858
+ return tool.blob2ArrayBuffer(blob);
700
859
  },
701
860
  clone: function (obj) {
702
- return clickgo.tool.clone(obj);
861
+ return tool.clone(obj);
703
862
  },
704
863
  sleep: function (ms = 0) {
705
- return clickgo.tool.sleep(ms);
864
+ return tool.sleep(ms);
865
+ },
866
+ nextFrame() {
867
+ return tool.nextFrame();
868
+ },
869
+ sleepFrame(count) {
870
+ return tool.sleepFrame(count);
706
871
  },
707
872
  purify: function (text) {
708
- return clickgo.tool.purify(text);
873
+ return tool.purify(text);
709
874
  },
710
875
  rand: function (min, max) {
711
- return clickgo.tool.rand(min, max);
712
- },
713
- 'RANDOM_N': clickgo.tool.RANDOM_N,
714
- 'RANDOM_U': clickgo.tool.RANDOM_U,
715
- 'RANDOM_L': clickgo.tool.RANDOM_L,
716
- 'RANDOM_UN': clickgo.tool.RANDOM_UN,
717
- 'RANDOM_LN': clickgo.tool.RANDOM_LN,
718
- 'RANDOM_LU': clickgo.tool.RANDOM_LU,
719
- 'RANDOM_LUN': clickgo.tool.RANDOM_LUN,
720
- 'RANDOM_V': clickgo.tool.RANDOM_V,
721
- 'RANDOM_LUNS': clickgo.tool.RANDOM_LUNS,
722
- random: function (length = 8, source = clickgo.tool.RANDOM_LN, block = '') {
723
- return clickgo.tool.random(length, source, block);
876
+ return tool.rand(min, max);
877
+ },
878
+ 'RANDOM_N': tool.RANDOM_N,
879
+ 'RANDOM_U': tool.RANDOM_U,
880
+ 'RANDOM_L': tool.RANDOM_L,
881
+ 'RANDOM_UN': tool.RANDOM_UN,
882
+ 'RANDOM_LN': tool.RANDOM_LN,
883
+ 'RANDOM_LU': tool.RANDOM_LU,
884
+ 'RANDOM_LUN': tool.RANDOM_LUN,
885
+ 'RANDOM_V': tool.RANDOM_V,
886
+ 'RANDOM_LUNS': tool.RANDOM_LUNS,
887
+ random: function (length = 8, source = tool.RANDOM_LN, block = '') {
888
+ return tool.random(length, source, block);
724
889
  },
725
890
  getBoolean: function (param) {
726
- return clickgo.tool.getBoolean(param);
891
+ return tool.getBoolean(param);
727
892
  },
728
893
  getNumber: function (param) {
729
- return clickgo.tool.getNumber(param);
894
+ return tool.getNumber(param);
895
+ },
896
+ getArray(param) {
897
+ return tool.getArray(param);
730
898
  },
731
899
  escapeHTML: function (html) {
732
- return clickgo.tool.escapeHTML(html);
900
+ return tool.escapeHTML(html);
733
901
  },
734
902
  request: function (url, opt) {
735
- return clickgo.tool.request(url, opt);
903
+ return tool.request(url, opt);
736
904
  },
737
905
  parseUrl: function (url) {
738
- return clickgo.tool.parseUrl(url);
906
+ return tool.parseUrl(url);
739
907
  },
740
908
  urlResolve: function (from, to) {
741
- return clickgo.tool.urlResolve(from, to);
909
+ return tool.urlResolve(from, to);
742
910
  },
743
911
  blob2Text: function (blob) {
744
- return clickgo.tool.blob2Text(blob);
912
+ return tool.blob2Text(blob);
745
913
  },
746
914
  blob2DataUrl: function (blob) {
747
- return clickgo.tool.blob2DataUrl(blob);
915
+ return tool.blob2DataUrl(blob);
748
916
  },
749
917
  execCommand: function (ac) {
750
- clickgo.tool.execCommand(ac);
918
+ tool.execCommand(ac);
751
919
  }
752
920
  },
753
921
  'zip': {
@@ -786,14 +954,36 @@ function run(url, opt = {}) {
786
954
  'path': path,
787
955
  'current': current,
788
956
  'runtime': clickgo.vue.reactive({
789
- 'permissions': {},
790
- 'dialogFormIds': []
957
+ 'dialogFormIds': [],
958
+ 'permissions': (_c = opt.permissions) !== null && _c !== void 0 ? _c : []
791
959
  }),
792
960
  'forms': {},
793
961
  'controls': {},
794
962
  'timers': {},
795
963
  'invoke': invoke
796
964
  };
965
+ if (app.config.locales) {
966
+ for (let path in app.config.locales) {
967
+ const locale = app.config.locales[path];
968
+ if (!path.endsWith('.json')) {
969
+ path += '.json';
970
+ }
971
+ const lcontent = yield fs.getContent(path, {
972
+ 'encoding': 'utf8',
973
+ 'files': app.files,
974
+ 'current': current
975
+ });
976
+ if (!lcontent) {
977
+ continue;
978
+ }
979
+ try {
980
+ const data = JSON.parse(lcontent);
981
+ loadLocaleData(locale, data, '', taskId);
982
+ }
983
+ catch (_e) {
984
+ }
985
+ }
986
+ }
797
987
  let expo = [];
798
988
  try {
799
989
  expo = loader.require('/app.js', app.files, {
@@ -815,23 +1005,190 @@ function run(url, opt = {}) {
815
1005
  return -3;
816
1006
  }
817
1007
  dom.createToStyleList(taskId);
1008
+ const r = yield control.init(taskId, invoke);
1009
+ if (r < 0) {
1010
+ dom.removeFromStyleList(taskId);
1011
+ delete exports.list[taskId];
1012
+ return -400 + r;
1013
+ }
1014
+ if ((_d = app.config.themes) === null || _d === void 0 ? void 0 : _d.length) {
1015
+ for (let path of app.config.themes) {
1016
+ path += '.cgt';
1017
+ path = tool.urlResolve('/', path);
1018
+ const file = yield fs.getContent(path, {
1019
+ 'files': app.files,
1020
+ 'current': current
1021
+ });
1022
+ if (file && typeof file !== 'string') {
1023
+ const th = yield theme.read(file);
1024
+ if (th) {
1025
+ yield theme.load(th, taskId);
1026
+ }
1027
+ }
1028
+ }
1029
+ }
1030
+ else {
1031
+ if (theme.global) {
1032
+ yield theme.load(undefined, taskId);
1033
+ }
1034
+ }
1035
+ if (app.config.style) {
1036
+ const style = yield fs.getContent(app.config.style + '.css', {
1037
+ 'encoding': 'utf8',
1038
+ 'files': app.files,
1039
+ 'current': current
1040
+ });
1041
+ if (style) {
1042
+ const r = tool.stylePrepend(style, 'cg-task' + taskId.toString() + '_');
1043
+ dom.pushStyle(taskId, yield tool.styleUrl2DataUrl(app.config.style, r.style, app.files));
1044
+ }
1045
+ }
818
1046
  core.trigger('taskStarted', taskId);
819
- if (taskId === 1) {
820
- native.invoke('cg-init', native.getToken());
1047
+ if (app.config.permissions) {
1048
+ yield checkPermission(app.config.permissions, true, undefined, taskId);
821
1049
  }
822
1050
  const appCls = new expo.default();
1051
+ exports.list[taskId].class = appCls;
823
1052
  yield appCls.main();
824
- if (!exports.list[taskId].class) {
825
- delete exports.list[taskId];
826
- dom.removeFromStyleList(taskId);
827
- core.trigger('taskEnded', taskId);
828
- return -4;
829
- }
830
1053
  return taskId;
831
1054
  });
832
1055
  }
833
1056
  exports.run = run;
1057
+ const locale = {
1058
+ 'sc': {
1059
+ 'unknown': '未知权限',
1060
+ 'apply-permission': '正在申请权限,请您仔细确认',
1061
+ 'native.form': '实体窗体控制',
1062
+ 'hash': '可修改地址栏 hash',
1063
+ 'fs': '文件系统',
1064
+ 'readonly': '只读',
1065
+ 'read-write': '读写'
1066
+ },
1067
+ 'tc': {
1068
+ 'unknown': '未知許可權',
1069
+ 'apply-permission': '正在申請許可權,請您仔細確認',
1070
+ 'native.form': '實體視窗控制',
1071
+ 'hash': '可修改位址列 hash',
1072
+ 'fs': '檔案系統',
1073
+ 'readonly': '唯讀',
1074
+ 'read-write': '讀寫'
1075
+ },
1076
+ 'en': {
1077
+ 'unknown': 'Unknown',
1078
+ 'apply-permission': 'is applying for permissions, please check carefully',
1079
+ 'native.form': 'Native window control',
1080
+ 'hash': 'Can modify the location hash',
1081
+ 'fs': 'File system',
1082
+ 'readonly': 'Read only',
1083
+ 'read-write': 'Read and write'
1084
+ },
1085
+ 'ja': {
1086
+ 'unknown': '不明な許可',
1087
+ 'apply-permission': '許可申請中、よくご確認ください',
1088
+ 'native.form': 'ローカルウィンドウを操作する',
1089
+ 'hash': '網址の hash 変更可能',
1090
+ 'fs': '資料システム',
1091
+ 'readonly': '読み取り専用',
1092
+ 'read-write': '読み書き'
1093
+ }
1094
+ };
1095
+ function checkPermission(vals, apply = false, applyHandler, taskId) {
1096
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1097
+ return __awaiter(this, void 0, void 0, function* () {
1098
+ if (!taskId) {
1099
+ return [false];
1100
+ }
1101
+ const task = exports.list[taskId];
1102
+ if (!task) {
1103
+ return [false];
1104
+ }
1105
+ if (typeof vals === 'string') {
1106
+ vals = [vals];
1107
+ }
1108
+ const rtn = [];
1109
+ const applyList = [];
1110
+ for (const val of vals) {
1111
+ if (task.runtime.permissions.includes('root')) {
1112
+ rtn.push(true);
1113
+ continue;
1114
+ }
1115
+ if (val.startsWith('fs.')) {
1116
+ let yes = false;
1117
+ const path = val.slice(3, -1);
1118
+ for (const v of task.runtime.permissions) {
1119
+ if (!v.startsWith('fs.')) {
1120
+ continue;
1121
+ }
1122
+ const pa = v.slice(3, -1);
1123
+ if (pa.endsWith('/')) {
1124
+ if (!path.startsWith(pa)) {
1125
+ continue;
1126
+ }
1127
+ }
1128
+ else if (pa !== path) {
1129
+ continue;
1130
+ }
1131
+ if (val.endsWith('w')) {
1132
+ if (v.endsWith('r')) {
1133
+ continue;
1134
+ }
1135
+ }
1136
+ yes = true;
1137
+ break;
1138
+ }
1139
+ rtn.push(yes);
1140
+ if (!yes && apply) {
1141
+ applyList.push(val);
1142
+ }
1143
+ continue;
1144
+ }
1145
+ const result = task.runtime.permissions.includes(val);
1146
+ if (!result && apply) {
1147
+ applyList.push(val);
1148
+ }
1149
+ rtn.push(result);
1150
+ }
1151
+ if (applyList.length) {
1152
+ let html = '<div>"' + tool.escapeHTML(task.app.config.name) + '" ' + (((_b = (_a = locale[core.config.locale]) === null || _a === void 0 ? void 0 : _a['apply-permission']) !== null && _b !== void 0 ? _b : locale['en']['apply-permission']) + ':') + '</div>';
1153
+ for (const item of applyList) {
1154
+ if (item.startsWith('fs.')) {
1155
+ const path = item.slice(3, -1);
1156
+ html += '<div style="margin-top: 10px;">' +
1157
+ ((_d = (_c = locale[core.config.locale]) === null || _c === void 0 ? void 0 : _c.fs) !== null && _d !== void 0 ? _d : locale['en'].fs) + ' ' + tool.escapeHTML(path) + ' ' + (item.endsWith('r') ? ((_f = (_e = locale[core.config.locale]) === null || _e === void 0 ? void 0 : _e.readonly) !== null && _f !== void 0 ? _f : locale['en'].readonly) : ((_h = (_g = locale[core.config.locale]) === null || _g === void 0 ? void 0 : _g['read-write']) !== null && _h !== void 0 ? _h : locale['en']['read-write'])) +
1158
+ '<div style="color: var(--system-border-color);">' + tool.escapeHTML(item) + '</div>' +
1159
+ '</div>';
1160
+ continue;
1161
+ }
1162
+ const lang = (_k = (_j = locale[core.config.locale]) === null || _j === void 0 ? void 0 : _j[item]) !== null && _k !== void 0 ? _k : locale['en'][item];
1163
+ html += '<div style="margin-top: 10px;">' +
1164
+ ((_m = lang !== null && lang !== void 0 ? lang : (_l = locale[core.config.locale]) === null || _l === void 0 ? void 0 : _l.unknown) !== null && _m !== void 0 ? _m : locale['en'].unknown) +
1165
+ '<div style="color: var(--system-border-color);">' + tool.escapeHTML(item) + '</div>' +
1166
+ '</div>';
1167
+ }
1168
+ if (yield form.superConfirm(html)) {
1169
+ for (let i = 0; i < rtn.length; ++i) {
1170
+ if (rtn[i]) {
1171
+ continue;
1172
+ }
1173
+ rtn[i] = true;
1174
+ }
1175
+ for (const item of applyList) {
1176
+ task.runtime.permissions.push(item);
1177
+ }
1178
+ try {
1179
+ applyHandler === null || applyHandler === void 0 ? void 0 : applyHandler(applyList);
1180
+ }
1181
+ catch (e) {
1182
+ console.log('task.checkPermission', e);
1183
+ }
1184
+ }
1185
+ }
1186
+ return rtn;
1187
+ });
1188
+ }
1189
+ exports.checkPermission = checkPermission;
834
1190
  function end(taskId) {
1191
+ var _a;
835
1192
  const task = exports.list[taskId];
836
1193
  if (!task) {
837
1194
  return true;
@@ -857,15 +1214,18 @@ function end(taskId) {
857
1214
  catch (err) {
858
1215
  const msg = `Message: ${err.message}\nTask id: ${task.id}\nForm id: ${fid}\nFunction: task.end, unmount.`;
859
1216
  form.notify({
860
- 'title': 'Runtime Error',
1217
+ 'title': 'Form Unmount Error',
861
1218
  'content': msg,
862
1219
  'type': 'danger'
863
1220
  });
864
- console.log('Runtime Error', msg, err);
1221
+ console.log('Form Unmount Error', msg, err);
865
1222
  }
866
1223
  f.vapp._container.remove();
1224
+ (_a = form.elements.popList.querySelector('[data-form-id="' + f.id.toString() + '"]')) === null || _a === void 0 ? void 0 : _a.remove();
1225
+ dom.clearWatchStyle(fid);
1226
+ dom.clearWatchProperty(fid);
867
1227
  }
868
- const flist = document.querySelectorAll('#cg-form-list > [data-task-id="' + taskId.toString() + '"]');
1228
+ const flist = form.elements.list.querySelectorAll('.cg-form-wrap[data-task-id="' + taskId.toString() + '"]');
869
1229
  for (const f of flist) {
870
1230
  f.remove();
871
1231
  }
@@ -881,6 +1241,8 @@ function end(taskId) {
881
1241
  }
882
1242
  }
883
1243
  dom.clearWatchSize(taskId);
1244
+ dom.clearWatch(taskId);
1245
+ native.clear(undefined, taskId);
884
1246
  delete exports.list[taskId];
885
1247
  core.trigger('taskEnded', taskId);
886
1248
  clearSystem(taskId);