clickgo 3.0.6-dev7 → 3.1.0-dev9

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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/app/demo/app.js +93 -0
  3. package/dist/app/demo/form/control/form/form.js +21 -20
  4. package/dist/app/demo/form/control/form/form.xml +3 -3
  5. package/dist/app/demo/form/main.js +20 -10
  6. package/dist/app/demo/form/main.xml +1 -1
  7. package/dist/app/task/app.js +46 -0
  8. package/dist/app/task/form/bar/bar.js +85 -86
  9. package/dist/app/task/form/bar/bar.xml +5 -6
  10. package/dist/clickgo.js +1 -10
  11. package/dist/clickgo.ts +0 -8
  12. package/dist/control/common.cgc +0 -0
  13. package/dist/control/form.cgc +0 -0
  14. package/dist/control/monaco.cgc +0 -0
  15. package/dist/control/property.cgc +0 -0
  16. package/dist/control/task.cgc +0 -0
  17. package/dist/global.css +1 -1
  18. package/dist/index.js +105 -56
  19. package/dist/index.ts +164 -59
  20. package/dist/lib/control.js +363 -240
  21. package/dist/lib/control.ts +497 -284
  22. package/dist/lib/core.js +331 -217
  23. package/dist/lib/core.ts +418 -244
  24. package/dist/lib/dom.js +6 -3
  25. package/dist/lib/dom.ts +7 -6
  26. package/dist/lib/form.js +635 -980
  27. package/dist/lib/form.ts +817 -1072
  28. package/dist/lib/fs.js +42 -39
  29. package/dist/lib/fs.ts +45 -41
  30. package/dist/lib/native.js +8 -148
  31. package/dist/lib/native.ts +9 -211
  32. package/dist/lib/task.js +707 -191
  33. package/dist/lib/task.ts +778 -210
  34. package/dist/lib/theme.ts +2 -2
  35. package/dist/lib/tool.js +58 -48
  36. package/dist/lib/tool.ts +79 -64
  37. package/dist/theme/familiar.cgt +0 -0
  38. package/package.json +5 -7
  39. package/types/index.d.ts +286 -324
  40. package/dist/app/demo/config.json +0 -106
  41. package/dist/app/task/config.json +0 -32
package/dist/lib/form.js CHANGED
@@ -9,13 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.hide = exports.show = exports.flash = exports.setTopMost = 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.getList = exports.send = exports.get = exports.getTaskId = exports.refreshMaxPosition = exports.bindDrag = exports.bindResize = exports.close = exports.max = exports.min = exports.simpleSystemTaskRoot = 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.getList = exports.send = exports.get = exports.getTaskId = exports.refreshMaxPosition = exports.bindDrag = exports.bindResize = exports.close = exports.max = exports.min = 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");
16
16
  const tool = require("./tool");
17
17
  const dom = require("./dom");
18
18
  const control = require("./control");
19
+ const fs = require("./fs");
19
20
  const native = require("./native");
20
21
  const info = {
21
22
  'lastId': 0,
@@ -26,28 +27,298 @@ const info = {
26
27
  'ok': '好',
27
28
  'yes': '是',
28
29
  'no': '否',
29
- 'cancel': '取消'
30
+ 'cancel': '取消',
31
+ 'search': '搜索'
30
32
  },
31
33
  'tc': {
32
34
  'ok': '好',
33
35
  'yes': '是',
34
36
  'no': '否',
35
- 'cancel': '取消'
37
+ 'cancel': '取消',
38
+ 'search': '檢索'
36
39
  },
37
40
  'en': {
38
41
  'ok': 'OK',
39
42
  'yes': 'Yes',
40
43
  'no': 'No',
41
- 'cancel': 'Cancel'
44
+ 'cancel': 'Cancel',
45
+ 'search': 'Search'
42
46
  },
43
47
  'ja': {
44
48
  'ok': '好',
45
49
  'yes': 'はい',
46
50
  'no': 'いいえ',
47
- 'cancel': 'キャンセル'
51
+ 'cancel': 'キャンセル',
52
+ 'search': '検索'
48
53
  }
49
54
  }
50
55
  };
