clickgo 3.1.3-dev12 → 3.1.5-dev14

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 (50) hide show
  1. package/README.md +1 -1
  2. package/dist/app/demo/app.js +1 -1
  3. package/dist/app/demo/config.json +9 -2
  4. package/dist/app/demo/form/control/text/text.js +1 -0
  5. package/dist/app/demo/form/control/text/text.xml +1 -1
  6. package/dist/app/demo/form/event/other/other.js +29 -0
  7. package/dist/app/demo/form/event/other/other.xml +5 -0
  8. package/dist/app/demo/form/main.js +51 -51
  9. package/dist/app/demo/form/main.xml +1 -0
  10. package/dist/app/demo/form/method/aform/aform.js +2 -13
  11. package/dist/app/demo/form/method/aform/aform.xml +0 -1
  12. package/dist/app/demo/form/method/aform/sd.js +25 -0
  13. package/dist/app/demo/form/method/aform/{test.xml → sd.xml} +3 -2
  14. package/dist/app/demo/form/method/core/core.js +12 -0
  15. package/dist/app/demo/form/method/core/core.xml +4 -0
  16. package/dist/app/demo/form/method/form/form.js +5 -6
  17. package/dist/app/demo/form/method/form/form.xml +1 -0
  18. package/dist/app/demo/form/method/form/test.xml +5 -0
  19. package/dist/app/demo/form/method/fs/fs.js +1 -4
  20. package/dist/app/demo/form/method/task/task.js +9 -1
  21. package/dist/app/demo/form/method/task/task.xml +1 -0
  22. package/dist/app/demo/form/method/tool/tool.js +3 -0
  23. package/dist/app/demo/form/method/tool/tool.xml +1 -0
  24. package/dist/app/demo/form/method/zip/zip.js +1 -4
  25. package/dist/app/task/app.js +1 -1
  26. package/dist/control/common.cgc +0 -0
  27. package/dist/control/form.cgc +0 -0
  28. package/dist/control/monaco.cgc +0 -0
  29. package/dist/control/property.cgc +0 -0
  30. package/dist/control/task.cgc +0 -0
  31. package/dist/global.css +1 -1
  32. package/dist/index.js +3 -0
  33. package/dist/index.ts +6 -0
  34. package/dist/lib/core.js +59 -10
  35. package/dist/lib/core.ts +67 -10
  36. package/dist/lib/dom.js +3 -3
  37. package/dist/lib/dom.ts +4 -4
  38. package/dist/lib/form.js +240 -215
  39. package/dist/lib/form.ts +290 -249
  40. package/dist/lib/fs.js +107 -12
  41. package/dist/lib/fs.ts +111 -20
  42. package/dist/lib/native.js +8 -1
  43. package/dist/lib/native.ts +6 -0
  44. package/dist/lib/task.js +253 -14
  45. package/dist/lib/task.ts +298 -12
  46. package/dist/lib/tool.js +39 -1
  47. package/dist/lib/tool.ts +45 -0
  48. package/dist/theme/familiar.cgt +0 -0
  49. package/package.json +3 -3
  50. package/types/index.d.ts +70 -52
package/dist/lib/form.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.hideLauncher = exports.showLauncher = exports.flash = exports.confirm = exports.dialog = exports.create = exports.remove = exports.doFocusAndPopEvent = exports.hidePop = exports.showPop = exports.removeFromPop = exports.appendToPop = exports.hideNotify = exports.notifyProgress = exports.notify = exports.hideDrag = exports.moveDrag = exports.showDrag = exports.hideRectangle = exports.showRectangle = exports.moveRectangle = exports.showCircular = exports.getRectByBorder = exports.getMaxZIndexID = exports.changeFocus = exports.getFocus = exports.getList = exports.send = exports.get = exports.getTaskId = exports.refreshMaxPosition = exports.bindDrag = exports.bindResize = exports.close = exports.max = exports.min = exports.elements = exports.launcherRoot = exports.simpleSystemTaskRoot = exports.AbstractForm = void 0;
12
+ exports.hideLauncher = exports.showLauncher = exports.flash = exports.confirm = exports.dialog = exports.create = exports.remove = exports.doFocusAndPopEvent = exports.hidePop = exports.showPop = exports.removeFromPop = exports.appendToPop = exports.hideNotify = exports.notifyProgress = exports.notify = exports.hideDrag = exports.moveDrag = exports.showDrag = exports.hideRectangle = exports.showRectangle = exports.moveRectangle = exports.showCircular = exports.getRectByBorder = exports.getMaxZIndexID = exports.changeFocus = exports.getFocus = exports.getList = exports.send = exports.get = exports.getTaskId = exports.refreshMaxPosition = exports.bindDrag = exports.bindResize = exports.close = exports.max = exports.min = exports.superConfirm = exports.elements = exports.launcherRoot = exports.simpleSystemTaskRoot = exports.AbstractForm = void 0;
13
13
  const clickgo = require("../clickgo");
