clickgo 3.1.4-dev13 → 3.1.6-dev15

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 (96) hide show
  1. package/README.md +7 -7
  2. package/dist/app/demo/app.js +29 -3
  3. package/dist/app/demo/config.json +22 -3
  4. package/dist/app/demo/form/control/box/box.js +66 -0
  5. package/dist/app/demo/form/control/box/box.xml +18 -0
  6. package/dist/app/demo/form/control/button/button.js +24 -1
  7. package/dist/app/demo/form/control/check/check.js +24 -1
  8. package/dist/app/demo/form/control/dialog/dialog.js +24 -1
  9. package/dist/app/demo/form/control/file/file.js +24 -1
  10. package/dist/app/demo/form/control/flow/flow.js +24 -1
  11. package/dist/app/demo/form/control/form/form.js +24 -1
  12. package/dist/app/demo/form/control/layout/layout.js +57 -0
  13. package/dist/app/demo/form/control/layout/layout.xml +16 -0
  14. package/dist/app/demo/form/control/list/list.js +24 -1
  15. package/dist/app/demo/form/control/list/list.xml +8 -2
  16. package/dist/app/demo/form/control/marquee/marquee.js +24 -2
  17. package/dist/app/demo/form/control/marquee/marquee.xml +2 -5
  18. package/dist/app/demo/form/control/menu/menu.js +24 -1
  19. package/dist/app/demo/form/control/monaco/monaco.js +24 -1
  20. package/dist/app/demo/form/control/nav/nav.js +52 -0
  21. package/dist/app/demo/form/control/nav/nav.xml +43 -0
  22. package/dist/app/demo/form/control/panel/panel.js +67 -0
  23. package/dist/app/demo/form/control/panel/panel.xml +11 -0
  24. package/dist/app/demo/form/control/panel/test1.js +58 -0
  25. package/dist/app/demo/form/control/panel/test1.xml +16 -0
  26. package/dist/app/demo/form/control/panel/test2.xml +3 -0
  27. package/dist/app/demo/form/control/property/property.js +24 -1
  28. package/dist/app/demo/form/control/radio/radio.js +24 -1
  29. package/dist/app/demo/form/control/scroll/scroll.js +25 -1
  30. package/dist/app/demo/form/control/scroll/scroll.xml +5 -2
  31. package/dist/app/demo/form/control/select/select.js +24 -1
  32. package/dist/app/demo/form/control/tab/tab.js +24 -1
  33. package/dist/app/demo/form/control/table/table.js +164 -0
  34. package/dist/app/demo/form/control/table/table.xml +35 -0
  35. package/dist/app/demo/form/control/text/text.js +25 -1
  36. package/dist/app/demo/form/control/text/text.xml +1 -1
  37. package/dist/app/demo/form/control/vflow/vflow.js +24 -1
  38. package/dist/app/demo/form/event/form/form.js +24 -1
  39. package/dist/app/demo/form/event/other/other.js +24 -1
  40. package/dist/app/demo/form/event/screen/screen.js +24 -1
  41. package/dist/app/demo/form/event/task/task.js +24 -1
  42. package/dist/app/demo/form/main.js +130 -84
  43. package/dist/app/demo/form/main.xml +5 -0
  44. package/dist/app/demo/form/method/aform/aform.js +29 -15
  45. package/dist/app/demo/form/method/aform/aform.xml +0 -1
  46. package/dist/app/demo/form/method/aform/sd.js +25 -5
  47. package/dist/app/demo/form/method/core/core.js +24 -1
  48. package/dist/app/demo/form/method/dom/dom.js +48 -2
  49. package/dist/app/demo/form/method/dom/dom.xml +11 -0
  50. package/dist/app/demo/form/method/form/form.js +40 -7
  51. package/dist/app/demo/form/method/form/form.xml +3 -0
  52. package/dist/app/demo/form/method/{aform → form}/test.xml +0 -0
  53. package/dist/app/demo/form/method/fs/fs.js +139 -8
  54. package/dist/app/demo/form/method/fs/fs.xml +11 -1
  55. package/dist/app/demo/form/method/fs/text.js +24 -1
  56. package/dist/app/demo/form/method/native/native.js +24 -1
  57. package/dist/app/demo/form/method/system/system.js +24 -1
  58. package/dist/app/demo/form/method/task/task.js +31 -4
  59. package/dist/app/demo/form/method/task/task.xml +6 -1
  60. package/dist/app/demo/form/method/theme/theme.js +24 -1
  61. package/dist/app/demo/form/method/tool/tool.js +38 -1
  62. package/dist/app/demo/form/method/tool/tool.xml +1 -0
  63. package/dist/app/demo/form/method/zip/zip.js +30 -7
  64. package/dist/app/task/app.js +29 -3
  65. package/dist/app/task/form/bar/bar.js +24 -1
  66. package/dist/clickgo.js +33 -10
  67. package/dist/control/box.cgc +0 -0
  68. package/dist/control/common.cgc +0 -0
  69. package/dist/control/form.cgc +0 -0
  70. package/dist/control/monaco.cgc +0 -0
  71. package/dist/control/nav.cgc +0 -0
  72. package/dist/control/property.cgc +0 -0
  73. package/dist/control/table.cgc +0 -0
  74. package/dist/control/task.cgc +0 -0
  75. package/dist/global.css +1 -1
  76. package/dist/lib/control.js +53 -12
  77. package/dist/lib/control.ts +25 -5
  78. package/dist/lib/core.js +44 -50
  79. package/dist/lib/core.ts +18 -48
  80. package/dist/lib/dom.js +322 -108
  81. package/dist/lib/dom.ts +394 -127
  82. package/dist/lib/form.js +590 -226
  83. package/dist/lib/form.ts +706 -267
  84. package/dist/lib/fs.js +485 -224
  85. package/dist/lib/fs.ts +493 -287
  86. package/dist/lib/native.js +24 -1
  87. package/dist/lib/task.js +159 -139
  88. package/dist/lib/task.ts +148 -130
  89. package/dist/lib/theme.js +27 -4
  90. package/dist/lib/tool.js +57 -2
  91. package/dist/lib/tool.ts +68 -1
  92. package/dist/lib/zip.js +29 -3
  93. package/dist/lib/zip.ts +1 -1
  94. package/dist/theme/familiar.cgt +0 -0
  95. package/package.json +5 -7
  96. package/types/index.d.ts +51 -70
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10,7 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
33
  };