56
+ class AbstractForm {
57
+ constructor() {
58
+ this._firstShow = true;
59
+ this.dialogResult = '';
60
+ }
61
+ static create(data) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const frm = new this();
64
+ const code = {
65
+ 'data': {},
66
+ 'methods': {},
67
+ 'computed': {},
68
+ beforeCreate: frm.onBeforeCreate,
69
+ created: function () {
70
+ this.onCreated();
71
+ },
72
+ beforeMount: function () {
73
+ this.onBeforeMount();
74
+ },
75
+ mounted: function (data) {
76
+ this.onMounted(data);
77
+ },
78
+ beforeUpdate: function () {
79
+ this.onBeforeUpdate();
80
+ },
81
+ updated: function () {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ yield this.$nextTick();
84
+ this.onUpdated();
85
+ });
86
+ },
87
+ beforeUnmount: function () {
88
+ this.onBeforeUnmount();
89
+ },
90
+ unmounted: function () {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ yield this.$nextTick();
93
+ this.onUnmounted();
94
+ });
95
+ }
96
+ };
97
+ const cdata = Object.entries(frm);
98
+ for (const item of cdata) {
99
+ code.data[item[0]] = item[1];
100
+ }
101
+ const layout = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'xml'];
102
+ if (typeof layout !== 'string') {
103
+ return 0;
104
+ }
105
+ const prot = tool.getClassPrototype(frm);
106
+ code.methods = prot.method;
107
+ code.computed = prot.access;
108
+ let style = undefined;
109
+ const fstyle = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'css'];
110
+ if (typeof fstyle === 'string') {
111
+ style = fstyle;
112
+ }
113
+ const fid = yield create({
114
+ 'code': code,
115
+ 'layout': layout,
116
+ 'style': style,
117
+ 'path': frm.filename.slice(0, frm.filename.lastIndexOf('/')),
118
+ 'data': data,
119
+ 'taskId': frm.taskId
120
+ });
121
+ if (fid > 0) {
122
+ return task.list[frm.taskId].forms[fid].vroot;
123
+ }
124
+ else {
125
+ return fid;
126
+ }
127
+ });
128
+ }
129
+ get filename() {
130
+ return '';
131
+ }
132
+ get controlName() {
133
+ return 'root';
134
+ }
135
+ set controlName(v) {
136
+ notify({
137
+ 'title': 'Error',
138
+ 'content': `The software tries to modify the system variable "controlName".\nPath: ${this.filename}`,
139
+ 'type': 'danger'
140
+ });
141
+ return;
142
+ }
143
+ get taskId() {
144
+ return 0;
145
+ }
146
+ get formId() {
147
+ return 0;
148
+ }
149
+ get formFocus() {
150
+ return this._formFocus;
151
+ }
152
+ set formFocus(b) {
153
+ notify({
154
+ 'title': 'Error',
155
+ 'content': `The software tries to modify the system variable "formFocus".\nPath: ${this.filename}`,
156
+ 'type': 'danger'
157
+ });
158
+ }
159
+ get path() {
160
+ return '';
161
+ }
162
+ get prep() {
163
+ return '';
164
+ }
165
+ get locale() {
166
+ return task.list[this.taskId].locale.lang || core.config.locale;
167
+ }
168
+ get l() {
169
+ return (key) => {
170
+ var _a, _b, _c, _d;
171
+ return (_d = (_b = (_a = task.list[this.taskId].locale.data[this.locale]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : (_c = task.list[this.taskId].locale.data['en']) === null || _c === void 0 ? void 0 : _c[key]) !== null && _d !== void 0 ? _d : 'LocaleError';
172
+ };
173
+ }
174
+ classPrepend() {
175
+ return (cla) => {
176
+ if (typeof cla !== 'string') {
177
+ return cla;
178
+ }
179
+ return `cg-task${this.taskId}_${cla}${this.prep ? (' ' + this.prep + cla) : ''}`;
180
+ };
181
+ }
182
+ watch(name, cb, opt = {}) {
183
+ return this.$watch(name, cb, opt);
184
+ }
185
+ get refs() {
186
+ return this.$refs;
187
+ }
188
+ get nextTick() {
189
+ return this.$nextTick;
190
+ }
191
+ allowEvent(e) {
192
+ return dom.allowEvent(e);
193
+ }
194
+ trigger(name, param1 = '', param2 = '') {
195
+ if (!['formTitleChanged', 'formIconChanged', 'formStateMinChanged', 'formStateMaxChanged', 'formShowChanged'].includes(name)) {
196
+ return;
197
+ }
198
+ core.trigger(name, this.taskId, this.formId, param1, param2);
199
+ }
200
+ get topMost() {
201
+ return false;
202
+ }
203
+ set topMost(v) {
204
+ }
205
+ send(fid, obj) {
206
+ obj.taskId = this.taskId;
207
+ obj.formId = this.formId;
208
+ send(fid, obj);
209
+ }
210
+ get isMask() {
211
+ return !task.list[this.taskId].runtime.dialogFormIds.length ||
212
+ task.list[this.taskId].runtime.dialogFormIds[task.list[this.taskId].runtime.dialogFormIds.length - 1]
213
+ === this.formId ? false : true;
214
+ }
215
+ show() {
216
+ const v = this;
217
+ v.$refs.form.$data.showData = true;
218
+ if (this._firstShow) {
219
+ this._firstShow = false;
220
+ const area = core.getAvailArea();
221
+ if (!v.$refs.form.stateMaxData) {
222
+ if (v.$refs.form.left === -1) {
223
+ v.$refs.form.setPropData('left', (area.width - v.$el.offsetWidth) / 2);
224
+ }
225
+ if (v.$refs.form.top === -1) {
226
+ v.$refs.form.setPropData('top', (area.height - v.$el.offsetHeight) / 2);
227
+ }
228
+ }
229
+ v.$refs.form.$data.showData = true;
230
+ changeFocus(this.formId);
231
+ }
232
+ }
233
+ showDialog() {
234
+ return __awaiter(this, void 0, void 0, function* () {
235
+ this.show();
236
+ task.list[this.taskId].runtime.dialogFormIds.push(this.formId);
237
+ return new Promise((resolve) => {
238
+ this.cgDialogCallback = () => {
239
+ resolve(this.dialogResult);
240
+ };
241
+ });
242
+ });
243
+ }
244
+ hide() {
245
+ const v = this;
246
+ v.$refs.form.$data.showData = false;
247
+ }
248
+ onBeforeCreate() {
249
+ return;
250
+ }
251
+ onCreated() {
252
+ return;
253
+ }
254
+ onBeforeMount() {
255
+ return;
256
+ }
257
+ onMounted() {
258
+ return;
259
+ }
260
+ onBeforeUpdate() {
261
+ return;
262
+ }
263
+ onUpdated() {
264
+ return;
265
+ }
266
+ onBeforeUnmount() {
267
+ return;
268
+ }
269
+ onUnmounted() {
270
+ return;
271
+ }
272
+ onReceive() {
273
+ return;
274
+ }
275
+ onScreenResize() {
276
+ return;
277
+ }
278
+ onConfigChanged() {
279
+ return;
280
+ }
281
+ onFormCreated() {
282
+ return;
283
+ }
284
+ onFormRemoved() {
285
+ return;
286
+ }
287
+ onFormTitleChanged() {
288
+ return;
289
+ }
290
+ onFormIconChanged() {
291
+ return;
292
+ }
293
+ onFormStateMinChanged() {
294
+ return;
295
+ }
296
+ onFormStateMaxChanged() {
297
+ return;
298
+ }
299
+ onFormShowChanged() {
300
+ return;
301
+ }
302
+ onFormFocused() {
303
+ return;
304
+ }
305
+ onFormBlurred() {
306
+ return;
307
+ }
308
+ onFormFlash() {
309
+ return;
310
+ }
311
+ onTaskStarted() {
312
+ return;
313
+ }
314
+ onTaskEnded() {
315
+ return;
316
+ }
317
+ onLauncherFolderNameChanged() {
318
+ return;
319
+ }
320
+ }
321
+ exports.AbstractForm = AbstractForm;
51
322
  const popInfo = {
52
323
  'list': [],
53
324
  'elList': [],
@@ -64,21 +335,16 @@ const elements = {
64
335
  'dragIcon': undefined,
65
336
  'system': document.createElement('div'),
66
337
  'simpleSystemtask': document.createElement('div'),
338
+ 'launcher': document.createElement('div'),
67
339
  'init': function () {
68
340
  this.wrap.id = 'cg-wrap';
69
341
  document.getElementsByTagName('body')[0].appendChild(this.wrap);
70
342
  if (clickgo.getNative() && (clickgo.getPlatform() === 'win32')) {
71
343
  this.wrap.addEventListener('mouseenter', function () {
72
- native.send('cg-mouse-ignore', JSON.stringify({
73
- 'token': native.getToken(),
74
- 'param': false
75
- }));
344
+ native.invoke('cg-mouse-ignore', native.getToken(), false);
76
345
  });
77
346
  this.wrap.addEventListener('mouseleave', function () {
78
- native.send('cg-mouse-ignore', JSON.stringify({
79
- 'token': native.getToken(),
80
- 'param': true
81
- }));
347
+ native.invoke('cg-mouse-ignore', native.getToken(), true);
82
348
  });
83
349
  }
84
350
  this.list.id = 'cg-form-list';
@@ -176,13 +442,187 @@ const elements = {
176
442
  }
177
443
  });
178
444
  simpletaskApp.mount('#cg-simpletask');
445
+ this.launcher.id = 'cg-launcher';
446
+ this.launcher.addEventListener('contextmenu', function (e) {
447
+ e.preventDefault();
448
+ });
449
+ this.wrap.appendChild(this.launcher);
450
+ this.launcher.addEventListener('touchmove', function (e) {
451
+ e.preventDefault();
452
+ }, {
453
+ 'passive': false
454
+ });
455
+ const waiting = function () {
456
+ if (!core.config) {
457
+ setTimeout(function () {
458
+ waiting();
459
+ }, 2000);
460
+ return;
461
+ }
462
+ const launcherApp = clickgo.vue.createApp({
463
+ 'template': `<div class="cg-launcher-search">` +
464
+ `<input v-if="folderName === ''" class="cg-launcher-sinput" :placeholder="search" v-model="name">` +
465
+ `<input v-else class="cg-launcher-foldername" :value="folderName" @change="folderNameChange">` +
466
+ `</div>` +
467
+ `<div class="cg-launcher-list" @mousedown="mousedown" @click="listClick" :class="[folderName === '' ? '' : 'cg-folder-open']">` +
468
+ `<div v-for="item of list" class="cg-launcher-item">` +
469
+ `<div class="cg-launcher-inner">` +
470
+ `<div v-if="!item.list || item.list.length === 0" class="cg-launcher-icon" :style="{'background-image': 'url(' + item.icon + ')'}" @click="iconClick($event, item)"></div>` +
471
+ `<div v-else class="cg-launcher-folder" @click="openFolder($event, item)">` +
472
+ `<div>` +
473
+ `<div v-for="sub of item.list" class="cg-launcher-item">` +
474
+ `<div class="cg-launcher-inner">` +
475
+ `<div class="cg-launcher-icon" :style="{'background-image': 'url(' + sub.icon + ')'}" @click="subIconClick($event, sub)"></div>` +
476
+ `<div class="cg-launcher-name">{{sub.name}}</div>` +
477
+ `</div>` +
478
+ `<div class="cg-launcher-space"></div>` +
479
+ `</div>` +
480
+ `</div>` +
481
+ `</div>` +
482
+ `<div class="cg-launcher-name">{{item.name}}</div>` +
483
+ `</div>` +
484
+ `<div class="cg-launcher-space"></div>` +
485
+ `</div>` +
486
+ `</div>`,
487
+ 'data': function () {
488
+ return {
489
+ 'name': '',
490
+ 'folderName': ''
491
+ };
492
+ },
493
+ 'computed': {
494
+ 'search': function () {
495
+ var _a, _b;
496
+ return (_b = (_a = info.locale[core.config.locale]) === null || _a === void 0 ? void 0 : _a.search) !== null && _b !== void 0 ? _b : info.locale['en'].search;
497
+ },
498
+ 'list': function () {
499
+ if (this.name === '') {
500
+ return core.config['launcher.list'];
501
+ }
502
+ const list = [];
503
+ for (const item of core.config['launcher.list']) {
504
+ if (item.list && item.list.length > 0) {
505
+ for (const sub of item.list) {
506
+ if (sub.name.toLowerCase().includes(this.name.toLowerCase())) {
507
+ list.push(sub);
508
+ }
509
+ }
510
+ }
511
+ else {
512
+ if (item.name.toLowerCase().includes(this.name.toLowerCase())) {
513
+ list.push(item);
514
+ }
515
+ }
516
+ }
517
+ return list;
518
+ }
519
+ },
520
+ 'methods': {
521
+ mousedown: function (e) {
522
+ this.md = e.pageX + e.pageY;
523
+ },
524
+ listClick: function (e) {
525
+ if (this.md !== e.pageX + e.pageY) {
526
+ return;
527
+ }
528
+ if (e.currentTarget !== e.target) {
529
+ return;
530
+ }
531
+ if (this.folderName === '') {
532
+ hideLauncher();
533
+ }
534
+ else {
535
+ this.closeFolder();
536
+ }
537
+ },
538
+ iconClick: function (e, item) {
539
+ return __awaiter(this, void 0, void 0, function* () {
540
+ if (this.md !== e.pageX + e.pageY) {
541
+ return;
542
+ }
543
+ hideLauncher();
544
+ yield clickgo.task.run(item.path, {
545
+ 'icon': item.icon
546
+ });
547
+ });
548
+ },
549
+ subIconClick: function (e, item) {
550
+ return __awaiter(this, void 0, void 0, function* () {
551
+ if (this.md !== e.pageX + e.pageY) {
552
+ return;
553
+ }
554
+ hideLauncher();
555
+ yield clickgo.task.run(item.path, {
556
+ 'icon': item.icon
557
+ });
558
+ });
559
+ },
560
+ closeFolder: function () {
561
+ this.folderName = '';
562
+ const el = this.folderEl;
563
+ const rect = el.parentNode.getBoundingClientRect();
564
+ el.classList.remove('cg-show');
565
+ el.style.left = (rect.left + 30).toString() + 'px';
566
+ el.style.top = rect.top.toString() + 'px';
567
+ el.style.width = '';
568
+ el.style.height = '';
569
+ setTimeout(() => {
570
+ el.style.position = '';
571
+ el.style.left = '';
572
+ el.style.top = '';
573
+ }, 150);
574
+ },
575
+ openFolder: function (e, item) {
576
+ if (this.md !== e.pageX + e.pageY) {
577
+ return;
578
+ }
579
+ if (e.currentTarget.childNodes[0] !== e.target) {
580
+ return;
581
+ }
582
+ if (this.folderName !== '') {
583
+ this.closeFolder();
584
+ return;
585
+ }
586
+ this.folderName = item.name;
587
+ this.folderItem = item;
588
+ const el = e.currentTarget.childNodes.item(0);
589
+ this.folderEl = el;
590
+ const searchEl = document.getElementsByClassName('cg-launcher-search')[0];
591
+ const rect = el.getBoundingClientRect();
592
+ el.style.left = rect.left.toString() + 'px';
593
+ el.style.top = rect.top.toString() + 'px';
594
+ el.style.position = 'fixed';
595
+ requestAnimationFrame(() => {
596
+ el.classList.add('cg-show');
597
+ el.style.left = '50px';
598
+ el.style.top = searchEl.offsetHeight.toString() + 'px';
599
+ el.style.width = 'calc(100% - 100px)';
600
+ el.style.height = 'calc(100% - 50px - ' + searchEl.offsetHeight.toString() + 'px)';
601
+ });
602
+ },
603
+ folderNameChange: function (e) {
604
+ var _a;
605
+ const input = e.target;
606
+ const val = input.value.trim();
607
+ if (val === '') {
608
+ input.value = this.folderName;
609
+ return;
610
+ }
611
+ this.folderName = val;
612
+ core.trigger('launcherFolderNameChanged', (_a = this.folderItem.id) !== null && _a !== void 0 ? _a : '', val);
613
+ }
614
+ },
615
+ 'mounted': function () {
616
+ exports.launcherRoot = this;
617
+ }
618
+ });
619
+ launcherApp.mount('#cg-launcher');
620
+ };
621
+ waiting();
179
622
  }
180
623
  };