14
14
  const core = require("./core");
15
15
  const task = require("./task");
@@ -60,80 +60,6 @@ class AbstractForm {
60
60
  this._firstShow = true;
61
61
  this.dialogResult = '';
62
62
  }
63
- static create(data, layout) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- const frm = new this();
66
- const code = {
67
- 'data': {},
68
- 'methods': {},
69
- 'computed': {},
70
- beforeCreate: frm.onBeforeCreate,
71
- created: function () {
72
- this.onCreated();
73
- },
74
- beforeMount: function () {
75
- this.onBeforeMount();
76
- },
77
- mounted: function (data) {
78
- this.onMounted(data);
79
- },
80
- beforeUpdate: function () {
81
- this.onBeforeUpdate();
82
- },
83
- updated: function () {
84
- return __awaiter(this, void 0, void 0, function* () {
85
- yield this.$nextTick();
86
- this.onUpdated();
87
- });
88
- },
89
- beforeUnmount: function () {
90
- this.onBeforeUnmount();
91
- },
92
- unmounted: function () {
93
- return __awaiter(this, void 0, void 0, function* () {
94
- yield this.$nextTick();
95
- this.onUnmounted();
96
- });
97
- }
98
- };
99
- const cdata = Object.entries(frm);
100
- for (const item of cdata) {
101
- if (item[0] === 'access') {
102
- continue;
103
- }
104
- code.data[item[0]] = item[1];
105
- }
106
- if (!layout) {
107
- const l = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'xml'];
108
- if (typeof l !== 'string') {
109
- return 0;
110
- }
111
- layout = l;
112
- }
113
- const prot = tool.getClassPrototype(frm);
114
- code.methods = prot.method;
115
- code.computed = prot.access;
116
- let style = undefined;
117
- const fstyle = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'css'];
118
- if (typeof fstyle === 'string') {
119
- style = fstyle;
120
- }
121
- const fid = yield create({
122
- 'code': code,
123
- 'layout': layout,
124
- 'style': style,
125
- 'path': frm.filename.slice(0, frm.filename.lastIndexOf('/')),
126
- 'data': data,
127
- 'taskId': frm.taskId
128
- });
129
- if (fid > 0) {
130
- return task.list[frm.taskId].forms[fid].vroot;
131
- }
132
- else {
133
- return fid;
134
- }
135
- });
136
- }
137
63
  get filename() {
138
64
  return '';
139
65
  }
@@ -205,21 +131,6 @@ class AbstractForm {
205
131
  }
206
132
  core.trigger(name, this.taskId, this.formId, param1, param2);
207
133
  }
208
- createForm(path, data) {
209
- return __awaiter(this, void 0, void 0, function* () {
210
- path = tool.urlResolve(this.filename, path);
211
- const taskId = this.taskId;
212
- const cls = class extends AbstractForm {
213
- get filename() {
214
- return path + '.js';
215
- }
216
- get taskId() {
217
- return taskId;
218
- }
219
- };
220
- return cls.create(data);
221
- });
222
- }
223
134
  get topMost() {
224
135
  return false;
225
136
  }
@@ -237,7 +148,6 @@ class AbstractForm {
237
148
  }