11
34
  Object.defineProperty(exports, "__esModule", { value: true });
12
35
  exports.isMax = exports.ping = exports.maximizable = exports.size = exports.restore = exports.min = exports.max = exports.invoke = exports.getListenerList = exports.clear = exports.off = exports.once = exports.on = exports.getToken = void 0;
13
- const clickgo = require("../clickgo");
36
+ const clickgo = __importStar(require("../clickgo"));
14
37
  const token = (Math.random() * 100000000000000 * (100 + Math.round(Math.random() * (999 - 100)))).toString(32);
15
38
  function getToken() {
16
39
  return token;
package/dist/lib/task.js CHANGED
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,16 +32,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
32
  });
10
33
  };
11
34
  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.checkPermission = exports.run = exports.getList = exports.get = exports.offFrame = exports.onFrame = exports.getFocus = exports.setFocus = exports.lastId = exports.list = void 0;
13
- const clickgo = require("../clickgo");
14
- const core = require("./core");
15
- const dom = require("./dom");
16
- const tool = require("./tool");
17
- const form = require("./form");
18
- const control = require("./control");
19
- const fs = require("./fs");
20
- const theme = require("./theme");
21
- const native = require("./native");
35
+ 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.getPermissions = exports.get = exports.offFrame = exports.onFrame = exports.getFocus = exports.setFocus = exports.lastId = exports.list = void 0;
36
+ const clickgo = __importStar(require("../clickgo"));
37
+ const core = __importStar(require("./core"));
38
+ const dom = __importStar(require("./dom"));
39
+ const tool = __importStar(require("./tool"));
40
+ const form = __importStar(require("./form"));
41
+ const control = __importStar(require("./control"));
42
+ const fs = __importStar(require("./fs"));
43
+ const theme = __importStar(require("./theme"));
44
+ const native = __importStar(require("./native"));
22
45
  exports.list = {};
23
46
  exports.lastId = 0;
24
47
  let focusId = null;