181
624
  elements.init();
182
625
  function changeState(state, formId) {
183
- if (!formId) {
184
- return false;
185
- }
186
626
  const tid = getTaskId(formId);
187
627
  const t = task.list[tid];
188
628
  if (!t) {
@@ -297,7 +737,7 @@ function get(formId) {
297
737
  'stateMax': item.vroot.$refs.form.stateMaxData,
298
738
  'stateMin': item.vroot.$refs.form.stateMinData,
299
739
  'show': item.vroot.$refs.form.showData,
300
- 'focus': item.vroot.cgFocus
740
+ 'focus': item.vroot.formFocus
301
741
  };
302
742
  }
303
743
  exports.get = get;
@@ -307,10 +747,7 @@ function send(formId, obj) {
307
747
  return;
308
748
  }
309
749
  const item = task.list[taskId].forms[formId];
310
- if (!item.vroot.cgReceive) {
311
- return;
312
- }
313
- item.vroot.cgReceive(obj);
750
+ item.vroot.onReceive(obj);
314
751
  }
315
752
  exports.send = send;
316
753
  function getList(taskId) {
@@ -327,7 +764,7 @@ function getList(taskId) {
327
764
  'stateMax': item.vroot.$refs.form.stateMaxData,
328
765
  'stateMin': item.vroot.$refs.form.stateMinData,
329
766
  'show': item.vroot.$refs.form.showData,
330
- 'focus': item.vroot.cgFocus
767
+ 'focus': item.vroot.formFocus
331
768
  };
332
769
  }
333
770
  return list;
@@ -343,7 +780,7 @@ function changeFocus(formId = 0) {
343
780
  });
344
781
  return;
345
782
  }