238
149
  show() {
239
150
  const v = this;
240
- v.$refs.form.$data.isShow = true;
241
151
  if (this._firstShow) {
242
152
  this._firstShow = false;
243
153
  const area = core.getAvailArea();
@@ -252,12 +162,15 @@ class AbstractForm {
252
162
  v.$refs.form.$data.isShow = true;
253
163
  changeFocus(this.formId);
254
164
  }
165
+ else {
166
+ v.$refs.form.$data.isShow = true;
167
+ }
255
168
  }
256
169
  showDialog() {
257
170
  return __awaiter(this, void 0, void 0, function* () {
258
- this.topMost = true;
259
- this.show();
260
171
  task.list[this.taskId].runtime.dialogFormIds.push(this.formId);
172
+ this.show();
173
+ this.topMost = true;
261
174
  return new Promise((resolve) => {
262
175
  this.cgDialogCallback = () => {
263
176
  resolve(this.dialogResult);
@@ -344,6 +257,9 @@ class AbstractForm {
344
257
  onLauncherFolderNameChanged() {
345
258
  return;
346
259
  }
260
+ onHashChanged() {
261
+ return;
262
+ }
347
263
  }
348
264
  exports.AbstractForm = AbstractForm;
349
265
  const popInfo = {
@@ -351,6 +267,7 @@ const popInfo = {
351
267
  'elList': [],
352
268
  'lastZIndex': 0
353
269
  };
270
+ let superConfirmHandler = undefined;
354
271
  exports.elements = {
355
272
  'wrap': document.createElement('div'),
356
273
  'list': document.createElement('div'),
@@ -359,10 +276,10 @@ exports.elements = {
359
276
  'rectangle': document.createElement('div'),
360
277
  'gesture': document.createElement('div'),
361
278
  'drag': document.createElement('div'),
362
- 'dragIcon': undefined,
363
- 'system': document.createElement('div'),
364
- 'simpleSystemtask': document.createElement('div'),
279
+ 'notify': document.createElement('div'),
280
+ 'simpletask': document.createElement('div'),
365
281
  'launcher': document.createElement('div'),
282
+ 'confirm': document.createElement('div'),
366
283
  'init': function () {
367
284
  this.wrap.id = 'cg-wrap';
368
285
  document.getElementsByTagName('body')[0].appendChild(this.wrap);
@@ -402,12 +319,11 @@ exports.elements = {
402
319
  this.wrap.appendChild(this.gesture);
403
320
  this.drag.id = 'cg-drag';
404
321
  this.drag.innerHTML = '<svg width="16" height="16" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 8L40 40" stroke="#FFF" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter"/><path d="M8 40L40 8" stroke="#FFF" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter"/></svg>';
405
- this.dragIcon = this.drag.childNodes[0];
406
322
  this.wrap.appendChild(this.drag);
407
- this.system.id = 'cg-system';
408
- this.wrap.appendChild(this.system);
409
- this.simpleSystemtask.id = 'cg-simpletask';
410
- this.wrap.appendChild(this.simpleSystemtask);
323
+ this.notify.id = 'cg-notify';
324
+ this.wrap.appendChild(this.notify);
325
+ this.simpletask.id = 'cg-simpletask';
326
+ this.wrap.appendChild(this.simpletask);
411
327
  const simpletaskApp = clickgo.vue.createApp({
412
328
  'template': '<div v-for="(item, formId) of forms" class="cg-simpletask-item" @click="click(parseInt(formId))"><div v-if="item.icon" class="cg-simpletask-icon" :style="{\'background-image\': \'url(\' + item.icon + \')\'}"></div><div>{{item.title}}</div></div>',
413
329
  'data': function () {
@@ -420,14 +336,14 @@ exports.elements = {
420
336
  handler: function () {
421
337
  const length = Object.keys(this.forms).length;
422
338
  if (length > 0) {
423
- if (exports.elements.simpleSystemtask.style.bottom !== '0px') {
424
- exports.elements.simpleSystemtask.style.bottom = '0px';
339
+ if (exports.elements.simpletask.style.bottom !== '0px') {
340
+ exports.elements.simpletask.style.bottom = '0px';
425
341
  core.trigger('screenResize');
426
342
  }
427
343
  }
428
344
  else {
429
- if (exports.elements.simpleSystemtask.style.bottom === '0px') {
430
- exports.elements.simpleSystemtask.style.bottom = '-46px';
345
+ if (exports.elements.simpletask.style.bottom === '0px') {
346
+ exports.elements.simpletask.style.bottom = '-46px';
431
347
  core.trigger('screenResize');
432
348
  }
433
349
  }
@@ -482,7 +398,8 @@ exports.elements = {
482
398
  'data': function () {
483
399
  return {
484
400
  'name': '',
485
- 'folderName': ''
401
+ 'folderName': '',
402
+ 'folderItem': {}
486
403
  };
487
404
  },
488
405
  'computed': {
@@ -614,9 +531,53 @@ exports.elements = {
614
531
  launcherApp.mount('#cg-launcher');
615
532
  };
616
533
  waiting();
534
+ this.confirm.id = 'cg-confirm';
535
+ this.wrap.appendChild(this.confirm);
536
+ this.confirm.innerHTML = `<div class="cg-confirm-box">` +
537
+ `<div id="cg-confirm-content"></div>` +
538
+ `<div class="cg-confirm-controls">` +
539
+ `<div id="cg-confirm-cancel"></div>` +
540
+ `<div id="cg-confirm-ok"></div>` +
541
+ `</div>` +
542
+ `</div>`;
543
+ this.confirm.style.display = 'none';
544
+ document.getElementById('cg-confirm-cancel').addEventListener('click', () => {
545
+ superConfirmHandler === null || superConfirmHandler === void 0 ? void 0 : superConfirmHandler(false);
546
+ this.confirm.style.display = 'none';
547
+ const fid = getMaxZIndexID();
548
+ if (fid) {
549
+ changeFocus(fid);
550
+ }
551
+ });
552
+ document.getElementById('cg-confirm-ok').addEventListener('click', () => {
553
+ superConfirmHandler === null || superConfirmHandler === void 0 ? void 0 : superConfirmHandler(true);
554
+ this.confirm.style.display = 'none';
555
+ const fid = getMaxZIndexID();
556
+ if (fid) {
557
+ changeFocus(fid);
558
+ }
559
+ });
617
560
  }
618
561
  };
619
562
  exports.elements.init();
563
+ function superConfirm(html) {
564
+ return new Promise((resolve) => {
565
+ var _a, _b, _c, _d;
566
+ if (superConfirmHandler !== undefined) {
567
+ resolve(false);
568
+ return;
569
+ }
570
+ exports.elements.confirm.style.display = 'flex';
571
+ document.getElementById('cg-confirm-content').innerHTML = html;
572
+ document.getElementById('cg-confirm-cancel').innerHTML = (_b = (_a = info.locale[core.config.locale]) === null || _a === void 0 ? void 0 : _a.cancel) !== null && _b !== void 0 ? _b : info.locale['en'].cancel;
573
+ document.getElementById('cg-confirm-ok').innerHTML = (_d = (_c = info.locale[core.config.locale]) === null || _c === void 0 ? void 0 : _c.ok) !== null && _d !== void 0 ? _d : info.locale['en'].ok;
574
+ superConfirmHandler = (result) => {
575
+ superConfirmHandler = undefined;
576
+ resolve(result);
577
+ };
578
+ });
579
+ }
580
+ exports.superConfirm = superConfirm;
620
581
  function changeState(state, formId) {
621
582
  const tid = getTaskId(formId);
622
583
  const t = task.list[tid];
@@ -1042,14 +1003,10 @@ function moveDrag(opt) {
1042
1003
  exports.elements.drag.style.height = opt.height.toString() + 'px';
1043
1004
  }
1044
1005
  if (opt.icon) {
1045
- if (exports.elements.dragIcon) {
1046
- exports.elements.dragIcon.style.display = 'block';
1047
- }
1006
+ exports.elements.drag.childNodes[0].style.display = 'block';
1048
1007
  }
1049
1008
  else {
1050
- if (exports.elements.dragIcon) {
1051
- exports.elements.dragIcon.style.display = 'none';
1052
- }
1009
+ exports.elements.drag.childNodes[0].style.display = 'none';
1053
1010
  }
1054
1011
  }
1055
1012
  exports.moveDrag = moveDrag;
@@ -1076,21 +1033,21 @@ function notify(opt) {
1076
1033
  }
1077
1034
  const el = document.createElement('div');
1078
1035
  const y = notifyTop;
1079
- el.classList.add('cg-system-notify');
1036
+ el.classList.add('cg-notify-wrap');
1080
1037
  el.setAttribute('data-notifyid', nid.toString());
1081
1038
  el.style.transform = `translateY(${y}px) translateX(280px)`;
1082
1039
  el.style.opacity = '1';
1083
- el.innerHTML = `<div class="cg-system-icon cg-${tool.escapeHTML((_a = opt.type) !== null && _a !== void 0 ? _a : 'primary')}"></div>
1040
+ el.innerHTML = `<div class="cg-notify-icon cg-${tool.escapeHTML((_a = opt.type) !== null && _a !== void 0 ? _a : 'primary')}"></div>
1084
1041
  <div style="flex: 1;">
1085
- <div class="cg-system-notify-title">${tool.escapeHTML(opt.title)}</div>
1086
- <div class="cg-system-notify-content">${tool.escapeHTML(opt.content).replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n/g, '<br>')}</div>
1087
- ${opt.progress ? '<div class="cg-system-notify-progress"></div>' : ''}
1042
+ <div class="cg-notify-title">${tool.escapeHTML(opt.title)}</div>
1043
+ <div class="cg-notify-content">${tool.escapeHTML(opt.content).replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n/g, '<br>')}</div>
1044
+ ${opt.progress ? '<div class="cg-notify-progress"></div>' : ''}
1088
1045
  </div>`;
1089
1046
  if (opt.icon) {
1090
1047
  el.childNodes.item(0).style.background = 'url(' + opt.icon + ')';
1091
1048
  el.childNodes.item(0).style.backgroundSize = '16px';
1092
1049
  }
1093
- exports.elements.system.appendChild(el);
1050
+ exports.elements.notify.appendChild(el);
1094
1051
  notifyTop += el.offsetHeight + 10;
1095
1052
  requestAnimationFrame(function () {
1096
1053
  el.style.transform = `translateY(${y}px) translateX(-10px)`;
@@ -1103,11 +1060,11 @@ function notify(opt) {
1103
1060
  }
1104
1061
  exports.notify = notify;
1105
1062
  function notifyProgress(notifyId, per) {
1106
- const el = exports.elements.system.querySelector(`[data-notifyid="${notifyId}"]`);
1063
+ const el = exports.elements.notify.querySelector(`[data-notifyid="${notifyId}"]`);
1107
1064
  if (!el) {
1108
1065
  return;
1109
1066
  }
1110
- const progress = el.querySelector('.cg-system-notify-progress');
1067
+ const progress = el.querySelector('.cg-notify-progress');
1111
1068
  if (!progress) {
1112
1069
  return;
1113
1070
  }
@@ -1127,7 +1084,7 @@ function notifyProgress(notifyId, per) {
1127
1084
  }
1128
1085
  exports.notifyProgress = notifyProgress;
1129
1086
  function hideNotify(notifyId) {
1130
- const el = exports.elements.system.querySelector(`[data-notifyid="${notifyId}"]`);
1087
+ const el = exports.elements.notify.querySelector(`[data-notifyid="${notifyId}"]`);
1131
1088
  if (!el) {
1132
1089
  return;
1133
1090
  }
@@ -1136,7 +1093,7 @@ function hideNotify(notifyId) {
1136
1093
  el.style.opacity = '0';
1137
1094
  setTimeout(function () {
1138
1095
  notifyTop -= notifyHeight + 10;
1139
- const notifyElementList = document.getElementsByClassName('cg-system-notify');
1096
+ const notifyElementList = document.getElementsByClassName('cg-notify-wrap');
1140
1097
  let needSub = false;
1141
1098
  for (const notifyElement of notifyElementList) {
1142
1099
  if (notifyElement === el) {
@@ -1432,60 +1389,89 @@ function getForm(taskId, formId) {
1432
1389
  }
1433
1390
  return form;
1434
1391
  }
1435
- function create(opt) {
1436
- var _a, _b, _c, _d, _e, _f;
1392
+ function create(cls, data, opt = {}, taskId) {
1393
+ var _a, _b;
1437
1394
  return __awaiter(this, void 0, void 0, function* () {
1438
- if (!opt.taskId) {
1439
- return -1;
1395
+ if (!taskId) {
1396
+ const err = new Error('form.create: -1');
1397
+ core.trigger('error', 0, 0, err, err.message);
1398
+ throw err;
1440
1399
  }
1441
- const t = task.list[opt.taskId];
1400
+ const t = task.list[taskId];
1442
1401
  if (!t) {
1443
- return -2;
1402
+ const err = new Error('form.create: -2');
1403
+ core.trigger('error', 0, 0, err, err.message);
1404
+ throw err;
1444
1405
  }
1445
- const formId = ++info.lastId;
1446
- const components = control.buildComponents(t.id, formId, (_a = opt.path) !== null && _a !== void 0 ? _a : '');
1447
- if (!components) {
1448
- return -3;
1449
- }
1450
- let data = {};
1451
- let access = {};
1452
- let methods = undefined;
1453
- let computed = {};
1454
- let beforeCreate = undefined;
1455
- let created = undefined;
1456
- let beforeMount = undefined;
1457
- let mounted = undefined;
1458
- let beforeUpdate = undefined;
1459
- let updated = undefined;
1460
- let beforeUnmount = undefined;
1461
- let unmounted = undefined;
1462
- if (opt.code) {
1463
- data = (_b = opt.code.data) !== null && _b !== void 0 ? _b : {};
1464
- access = (_c = opt.code.access) !== null && _c !== void 0 ? _c : {};
1465
- methods = opt.code.methods;
1466
- computed = (_d = opt.code.computed) !== null && _d !== void 0 ? _d : {};
1467
- beforeCreate = opt.code.beforeCreate;
1468
- created = opt.code.created;
1469
- beforeMount = opt.code.beforeMount;
1470
- mounted = opt.code.mounted;
1471
- beforeUpdate = opt.code.beforeUpdate;
1472
- updated = opt.code.updated;
1473
- beforeUnmount = opt.code.beforeUnmount;
1474
- unmounted = opt.code.unmounted;
1406
+ let layout = '';
1407
+ if (opt.layout) {
1408
+ layout = opt.layout;
1475
1409
  }
1476
1410
  let style = '';
1477
- let prep = '';
1478
1411
  if (opt.style) {
1479
- const r = tool.stylePrepend(opt.style);
1412
+ style = opt.style;
1413
+ }
1414
+ let prep = '';
1415
+ let filename = '';
1416
+ if (typeof cls === 'string') {
1417
+ filename = tool.urlResolve((_a = opt.path) !== null && _a !== void 0 ? _a : '/', cls);
1418
+ if (!layout) {
1419
+ const l = t.app.files[filename + '.xml'];
1420
+ if (typeof l !== 'string') {
1421
+ const err = new Error('form.create: -3');
1422
+ core.trigger('error', 0, 0, err, err.message);
1423
+ throw err;
1424
+ }
1425
+ layout = l;
1426
+ }
1427
+ if (!style) {
1428
+ const s = t.app.files[filename + '.css'];
1429
+ if (typeof s === 'string') {
1430
+ style = s;
1431
+ }
1432
+ }
1433
+ cls = class extends AbstractForm {
1434
+ get filename() {
1435
+ return filename + '.js';
1436
+ }
1437
+ get taskId() {
1438
+ return t.id;
1439
+ }
1440
+ };
1441
+ }
1442
+ const formId = ++info.lastId;
1443
+ const frm = new cls();
1444
+ if (!filename) {
1445
+ filename = frm.filename;
1446
+ }
1447
+ const lio = filename.lastIndexOf('/');
1448
+ const path = filename.slice(0, lio);
1449
+ if (!style) {
1450
+ const s = t.app.files[filename.slice(0, -2) + 'css'];
1451
+ if (typeof s === 'string') {
1452
+ style = s;
1453
+ }
1454
+ }
1455
+ if (style) {
1456
+ const r = tool.stylePrepend(style);
1480
1457
  prep = r.prep;
1481
- style = yield tool.styleUrl2DataUrl((_e = opt.path) !== null && _e !== void 0 ? _e : '/', r.style, t.app.files);
1458
+ style = yield tool.styleUrl2DataUrl(path + '/', r.style, t.app.files);
1459
+ }
1460
+ if (!layout) {
1461
+ const l = t.app.files[frm.filename.slice(0, -2) + 'xml'];
1462
+ if (typeof l !== 'string') {
1463
+ const err = new Error('form.create: -4');
1464
+ core.trigger('error', 0, 0, err, err.message);
1465
+ throw err;
1466
+ }
1467
+ layout = l;
1482
1468
  }
1483
- let layout = tool.purify(opt.layout);
1469
+ layout = tool.purify(layout);
1484
1470
  layout = tool.layoutAddTagClassAndReTagName(layout, true);
1485
1471
  layout = tool.layoutInsertAttr(layout, ':form-focus=\'formFocus\'', {
1486
1472
  'include': [/^cg-.+/]
1487
1473
  });
1488
- const prepList = ['cg-task' + opt.taskId.toString() + '_'];
1474
+ const prepList = ['cg-task' + t.id.toString() + '_'];
1489
1475
  if (prep !== '') {
1490
1476
  prepList.push(prep);
1491
1477
  }
@@ -1494,9 +1480,27 @@ function create(opt) {
1494
1480
  if (layout.includes('<teleport')) {
1495
1481
  layout = tool.teleportGlue(layout, formId);
1496
1482
  }
1497
- exports.elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${opt.taskId.toString()}"></div>`);
1498
- exports.elements.popList.insertAdjacentHTML('beforeend', `<div data-form-id="${formId.toString()}" data-task-id="${opt.taskId.toString()}"></div>`);
1499
- const el = exports.elements.list.children.item(exports.elements.list.children.length - 1);
1483
+ const components = control.buildComponents(t.id, formId, path);
1484
+ if (!components) {
1485
+ const err = new Error('form.create: -5');
1486
+ core.trigger('error', 0, 0, err, err.message);
1487
+ throw err;
1488
+ }
1489
+ const idata = {};
1490
+ const cdata = Object.entries(frm);
1491
+ for (const item of cdata) {
1492
+ if (item[0] === 'access') {
1493
+ continue;
1494
+ }
1495
+ idata[item[0]] = item[1];
1496
+ }
1497
+ idata._formFocus = false;
1498
+ if (clickgo.isNative() && (formId === 1) && !clickgo.isImmersion() && !clickgo.hasFrame()) {
1499
+ idata.isNativeSync = true;
1500
+ }
1501
+ const prot = tool.getClassPrototype(frm);
1502
+ const methods = prot.method;
1503
+ const computed = prot.access;
1500
1504
  computed.formId = {
1501
1505
  get: function () {
1502
1506
  return formId;
@@ -1510,11 +1514,9 @@ function create(opt) {
1510
1514
  return;
1511
1515
  }
1512
1516
  };
1513
- data._formFocus = false;
1514
1517
  computed.path = {
1515
1518
  get: function () {
1516
- var _a;
1517
- return (_a = opt.path) !== null && _a !== void 0 ? _a : '';
1519
+ return path;
1518
1520
  },
1519
1521
  set: function () {
1520
1522
  notify({
@@ -1538,7 +1540,7 @@ function create(opt) {
1538
1540
  return;
1539
1541
  }
1540
1542
  };
1541
- data._topMost = false;
1543
+ idata._topMost = false;
1542
1544
  computed.topMost = {
1543
1545
  get: function () {
1544
1546
  return this._topMost;
@@ -1564,26 +1566,30 @@ function create(opt) {
1564
1566
  return;
1565
1567
  }
1566
1568
  };
1567
- if (clickgo.isNative() && (formId === 1) && !clickgo.isImmersion() && !clickgo.hasFrame()) {
1568
- data.isNativeSync = true;
1569
- }
1569
+ exports.elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${t.id.toString()}"></div>`);
1570
+ exports.elements.popList.insertAdjacentHTML('beforeend', `<div data-form-id="${formId.toString()}" data-task-id="${t.id.toString()}"></div>`);
1570
1571
  if (style) {
1571
- dom.pushStyle(opt.taskId, style, 'form', formId);
1572
+ dom.pushStyle(t.id, style, 'form', formId);
1572
1573
  }
1574
+ const el = exports.elements.list.children.item(exports.elements.list.children.length - 1);
1573
1575
  const rtn = yield new Promise(function (resolve) {
1574
1576
  const vapp = clickgo.vue.createApp({
1575
1577
  'template': layout.replace(/^<cg-form/, '<cg-form ref="form"'),
1576
1578
  'data': function () {
1577
- return tool.clone(data);
1579
+ return tool.clone(idata);
1578
1580
  },
1579
1581
  'methods': methods,
1580
1582
  'computed': computed,
1581
- 'beforeCreate': beforeCreate,
1583
+ 'beforeCreate': frm.onBeforeCreate,
1582
1584
  'created': function () {
1583
- this.access = tool.clone(access);
1584
- created === null || created === void 0 ? void 0 : created.call(this);
1585
+ if (frm.access) {
1586
+ this.access = tool.clone(frm.access);
1587
+ }
1588
+ this.onCreated();
1589
+ },
1590
+ 'beforeMount': function () {
1591
+ this.onBeforeMount();
1585
1592
  },
1586
- 'beforeMount': beforeMount,
1587
1593
  'mounted': function () {
1588
1594
  return __awaiter(this, void 0, void 0, function* () {
1589
1595
  yield this.$nextTick();
@@ -1600,10 +1606,24 @@ function create(opt) {
1600
1606
  });
1601
1607
  });
1602
1608
  },
1603
- 'beforeUpdate': beforeUpdate,
1604
- 'updated': updated,
1605
- 'beforeUnmount': beforeUnmount,
1606
- 'unmounted': unmounted
1609
+ 'beforeUpdate': function () {
1610
+ this.onBeforeUpdate();
1611
+ },
1612
+ 'updated': function () {
1613
+ return __awaiter(this, void 0, void 0, function* () {
1614
+ yield this.$nextTick();
1615
+ this.onUpdated();
1616
+ });
1617
+ },
1618
+ 'beforeUnmount': function () {
1619
+ this.onBeforeUnmount();
1620
+ },
1621
+ 'unmounted': function () {
1622
+ return __awaiter(this, void 0, void 0, function* () {
1623
+ yield this.$nextTick();
1624
+ this.onUnmounted();
1625
+ });
1626
+ }
1607
1627
  });
1608
1628
  vapp.config.errorHandler = function (err, vm, info) {
1609
1629
  notify({
@@ -1622,10 +1642,10 @@ function create(opt) {
1622
1642
  catch (err) {
1623
1643
  notify({
1624
1644
  'title': 'Runtime Error',
1625
- 'content': `Message: ${err.message}\nTask id: ${opt.taskId}\nForm id: ${formId}`,
1645
+ 'content': `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}`,
1626
1646
  'type': 'danger'
1627
1647
  });
1628
- core.trigger('error', opt.taskId, formId, err, err.message + '(-2)');
1648
+ core.trigger('error', t.id, formId, err, err.message);
1629
1649
  }
1630
1650
  });
1631
1651
  const nform = {
@@ -1635,54 +1655,53 @@ function create(opt) {
1635
1655
  };
1636
1656
  t.forms[formId] = nform;
1637
1657
  yield tool.sleep(34);
1638
- if (mounted) {
1658
+ try {
1659
+ yield frm.onMounted.call(rtn.vroot, data !== null && data !== void 0 ? data : {});
1660
+ }
1661
+ catch (err) {
1662
+ core.trigger('error', rtn.vroot.taskId, rtn.vroot.formId, err, 'Create form mounted error: -7.');
1663
+ delete t.forms[formId];
1639
1664
  try {
1640
- yield mounted.call(rtn.vroot, opt.data);
1665
+ rtn.vapp.unmount();
1641
1666
  }
1642
1667
  catch (err) {
1643
- core.trigger('error', rtn.vroot.taskId, rtn.vroot.formId, err, 'Create form mounted error.');
1644
- delete t.forms[formId];
1645
- try {
1646
- rtn.vapp.unmount();
1647
- }
1648
- catch (err) {
1649
- const msg = `Message: ${err.message}\nTask id: ${opt.taskId}\nForm id: ${formId}\nFunction: form.create, unmount.`;
1650
- notify({
1651
- 'title': 'Form Unmount Error',
1652
- 'content': msg,
1653
- 'type': 'danger'
1654
- });
1655
- console.log('Form Unmount Error', msg, err);
1656
- }
1657
- rtn.vapp._container.remove();
1658
- (_f = exports.elements.popList.querySelector('[data-form-id="' + rtn.vroot.formId + '"]')) === null || _f === void 0 ? void 0 : _f.remove();
1659
- dom.clearWatchStyle(rtn.vroot.formId);
1660
- dom.clearWatchProperty(rtn.vroot.formId);
1661
- native.clear(formId, t.id);
1662
- dom.removeStyle(rtn.vroot.taskId, 'form', rtn.vroot.formId);
1663
- return -8;
1668
+ const msg = `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}\nFunction: form.create, unmount.`;
1669
+ notify({
1670
+ 'title': 'Form Unmount Error',
1671
+ 'content': msg,
1672
+ 'type': 'danger'
1673
+ });
1674
+ console.log('Form Unmount Error', msg, err);
1664
1675
  }
1665
- }
1666
- core.trigger('formCreated', opt.taskId, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconDataUrl);
1676
+ rtn.vapp._container.remove();
1677
+ (_b = exports.elements.popList.querySelector('[data-form-id="' + rtn.vroot.formId + '"]')) === null || _b === void 0 ? void 0 : _b.remove();
1678
+ dom.clearWatchStyle(rtn.vroot.formId);
1679
+ dom.clearWatchProperty(rtn.vroot.formId);
1680
+ native.clear(formId, t.id);
1681
+ dom.removeStyle(rtn.vroot.taskId, 'form', rtn.vroot.formId);
1682
+ throw err;
1683
+ }
1684
+ core.trigger('formCreated', t.id, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconDataUrl);
1667
1685
  if (rtn.vroot.isNativeSync) {
1668
- native.invoke('cg-set-size', native.getToken(), rtn.vroot.$refs.form.$el.offsetWidth, rtn.vroot.$refs.form.$el.offsetHeight);
1686
+ yield native.invoke('cg-set-size', native.getToken(), rtn.vroot.$refs.form.$el.offsetWidth, rtn.vroot.$refs.form.$el.offsetHeight);
1669
1687
  window.addEventListener('resize', function () {
1670
1688
  rtn.vroot.$refs.form.setPropData('width', window.innerWidth);
1671
1689
  rtn.vroot.$refs.form.setPropData('height', window.innerHeight);
1672
1690
  });
1673
1691
  }
1674
- return formId;
1692
+ return rtn.vroot;
1675
1693
  });
1676
1694
  }
1677
1695
  exports.create = create;
1678
1696
  function dialog(opt) {
1679
1697
  return new Promise(function (resolve) {
1680
- var _a, _b, _c;
1698
+ var _a, _b, _c, _d;
1681
1699
  if (typeof opt === 'string') {
1682
1700
  opt = {
1683
1701
  'content': opt
1684
1702
  };
1685
1703
  }
1704
+ const filename = tool.urlResolve((_a = opt.path) !== null && _a !== void 0 ? _a : '/', './tmp' + (Math.random() * 100000000000000).toFixed() + '.js');
1686
1705
  const nopt = opt;
1687
1706
  const taskId = nopt.taskId;
1688
1707
  if (!taskId) {
@@ -1696,13 +1715,16 @@ function dialog(opt) {
1696
1715
  }
1697
1716
  const locale = t.locale.lang || core.config.locale;
1698
1717
  if (nopt.buttons === undefined) {
1699
- nopt.buttons = [(_b = (_a = info.locale[locale]) === null || _a === void 0 ? void 0 : _a.ok) !== null && _b !== void 0 ? _b : info.locale['en'].ok];
1718
+ nopt.buttons = [(_c = (_b = info.locale[locale]) === null || _b === void 0 ? void 0 : _b.ok) !== null && _c !== void 0 ? _c : info.locale['en'].ok];
1700
1719
  }
1701
1720
  const cls = class extends AbstractForm {
1702
1721
  constructor() {
1703
1722
  super(...arguments);
1704
1723
  this.buttons = nopt.buttons;
1705
1724
  }
1725
+ get filename() {
1726
+ return filename;
1727
+ }
1706
1728
  get taskId() {
1707
1729
  return taskId;
1708
1730
  }
@@ -1721,7 +1743,10 @@ function dialog(opt) {
1721
1743
  }
1722
1744
  }
1723
1745
  };
1724
- cls.create(undefined, `<form title="${(_c = nopt.title) !== null && _c !== void 0 ? _c : 'dialog'}" min="false" max="false" resize="false" height="0" width="0" border="${nopt.title ? 'normal' : 'plain'}" direction="v"><dialog :buttons="buttons" @select="select"${nopt.direction ? ` direction="${nopt.direction}"` : ''}>${nopt.content}</dialog></form>`).then((frm) => {
1746
+ create(cls, undefined, {
1747
+ 'layout': `<form title="${(_d = nopt.title) !== null && _d !== void 0 ? _d : 'dialog'}" min="false" max="false" resize="false" height="0" width="0" border="${nopt.title ? 'normal' : 'plain'}" direction="v"><dialog :buttons="buttons" @select="select"${nopt.direction ? ` direction="${nopt.direction}"` : ''}>${nopt.content}</dialog></form>`,
1748
+ 'style': nopt.style
1749
+ }, t.id).then((frm) => {
1725
1750
  if (typeof frm === 'number') {
1726
1751
  resolve('');
1727
1752
  return;