@@ -84,7 +107,7 @@ function onFrame(fun, opt = {}) {
84
107
  else {
85
108
  timer = requestAnimationFrame(function () {
86
109
  timerHandler().catch(function (e) {
87
- console.log(e);
110
+ console.log('task.onFrame: -3', e);
88
111
  });
89
112
  });
90
113
  frameMaps[ft] = timer;
@@ -97,7 +120,7 @@ function onFrame(fun, opt = {}) {
97
120
  else {
98
121
  timer = requestAnimationFrame(function () {
99
122
  timerHandler().catch(function (e) {
100
- console.log(e);
123
+ console.log('task.onFrame: -2', e);
101
124
  });
102
125
  });
103
126
  frameMaps[ft] = timer;
@@ -105,7 +128,7 @@ function onFrame(fun, opt = {}) {
105
128
  });
106
129
  timer = requestAnimationFrame(function () {
107
130
  timerHandler().catch(function (e) {
108
- console.log(e);
131
+ console.log('task.onFrame: -1', e);
109
132
  });
110
133
  });
111
134
  frameMaps[ft] = timer;
@@ -145,6 +168,13 @@ function get(tid) {
145
168
  };
146
169
  }
147
170
  exports.get = get;
171
+ function getPermissions(tid) {
172
+ if (exports.list[tid] === undefined) {
173
+ return [];
174
+ }
175
+ return tool.clone(exports.list[tid].runtime.permissions);
176
+ }
177
+ exports.getPermissions = getPermissions;
148
178
  function getList() {
149
179
  const rtn = {};
150
180
  for (const tid in exports.list) {
@@ -162,13 +192,9 @@ function getList() {
162
192
  return rtn;
163
193
  }
164
194
  exports.getList = getList;
165
- function run(url, opt = {}) {
195
+ function run(url, opt = {}, ntid) {
166
196
  var _a, _b, _c, _d;
167
197
  return __awaiter(this, void 0, void 0, function* () {
168
- let ntask = null;
169
- if (opt.taskId) {
170
- ntask = exports.list[opt.taskId];
171
- }
172
198
  if (!url.endsWith('/') && !url.endsWith('.cga')) {
173
199
  return 0;
174
200
  }
@@ -186,11 +212,18 @@ function run(url, opt = {}) {
186
212
  'timeout': 0,
187
213
  'progress': true
188
214
  }) : undefined;
215
+ if (!ntid &&
216
+ !url.startsWith('/clickgo/') &&
217
+ !url.startsWith('/storage/') &&
218
+ !url.startsWith('/mounted/') &&
219
+ !url.startsWith('/package/') &&
220
+ !url.startsWith('/current/')) {
221
+ url = tool.urlResolve(location.href, url);
222
+ }
189
223
  const app = yield core.fetchApp(url, {
190
224
  'notifyId': notifyId,
191
- 'current': ntask ? ntask.current : undefined,
192
225
  'progress': opt.progress
193
- });
226
+ }, ntid);
194
227
  if (notifyId) {
195
228
  setTimeout(function () {
196
229
  form.hideNotify(notifyId);
@@ -203,7 +236,7 @@ function run(url, opt = {}) {
203
236
  const unblock = opt.unblock ? tool.clone(opt.unblock) : [];
204
237
  const unblockSys = [
205
238
  'require',
206
- '__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Error', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch', 'Number'
239
+ '__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Error', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch', 'Number', 'Object'
207
240
  ];
208
241
  for (const name of unblockSys) {
209
242
  if (unblock.includes(name)) {
@@ -382,6 +415,9 @@ function run(url, opt = {}) {
382
415
  }
383
416
  },
384
417
  'dom': {
418
+ inPage: function (el) {
419
+ return dom.inPage(el);
420
+ },
385
421
  setGlobalCursor: function (type) {
386
422
  dom.setGlobalCursor(type);
387
423
  },
@@ -391,15 +427,21 @@ function run(url, opt = {}) {
391
427
  getStyleCount: function (taskId, type) {
392
428
  return dom.getStyleCount(taskId, type);
393
429
  },
430
+ getWatchSizeCount: function (taskId) {
431
+ return dom.getWatchSizeCount(taskId);
432
+ },
394
433
  watchSize: function (el, cb, immediate = false) {
395
434
  return dom.watchSize(el, cb, immediate, taskId);
396
435
  },
397
436
  unwatchSize: function (el) {
398
437
  dom.unwatchSize(el, taskId);
399
438
  },
400
- isWatchSize(el) {
439
+ isWatchSize: function (el) {
401
440
  return dom.isWatchSize(el);
402
441
  },
442
+ getWatchCount: function (taskId) {
443
+ return dom.getWatchCount(taskId);
444
+ },
403
445
  watch: function (el, cb, mode = 'default', immediate = false) {
404
446
  dom.watch(el, cb, mode, immediate, taskId);
405
447
  },
@@ -415,13 +457,16 @@ function run(url, opt = {}) {
415
457
  isWatchStyle: function (el) {
416
458
  return dom.isWatchStyle(el);
417
459
  },
418
- watchProperty(el, name, cb, immediate = false) {
460
+ watchProperty: function (el, name, cb, immediate = false) {
419
461
  dom.watchProperty(el, name, cb, immediate);
420
462
  },
421
463
  isWatchProperty(el) {
422
464
  return dom.isWatchProperty(el);
423
465
  },
424
- bindClick(e, handler) {
466
+ getWatchInfo: function () {
467
+ return dom.getWatchInfo();
468
+ },
469
+ bindClick: function (e, handler) {
425
470
  dom.bindClick(e, handler);
426
471
  },
427
472
  bindDown: function (oe, opt) {
@@ -443,8 +488,8 @@ function run(url, opt = {}) {
443
488
  bindResize: function (e, opt) {
444
489
  dom.bindResize(e, opt);
445
490
  },
446
- findParentByData: function (el, name) {
447
- return dom.findParentByData(el, name);
491
+ findParentByData: function (el, name, value) {
492
+ return dom.findParentByData(el, name, value);
448
493
  },
449
494
  findParentByClass: function (el, name) {
450
495
  return dom.findParentByClass(el, name);
@@ -460,6 +505,11 @@ function run(url, opt = {}) {
460
505
  }
461
506
  },
462
507
  'form': {
508
+ 'AbstractPanel': class extends form.AbstractPanel {
509
+ get taskId() {
510
+ return taskId;
511
+ }
512
+ },
463
513
  'AbstractForm': class extends form.AbstractForm {
464
514
  get taskId() {
465
515
  return taskId;
@@ -492,6 +542,15 @@ function run(url, opt = {}) {
492
542
  getFocus: function () {
493
543
  return form.getFocus();
494
544
  },
545
+ getActivePanel: function (formId) {
546
+ return form.getActivePanel(formId);
547
+ },
548
+ removeActivePanel: function (panelId, formId) {
549
+ return form.removeActivePanel(panelId, formId, taskId);
550
+ },
551
+ setActivePanel: function (panelId, formId) {
552
+ return form.setActivePanel(panelId, formId, taskId);
553
+ },
495
554
  changeFocus: function (fid = 0) {
496
555
  form.changeFocus(fid);
497
556
  },
@@ -537,6 +596,15 @@ function run(url, opt = {}) {
537
596
  hidePop: function (pop) {
538
597
  form.hidePop(pop);
539
598
  },
599
+ removePanel(id, vapp, el) {
600
+ return form.removePanel(id, vapp, el);
601
+ },
602
+ createPanel(cls, el, formId) {
603
+ return form.createPanel(cls, el, formId, taskId);
604
+ },
605
+ create: function (cls, data, opt) {
606
+ return form.create(cls, data, opt, taskId);
607
+ },
540
608
  dialog: function (opt) {
541
609
  if (typeof opt === 'string') {
542
610
  opt = {
@@ -566,116 +634,59 @@ function run(url, opt = {}) {
566
634
  }
567
635
  },
568
636
  'fs': {
637
+ mount: function (name, handler) {
638
+ return clickgo.fs.mount(name, handler, taskId);
639
+ },
640
+ unmount: function (name) {
641
+ return clickgo.fs.unmount(name);
642
+ },
569
643
  getContent: function (path, options = {}) {
570
- if (!options.files) {
571
- options.files = exports.list[taskId].app.files;
572
- }
573
- if (!options.current) {
574
- options.current = exports.list[taskId].current;
575
- }
576
- return fs.getContent(path, options);
644
+ return fs.getContent(path, options, taskId);
577
645
  },
578
646
  putContent: function (path, data, options = {}) {
579
- if (!options.current) {
580
- options.current = exports.list[taskId].current;
581
- }
582
- return fs.putContent(path, data, options);
647
+ return fs.putContent(path, data, options, taskId);
583
648
  },
584
649
  readLink: function (path, options = {}) {
585
- if (!options.current) {
586
- options.current = exports.list[taskId].current;
587
- }
588
- return fs.readLink(path, options);
650
+ return fs.readLink(path, options, taskId);
589
651
  },
590
652
  symlink: function (fPath, linkPath, options = {}) {
591
- if (!options.current) {
592
- options.current = exports.list[taskId].current;
593
- }
594
- return fs.symlink(fPath, linkPath, options);
653
+ return fs.symlink(fPath, linkPath, options, taskId);
595
654
  },
596
- unlink: function (path, options = {}) {
597
- if (!options.current) {
598
- options.current = exports.list[taskId].current;
599
- }
600
- return fs.unlink(path, options);
655
+ unlink: function (path) {
656
+ return fs.unlink(path, taskId);
601
657
  },
602
- stats: function (path, options = {}) {
603
- if (!options.files) {
604
- options.files = exports.list[taskId].app.files;
605
- }
606
- if (!options.current) {
607
- options.current = exports.list[taskId].current;
608
- }
609
- return fs.stats(path, options);
658
+ stats: function (path) {
659
+ return fs.stats(path, taskId);
610
660
  },
611
- isDir: function (path, options = {}) {
612
- if (!options.files) {
613
- options.files = exports.list[taskId].app.files;
614
- }
615
- if (!options.current) {
616
- options.current = exports.list[taskId].current;
617
- }
618
- return fs.isDir(path, options);
661
+ isDir: function (path) {
662
+ return fs.isDir(path, taskId);
619
663
  },
620
- isFile: function (path, options = {}) {
621
- if (!options.files) {
622
- options.files = exports.list[taskId].app.files;
623
- }
624
- if (!options.current) {
625
- options.current = exports.list[taskId].current;
626
- }
627
- return fs.isFile(path, options);
664
+ isFile: function (path) {
665
+ return fs.isFile(path, taskId);
628
666
  },
629
- mkdir: function (path, mode, options = {}) {
630
- if (!options.current) {
631
- options.current = exports.list[taskId].current;
632
- }
633
- return fs.mkdir(path, mode, options);
667
+ mkdir: function (path, mode) {
668
+ return fs.mkdir(path, mode, taskId);
634
669
  },
635
- rmdir: function (path, options = {}) {
636
- if (!options.current) {
637
- options.current = exports.list[taskId].current;
638
- }
639
- return fs.rmdir(path, options);
670
+ rmdir: function (path) {
671
+ return fs.rmdir(path, taskId);
640
672
  },
641
- rmdirDeep: function (path, options = {}) {
642
- if (!options.current) {
643
- options.current = exports.list[taskId].current;
644
- }
645
- return fs.rmdirDeep(path, options);
673
+ rmdirDeep: function (path) {
674
+ return fs.rmdirDeep(path, taskId);
646
675
  },
647
- chmod: function (path, mod, options = {}) {
648
- if (!options.current) {
649
- options.current = exports.list[taskId].current;
650
- }
651
- return fs.chmod(path, mod, options);
676
+ chmod: function (path, mod) {
677
+ return fs.chmod(path, mod, taskId);
652
678
  },
653
- rename(oldPath, newPath, options = {}) {
654
- if (!options.current) {
655
- options.current = exports.list[taskId].current;
656
- }
657
- return fs.rename(oldPath, newPath, options);
679
+ rename(oldPath, newPath) {
680
+ return fs.rename(oldPath, newPath, taskId);
658
681
  },
659
- readDir(path, options = {}) {
660
- if (!options.files) {
661
- options.files = exports.list[taskId].app.files;
662
- }
663
- if (!options.current) {
664
- options.current = exports.list[taskId].current;
665
- }
666
- return fs.readDir(path, options);
682
+ readDir(path, encoding) {
683
+ return fs.readDir(path, encoding, taskId);
667
684
  },
668
685
  copyFolder(from, to, options = {}) {
669
- if (!options.current) {
670
- options.current = exports.list[taskId].current;
671
- }
672
- return fs.copyFolder(from, to, options);
686
+ return fs.copyFolder(from, to, options, taskId);
673
687
  },
674
- copyFile(src, dest, options = {}) {
675
- if (!options.current) {
676
- options.current = exports.list[taskId].current;
677
- }
678
- return fs.copyFile(src, dest, options);
688
+ copyFile(src, dest) {
689
+ return fs.copyFile(src, dest, taskId);
679
690
  }
680
691
  },
681
692
  'native': {
@@ -764,11 +775,14 @@ function run(url, opt = {}) {
764
775
  get: function (tid) {
765
776
  return get(tid);
766
777
  },
778
+ getPermissions: function (tid) {
779
+ return getPermissions(tid);
780
+ },
767
781
  getList: function () {
768
782
  return getList();
769
783
  },
770
784
  run: function (url, opt = {}) {
771
- opt.taskId = taskId;
785
+ var _a;
772
786
  if (opt.unblock) {
773
787
  const inUnblock = [];
774
788
  for (const item of opt.unblock) {
@@ -780,11 +794,11 @@ function run(url, opt = {}) {
780
794
  opt.unblock = inUnblock;
781
795
  }
782
796
  if (opt.permissions) {
783
- if (ntask && !ntask.runtime.permissions.includes('root')) {
797
+ if (!((_a = exports.list[taskId]) === null || _a === void 0 ? void 0 : _a.runtime.permissions.includes('root'))) {
784
798
  opt.permissions = undefined;
785
799
  }
786
800
  }
787
- return run(url, opt);
801
+ return run(url, opt, taskId);
788
802
  },
789
803
  checkPermission: function (vals, apply = false, applyHandler) {
790
804
  return checkPermission(vals, apply, applyHandler, taskId);
@@ -899,6 +913,9 @@ function run(url, opt = {}) {
899
913
  escapeHTML: function (html) {
900
914
  return tool.escapeHTML(html);
901
915
  },
916
+ rgb2hsl: function (rgb) {
917
+ return tool.rgb2hsl(rgb);
918
+ },
902
919
  request: function (url, opt) {
903
920
  return tool.request(url, opt);
904
921
  },
@@ -908,6 +925,9 @@ function run(url, opt = {}) {
908
925
  urlResolve: function (from, to) {
909
926
  return tool.urlResolve(from, to);
910
927
  },
928
+ urlAtom: function (url) {
929
+ return tool.urlAtom(url);
930
+ },
911
931
  blob2Text: function (blob) {
912
932
  return tool.blob2Text(blob);
913
933
  },
@@ -934,7 +954,7 @@ function run(url, opt = {}) {
934
954
  });
935
955
  return '';
936
956
  }
937
- code = code.replace(/extends[\s\S]+?\.\s*(AbstractApp|AbstractForm)\s*{/, (t) => {
957
+ code = code.replace(/extends[\s\S]+?\.\s*(AbstractApp|AbstractForm|AbstractPanel)\s*{/, (t) => {
938
958
  return t + 'get filename() {return __filename;}';
939
959
  });
940
960
  return code;
@@ -969,10 +989,8 @@ function run(url, opt = {}) {
969
989
  path += '.json';
970
990
  }
971
991
  const lcontent = yield fs.getContent(path, {
972
- 'encoding': 'utf8',
973
- 'files': app.files,
974
- 'current': current
975
- });
992
+ 'encoding': 'utf8'
993
+ }, taskId);
976
994
  if (!lcontent) {
977
995
  continue;
978
996
  }
@@ -986,13 +1004,17 @@ function run(url, opt = {}) {
986
1004
  }
987
1005
  let expo = [];
988
1006
  try {
1007
+ const map = {
1008
+ 'clickgo': '/invoke/clickgo'
1009
+ };
1010
+ if (app.config.map) {
1011
+ Object.assign(map, app.config.map);
1012
+ }
989
1013
  expo = loader.require('/app.js', app.files, {
990
1014
  'dir': '/',
991
1015
  'invoke': invoke,
992
1016
  'preprocess': preprocess,
993
- 'map': {
994
- 'clickgo': '/invoke/clickgo'
995
- }
1017
+ 'map': map
996
1018
  })[0];
997
1019
  }
998
1020
  catch (e) {
@@ -1015,10 +1037,7 @@ function run(url, opt = {}) {
1015
1037
  for (let path of app.config.themes) {
1016
1038
  path += '.cgt';
1017
1039
  path = tool.urlResolve('/', path);
1018
- const file = yield fs.getContent(path, {
1019
- 'files': app.files,
1020
- 'current': current
1021
- });
1040
+ const file = yield fs.getContent(path, undefined, taskId);
1022
1041
  if (file && typeof file !== 'string') {
1023
1042
  const th = yield theme.read(file);
1024
1043
  if (th) {
@@ -1034,10 +1053,8 @@ function run(url, opt = {}) {
1034
1053
  }
1035
1054
  if (app.config.style) {
1036
1055
  const style = yield fs.getContent(app.config.style + '.css', {
1037
- 'encoding': 'utf8',
1038
- 'files': app.files,
1039
- 'current': current
1040
- });
1056
+ 'encoding': 'utf8'
1057
+ }, taskId);
1041
1058
  if (style) {
1042
1059
  const r = tool.stylePrepend(style, 'cg-task' + taskId.toString() + '_');
1043
1060
  dom.pushStyle(taskId, yield tool.styleUrl2DataUrl(app.config.style, r.style, app.files));
@@ -1057,6 +1074,7 @@ exports.run = run;
1057
1074
  const locale = {
1058
1075
  'sc': {
1059
1076
  'unknown': '未知权限',
1077
+ 'root': '<b>危险!</b>最高权限!请一定确认是否允许!',
1060
1078
  'apply-permission': '正在申请权限,请您仔细确认',
1061
1079
  'native.form': '实体窗体控制',
1062
1080
  'hash': '可修改地址栏 hash',
@@ -1066,6 +1084,7 @@ const locale = {
1066
1084
  },
1067
1085
  'tc': {
1068
1086
  'unknown': '未知許可權',
1087
+ 'root': '<b>危險!</b>最高許可權!請一定確認是否允許!',
1069
1088
  'apply-permission': '正在申請許可權,請您仔細確認',
1070
1089
  'native.form': '實體視窗控制',
1071
1090
  'hash': '可修改位址列 hash',
@@ -1075,6 +1094,7 @@ const locale = {
1075
1094
  },
1076
1095
  'en': {
1077
1096
  'unknown': 'Unknown',
1097
+ 'root': '<b>Danger!</b> Highest authorization! Please confirm whether to authorize?',
1078
1098
  'apply-permission': 'is applying for permissions, please check carefully',
1079
1099
  'native.form': 'Native window control',
1080
1100
  'hash': 'Can modify the location hash',
@@ -1084,6 +1104,7 @@ const locale = {
1084
1104
  },
1085
1105
  'ja': {
1086
1106
  'unknown': '不明な許可',
1107
+ 'root': '<b>危険!</b>最高の許可!承認するかどうかを確認してください!',
1087
1108
  'apply-permission': '許可申請中、よくご確認ください',
1088
1109
  'native.form': 'ローカルウィンドウを操作する',
1089
1110
  'hash': '網址の hash 変更可能',
@@ -1224,6 +1245,7 @@ function end(taskId) {
1224
1245
  (_a = form.elements.popList.querySelector('[data-form-id="' + f.id.toString() + '"]')) === null || _a === void 0 ? void 0 : _a.remove();
1225
1246
  dom.clearWatchStyle(fid);
1226
1247
  dom.clearWatchProperty(fid);
1248
+ delete form.activePanels[fid];
1227
1249
  }
1228
1250
  const flist = form.elements.list.querySelectorAll('.cg-form-wrap[data-task-id="' + taskId.toString() + '"]');
1229
1251
  for (const f of flist) {
@@ -1278,10 +1300,8 @@ function loadLocale(lang, path, taskId) {
1278
1300
  }
1279
1301
  path = tool.urlResolve(task.current + '/', path) + '.json';
1280
1302
  const fcontent = yield fs.getContent(path, {
1281
- 'encoding': 'utf8',
1282
- 'files': task.app.files,
1283
- 'current': task.current
1284
- });
1303
+ 'encoding': 'utf8'
1304
+ }, taskId);
1285
1305
  if (!fcontent) {
1286
1306
  return false;
1287
1307
  }