346
- const focusElement = document.querySelector('#cg-form-list > [data-cg-focus]');
783
+ const focusElement = document.querySelector('#cg-form-list > [data-form-focus]');
347
784
  if (focusElement) {
348
785
  const dataFormId = focusElement.getAttribute('data-form-id');
349
786
  if (dataFormId) {
@@ -354,8 +791,8 @@ function changeFocus(formId = 0) {
354
791
  else {
355
792
  const taskId = parseInt((_a = focusElement.getAttribute('data-task-id')) !== null && _a !== void 0 ? _a : '0');
356
793
  const t = task.list[taskId];
357
- t.forms[dataFormIdNumber].vapp._container.removeAttribute('data-cg-focus');
358
- t.forms[dataFormIdNumber].vroot._cgFocus = false;
794
+ t.forms[dataFormIdNumber].vapp._container.removeAttribute('data-form-focus');
795
+ t.forms[dataFormIdNumber].vroot._formFocus = false;
359
796
  core.trigger('formBlurred', taskId, dataFormIdNumber);
360
797
  }
361
798
  }
@@ -375,35 +812,33 @@ function changeFocus(formId = 0) {
375
812
  }
376
813
  const taskId = parseInt((_b = el.getAttribute('data-task-id')) !== null && _b !== void 0 ? _b : '0');
377
814
  const t = task.list[taskId];
378
- if (!t.forms[formId].vroot.cgCustomZIndex) {
379
- if (t.forms[formId].vroot.cgTopMost) {
380
- t.forms[formId].vroot.$refs.form.setPropData('zIndex', ++info.topLastZIndex);
381
- }
382
- else {
383
- t.forms[formId].vroot.$refs.form.setPropData('zIndex', ++info.lastZIndex);
384
- }
815
+ if (t.forms[formId].vroot._topMost) {
816
+ t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
385
817
  }
386
- const maskFor = t.forms[formId].vroot.$refs.form.maskFor;
387
- if ((typeof maskFor === 'number') && (task.list[taskId].forms[maskFor])) {
388
- if (get(maskFor).stateMin) {
389
- min(maskFor);
390
- }
391
- if (!task.list[taskId].forms[maskFor].vroot.cgCustomZIndex) {
392
- if (task.list[taskId].forms[maskFor].vroot.cgTopMost) {
393
- task.list[taskId].forms[maskFor].vroot.$refs.form.setPropData('zIndex', ++info.topLastZIndex);
818
+ else {
819
+ t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
820
+ }
821
+ if (t.runtime.dialogFormIds.length) {
822
+ const dialogFormId = t.runtime.dialogFormIds[t.runtime.dialogFormIds.length - 1];
823
+ if (dialogFormId !== formId) {
824
+ if (get(dialogFormId).stateMin) {
825
+ min(dialogFormId);
826
+ }
827
+ if (task.list[taskId].forms[dialogFormId].vroot._topMost) {
828
+ task.list[taskId].forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
394
829
  }
395
830
  else {
396
- task.list[taskId].forms[maskFor].vroot.$refs.form.setPropData('zIndex', ++info.lastZIndex);
831
+ task.list[taskId].forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
397
832
  }
833
+ task.list[taskId].forms[dialogFormId].vapp._container.dataset.formFocus = '';
834
+ task.list[taskId].forms[dialogFormId].vroot._formFocus = true;
835
+ core.trigger('formFocused', taskId, dialogFormId);
836
+ clickgo.form.flash(dialogFormId, taskId);
398
837
  }
399
- task.list[taskId].forms[maskFor].vapp._container.dataset.cgFocus = '';
400
- task.list[taskId].forms[maskFor].vroot._cgFocus = true;
401
- core.trigger('formFocused', taskId, maskFor);
402
- clickgo.form.flash(maskFor, taskId);
403
838
  }
404
839
  else {
405
- t.forms[formId].vapp._container.dataset.cgFocus = '';
406
- t.forms[formId].vroot._cgFocus = true;
840
+ t.forms[formId].vapp._container.dataset.formFocus = '';
841
+ t.forms[formId].vroot._formFocus = true;
407
842
  core.trigger('formFocused', taskId, formId);
408
843
  }
409
844
  }
@@ -415,6 +850,9 @@ function getMaxZIndexID(out = {}) {
415
850
  for (let i = 0; i < elements.list.children.length; ++i) {
416
851
  const formWrap = elements.list.children.item(i);
417
852
  const formInner = formWrap.children.item(0);
853
+ if (!formInner) {
854
+ continue;
855
+ }
418
856
  const z = parseInt(formInner.style.zIndex);
419
857
  if (z > 9999999) {
420
858
  continue;
@@ -944,9 +1382,9 @@ function remove(formId) {
944
1382
  if (task.list[taskId].forms[formId]) {
945
1383
  title = task.list[taskId].forms[formId].vroot.$refs.form.title;
946
1384
  icon = task.list[taskId].forms[formId].vroot.$refs.form.iconData;
947
- if (task.list[taskId].forms[formId].vroot.$refs.form.maskFrom !== undefined) {
948
- const fid = task.list[taskId].forms[formId].vroot.$refs.form.maskFrom;
949
- task.list[taskId].forms[fid].vroot.$refs.form.maskFor = undefined;
1385
+ const io = task.list[taskId].runtime.dialogFormIds.indexOf(formId);
1386
+ if (io > -1) {
1387
+ task.list[taskId].runtime.dialogFormIds.splice(io, 1);
950
1388
  }
951
1389
  task.list[taskId].forms[formId].vroot.$refs.form.$data.showData = false;
952
1390
  setTimeout(function () {
@@ -964,6 +1402,9 @@ function remove(formId) {
964
1402
  }
965
1403
  task.list[taskId].forms[formId].vapp.unmount();
966
1404
  task.list[taskId].forms[formId].vapp._container.remove();
1405
+ if (io > -1) {
1406
+ task.list[taskId].forms[formId].vroot.cgDialogCallback();
1407
+ }
967
1408
  delete task.list[taskId].forms[formId];
968
1409
  dom.removeStyle(taskId, 'form', formId);
969
1410
  core.trigger('formRemoved', taskId, formId, title, icon);
@@ -979,16 +1420,10 @@ function remove(formId) {
979
1420
  }
980
1421
  exports.remove = remove;
981
1422
  function getForm(taskId, formId) {
982
- if (!taskId) {
983
- return null;
984
- }
985
1423
  const t = task.list[taskId];
986
1424
  if (!t) {
987
1425
  return null;
988
1426
  }
989
- if (!formId) {
990
- return null;
991
- }
992
1427
  const form = t.forms[formId];
993
1428
  if (!form) {
994
1429
  return null;
@@ -998,875 +1433,131 @@ function getForm(taskId, formId) {
998
1433
  function create(opt) {
999
1434
  var _a, _b, _c, _d;
1000
1435
  return __awaiter(this, void 0, void 0, function* () {
1001
- if (typeof opt === 'string') {
1002
- return 0;
1003
- }
1004
1436
  if (!opt.taskId) {
1005
1437
  return -1;
1006
1438
  }
1007
- if (opt.path && (!opt.path.endsWith('/') || !((_a = opt.path) === null || _a === void 0 ? void 0 : _a.startsWith('/')))) {
1439
+ const t = task.list[opt.taskId];
1440
+ if (!t) {
1008
1441
  return -2;
1009
1442
  }
1010
- const taskId = opt.taskId;
1011
- const t = task.list[taskId];
1012
- if (!t) {
1443
+ const formId = ++info.lastId;
1444
+ const components = control.buildComponents(t.id, formId, (_a = opt.path) !== null && _a !== void 0 ? _a : '');
1445
+ if (!components) {
1013
1446
  return -3;
1014
1447
  }
1015
- let form = null;
1016
- if (opt.formId) {
1017
- if (!t.forms[opt.formId]) {
1018
- return -4;
1019
- }
1020
- form = t.forms[opt.formId];
1021
- }
1022
- let topMost = (_b = opt.topMost) !== null && _b !== void 0 ? _b : false;
1023
- if (form === null || form === void 0 ? void 0 : form.vroot.cgTopMost) {
1024
- topMost = true;
1025
- }
1026
- if (opt.mask && form) {
1027
- form.vroot.$refs.form.maskFor = 0;
1028
- }
1029
- const base = form ? form.vroot.cgPath : '/';
1030
- let filePath = '', newBase = '';
1031
- if (opt.file) {
1032
- filePath = clickgo.tool.urlResolve(base, opt.file);
1033
- newBase = filePath.slice(0, filePath.lastIndexOf('/') + 1);
1448
+ let data = {};
1449
+ let methods = undefined;
1450
+ let computed = {};
1451
+ let beforeCreate = undefined;
1452
+ let created = undefined;
1453
+ let beforeMount = undefined;
1454
+ let mounted = undefined;
1455
+ let beforeUpdate = undefined;
1456
+ let updated = undefined;
1457
+ let beforeUnmount = undefined;
1458
+ let unmounted = undefined;
1459
+ if (opt.code) {
1460
+ data = (_b = opt.code.data) !== null && _b !== void 0 ? _b : {};
1461
+ methods = opt.code.methods;
1462
+ computed = (_c = opt.code.computed) !== null && _c !== void 0 ? _c : {};
1463
+ beforeCreate = opt.code.beforeCreate;
1464
+ created = opt.code.created;
1465
+ beforeMount = opt.code.beforeMount;
1466
+ mounted = opt.code.mounted;
1467
+ beforeUpdate = opt.code.beforeUpdate;
1468
+ updated = opt.code.updated;
1469
+ beforeUnmount = opt.code.beforeUnmount;
1470
+ unmounted = opt.code.unmounted;
1471
+ }
1472
+ let style = '';
1473
+ let prep = '';
1474
+ if (opt.style) {
1475
+ const r = tool.stylePrepend(opt.style);
1476
+ prep = r.prep;
1477
+ style = yield tool.styleUrl2DataUrl((_d = opt.path) !== null && _d !== void 0 ? _d : '/', r.style, t.app.files);
1034
1478
  }
1035
- else {
1036
- newBase = (_c = opt.path) !== null && _c !== void 0 ? _c : base;
1479
+ let layout = tool.purify(opt.layout);
1480
+ layout = tool.layoutAddTagClassAndReTagName(layout, true);
1481
+ layout = tool.layoutInsertAttr(layout, ':form-focus=\'formFocus\'', {
1482
+ 'include': [/^cg-.+/]
1483
+ });
1484
+ const prepList = ['cg-task' + opt.taskId.toString() + '_'];
1485
+ if (prep !== '') {
1486
+ prepList.push(prep);
1037
1487
  }
1038
- const app = t.app;
1039
- const formId = ++info.lastId;
1040
- const invoke = {};
1041
- if (clickgo.getSafe()) {
1042
- invoke.window = undefined;
1043
- invoke.loader = undefined;
1044
- const ks = Object.getOwnPropertyNames(window);
1045
- for (const k of ks) {
1046
- if (k.includes('Event')) {
1047
- continue;
1048
- }
1049
- if (k.includes('-')) {
1050
- continue;
1051
- }
1052
- if (/^[0-9]+$/.test(k)) {
1053
- continue;
1054
- }
1055
- if ([
1056
- 'require',
1057
- '__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch'
1058
- ].includes(k)) {
1059
- continue;
1060
- }
1061
- invoke[k] = undefined;
1062
- }
1063
- invoke.console = {
1064
- log: function (message, ...optionalParams) {
1065
- console.log(message, ...optionalParams);
1066
- }
1067
- };
1068
- invoke.loader = {
1069
- require: function (paths, files, opt) {
1070
- return loader.require(paths, files, opt);
1071
- }
1072
- };
1073
- invoke.Object = {
1074
- defineProperty: function () {
1075
- return;
1076
- },
1077
- keys: function (o) {
1078
- return Object.keys(o);
1079
- },
1080
- assign: function (o, o2) {
1081
- if (o.controlName !== undefined) {
1082
- return o;
1083
- }
1084
- return Object.assign(o, o2);
1085
- }
1086
- };
1087
- invoke.navigator = {};
1088
- if (navigator.clipboard) {
1089
- invoke.navigator.clipboard = navigator.clipboard;
1090
- }
1091
- invoke.invokeClickgo = {
1092
- getVersion: function () {
1093
- return clickgo.getVersion();
1094
- },
1095
- getNative() {
1096
- return clickgo.getNative();
1097
- },
1098
- getPlatform() {
1099
- return clickgo.getPlatform();
1100
- },
1101
- getSafe() {
1102
- return clickgo.getSafe();
1103
- },
1104
- 'control': {
1105
- read: function (blob) {
1106
- return clickgo.control.read(blob);
1107
- }
1108
- },
1109
- 'core': {
1110
- 'config': clickgo.core.config,
1111
- 'cdn': loader.cdn,
1112
- initModules: function (names) {
1113
- return clickgo.core.initModules(names);
1114
- },
1115
- getModule: function (name) {
1116
- return clickgo.core.getModule(name);
1117
- },
1118
- setSystemEventListener: function (name, func, fid) {
1119
- clickgo.core.setSystemEventListener(name, func, fid !== null && fid !== void 0 ? fid : formId, taskId);
1120
- },
1121
- removeSystemEventListener: function (name, fid) {
1122
- clickgo.core.removeSystemEventListener(name, fid !== null && fid !== void 0 ? fid : formId, taskId);
1123
- },
1124
- trigger: function (name, param1 = '', param2 = '') {
1125
- if (!['formTitleChanged', 'formIconChanged', 'formStateMinChanged', 'formStateMaxChanged', 'formShowChanged'].includes(name)) {
1126
- return;
1127
- }
1128
- clickgo.core.trigger(name, taskId, formId, param1, param2);
1129
- },
1130
- readApp: function (blob) {
1131
- return clickgo.core.readApp(blob);
1132
- },
1133
- getAvailArea: function () {
1134
- return clickgo.core.getAvailArea();
1135
- }
1136
- },
1137
- 'dom': {
1138
- setGlobalCursor: function (type) {
1139
- clickgo.dom.setGlobalCursor(type);
1140
- },
1141
- hasTouchButMouse: function (e) {
1142
- return clickgo.dom.hasTouchButMouse(e);
1143
- },
1144
- getStyleCount: function (taskId, type) {
1145
- return clickgo.dom.getStyleCount(taskId, type);
1146
- },
1147
- getSize: function (el) {
1148
- return clickgo.dom.getSize(el);
1149
- },
1150
- watchSize: function (el, cb, immediate = false) {
1151
- return clickgo.dom.watchSize(el, cb, immediate, taskId);
1152
- },
1153
- unwatchSize: function (el) {
1154
- clickgo.dom.unwatchSize(el, taskId);
1155
- },
1156
- clearWatchSize() {
1157
- clickgo.dom.clearWatchSize(taskId);
1158
- },
1159
- watch: function (el, cb, mode = 'default', immediate = false) {
1160
- clickgo.dom.watch(el, cb, mode, immediate, taskId);
1161
- },
1162
- unwatch: function (el) {
1163
- clickgo.dom.unwatch(el, taskId);
1164
- },
1165
- clearWatch: function () {
1166
- clickgo.dom.clearWatch(taskId);
1167
- },
1168
- watchStyle: function (el, name, cb, immediate = false) {
1169
- clickgo.dom.watchStyle(el, name, cb, immediate);
1170
- },
1171
- isWatchStyle: function (el) {
1172
- return clickgo.dom.isWatchStyle(el);
1173
- },
1174
- bindDown: function (oe, opt) {
1175
- clickgo.dom.bindDown(oe, opt);
1176
- },
1177
- bindGesture: function (e, opt) {
1178
- clickgo.dom.bindGesture(e, opt);
1179
- },
1180
- bindLong: function (e, long) {
1181
- clickgo.dom.bindLong(e, long);
1182
- },
1183
- bindDrag: function (e, opt) {
1184
- clickgo.dom.bindDrag(e, opt);
1185
- },
1186
- 'is': clickgo.dom.is,
1187
- bindMove: function (e, opt) {
1188
- return clickgo.dom.bindMove(e, opt);
1189
- },
1190
- bindResize: function (e, opt) {
1191
- clickgo.dom.bindResize(e, opt);
1192
- },
1193
- findParentByData: function (el, name) {
1194
- return clickgo.dom.findParentByData(el, name);
1195
- },
1196
- findParentByClass: function (el, name) {
1197
- return clickgo.dom.findParentByClass(el, name);
1198
- },
1199
- siblings: function (el) {
1200
- return clickgo.dom.siblings(el);
1201
- },
1202
- siblingsData: function (el, name) {
1203
- return clickgo.dom.siblingsData(el, name);
1204
- },
1205
- fullscreen: function () {
1206
- return clickgo.dom.fullscreen();
1207
- }
1208
- },
1209
- 'form': {
1210
- min: function (fid) {
1211
- return clickgo.form.min(fid !== null && fid !== void 0 ? fid : formId);
1212
- },
1213
- max: function max(fid) {
1214
- return clickgo.form.max(fid !== null && fid !== void 0 ? fid : formId);
1215
- },
1216
- close: function (fid) {
1217
- return clickgo.form.close(fid !== null && fid !== void 0 ? fid : formId);
1218
- },
1219
- bindResize: function (e, border) {
1220
- clickgo.form.bindResize(e, border);
1221
- },
1222
- bindDrag: function (e) {
1223
- clickgo.form.bindDrag(e);
1224
- },
1225
- getTaskId: function (fid) {
1226
- return clickgo.form.getTaskId(fid);
1227
- },
1228
- get: function (fid) {
1229
- return clickgo.form.get(fid);
1230
- },
1231
- send: function (fid, obj) {
1232
- obj.taskId = taskId;
1233
- obj.formId = formId;
1234
- clickgo.form.send(fid, obj);
1235
- },
1236
- getList: function (tid) {
1237
- return clickgo.form.getList(tid);
1238
- },
1239
- changeFocus: function (fid = 0) {
1240
- clickgo.form.changeFocus(fid);
1241
- },
1242
- getMaxZIndexID: function (out) {
1243
- return clickgo.form.getMaxZIndexID(out);
1244
- },
1245
- getRectByBorder: function (border) {
1246
- return clickgo.form.getRectByBorder(border);
1247
- },
1248
- showCircular: function (x, y) {
1249
- clickgo.form.showCircular(x, y);
1250
- },
1251
- moveRectangle: function (border) {
1252
- clickgo.form.moveRectangle(border);
1253
- },
1254
- showRectangle: function (x, y, border) {
1255
- clickgo.form.showRectangle(x, y, border);
1256
- },
1257
- hideRectangle: function () {
1258
- clickgo.form.hideRectangle();
1259
- },
1260
- showDrag: function () {
1261
- clickgo.form.showDrag();
1262
- },
1263
- moveDrag: function (opt) {
1264
- clickgo.form.moveDrag(opt);
1265
- },
1266
- hideDrag: function () {
1267
- clickgo.form.hideDrag();
1268
- },
1269
- notify: function (opt) {
1270
- return clickgo.form.notify(opt);
1271
- },
1272
- notifyProgress: function (notifyId, per) {
1273
- clickgo.form.notifyProgress(notifyId, per);
1274
- },
1275
- hideNotify: function (notifyId) {
1276
- clickgo.form.hideNotify(notifyId);
1277
- },
1278
- showPop: function (el, pop, direction, opt = {}) {
1279
- clickgo.form.showPop(el, pop, direction, opt);
1280
- },
1281
- hidePop: function (pop) {
1282
- clickgo.form.hidePop(pop);
1283
- },
1284
- create: function (opt) {
1285
- if (typeof opt === 'string') {
1286
- opt = {
1287
- 'file': opt
1288
- };
1289
- }
1290
- opt.taskId = taskId;
1291
- opt.formId = formId;
1292
- return clickgo.form.create(opt);
1293
- },
1294
- dialog: function (opt) {
1295
- if (typeof opt === 'string') {
1296
- opt = {
1297
- 'content': opt
1298
- };
1299
- }
1300
- opt.formId = formId;
1301
- return clickgo.form.dialog(opt);
1302
- },
1303
- confirm: function (opt) {
1304
- if (typeof opt === 'string') {
1305
- opt = {
1306
- 'content': opt
1307
- };
1308
- }
1309
- opt.formId = formId;
1310
- return clickgo.form.confirm(opt);
1311
- },
1312
- setTopMost: function (top, opt = {}) {
1313
- opt.taskId = taskId;
1314
- opt.formId = formId;
1315
- clickgo.form.setTopMost(top, opt);
1316
- },
1317
- flash: function (fid) {
1318
- clickgo.form.flash(fid !== null && fid !== void 0 ? fid : formId, taskId);
1319
- },
1320
- show: function (fid) {
1321
- clickgo.form.show(fid !== null && fid !== void 0 ? fid : formId, taskId);
1322
- },
1323
- hide: function (fid) {
1324
- clickgo.form.hide(fid !== null && fid !== void 0 ? fid : formId, taskId);
1325
- }
1326
- },
1327
- 'fs': {
1328
- getContent: function (path, options = {}) {
1329
- if (!options.files) {
1330
- options.files = t.files;
1331
- }
1332
- if (!options.current) {
1333
- options.current = t.path;
1334
- }
1335
- return clickgo.fs.getContent(path, options);
1336
- },
1337
- putContent: function (path, data, options = {}) {
1338
- if (!options.current) {
1339
- options.current = t.path;
1340
- }
1341
- return clickgo.fs.putContent(path, data, options);
1342
- },
1343
- readLink: function (path, options = {}) {
1344
- if (!options.current) {
1345
- options.current = t.path;
1346
- }
1347
- return clickgo.fs.readLink(path, options);
1348
- },
1349
- symlink: function (fPath, linkPath, options = {}) {
1350
- if (!options.current) {
1351
- options.current = t.path;
1352
- }
1353
- return clickgo.fs.symlink(fPath, linkPath, options);
1354
- },
1355
- unlink: function (path, options = {}) {
1356
- if (!options.current) {
1357
- options.current = t.path;
1358
- }
1359
- return clickgo.fs.unlink(path, options);
1360
- },
1361
- stats: function (path, options = {}) {
1362
- if (!options.files) {
1363
- options.files = t.files;
1364
- }
1365
- if (!options.current) {
1366
- options.current = t.path;
1367
- }
1368
- return clickgo.fs.stats(path, options);
1369
- },
1370
- isDir: function (path, options = {}) {
1371
- if (!options.files) {
1372
- options.files = t.files;
1373
- }
1374
- if (!options.current) {
1375
- options.current = t.path;
1376
- }
1377
- return clickgo.fs.isDir(path, options);
1378
- },
1379
- isFile: function (path, options = {}) {
1380
- if (!options.files) {
1381
- options.files = t.files;
1382
- }
1383
- if (!options.current) {
1384
- options.current = t.path;
1385
- }
1386
- return clickgo.fs.isFile(path, options);
1387
- },
1388
- mkdir: function (path, mode, options = {}) {
1389
- if (!options.current) {
1390
- options.current = t.path;
1391
- }
1392
- return clickgo.fs.mkdir(path, mode, options);
1393
- },
1394
- rmdir: function (path, options = {}) {
1395
- if (!options.current) {
1396
- options.current = t.path;
1397
- }
1398
- return clickgo.fs.rmdir(path, options);
1399
- },
1400
- rmdirDeep: function (path, options = {}) {
1401
- if (!options.current) {
1402
- options.current = t.path;
1403
- }
1404
- return clickgo.fs.rmdirDeep(path, options);
1405
- },
1406
- chmod: function (path, mod, options = {}) {
1407
- if (!options.current) {
1408
- options.current = t.path;
1409
- }
1410
- return clickgo.fs.chmod(path, mod, options);
1411
- },
1412
- rename(oldPath, newPath, options = {}) {
1413
- if (!options.current) {
1414
- options.current = t.path;
1415
- }
1416
- return clickgo.fs.rename(oldPath, newPath, options);
1417
- },
1418
- readDir(path, options = {}) {
1419
- if (!options.files) {
1420
- options.files = t.files;
1421
- }
1422
- if (!options.current) {
1423
- options.current = t.path;
1424
- }
1425
- return clickgo.fs.readDir(path, options);
1426
- },
1427
- copyFolder(from, to, options = {}) {
1428
- if (!options.current) {
1429
- options.current = t.path;
1430
- }
1431
- return clickgo.fs.copyFolder(from, to, options);
1432
- },
1433
- copyFile(src, dest, options = {}) {
1434
- if (!options.current) {
1435
- options.current = t.path;
1436
- }
1437
- return clickgo.fs.copyFile(src, dest, options);
1438
- }
1439
- },
1440
- 'native': {
1441
- getListeners: function () {
1442
- return clickgo.native.getListeners();
1443
- },
1444
- send: function (name, param, handler) {
1445
- return clickgo.native.send(name, param, handler, taskId);
1446
- },
1447
- on: function (name, handler, id, once = false) {
1448
- clickgo.native.on(name, handler, id, once, taskId);
1449
- },
1450
- once: function (name, handler, id) {
1451
- clickgo.native.once(name, handler, id, taskId);
1452
- },
1453
- off: function (name, handler) {
1454
- clickgo.native.off(name, handler, taskId);
1455
- },
1456
- clearListener: function () {
1457
- clickgo.native.clearListener(taskId);
1458
- },
1459
- max: function () {
1460
- clickgo.native.max();
1461
- },
1462
- min: function () {
1463
- clickgo.native.min();
1464
- },
1465
- restore: function () {
1466
- clickgo.native.restore();
1467
- },
1468
- size: function (width, height) {
1469
- clickgo.native.size(width, height);
1470
- }
1471
- },
1472
- 'task': {
1473
- onFrame: function (fun, opt = {}) {
1474
- opt.taskId = taskId;
1475
- opt.formId = formId;
1476
- return clickgo.task.onFrame(fun, opt);
1477
- },
1478
- offFrame: function (ft, opt = {}) {
1479
- opt.taskId = taskId;
1480
- clickgo.task.offFrame(ft, opt);
1481
- },
1482
- get: function (tid) {
1483
- return clickgo.task.get(tid);
1484
- },
1485
- getList: function () {
1486
- return clickgo.task.getList();
1487
- },
1488
- run: function (url, opt = {}) {
1489
- opt.taskId = taskId;
1490
- opt.main = false;
1491
- return clickgo.task.run(url, opt);
1492
- },
1493
- end: function (tid) {
1494
- return clickgo.task.end(tid !== null && tid !== void 0 ? tid : taskId);
1495
- },
1496
- loadLocaleData: function (lang, data, pre = '') {
1497
- clickgo.task.loadLocaleData(lang, data, pre, taskId);
1498
- },
1499
- loadLocale: function (lang, path) {
1500
- return clickgo.task.loadLocale(lang, path, taskId, formId);
1501
- },
1502
- clearLocale: function () {
1503
- clickgo.task.clearLocale(taskId);
1504
- },
1505
- setLocale: function (lang, path) {
1506
- return clickgo.task.setLocale(lang, path, taskId, formId);
1507
- },
1508
- setLocaleLang: function (lang) {
1509
- clickgo.task.setLocaleLang(lang, taskId);
1510
- },
1511
- clearLocaleLang: function () {
1512
- clickgo.task.clearLocaleLang(taskId);
1513
- },
1514
- createTimer: function (fun, delay, opt = {}) {
1515
- opt.taskId = taskId;
1516
- if (!opt.formId) {
1517
- opt.formId = formId;
1518
- }
1519
- return clickgo.task.createTimer(fun, delay, opt);
1520
- },
1521
- removeTimer: function (timer) {
1522
- clickgo.task.removeTimer(timer, taskId);
1523
- },
1524
- sleep: function (fun, delay) {
1525
- return clickgo.task.sleep(fun, delay, taskId, formId);
1526
- },
1527
- systemTaskInfo: clickgo.task.systemTaskInfo,
1528
- setSystem: function (fid) {
1529
- return clickgo.task.setSystem(fid !== null && fid !== void 0 ? fid : formId, taskId);
1530
- },
1531
- clearSystem: function () {
1532
- return clickgo.task.clearSystem(taskId);
1533
- }
1534
- },
1535
- 'theme': {
1536
- read: function (blob) {
1537
- return clickgo.theme.read(blob);
1538
- },
1539
- load: function (theme) {
1540
- return __awaiter(this, void 0, void 0, function* () {
1541
- if (!theme) {
1542
- return false;
1543
- }
1544
- return clickgo.theme.load(theme, taskId);
1545
- });
1546
- },
1547
- remove: function (name) {
1548
- return clickgo.theme.remove(name, taskId);
1549
- },
1550
- clear: function () {
1551
- return clickgo.theme.clear(taskId);
1552
- },
1553
- setGlobal: function (theme) {
1554
- return clickgo.theme.setGlobal(theme);
1555
- },
1556
- clearGlobal: function () {
1557
- clickgo.theme.clearGlobal();
1558
- }
1559
- },
1560
- 'tool': {
1561
- blob2ArrayBuffer: function (blob) {
1562
- return clickgo.tool.blob2ArrayBuffer(blob);
1563
- },
1564
- clone: function (obj) {
1565
- return clickgo.tool.clone(obj);
1566
- },
1567
- sleep: function (ms = 0) {
1568
- return clickgo.tool.sleep(ms);
1569
- },
1570
- purify: function (text) {
1571
- return clickgo.tool.purify(text);
1572
- },
1573
- createObjectURL: function (object) {
1574
- return clickgo.tool.createObjectURL(object, taskId);
1575
- },
1576
- revokeObjectURL: function (url) {
1577
- clickgo.tool.revokeObjectURL(url, taskId);
1578
- },
1579
- rand: function (min, max) {
1580
- return clickgo.tool.rand(min, max);
1581
- },
1582
- 'RANDOM_N': clickgo.tool.RANDOM_N,
1583
- 'RANDOM_U': clickgo.tool.RANDOM_U,
1584
- 'RANDOM_L': clickgo.tool.RANDOM_L,
1585
- 'RANDOM_UN': clickgo.tool.RANDOM_UN,
1586
- 'RANDOM_LN': clickgo.tool.RANDOM_LN,
1587
- 'RANDOM_LU': clickgo.tool.RANDOM_LU,
1588
- 'RANDOM_LUN': clickgo.tool.RANDOM_LUN,
1589
- 'RANDOM_V': clickgo.tool.RANDOM_V,
1590
- 'RANDOM_LUNS': clickgo.tool.RANDOM_LUNS,
1591
- random: function (length = 8, source = clickgo.tool.RANDOM_LN, block = '') {
1592
- return clickgo.tool.random(length, source, block);
1593
- },
1594
- getBoolean: function (param) {
1595
- return clickgo.tool.getBoolean(param);
1596
- },
1597
- escapeHTML: function (html) {
1598
- return clickgo.tool.escapeHTML(html);
1599
- },
1600
- request: function (url, opt) {
1601
- return clickgo.tool.request(url, opt);
1602
- },
1603
- parseUrl: function (url) {
1604
- return clickgo.tool.parseUrl(url);
1605
- },
1606
- urlResolve: function (from, to) {
1607
- return clickgo.tool.urlResolve(from, to);
1608
- },
1609
- blob2Text: function (blob) {
1610
- return clickgo.tool.blob2Text(blob);
1611
- },
1612
- blob2DataUrl: function (blob) {
1613
- return clickgo.tool.blob2DataUrl(blob);
1614
- },
1615
- execCommand: function (ac) {
1616
- clickgo.tool.execCommand(ac);
1617
- }
1618
- },
1619
- 'zip': {
1620
- get: function (data) {
1621
- return clickgo.zip.get(data);
1622
- }
1623
- }
1624
- };
1625
- }
1626
- else {
1627
- invoke.invokeClickgo = clickgo;
1628
- }
1629
- const preprocess = clickgo.getSafe() ? function (code, path) {
1630
- const exec = /eval\W/.exec(code);
1631
- if (exec) {
1632
- notify({
1633
- 'title': 'Error',
1634
- 'content': `The "eval" is prohibited.\nFile: "${path}".`,
1635
- 'type': 'danger'
1636
- });
1637
- return '';
1638
- }
1639
- return code;
1640
- } : undefined;
1641
- const components = yield control.init(t.id, formId, newBase, preprocess, invoke);
1642
- if (!components) {
1643
- if ((form === null || form === void 0 ? void 0 : form.vroot.$refs.form.maskFor) !== undefined) {
1644
- form.vroot.$refs.form.maskFor = undefined;
1645
- }
1646
- return -5;
1647
- }
1648
- let style = opt.style;
1649
- let layout = opt.layout;
1650
- if (filePath) {
1651
- if (!filePath.startsWith('/package/')) {
1652
- return -6;
1653
- }
1654
- const file = filePath.slice(8);
1655
- const layoutFile = app.files[file + '.xml'];
1656
- if (layoutFile) {
1657
- layout = layoutFile.replace(/^\ufeff/, '');
1658
- }
1659
- const styleFile = app.files[file + '.css'];
1660
- if (styleFile) {
1661
- style = styleFile.replace(/^\ufeff/, '');
1662
- }
1663
- }
1664
- if (layout === undefined) {
1665
- if ((form === null || form === void 0 ? void 0 : form.vroot.$refs.form.maskFor) !== undefined) {
1666
- form.vroot.$refs.form.maskFor = undefined;
1667
- }
1668
- return -7;
1669
- }
1670
- let data = {};
1671
- let methods = {};
1672
- let computed = {};
1673
- let watch = {};
1674
- let beforeCreate = undefined;
1675
- let created = undefined;
1676
- let beforeMount = undefined;
1677
- let mounted = undefined;
1678
- let beforeUpdate = undefined;
1679
- let updated = undefined;
1680
- let beforeUnmount = undefined;
1681
- let unmounted = undefined;
1682
- let receive = undefined;
1683
- let expo = opt.code;
1684
- if ((filePath === null || filePath === void 0 ? void 0 : filePath.startsWith('/package/')) && app.files[filePath.slice(8) + '.js']) {
1685
- const file = filePath.slice(8);
1686
- if (app.files[file + '.js']) {
1687
- app.files['/invoke/clickgo.js'] = `module.exports = invokeClickgo;`;
1688
- expo = loader.require(file, app.files, {
1689
- 'dir': '/',
1690
- 'invoke': invoke,
1691
- 'preprocess': preprocess,
1692
- 'map': {
1693
- 'clickgo': '/invoke/clickgo'
1694
- }
1695
- })[0];
1696
- }
1697
- }
1698
- if (expo) {
1699
- data = (_d = expo.data) !== null && _d !== void 0 ? _d : {};
1700
- methods = expo.methods || {};
1701
- computed = expo.computed || {};
1702
- watch = expo.watch || {};
1703
- beforeCreate = expo.beforeCreate;
1704
- created = expo.created;
1705
- beforeMount = expo.beforeMount;
1706
- mounted = expo.mounted;
1707
- beforeUpdate = expo.beforeUpdate;
1708
- updated = expo.updated;
1709
- beforeUnmount = expo.beforeUnmount;
1710
- unmounted = expo.unmounted;
1711
- receive = expo.receive;
1712
- }
1713
- let prep = '';
1714
- if (style) {
1715
- const r = tool.stylePrepend(style);
1716
- prep = r.prep;
1717
- style = yield tool.styleUrl2DataUrl(newBase, r.style, app.files);
1718
- }
1719
- layout = tool.purify(layout);
1720
- layout = tool.layoutAddTagClassAndReTagName(layout, true);
1721
- layout = tool.layoutInsertAttr(layout, ':cg-focus=\'cgFocus\'', {
1722
- 'include': [/^cg-.+/]
1723
- });
1724
- const prepList = ['cg-task' + opt.taskId.toString() + '_'];
1725
- if (prep !== '') {
1726
- prepList.push(prep);
1727
- }
1728
- layout = tool.layoutClassPrepend(layout, prepList);
1729
- layout = tool.eventsAttrWrap(layout);
1730
- elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${opt.taskId.toString()}"></div>`);
1731
- const el = elements.list.children.item(elements.list.children.length - 1);
1732
- computed.taskId = {
1733
- get: function () {
1734
- return taskId;
1735
- },
1736
- set: function () {
1737
- notify({
1738
- 'title': 'Error',
1739
- 'content': `The software tries to modify the system variable "taskId".\nPath: ${this.cgPath}`,
1740
- 'type': 'danger'
1741
- });
1742
- return;
1743
- }
1744
- };
1745
- computed.formId = {
1746
- get: function () {
1747
- return formId;
1748
- },
1749
- set: function () {
1750
- notify({
1751
- 'title': 'Error',
1752
- 'content': `The software tries to modify the system variable "formId".\nPath: ${this.cgPath}`,
1753
- 'type': 'danger'
1754
- });
1755
- return;
1488
+ layout = tool.layoutClassPrepend(layout, prepList);
1489
+ layout = tool.eventsAttrWrap(layout);
1490
+ elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${opt.taskId.toString()}"></div>`);
1491
+ const el = elements.list.children.item(elements.list.children.length - 1);
1492
+ computed.formId = {
1493
+ get: function () {
1494
+ return formId;
1495
+ },
1496
+ set: function () {
1497
+ notify({
1498
+ 'title': 'Error',
1499
+ 'content': `The software tries to modify the system variable "formId".\nPath: ${this.filename}`,
1500
+ 'type': 'danger'
1501
+ });
1502
+ return;
1756
1503
  }
1757
1504
  };
1758
- computed.controlName = {
1505
+ data._formFocus = false;
1506
+ computed.path = {
1759
1507
  get: function () {
1760
- return 'root';
1508
+ var _a;
1509
+ return (_a = opt.path) !== null && _a !== void 0 ? _a : '';
1761
1510
  },
1762
1511
  set: function () {
1763
1512
  notify({
1764
1513
  'title': 'Error',
1765
- 'content': `The software tries to modify the system variable "controlName".\nPath: ${this.cgPath}`,
1514
+ 'content': `The software tries to modify the system variable "path".\nPath: ${this.filename}`,
1766
1515
  'type': 'danger'
1767
1516
  });
1768
1517
  return;
1769
1518
  }
1770
1519
  };
1771
- data._cgFocus = false;
1772
- computed.cgFocus = {
1773
- get: function () {
1774
- return this._cgFocus;
1775
- },
1776
- set: function () {
1777
- notify({
1778
- 'title': 'Error',
1779
- 'content': `The software tries to modify the system variable "cgFocus".\nPath: ${this.cgPath}`,
1780
- 'type': 'danger'
1781
- });
1782
- return;
1783
- }
1784
- };
1785
- computed.cgPath = {
1786
- get: function () {
1787
- return newBase;
1788
- },
1789
- set: function () {
1790
- notify({
1791
- 'title': 'Error',
1792
- 'content': `The software tries to modify the system variable "cgPath".\nPath: ${this.cgPath}`,
1793
- 'type': 'danger'
1794
- });
1795
- return;
1796
- }
1797
- };
1798
- computed.cgPrep = {
1520
+ computed.prep = {
1799
1521
  get: function () {
1800
1522
  return prep;
1801
1523
  },
1802
1524
  set: function () {
1803
1525
  notify({
1804
1526
  'title': 'Error',
1805
- 'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this._cgPath}`,
1527
+ 'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this.filename}`,
1806
1528
  'type': 'danger'
1807
1529
  });
1808
1530
  return;
1809
1531
  }
1810
1532
  };
1811
- data._cgCustomZIndex = false;
1812
- computed.cgCustomZIndex = {
1533
+ data._topMost = false;
1534
+ computed.topMost = {
1813
1535
  get: function () {
1814
- return this._cgCustomZIndex;
1536
+ return this._topMost;
1815
1537
  },
1816
- set: function () {
1817
- notify({
1818
- 'title': 'Error',
1819
- 'content': `The software tries to modify the system variable "cgCustomZIndex".\nPath: ${this.cgPath}`,
1820
- 'type': 'danger'
1821
- });
1822
- return;
1823
- }
1824
- };
1825
- if (topMost) {
1826
- data._cgTopMost = true;
1827
- }
1828
- else {
1829
- data._cgTopMost = false;
1830
- }
1831
- computed.cgTopMost = {
1832
- get: function () {
1833
- return this._cgTopMost;
1834
- },
1835
- set: function () {
1836
- notify({
1837
- 'title': 'Error',
1838
- 'content': `The software tries to modify the system variable "cgTopMost".\nPath: ${this.cgPath}`,
1839
- 'type': 'danger'
1840
- });
1538
+ set: function (v) {
1539
+ const form = t.forms[formId];
1540
+ if (!form) {
1541
+ return;
1542
+ }
1543
+ if (v) {
1544
+ form.vroot.$data._topMost = true;
1545
+ if (!form.vroot._formFocus) {
1546
+ changeFocus(form.id);
1547
+ }
1548
+ else {
1549
+ form.vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
1550
+ }
1551
+ }
1552
+ else {
1553
+ form.vroot.$data._topMost = false;
1554
+ form.vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
1555
+ }
1841
1556
  return;
1842
1557
  }
1843
1558
  };
1844
- computed.cgLocale = function () {
1845
- if (task.list[this.taskId].locale.lang === '') {
1846
- return core.config.locale;
1847
- }
1848
- return task.list[this.taskId].locale.lang;
1849
- };
1850
- computed.l = function () {
1851
- return (key) => {
1852
- var _a, _b, _c, _d;
1853
- return (_d = (_b = (_a = task.list[this.taskId].locale.data[this.cgLocale]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : (_c = task.list[this.taskId].locale.data['en']) === null || _c === void 0 ? void 0 : _c[key]) !== null && _d !== void 0 ? _d : 'LocaleError';
1854
- };
1855
- };
1856
- methods.cgClassPrepend = function (cla) {
1857
- if (typeof cla !== 'string') {
1858
- return cla;
1859
- }
1860
- return `cg-task${this.taskId}_${cla} ${this.cgPrep}${cla}`;
1861
- };
1862
- methods.cgAllowEvent = function (e) {
1863
- return dom.allowEvent(e);
1864
- };
1865
- methods.cgReceive = function (obj) {
1866
- receive === null || receive === void 0 ? void 0 : receive.call(this, obj);
1867
- };
1868
1559
  if (style) {
1869
- dom.pushStyle(taskId, style, 'form', formId);
1560
+ dom.pushStyle(opt.taskId, style, 'form', formId);
1870
1561
  }
1871
1562
  const rtn = yield new Promise(function (resolve) {
1872
1563
  const vapp = clickgo.vue.createApp({
@@ -1876,16 +1567,18 @@ function create(opt) {
1876
1567
  },
1877
1568
  'methods': methods,
1878
1569
  'computed': computed,
1879
- 'watch': watch,
1880
1570
  'beforeCreate': beforeCreate,
1881
1571
  'created': created,
1882
1572
  'beforeMount': beforeMount,
1883
1573
  'mounted': function () {
1884
1574
  return __awaiter(this, void 0, void 0, function* () {
1885
1575
  yield this.$nextTick();
1886
- if (this.$refs.form.icon !== '') {
1887
- const icon = yield clickgo.fs.getContent(this.$refs.form.icon);
1888
- this.$refs.form.iconData = (icon instanceof Blob) ? yield clickgo.tool.blob2DataUrl(icon) : '';
1576
+ if (this.$refs.form.icon) {
1577
+ const icon = yield fs.getContent(this.$refs.form.icon, {
1578
+ 'current': t.current,
1579
+ 'files': t.app.files
1580
+ });
1581
+ this.$refs.form.iconData = (icon instanceof Blob) ? yield tool.blob2DataUrl(icon) : '';
1889
1582
  }
1890
1583
  resolve({
1891
1584
  'vapp': vapp,
@@ -1894,48 +1587,45 @@ function create(opt) {
1894
1587
  });
1895
1588
  },
1896
1589
  'beforeUpdate': beforeUpdate,
1897
- 'updated': function () {
1898
- return __awaiter(this, void 0, void 0, function* () {
1899
- yield this.$nextTick();
1900
- updated === null || updated === void 0 ? void 0 : updated.call(this);
1901
- });
1902
- },
1590
+ 'updated': updated,
1903
1591
  'beforeUnmount': beforeUnmount,
1904
- 'unmounted': unmounted,
1592
+ 'unmounted': unmounted
1905
1593
  });
1906
1594
  vapp.config.errorHandler = function (err, vm, info) {
1907
1595
  notify({
1908
1596
  'title': 'Runtime Error',
1909
- 'content': `Message: ${err.message}\ntask id: ${vm.taskId}\nForm id: ${vm.formId}`,
1597
+ 'content': `Message: ${err.message}\nTask id: ${vm.taskId}\nForm id: ${vm.formId}`,
1910
1598
  'type': 'danger'
1911
1599
  });
1912
- core.trigger('error', vm.taskId, vm.formId, err, info);
1600
+ core.trigger('error', vm.taskId, vm.formId, err, info + '(-3,' + vm.taskId + ',' + vm.formId + ')');
1913
1601
  };
1914
1602
  for (const key in components) {
1915
1603
  vapp.component(key, components[key]);
1916
1604
  }
1917
- vapp.mount(el);
1605
+ try {
1606
+ vapp.mount(el);
1607
+ }
1608
+ catch (err) {
1609
+ notify({
1610
+ 'title': 'Runtime Error',
1611
+ 'content': `Message: ${err.message}\nTask id: ${opt.taskId}\nForm id: ${formId}`,
1612
+ 'type': 'danger'
1613
+ });
1614
+ core.trigger('error', opt.taskId, formId, err, err.message + '(-2)');
1615
+ }
1918
1616
  });
1919
1617
  const nform = {
1920
1618
  'id': formId,
1921
1619
  'vapp': rtn.vapp,
1922
- 'vroot': rtn.vroot,
1923
- 'events': {}
1620
+ 'vroot': rtn.vroot
1924
1621
  };
1925
1622
  t.forms[formId] = nform;
1926
- if (opt.mask && form) {
1927
- form.vroot.$refs.form.maskFor = formId;
1928
- nform.vroot.$refs.form.maskFrom = form.id;
1929
- }
1930
1623
  yield tool.sleep(34);
1931
1624
  if (mounted) {
1932
1625
  try {
1933
1626
  yield mounted.call(rtn.vroot, opt.data);
1934
1627
  }
1935
1628
  catch (err) {
1936
- if ((nform === null || nform === void 0 ? void 0 : nform.vroot.$refs.form.maskFor) !== undefined) {
1937
- nform.vroot.$refs.form.maskFor = undefined;
1938
- }
1939
1629
  core.trigger('error', rtn.vroot.taskId, rtn.vroot.formId, err, 'Create form mounted error.');
1940
1630
  t.forms[formId] = undefined;
1941
1631
  delete t.forms[formId];
@@ -1945,24 +1635,8 @@ function create(opt) {
1945
1635
  return -8;
1946
1636
  }
1947
1637
  }
1948
- const area = core.getAvailArea();
1949
- if (!rtn.vroot.$refs.form.stateMaxData) {
1950
- if (rtn.vroot.$refs.form.left === -1) {
1951
- rtn.vroot.$refs.form.setPropData('left', (area.width - rtn.vroot.$el.offsetWidth) / 2);
1952
- }
1953
- if (rtn.vroot.$refs.form.top === -1) {
1954
- rtn.vroot.$refs.form.setPropData('top', (area.height - rtn.vroot.$el.offsetHeight) / 2);
1955
- }
1956
- }
1957
- if (rtn.vroot.$refs.form.zIndex !== -1) {
1958
- rtn.vroot._cgCustomZIndex = true;
1959
- }
1960
- if (rtn.vroot.$refs.form.$data.show !== false) {
1961
- rtn.vroot.$refs.form.$data.showData = true;
1962
- }
1963
- core.trigger('formCreated', taskId, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconData);
1964
- changeFocus(formId);
1965
- return nform;
1638
+ core.trigger('formCreated', opt.taskId, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconData);
1639
+ return formId;
1966
1640
  });
1967
1641
  }
1968
1642
  exports.create = create;
@@ -1974,25 +1648,21 @@ function dialog(opt) {
1974
1648
  'content': opt
1975
1649
  };
1976
1650
  }
1977
- const formId = opt.formId;
1978
- if (!formId) {
1651
+ const taskId = opt.taskId;
1652
+ if (!taskId) {
1979
1653
  resolve('');
1980
1654
  return;
1981
1655
  }
1982
- const taskId = getTaskId(formId);
1983
1656
  const t = task.list[taskId];
1984
1657
  if (!t) {
1985
1658
  resolve('');
1986
1659
  return;
1987
1660
  }
1988
- const locale = t.forms[formId].vroot.cgLocale;
1661
+ const locale = t.locale.lang || core.config.locale;
1989
1662
  if (opt.buttons === undefined) {
1990
1663
  opt.buttons = [(_b = (_a = info.locale[locale]) === null || _a === void 0 ? void 0 : _a.ok) !== null && _b !== void 0 ? _b : info.locale['en'].ok];
1991
1664
  }
1992
1665
  create({
1993
- 'taskId': taskId,
1994
- 'formId': formId,
1995
- 'layout': `<form title="${(_c = opt.title) !== null && _c !== void 0 ? _c : 'dialog'}" width="auto" height="auto" :min="false" :max="false" :resize="false" border="${opt.title ? 'normal' : 'plain'}" direction="v"><dialog :buttons="buttons" @select="select"${opt.direction ? ` direction="${opt.direction}"` : ''}>${opt.content}</dialog></form>`,
1996
1666
  'code': {
1997
1667
  data: {
1998
1668
  'buttons': opt.buttons
@@ -2008,14 +1678,17 @@ function dialog(opt) {
2008
1678
  };
2009
1679
  (_b = (_a = opt).select) === null || _b === void 0 ? void 0 : _b.call(_a, event, button);
2010
1680
  if (event.go) {
1681
+ this.dialogResult = button;
2011
1682
  close(this.formId);
2012
- resolve(button);
2013
1683
  }
2014
1684
  }
2015
1685
  }
2016
1686
  },
2017
- 'mask': true
2018
- }).catch((e) => {
1687
+ 'layout': `<form title="${(_c = opt.title) !== null && _c !== void 0 ? _c : 'dialog'}" :min="false" :max="false" :resize="false" border="${opt.title ? 'normal' : 'plain'}" direction="v"><dialog :buttons="buttons" @select="select"${opt.direction ? ` direction="${opt.direction}"` : ''}>${opt.content}</dialog></form>`,
1688
+ 'taskId': taskId
1689
+ }).then((fid) => __awaiter(this, void 0, void 0, function* () {
1690
+ resolve(yield t.forms[fid].vroot.showDialog());
1691
+ })).catch((e) => {
2019
1692
  throw e;
2020
1693
  });
2021
1694
  });
@@ -2029,22 +1702,21 @@ function confirm(opt) {
2029
1702
  'content': opt
2030
1703
  };
2031
1704
  }
2032
- const formId = opt.formId;
2033
- if (!formId) {
1705
+ const taskId = opt.taskId;
1706
+ if (!taskId) {
2034
1707
  return false;
2035
1708
  }
2036
- const taskId = getTaskId(formId);
2037
1709
  const t = task.list[taskId];
2038
1710
  if (!t) {
2039
1711
  return false;
2040
1712
  }
2041
- const locale = t.forms[formId].vroot.cgLocale;
1713
+ const locale = t.locale.lang || core.config.locale;
2042
1714
  const buttons = [(_b = (_a = info.locale[locale]) === null || _a === void 0 ? void 0 : _a.yes) !== null && _b !== void 0 ? _b : info.locale['en'].yes, (_d = (_c = info.locale[locale]) === null || _c === void 0 ? void 0 : _c.no) !== null && _d !== void 0 ? _d : info.locale['en'].no];
2043
1715
  if (opt.cancel) {
2044
1716
  buttons.push((_f = (_e = info.locale[locale]) === null || _e === void 0 ? void 0 : _e.cancel) !== null && _f !== void 0 ? _f : info.locale['en'].cancel);
2045
1717
  }
2046
1718
  const res = yield dialog({
2047
- 'formId': formId,
1719
+ 'taskId': taskId,
2048
1720
  'content': opt.content,
2049
1721
  'buttons': buttons
2050
1722
  });
@@ -2058,37 +1730,18 @@ function confirm(opt) {
2058
1730
  });
2059
1731
  }
2060
1732
  exports.confirm = confirm;
2061
- function setTopMost(top, opt = {}) {
2062
- const form = getForm(opt.taskId, opt.formId);
2063
- if (!form) {
1733
+ function flash(formId, taskId) {
1734
+ if (!taskId) {
2064
1735
  return;
2065
1736
  }
2066
- form.vroot.$data._cgCustomZIndex = false;
2067
- if (top) {
2068
- form.vroot.$data._cgTopMost = true;
2069
- if (!form.vroot.cgFocus) {
2070
- changeFocus(form.id);
2071
- }
2072
- else {
2073
- form.vroot.$refs.form.setPropData('zIndex', ++info.topLastZIndex);
2074
- }
2075
- }
2076
- else {
2077
- form.vroot.$data._cgTopMost = false;
2078
- form.vroot.$refs.form.setPropData('zIndex', ++info.lastZIndex);
2079
- }
2080
- }
2081
- exports.setTopMost = setTopMost;
2082
- function flash(formId, taskId) {
2083
- var _a;
2084
1737
  const form = getForm(taskId, formId);
2085
1738
  if (!form) {
2086
1739
  return;
2087
1740
  }
2088
- if (!form.vroot.cgFocus) {
1741
+ if (!form.vroot._formFocus) {
2089
1742
  changeFocus(form.id);
2090
1743
  }
2091
- if ((_a = form.vroot.$refs.form) === null || _a === void 0 ? void 0 : _a.flashTimer) {
1744
+ if (form.vroot.$refs.form.flashTimer) {
2092
1745
  clearTimeout(form.vroot.$refs.form.flashTimer);
2093
1746
  form.vroot.$refs.form.flashTimer = undefined;
2094
1747
  }
@@ -2100,22 +1753,24 @@ function flash(formId, taskId) {
2100
1753
  core.trigger('formFlash', taskId, formId);
2101
1754
  }
2102
1755
  exports.flash = flash;
2103
- function show(formId, taskId) {
2104
- const form = getForm(taskId, formId);
2105
- if (!form) {
2106
- return;
2107
- }
2108
- form.vroot.$refs.form.$data.showData = true;
1756
+ function showLauncher() {
1757
+ elements.launcher.style.display = 'flex';
1758
+ requestAnimationFrame(function () {
1759
+ elements.launcher.classList.add('cg-show');
1760
+ });
2109
1761
  }
2110
- exports.show = show;
2111
- function hide(formId, taskId) {
2112
- const form = getForm(taskId, formId);
2113
- if (!form) {
2114
- return;
2115
- }
2116
- form.vroot.$refs.form.$data.showData = false;
1762
+ exports.showLauncher = showLauncher;
1763
+ function hideLauncher() {
1764
+ elements.launcher.classList.remove('cg-show');
1765
+ setTimeout(function () {
1766
+ if (exports.launcherRoot.folderName !== '') {
1767
+ exports.launcherRoot.closeFolder();
1768
+ }
1769
+ exports.launcherRoot.name = '';
1770
+ elements.launcher.style.display = 'none';
1771
+ }, 300);
2117
1772
  }
2118
- exports.hide = hide;
1773
+ exports.hideLauncher = hideLauncher;
2119
1774
  window.addEventListener('resize', function () {
2120
1775
  task.refreshSystemPosition();
2121
1776
  });