clickgo 3.0.7-dev8 → 3.1.1-dev10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/app/demo/app.js +93 -0
- package/dist/app/demo/form/control/dialog/dialog.js +10 -6
- package/dist/app/demo/form/control/form/form.js +21 -20
- package/dist/app/demo/form/control/form/form.xml +3 -3
- package/dist/app/demo/form/main.js +34 -10
- package/dist/app/demo/form/main.xml +4 -4
- package/dist/app/demo/form/method/form/form.js +103 -101
- package/dist/app/demo/form/method/form/form.xml +9 -10
- package/dist/app/task/app.js +46 -0
- package/dist/app/task/form/bar/bar.js +84 -88
- package/dist/app/task/form/bar/bar.xml +4 -5
- package/dist/clickgo.js +1 -10
- package/dist/clickgo.ts +0 -8
- package/dist/control/common.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/index.js +105 -56
- package/dist/index.ts +164 -59
- package/dist/lib/control.js +363 -240
- package/dist/lib/control.ts +497 -284
- package/dist/lib/core.js +313 -228
- package/dist/lib/core.ts +400 -255
- package/dist/lib/dom.ts +1 -3
- package/dist/lib/form.js +447 -951
- package/dist/lib/form.ts +686 -1097
- package/dist/lib/fs.js +42 -39
- package/dist/lib/fs.ts +45 -41
- package/dist/lib/native.ts +3 -0
- package/dist/lib/task.js +708 -182
- package/dist/lib/task.ts +778 -200
- package/dist/lib/theme.ts +2 -2
- package/dist/lib/tool.js +58 -48
- package/dist/lib/tool.ts +80 -64
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +5 -7
- package/types/index.d.ts +284 -335
- package/dist/app/demo/config.json +0 -106
- 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.hideLauncher = exports.showLauncher = exports.
|
|
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,
|
|
@@ -52,6 +53,290 @@ const info = {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
};
|
|
56
|
+
class AbstractForm {
|
|
57
|
+
constructor() {
|
|
58
|
+
this._firstShow = true;
|
|
59
|
+
this.dialogResult = '';
|
|
60
|
+
}
|
|
61
|
+
static create(data, layout) {
|
|
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
|
+
if (!layout) {
|
|
102
|
+
const l = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'xml'];
|
|
103
|
+
if (typeof l !== 'string') {
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
layout = l;
|
|
107
|
+
}
|
|
108
|
+
const prot = tool.getClassPrototype(frm);
|
|
109
|
+
code.methods = prot.method;
|
|
110
|
+
code.computed = prot.access;
|
|
111
|
+
let style = undefined;
|
|
112
|
+
const fstyle = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'css'];
|
|
113
|
+
if (typeof fstyle === 'string') {
|
|
114
|
+
style = fstyle;
|
|
115
|
+
}
|
|
116
|
+
const fid = yield create({
|
|
117
|
+
'code': code,
|
|
118
|
+
'layout': layout,
|
|
119
|
+
'style': style,
|
|
120
|
+
'path': frm.filename.slice(0, frm.filename.lastIndexOf('/')),
|
|
121
|
+
'data': data,
|
|
122
|
+
'taskId': frm.taskId
|
|
123
|
+
});
|
|
124
|
+
if (fid > 0) {
|
|
125
|
+
return task.list[frm.taskId].forms[fid].vroot;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
return fid;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
get filename() {
|
|
133
|
+
return '';
|
|
134
|
+
}
|
|
135
|
+
get controlName() {
|
|
136
|
+
return 'root';
|
|
137
|
+
}
|
|
138
|
+
set controlName(v) {
|
|
139
|
+
notify({
|
|
140
|
+
'title': 'Error',
|
|
141
|
+
'content': `The software tries to modify the system variable "controlName".\nPath: ${this.filename}`,
|
|
142
|
+
'type': 'danger'
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
get taskId() {
|
|
147
|
+
return 0;
|
|
148
|
+
}
|
|
149
|
+
get formId() {
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
get formFocus() {
|
|
153
|
+
return this._formFocus;
|
|
154
|
+
}
|
|
155
|
+
set formFocus(b) {
|
|
156
|
+
notify({
|
|
157
|
+
'title': 'Error',
|
|
158
|
+
'content': `The software tries to modify the system variable "formFocus".\nPath: ${this.filename}`,
|
|
159
|
+
'type': 'danger'
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
get path() {
|
|
163
|
+
return '';
|
|
164
|
+
}
|
|
165
|
+
get prep() {
|
|
166
|
+
return '';
|
|
167
|
+
}
|
|
168
|
+
get locale() {
|
|
169
|
+
return task.list[this.taskId].locale.lang || core.config.locale;
|
|
170
|
+
}
|
|
171
|
+
get l() {
|
|
172
|
+
return (key) => {
|
|
173
|
+
var _a, _b, _c, _d;
|
|
174
|
+
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';
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
classPrepend() {
|
|
178
|
+
return (cla) => {
|
|
179
|
+
if (typeof cla !== 'string') {
|
|
180
|
+
return cla;
|
|
181
|
+
}
|
|
182
|
+
return `cg-task${this.taskId}_${cla}${this.prep ? (' ' + this.prep + cla) : ''}`;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
watch(name, cb, opt = {}) {
|
|
186
|
+
return this.$watch(name, cb, opt);
|
|
187
|
+
}
|
|
188
|
+
get refs() {
|
|
189
|
+
return this.$refs;
|
|
190
|
+
}
|
|
191
|
+
get nextTick() {
|
|
192
|
+
return this.$nextTick;
|
|
193
|
+
}
|
|
194
|
+
allowEvent(e) {
|
|
195
|
+
return dom.allowEvent(e);
|
|
196
|
+
}
|
|
197
|
+
trigger(name, param1 = '', param2 = '') {
|
|
198
|
+
if (!['formTitleChanged', 'formIconChanged', 'formStateMinChanged', 'formStateMaxChanged', 'formShowChanged'].includes(name)) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
core.trigger(name, this.taskId, this.formId, param1, param2);
|
|
202
|
+
}
|
|
203
|
+
createForm(path, data) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
path = tool.urlResolve(this.filename, path);
|
|
206
|
+
const taskId = this.taskId;
|
|
207
|
+
const cls = class extends AbstractForm {
|
|
208
|
+
get filename() {
|
|
209
|
+
return path + '.js';
|
|
210
|
+
}
|
|
211
|
+
get taskId() {
|
|
212
|
+
return taskId;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
return cls.create(data);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
get topMost() {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
set topMost(v) {
|
|
222
|
+
}
|
|
223
|
+
send(fid, obj) {
|
|
224
|
+
obj.taskId = this.taskId;
|
|
225
|
+
obj.formId = this.formId;
|
|
226
|
+
send(fid, obj);
|
|
227
|
+
}
|
|
228
|
+
get isMask() {
|
|
229
|
+
return !task.list[this.taskId].runtime.dialogFormIds.length ||
|
|
230
|
+
task.list[this.taskId].runtime.dialogFormIds[task.list[this.taskId].runtime.dialogFormIds.length - 1]
|
|
231
|
+
=== this.formId ? false : true;
|
|
232
|
+
}
|
|
233
|
+
show() {
|
|
234
|
+
const v = this;
|
|
235
|
+
v.$refs.form.$data.showData = true;
|
|
236
|
+
if (this._firstShow) {
|
|
237
|
+
this._firstShow = false;
|
|
238
|
+
const area = core.getAvailArea();
|
|
239
|
+
if (!v.$refs.form.stateMaxData) {
|
|
240
|
+
if (v.$refs.form.left === -1) {
|
|
241
|
+
v.$refs.form.setPropData('left', (area.width - v.$el.offsetWidth) / 2);
|
|
242
|
+
}
|
|
243
|
+
if (v.$refs.form.top === -1) {
|
|
244
|
+
v.$refs.form.setPropData('top', (area.height - v.$el.offsetHeight) / 2);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
v.$refs.form.$data.showData = true;
|
|
248
|
+
changeFocus(this.formId);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
showDialog() {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
+
this.show();
|
|
254
|
+
task.list[this.taskId].runtime.dialogFormIds.push(this.formId);
|
|
255
|
+
return new Promise((resolve) => {
|
|
256
|
+
this.cgDialogCallback = () => {
|
|
257
|
+
resolve(this.dialogResult);
|
|
258
|
+
};
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
hide() {
|
|
263
|
+
const v = this;
|
|
264
|
+
v.$refs.form.$data.showData = false;
|
|
265
|
+
}
|
|
266
|
+
onBeforeCreate() {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
onCreated() {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
onBeforeMount() {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
onMounted() {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
onBeforeUpdate() {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
onUpdated() {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
onBeforeUnmount() {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
onUnmounted() {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
onReceive() {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
onScreenResize() {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
onConfigChanged() {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
onFormCreated() {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
onFormRemoved() {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
onFormTitleChanged() {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
onFormIconChanged() {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
onFormStateMinChanged() {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
onFormStateMaxChanged() {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
onFormShowChanged() {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
onFormFocused() {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
onFormBlurred() {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
onFormFlash() {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
onTaskStarted() {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
onTaskEnded() {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
onLauncherFolderNameChanged() {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
exports.AbstractForm = AbstractForm;
|
|
55
340
|
const popInfo = {
|
|
56
341
|
'list': [],
|
|
57
342
|
'elList': [],
|
|
@@ -356,9 +641,6 @@ const elements = {
|
|
|
356
641
|
};
|
|
357
642
|
elements.init();
|
|
358
643
|
function changeState(state, formId) {
|
|
359
|
-
if (!formId) {
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
644
|
const tid = getTaskId(formId);
|
|
363
645
|
const t = task.list[tid];
|
|
364
646
|
if (!t) {
|
|
@@ -473,7 +755,7 @@ function get(formId) {
|
|
|
473
755
|
'stateMax': item.vroot.$refs.form.stateMaxData,
|
|
474
756
|
'stateMin': item.vroot.$refs.form.stateMinData,
|
|
475
757
|
'show': item.vroot.$refs.form.showData,
|
|
476
|
-
'focus': item.vroot.
|
|
758
|
+
'focus': item.vroot.formFocus
|
|
477
759
|
};
|
|
478
760
|
}
|
|
479
761
|
exports.get = get;
|
|
@@ -483,10 +765,7 @@ function send(formId, obj) {
|
|
|
483
765
|
return;
|
|
484
766
|
}
|
|
485
767
|
const item = task.list[taskId].forms[formId];
|
|
486
|
-
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
item.vroot.cgReceive(obj);
|
|
768
|
+
item.vroot.onReceive(obj);
|
|
490
769
|
}
|
|
491
770
|
exports.send = send;
|
|
492
771
|
function getList(taskId) {
|
|
@@ -503,7 +782,7 @@ function getList(taskId) {
|
|
|
503
782
|
'stateMax': item.vroot.$refs.form.stateMaxData,
|
|
504
783
|
'stateMin': item.vroot.$refs.form.stateMinData,
|
|
505
784
|
'show': item.vroot.$refs.form.showData,
|
|
506
|
-
'focus': item.vroot.
|
|
785
|
+
'focus': item.vroot.formFocus
|
|
507
786
|
};
|
|
508
787
|
}
|
|
509
788
|
return list;
|
|
@@ -519,7 +798,7 @@ function changeFocus(formId = 0) {
|
|
|
519
798
|
});
|
|
520
799
|
return;
|
|
521
800
|
}
|
|
522
|
-
const focusElement = document.querySelector('#cg-form-list > [data-
|
|
801
|
+
const focusElement = document.querySelector('#cg-form-list > [data-form-focus]');
|
|
523
802
|
if (focusElement) {
|
|
524
803
|
const dataFormId = focusElement.getAttribute('data-form-id');
|
|
525
804
|
if (dataFormId) {
|
|
@@ -530,8 +809,8 @@ function changeFocus(formId = 0) {
|
|
|
530
809
|
else {
|
|
531
810
|
const taskId = parseInt((_a = focusElement.getAttribute('data-task-id')) !== null && _a !== void 0 ? _a : '0');
|
|
532
811
|
const t = task.list[taskId];
|
|
533
|
-
t.forms[dataFormIdNumber].vapp._container.removeAttribute('data-
|
|
534
|
-
t.forms[dataFormIdNumber].vroot.
|
|
812
|
+
t.forms[dataFormIdNumber].vapp._container.removeAttribute('data-form-focus');
|
|
813
|
+
t.forms[dataFormIdNumber].vroot._formFocus = false;
|
|
535
814
|
core.trigger('formBlurred', taskId, dataFormIdNumber);
|
|
536
815
|
}
|
|
537
816
|
}
|
|
@@ -551,35 +830,33 @@ function changeFocus(formId = 0) {
|
|
|
551
830
|
}
|
|
552
831
|
const taskId = parseInt((_b = el.getAttribute('data-task-id')) !== null && _b !== void 0 ? _b : '0');
|
|
553
832
|
const t = task.list[taskId];
|
|
554
|
-
if (
|
|
555
|
-
|
|
556
|
-
|
|
833
|
+
if (t.runtime.dialogFormIds.length) {
|
|
834
|
+
const dialogFormId = t.runtime.dialogFormIds[t.runtime.dialogFormIds.length - 1];
|
|
835
|
+
if (get(dialogFormId).stateMin) {
|
|
836
|
+
min(dialogFormId);
|
|
557
837
|
}
|
|
558
|
-
|
|
559
|
-
t.forms[
|
|
838
|
+
if (t.forms[dialogFormId].vroot._topMost) {
|
|
839
|
+
t.forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
560
840
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
if ((typeof maskFor === 'number') && (task.list[taskId].forms[maskFor])) {
|
|
564
|
-
if (get(maskFor).stateMin) {
|
|
565
|
-
min(maskFor);
|
|
841
|
+
else {
|
|
842
|
+
t.forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
566
843
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
task.list[taskId].forms[maskFor].vroot.$refs.form.setPropData('zIndex', ++info.lastZIndex);
|
|
573
|
-
}
|
|
844
|
+
t.forms[dialogFormId].vapp._container.dataset.formFocus = '';
|
|
845
|
+
t.forms[dialogFormId].vroot._formFocus = true;
|
|
846
|
+
core.trigger('formFocused', taskId, dialogFormId);
|
|
847
|
+
if (dialogFormId !== formId) {
|
|
848
|
+
clickgo.form.flash(dialogFormId, taskId);
|
|
574
849
|
}
|
|
575
|
-
task.list[taskId].forms[maskFor].vapp._container.dataset.cgFocus = '';
|
|
576
|
-
task.list[taskId].forms[maskFor].vroot._cgFocus = true;
|
|
577
|
-
core.trigger('formFocused', taskId, maskFor);
|
|
578
|
-
clickgo.form.flash(maskFor, taskId);
|
|
579
850
|
}
|
|
580
851
|
else {
|
|
581
|
-
t.forms[formId].
|
|
582
|
-
|
|
852
|
+
if (t.forms[formId].vroot._topMost) {
|
|
853
|
+
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
857
|
+
}
|
|
858
|
+
t.forms[formId].vapp._container.dataset.formFocus = '';
|
|
859
|
+
t.forms[formId].vroot._formFocus = true;
|
|
583
860
|
core.trigger('formFocused', taskId, formId);
|
|
584
861
|
}
|
|
585
862
|
}
|
|
@@ -591,6 +868,9 @@ function getMaxZIndexID(out = {}) {
|
|
|
591
868
|
for (let i = 0; i < elements.list.children.length; ++i) {
|
|
592
869
|
const formWrap = elements.list.children.item(i);
|
|
593
870
|
const formInner = formWrap.children.item(0);
|
|
871
|
+
if (!formInner) {
|
|
872
|
+
continue;
|
|
873
|
+
}
|
|
594
874
|
const z = parseInt(formInner.style.zIndex);
|
|
595
875
|
if (z > 9999999) {
|
|
596
876
|
continue;
|
|
@@ -1120,9 +1400,9 @@ function remove(formId) {
|
|
|
1120
1400
|
if (task.list[taskId].forms[formId]) {
|
|
1121
1401
|
title = task.list[taskId].forms[formId].vroot.$refs.form.title;
|
|
1122
1402
|
icon = task.list[taskId].forms[formId].vroot.$refs.form.iconData;
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
task.list[taskId].
|
|
1403
|
+
const io = task.list[taskId].runtime.dialogFormIds.indexOf(formId);
|
|
1404
|
+
if (io > -1) {
|
|
1405
|
+
task.list[taskId].runtime.dialogFormIds.splice(io, 1);
|
|
1126
1406
|
}
|
|
1127
1407
|
task.list[taskId].forms[formId].vroot.$refs.form.$data.showData = false;
|
|
1128
1408
|
setTimeout(function () {
|
|
@@ -1140,6 +1420,9 @@ function remove(formId) {
|
|
|
1140
1420
|
}
|
|
1141
1421
|
task.list[taskId].forms[formId].vapp.unmount();
|
|
1142
1422
|
task.list[taskId].forms[formId].vapp._container.remove();
|
|
1423
|
+
if (io > -1) {
|
|
1424
|
+
task.list[taskId].forms[formId].vroot.cgDialogCallback();
|
|
1425
|
+
}
|
|
1143
1426
|
delete task.list[taskId].forms[formId];
|
|
1144
1427
|
dom.removeStyle(taskId, 'form', formId);
|
|
1145
1428
|
core.trigger('formRemoved', taskId, formId, title, icon);
|
|
@@ -1155,16 +1438,10 @@ function remove(formId) {
|
|
|
1155
1438
|
}
|
|
1156
1439
|
exports.remove = remove;
|
|
1157
1440
|
function getForm(taskId, formId) {
|
|
1158
|
-
if (!taskId) {
|
|
1159
|
-
return null;
|
|
1160
|
-
}
|
|
1161
1441
|
const t = task.list[taskId];
|
|
1162
1442
|
if (!t) {
|
|
1163
1443
|
return null;
|
|
1164
1444
|
}
|
|
1165
|
-
if (!formId) {
|
|
1166
|
-
return null;
|
|
1167
|
-
}
|
|
1168
1445
|
const form = t.forms[formId];
|
|
1169
1446
|
if (!form) {
|
|
1170
1447
|
return null;
|
|
@@ -1174,670 +1451,21 @@ function getForm(taskId, formId) {
|
|
|
1174
1451
|
function create(opt) {
|
|
1175
1452
|
var _a, _b, _c, _d;
|
|
1176
1453
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1177
|
-
if (typeof opt === 'string') {
|
|
1178
|
-
return 0;
|
|
1179
|
-
}
|
|
1180
1454
|
if (!opt.taskId) {
|
|
1181
1455
|
return -1;
|
|
1182
1456
|
}
|
|
1183
|
-
|
|
1184
|
-
return -2;
|
|
1185
|
-
}
|
|
1186
|
-
const taskId = opt.taskId;
|
|
1187
|
-
const t = task.list[taskId];
|
|
1457
|
+
const t = task.list[opt.taskId];
|
|
1188
1458
|
if (!t) {
|
|
1189
|
-
return -
|
|
1190
|
-
}
|
|
1191
|
-
let form = null;
|
|
1192
|
-
if (opt.formId) {
|
|
1193
|
-
if (!t.forms[opt.formId]) {
|
|
1194
|
-
return -4;
|
|
1195
|
-
}
|
|
1196
|
-
form = t.forms[opt.formId];
|
|
1197
|
-
}
|
|
1198
|
-
let topMost = (_b = opt.topMost) !== null && _b !== void 0 ? _b : false;
|
|
1199
|
-
if (form === null || form === void 0 ? void 0 : form.vroot.cgTopMost) {
|
|
1200
|
-
topMost = true;
|
|
1201
|
-
}
|
|
1202
|
-
if (opt.mask && form) {
|
|
1203
|
-
form.vroot.$refs.form.maskFor = 0;
|
|
1204
|
-
}
|
|
1205
|
-
const base = form ? form.vroot.cgPath : '/';
|
|
1206
|
-
let filePath = '', newBase = '';
|
|
1207
|
-
if (opt.file) {
|
|
1208
|
-
filePath = clickgo.tool.urlResolve(base, opt.file);
|
|
1209
|
-
newBase = filePath.slice(0, filePath.lastIndexOf('/') + 1);
|
|
1210
|
-
}
|
|
1211
|
-
else {
|
|
1212
|
-
newBase = (_c = opt.path) !== null && _c !== void 0 ? _c : base;
|
|
1459
|
+
return -2;
|
|
1213
1460
|
}
|
|
1214
|
-
const app = t.app;
|
|
1215
1461
|
const formId = ++info.lastId;
|
|
1216
|
-
const
|
|
1217
|
-
if (clickgo.getSafe()) {
|
|
1218
|
-
invoke.window = undefined;
|
|
1219
|
-
invoke.loader = undefined;
|
|
1220
|
-
const ks = Object.getOwnPropertyNames(window);
|
|
1221
|
-
for (const k of ks) {
|
|
1222
|
-
if (k.includes('Event')) {
|
|
1223
|
-
continue;
|
|
1224
|
-
}
|
|
1225
|
-
if (k.includes('-')) {
|
|
1226
|
-
continue;
|
|
1227
|
-
}
|
|
1228
|
-
if (/^[0-9]+$/.test(k)) {
|
|
1229
|
-
continue;
|
|
1230
|
-
}
|
|
1231
|
-
if ([
|
|
1232
|
-
'require',
|
|
1233
|
-
'__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch'
|
|
1234
|
-
].includes(k)) {
|
|
1235
|
-
continue;
|
|
1236
|
-
}
|
|
1237
|
-
invoke[k] = undefined;
|
|
1238
|
-
}
|
|
1239
|
-
invoke.console = {
|
|
1240
|
-
log: function (message, ...optionalParams) {
|
|
1241
|
-
console.log(message, ...optionalParams);
|
|
1242
|
-
}
|
|
1243
|
-
};
|
|
1244
|
-
invoke.loader = {
|
|
1245
|
-
require: function (paths, files, opt) {
|
|
1246
|
-
return loader.require(paths, files, opt);
|
|
1247
|
-
}
|
|
1248
|
-
};
|
|
1249
|
-
invoke.Object = {
|
|
1250
|
-
defineProperty: function () {
|
|
1251
|
-
return;
|
|
1252
|
-
},
|
|
1253
|
-
keys: function (o) {
|
|
1254
|
-
return Object.keys(o);
|
|
1255
|
-
},
|
|
1256
|
-
assign: function (o, o2) {
|
|
1257
|
-
if (o.controlName !== undefined) {
|
|
1258
|
-
return o;
|
|
1259
|
-
}
|
|
1260
|
-
return Object.assign(o, o2);
|
|
1261
|
-
}
|
|
1262
|
-
};
|
|
1263
|
-
invoke.navigator = {};
|
|
1264
|
-
if (navigator.clipboard) {
|
|
1265
|
-
invoke.navigator.clipboard = navigator.clipboard;
|
|
1266
|
-
}
|
|
1267
|
-
invoke.invokeClickgo = {
|
|
1268
|
-
getVersion: function () {
|
|
1269
|
-
return clickgo.getVersion();
|
|
1270
|
-
},
|
|
1271
|
-
getNative() {
|
|
1272
|
-
return clickgo.getNative();
|
|
1273
|
-
},
|
|
1274
|
-
getPlatform() {
|
|
1275
|
-
return clickgo.getPlatform();
|
|
1276
|
-
},
|
|
1277
|
-
getSafe() {
|
|
1278
|
-
return clickgo.getSafe();
|
|
1279
|
-
},
|
|
1280
|
-
'control': {
|
|
1281
|
-
read: function (blob) {
|
|
1282
|
-
return clickgo.control.read(blob);
|
|
1283
|
-
}
|
|
1284
|
-
},
|
|
1285
|
-
'core': {
|
|
1286
|
-
'config': clickgo.core.config,
|
|
1287
|
-
'cdn': loader.cdn,
|
|
1288
|
-
initModules: function (names) {
|
|
1289
|
-
return clickgo.core.initModules(names);
|
|
1290
|
-
},
|
|
1291
|
-
getModule: function (name) {
|
|
1292
|
-
return clickgo.core.getModule(name);
|
|
1293
|
-
},
|
|
1294
|
-
setSystemEventListener: function (name, func, fid) {
|
|
1295
|
-
clickgo.core.setSystemEventListener(name, func, fid !== null && fid !== void 0 ? fid : formId, taskId);
|
|
1296
|
-
},
|
|
1297
|
-
removeSystemEventListener: function (name, fid) {
|
|
1298
|
-
clickgo.core.removeSystemEventListener(name, fid !== null && fid !== void 0 ? fid : formId, taskId);
|
|
1299
|
-
},
|
|
1300
|
-
trigger: function (name, param1 = '', param2 = '') {
|
|
1301
|
-
if (!['formTitleChanged', 'formIconChanged', 'formStateMinChanged', 'formStateMaxChanged', 'formShowChanged'].includes(name)) {
|
|
1302
|
-
return;
|
|
1303
|
-
}
|
|
1304
|
-
clickgo.core.trigger(name, taskId, formId, param1, param2);
|
|
1305
|
-
},
|
|
1306
|
-
readApp: function (blob) {
|
|
1307
|
-
return clickgo.core.readApp(blob);
|
|
1308
|
-
},
|
|
1309
|
-
getAvailArea: function () {
|
|
1310
|
-
return clickgo.core.getAvailArea();
|
|
1311
|
-
}
|
|
1312
|
-
},
|
|
1313
|
-
'dom': {
|
|
1314
|
-
setGlobalCursor: function (type) {
|
|
1315
|
-
clickgo.dom.setGlobalCursor(type);
|
|
1316
|
-
},
|
|
1317
|
-
hasTouchButMouse: function (e) {
|
|
1318
|
-
return clickgo.dom.hasTouchButMouse(e);
|
|
1319
|
-
},
|
|
1320
|
-
getStyleCount: function (taskId, type) {
|
|
1321
|
-
return clickgo.dom.getStyleCount(taskId, type);
|
|
1322
|
-
},
|
|
1323
|
-
getSize: function (el) {
|
|
1324
|
-
return clickgo.dom.getSize(el);
|
|
1325
|
-
},
|
|
1326
|
-
watchSize: function (el, cb, immediate = false) {
|
|
1327
|
-
return clickgo.dom.watchSize(el, cb, immediate, taskId);
|
|
1328
|
-
},
|
|
1329
|
-
unwatchSize: function (el) {
|
|
1330
|
-
clickgo.dom.unwatchSize(el, taskId);
|
|
1331
|
-
},
|
|
1332
|
-
clearWatchSize() {
|
|
1333
|
-
clickgo.dom.clearWatchSize(taskId);
|
|
1334
|
-
},
|
|
1335
|
-
watch: function (el, cb, mode = 'default', immediate = false) {
|
|
1336
|
-
clickgo.dom.watch(el, cb, mode, immediate, taskId);
|
|
1337
|
-
},
|
|
1338
|
-
unwatch: function (el) {
|
|
1339
|
-
clickgo.dom.unwatch(el, taskId);
|
|
1340
|
-
},
|
|
1341
|
-
clearWatch: function () {
|
|
1342
|
-
clickgo.dom.clearWatch(taskId);
|
|
1343
|
-
},
|
|
1344
|
-
watchStyle: function (el, name, cb, immediate = false) {
|
|
1345
|
-
clickgo.dom.watchStyle(el, name, cb, immediate);
|
|
1346
|
-
},
|
|
1347
|
-
isWatchStyle: function (el) {
|
|
1348
|
-
return clickgo.dom.isWatchStyle(el);
|
|
1349
|
-
},
|
|
1350
|
-
bindDown: function (oe, opt) {
|
|
1351
|
-
clickgo.dom.bindDown(oe, opt);
|
|
1352
|
-
},
|
|
1353
|
-
bindGesture: function (e, opt) {
|
|
1354
|
-
clickgo.dom.bindGesture(e, opt);
|
|
1355
|
-
},
|
|
1356
|
-
bindLong: function (e, long) {
|
|
1357
|
-
clickgo.dom.bindLong(e, long);
|
|
1358
|
-
},
|
|
1359
|
-
bindDrag: function (e, opt) {
|
|
1360
|
-
clickgo.dom.bindDrag(e, opt);
|
|
1361
|
-
},
|
|
1362
|
-
'is': clickgo.dom.is,
|
|
1363
|
-
bindMove: function (e, opt) {
|
|
1364
|
-
return clickgo.dom.bindMove(e, opt);
|
|
1365
|
-
},
|
|
1366
|
-
bindResize: function (e, opt) {
|
|
1367
|
-
clickgo.dom.bindResize(e, opt);
|
|
1368
|
-
},
|
|
1369
|
-
findParentByData: function (el, name) {
|
|
1370
|
-
return clickgo.dom.findParentByData(el, name);
|
|
1371
|
-
},
|
|
1372
|
-
findParentByClass: function (el, name) {
|
|
1373
|
-
return clickgo.dom.findParentByClass(el, name);
|
|
1374
|
-
},
|
|
1375
|
-
siblings: function (el) {
|
|
1376
|
-
return clickgo.dom.siblings(el);
|
|
1377
|
-
},
|
|
1378
|
-
siblingsData: function (el, name) {
|
|
1379
|
-
return clickgo.dom.siblingsData(el, name);
|
|
1380
|
-
},
|
|
1381
|
-
fullscreen: function () {
|
|
1382
|
-
return clickgo.dom.fullscreen();
|
|
1383
|
-
}
|
|
1384
|
-
},
|
|
1385
|
-
'form': {
|
|
1386
|
-
min: function (fid) {
|
|
1387
|
-
return clickgo.form.min(fid !== null && fid !== void 0 ? fid : formId);
|
|
1388
|
-
},
|
|
1389
|
-
max: function max(fid) {
|
|
1390
|
-
return clickgo.form.max(fid !== null && fid !== void 0 ? fid : formId);
|
|
1391
|
-
},
|
|
1392
|
-
close: function (fid) {
|
|
1393
|
-
return clickgo.form.close(fid !== null && fid !== void 0 ? fid : formId);
|
|
1394
|
-
},
|
|
1395
|
-
bindResize: function (e, border) {
|
|
1396
|
-
clickgo.form.bindResize(e, border);
|
|
1397
|
-
},
|
|
1398
|
-
bindDrag: function (e) {
|
|
1399
|
-
clickgo.form.bindDrag(e);
|
|
1400
|
-
},
|
|
1401
|
-
getTaskId: function (fid) {
|
|
1402
|
-
return clickgo.form.getTaskId(fid);
|
|
1403
|
-
},
|
|
1404
|
-
get: function (fid) {
|
|
1405
|
-
return clickgo.form.get(fid);
|
|
1406
|
-
},
|
|
1407
|
-
send: function (fid, obj) {
|
|
1408
|
-
obj.taskId = taskId;
|
|
1409
|
-
obj.formId = formId;
|
|
1410
|
-
clickgo.form.send(fid, obj);
|
|
1411
|
-
},
|
|
1412
|
-
getList: function (tid) {
|
|
1413
|
-
return clickgo.form.getList(tid);
|
|
1414
|
-
},
|
|
1415
|
-
changeFocus: function (fid = 0) {
|
|
1416
|
-
clickgo.form.changeFocus(fid);
|
|
1417
|
-
},
|
|
1418
|
-
getMaxZIndexID: function (out) {
|
|
1419
|
-
return clickgo.form.getMaxZIndexID(out);
|
|
1420
|
-
},
|
|
1421
|
-
getRectByBorder: function (border) {
|
|
1422
|
-
return clickgo.form.getRectByBorder(border);
|
|
1423
|
-
},
|
|
1424
|
-
showCircular: function (x, y) {
|
|
1425
|
-
clickgo.form.showCircular(x, y);
|
|
1426
|
-
},
|
|
1427
|
-
moveRectangle: function (border) {
|
|
1428
|
-
clickgo.form.moveRectangle(border);
|
|
1429
|
-
},
|
|
1430
|
-
showRectangle: function (x, y, border) {
|
|
1431
|
-
clickgo.form.showRectangle(x, y, border);
|
|
1432
|
-
},
|
|
1433
|
-
hideRectangle: function () {
|
|
1434
|
-
clickgo.form.hideRectangle();
|
|
1435
|
-
},
|
|
1436
|
-
showDrag: function () {
|
|
1437
|
-
clickgo.form.showDrag();
|
|
1438
|
-
},
|
|
1439
|
-
moveDrag: function (opt) {
|
|
1440
|
-
clickgo.form.moveDrag(opt);
|
|
1441
|
-
},
|
|
1442
|
-
hideDrag: function () {
|
|
1443
|
-
clickgo.form.hideDrag();
|
|
1444
|
-
},
|
|
1445
|
-
notify: function (opt) {
|
|
1446
|
-
return clickgo.form.notify(opt);
|
|
1447
|
-
},
|
|
1448
|
-
notifyProgress: function (notifyId, per) {
|
|
1449
|
-
clickgo.form.notifyProgress(notifyId, per);
|
|
1450
|
-
},
|
|
1451
|
-
hideNotify: function (notifyId) {
|
|
1452
|
-
clickgo.form.hideNotify(notifyId);
|
|
1453
|
-
},
|
|
1454
|
-
showPop: function (el, pop, direction, opt = {}) {
|
|
1455
|
-
clickgo.form.showPop(el, pop, direction, opt);
|
|
1456
|
-
},
|
|
1457
|
-
hidePop: function (pop) {
|
|
1458
|
-
clickgo.form.hidePop(pop);
|
|
1459
|
-
},
|
|
1460
|
-
create: function (opt) {
|
|
1461
|
-
if (typeof opt === 'string') {
|
|
1462
|
-
opt = {
|
|
1463
|
-
'file': opt
|
|
1464
|
-
};
|
|
1465
|
-
}
|
|
1466
|
-
opt.taskId = taskId;
|
|
1467
|
-
opt.formId = formId;
|
|
1468
|
-
return clickgo.form.create(opt);
|
|
1469
|
-
},
|
|
1470
|
-
dialog: function (opt) {
|
|
1471
|
-
if (typeof opt === 'string') {
|
|
1472
|
-
opt = {
|
|
1473
|
-
'content': opt
|
|
1474
|
-
};
|
|
1475
|
-
}
|
|
1476
|
-
opt.formId = formId;
|
|
1477
|
-
return clickgo.form.dialog(opt);
|
|
1478
|
-
},
|
|
1479
|
-
confirm: function (opt) {
|
|
1480
|
-
if (typeof opt === 'string') {
|
|
1481
|
-
opt = {
|
|
1482
|
-
'content': opt
|
|
1483
|
-
};
|
|
1484
|
-
}
|
|
1485
|
-
opt.formId = formId;
|
|
1486
|
-
return clickgo.form.confirm(opt);
|
|
1487
|
-
},
|
|
1488
|
-
setTopMost: function (top, opt = {}) {
|
|
1489
|
-
opt.taskId = taskId;
|
|
1490
|
-
opt.formId = formId;
|
|
1491
|
-
clickgo.form.setTopMost(top, opt);
|
|
1492
|
-
},
|
|
1493
|
-
flash: function (fid) {
|
|
1494
|
-
clickgo.form.flash(fid !== null && fid !== void 0 ? fid : formId, taskId);
|
|
1495
|
-
},
|
|
1496
|
-
show: function (fid) {
|
|
1497
|
-
clickgo.form.show(fid !== null && fid !== void 0 ? fid : formId, taskId);
|
|
1498
|
-
},
|
|
1499
|
-
hide: function (fid) {
|
|
1500
|
-
clickgo.form.hide(fid !== null && fid !== void 0 ? fid : formId, taskId);
|
|
1501
|
-
},
|
|
1502
|
-
showLauncher: function () {
|
|
1503
|
-
clickgo.form.showLauncher();
|
|
1504
|
-
},
|
|
1505
|
-
hideLauncher: function () {
|
|
1506
|
-
clickgo.form.hideLauncher();
|
|
1507
|
-
}
|
|
1508
|
-
},
|
|
1509
|
-
'fs': {
|
|
1510
|
-
getContent: function (path, options = {}) {
|
|
1511
|
-
if (!options.files) {
|
|
1512
|
-
options.files = t.files;
|
|
1513
|
-
}
|
|
1514
|
-
if (!options.current) {
|
|
1515
|
-
options.current = t.path;
|
|
1516
|
-
}
|
|
1517
|
-
return clickgo.fs.getContent(path, options);
|
|
1518
|
-
},
|
|
1519
|
-
putContent: function (path, data, options = {}) {
|
|
1520
|
-
if (!options.current) {
|
|
1521
|
-
options.current = t.path;
|
|
1522
|
-
}
|
|
1523
|
-
return clickgo.fs.putContent(path, data, options);
|
|
1524
|
-
},
|
|
1525
|
-
readLink: function (path, options = {}) {
|
|
1526
|
-
if (!options.current) {
|
|
1527
|
-
options.current = t.path;
|
|
1528
|
-
}
|
|
1529
|
-
return clickgo.fs.readLink(path, options);
|
|
1530
|
-
},
|
|
1531
|
-
symlink: function (fPath, linkPath, options = {}) {
|
|
1532
|
-
if (!options.current) {
|
|
1533
|
-
options.current = t.path;
|
|
1534
|
-
}
|
|
1535
|
-
return clickgo.fs.symlink(fPath, linkPath, options);
|
|
1536
|
-
},
|
|
1537
|
-
unlink: function (path, options = {}) {
|
|
1538
|
-
if (!options.current) {
|
|
1539
|
-
options.current = t.path;
|
|
1540
|
-
}
|
|
1541
|
-
return clickgo.fs.unlink(path, options);
|
|
1542
|
-
},
|
|
1543
|
-
stats: function (path, options = {}) {
|
|
1544
|
-
if (!options.files) {
|
|
1545
|
-
options.files = t.files;
|
|
1546
|
-
}
|
|
1547
|
-
if (!options.current) {
|
|
1548
|
-
options.current = t.path;
|
|
1549
|
-
}
|
|
1550
|
-
return clickgo.fs.stats(path, options);
|
|
1551
|
-
},
|
|
1552
|
-
isDir: function (path, options = {}) {
|
|
1553
|
-
if (!options.files) {
|
|
1554
|
-
options.files = t.files;
|
|
1555
|
-
}
|
|
1556
|
-
if (!options.current) {
|
|
1557
|
-
options.current = t.path;
|
|
1558
|
-
}
|
|
1559
|
-
return clickgo.fs.isDir(path, options);
|
|
1560
|
-
},
|
|
1561
|
-
isFile: function (path, options = {}) {
|
|
1562
|
-
if (!options.files) {
|
|
1563
|
-
options.files = t.files;
|
|
1564
|
-
}
|
|
1565
|
-
if (!options.current) {
|
|
1566
|
-
options.current = t.path;
|
|
1567
|
-
}
|
|
1568
|
-
return clickgo.fs.isFile(path, options);
|
|
1569
|
-
},
|
|
1570
|
-
mkdir: function (path, mode, options = {}) {
|
|
1571
|
-
if (!options.current) {
|
|
1572
|
-
options.current = t.path;
|
|
1573
|
-
}
|
|
1574
|
-
return clickgo.fs.mkdir(path, mode, options);
|
|
1575
|
-
},
|
|
1576
|
-
rmdir: function (path, options = {}) {
|
|
1577
|
-
if (!options.current) {
|
|
1578
|
-
options.current = t.path;
|
|
1579
|
-
}
|
|
1580
|
-
return clickgo.fs.rmdir(path, options);
|
|
1581
|
-
},
|
|
1582
|
-
rmdirDeep: function (path, options = {}) {
|
|
1583
|
-
if (!options.current) {
|
|
1584
|
-
options.current = t.path;
|
|
1585
|
-
}
|
|
1586
|
-
return clickgo.fs.rmdirDeep(path, options);
|
|
1587
|
-
},
|
|
1588
|
-
chmod: function (path, mod, options = {}) {
|
|
1589
|
-
if (!options.current) {
|
|
1590
|
-
options.current = t.path;
|
|
1591
|
-
}
|
|
1592
|
-
return clickgo.fs.chmod(path, mod, options);
|
|
1593
|
-
},
|
|
1594
|
-
rename(oldPath, newPath, options = {}) {
|
|
1595
|
-
if (!options.current) {
|
|
1596
|
-
options.current = t.path;
|
|
1597
|
-
}
|
|
1598
|
-
return clickgo.fs.rename(oldPath, newPath, options);
|
|
1599
|
-
},
|
|
1600
|
-
readDir(path, options = {}) {
|
|
1601
|
-
if (!options.files) {
|
|
1602
|
-
options.files = t.files;
|
|
1603
|
-
}
|
|
1604
|
-
if (!options.current) {
|
|
1605
|
-
options.current = t.path;
|
|
1606
|
-
}
|
|
1607
|
-
return clickgo.fs.readDir(path, options);
|
|
1608
|
-
},
|
|
1609
|
-
copyFolder(from, to, options = {}) {
|
|
1610
|
-
if (!options.current) {
|
|
1611
|
-
options.current = t.path;
|
|
1612
|
-
}
|
|
1613
|
-
return clickgo.fs.copyFolder(from, to, options);
|
|
1614
|
-
},
|
|
1615
|
-
copyFile(src, dest, options = {}) {
|
|
1616
|
-
if (!options.current) {
|
|
1617
|
-
options.current = t.path;
|
|
1618
|
-
}
|
|
1619
|
-
return clickgo.fs.copyFile(src, dest, options);
|
|
1620
|
-
}
|
|
1621
|
-
},
|
|
1622
|
-
'native': {
|
|
1623
|
-
invoke: function (name, ...param) {
|
|
1624
|
-
return clickgo.native.invoke(name, ...param);
|
|
1625
|
-
},
|
|
1626
|
-
max: function () {
|
|
1627
|
-
clickgo.native.max();
|
|
1628
|
-
},
|
|
1629
|
-
min: function () {
|
|
1630
|
-
clickgo.native.min();
|
|
1631
|
-
},
|
|
1632
|
-
restore: function () {
|
|
1633
|
-
clickgo.native.restore();
|
|
1634
|
-
},
|
|
1635
|
-
size: function (width, height) {
|
|
1636
|
-
clickgo.native.size(width, height);
|
|
1637
|
-
}
|
|
1638
|
-
},
|
|
1639
|
-
'task': {
|
|
1640
|
-
onFrame: function (fun, opt = {}) {
|
|
1641
|
-
opt.taskId = taskId;
|
|
1642
|
-
opt.formId = formId;
|
|
1643
|
-
return clickgo.task.onFrame(fun, opt);
|
|
1644
|
-
},
|
|
1645
|
-
offFrame: function (ft, opt = {}) {
|
|
1646
|
-
opt.taskId = taskId;
|
|
1647
|
-
clickgo.task.offFrame(ft, opt);
|
|
1648
|
-
},
|
|
1649
|
-
get: function (tid) {
|
|
1650
|
-
return clickgo.task.get(tid);
|
|
1651
|
-
},
|
|
1652
|
-
getList: function () {
|
|
1653
|
-
return clickgo.task.getList();
|
|
1654
|
-
},
|
|
1655
|
-
run: function (url, opt = {}) {
|
|
1656
|
-
opt.taskId = taskId;
|
|
1657
|
-
opt.main = false;
|
|
1658
|
-
return clickgo.task.run(url, opt);
|
|
1659
|
-
},
|
|
1660
|
-
end: function (tid) {
|
|
1661
|
-
return clickgo.task.end(tid !== null && tid !== void 0 ? tid : taskId);
|
|
1662
|
-
},
|
|
1663
|
-
loadLocaleData: function (lang, data, pre = '') {
|
|
1664
|
-
clickgo.task.loadLocaleData(lang, data, pre, taskId);
|
|
1665
|
-
},
|
|
1666
|
-
loadLocale: function (lang, path) {
|
|
1667
|
-
return clickgo.task.loadLocale(lang, path, taskId, formId);
|
|
1668
|
-
},
|
|
1669
|
-
clearLocale: function () {
|
|
1670
|
-
clickgo.task.clearLocale(taskId);
|
|
1671
|
-
},
|
|
1672
|
-
setLocale: function (lang, path) {
|
|
1673
|
-
return clickgo.task.setLocale(lang, path, taskId, formId);
|
|
1674
|
-
},
|
|
1675
|
-
setLocaleLang: function (lang) {
|
|
1676
|
-
clickgo.task.setLocaleLang(lang, taskId);
|
|
1677
|
-
},
|
|
1678
|
-
clearLocaleLang: function () {
|
|
1679
|
-
clickgo.task.clearLocaleLang(taskId);
|
|
1680
|
-
},
|
|
1681
|
-
createTimer: function (fun, delay, opt = {}) {
|
|
1682
|
-
opt.taskId = taskId;
|
|
1683
|
-
if (!opt.formId) {
|
|
1684
|
-
opt.formId = formId;
|
|
1685
|
-
}
|
|
1686
|
-
return clickgo.task.createTimer(fun, delay, opt);
|
|
1687
|
-
},
|
|
1688
|
-
removeTimer: function (timer) {
|
|
1689
|
-
clickgo.task.removeTimer(timer, taskId);
|
|
1690
|
-
},
|
|
1691
|
-
sleep: function (fun, delay) {
|
|
1692
|
-
return clickgo.task.sleep(fun, delay, taskId, formId);
|
|
1693
|
-
},
|
|
1694
|
-
systemTaskInfo: clickgo.task.systemTaskInfo,
|
|
1695
|
-
setSystem: function (fid) {
|
|
1696
|
-
return clickgo.task.setSystem(fid !== null && fid !== void 0 ? fid : formId, taskId);
|
|
1697
|
-
},
|
|
1698
|
-
clearSystem: function () {
|
|
1699
|
-
return clickgo.task.clearSystem(taskId);
|
|
1700
|
-
}
|
|
1701
|
-
},
|
|
1702
|
-
'theme': {
|
|
1703
|
-
read: function (blob) {
|
|
1704
|
-
return clickgo.theme.read(blob);
|
|
1705
|
-
},
|
|
1706
|
-
load: function (theme) {
|
|
1707
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1708
|
-
if (!theme) {
|
|
1709
|
-
return false;
|
|
1710
|
-
}
|
|
1711
|
-
return clickgo.theme.load(theme, taskId);
|
|
1712
|
-
});
|
|
1713
|
-
},
|
|
1714
|
-
remove: function (name) {
|
|
1715
|
-
return clickgo.theme.remove(name, taskId);
|
|
1716
|
-
},
|
|
1717
|
-
clear: function () {
|
|
1718
|
-
return clickgo.theme.clear(taskId);
|
|
1719
|
-
},
|
|
1720
|
-
setGlobal: function (theme) {
|
|
1721
|
-
return clickgo.theme.setGlobal(theme);
|
|
1722
|
-
},
|
|
1723
|
-
clearGlobal: function () {
|
|
1724
|
-
clickgo.theme.clearGlobal();
|
|
1725
|
-
}
|
|
1726
|
-
},
|
|
1727
|
-
'tool': {
|
|
1728
|
-
blob2ArrayBuffer: function (blob) {
|
|
1729
|
-
return clickgo.tool.blob2ArrayBuffer(blob);
|
|
1730
|
-
},
|
|
1731
|
-
clone: function (obj) {
|
|
1732
|
-
return clickgo.tool.clone(obj);
|
|
1733
|
-
},
|
|
1734
|
-
sleep: function (ms = 0) {
|
|
1735
|
-
return clickgo.tool.sleep(ms);
|
|
1736
|
-
},
|
|
1737
|
-
purify: function (text) {
|
|
1738
|
-
return clickgo.tool.purify(text);
|
|
1739
|
-
},
|
|
1740
|
-
createObjectURL: function (object) {
|
|
1741
|
-
return clickgo.tool.createObjectURL(object, taskId);
|
|
1742
|
-
},
|
|
1743
|
-
revokeObjectURL: function (url) {
|
|
1744
|
-
clickgo.tool.revokeObjectURL(url, taskId);
|
|
1745
|
-
},
|
|
1746
|
-
rand: function (min, max) {
|
|
1747
|
-
return clickgo.tool.rand(min, max);
|
|
1748
|
-
},
|
|
1749
|
-
'RANDOM_N': clickgo.tool.RANDOM_N,
|
|
1750
|
-
'RANDOM_U': clickgo.tool.RANDOM_U,
|
|
1751
|
-
'RANDOM_L': clickgo.tool.RANDOM_L,
|
|
1752
|
-
'RANDOM_UN': clickgo.tool.RANDOM_UN,
|
|
1753
|
-
'RANDOM_LN': clickgo.tool.RANDOM_LN,
|
|
1754
|
-
'RANDOM_LU': clickgo.tool.RANDOM_LU,
|
|
1755
|
-
'RANDOM_LUN': clickgo.tool.RANDOM_LUN,
|
|
1756
|
-
'RANDOM_V': clickgo.tool.RANDOM_V,
|
|
1757
|
-
'RANDOM_LUNS': clickgo.tool.RANDOM_LUNS,
|
|
1758
|
-
random: function (length = 8, source = clickgo.tool.RANDOM_LN, block = '') {
|
|
1759
|
-
return clickgo.tool.random(length, source, block);
|
|
1760
|
-
},
|
|
1761
|
-
getBoolean: function (param) {
|
|
1762
|
-
return clickgo.tool.getBoolean(param);
|
|
1763
|
-
},
|
|
1764
|
-
escapeHTML: function (html) {
|
|
1765
|
-
return clickgo.tool.escapeHTML(html);
|
|
1766
|
-
},
|
|
1767
|
-
request: function (url, opt) {
|
|
1768
|
-
return clickgo.tool.request(url, opt);
|
|
1769
|
-
},
|
|
1770
|
-
parseUrl: function (url) {
|
|
1771
|
-
return clickgo.tool.parseUrl(url);
|
|
1772
|
-
},
|
|
1773
|
-
urlResolve: function (from, to) {
|
|
1774
|
-
return clickgo.tool.urlResolve(from, to);
|
|
1775
|
-
},
|
|
1776
|
-
blob2Text: function (blob) {
|
|
1777
|
-
return clickgo.tool.blob2Text(blob);
|
|
1778
|
-
},
|
|
1779
|
-
blob2DataUrl: function (blob) {
|
|
1780
|
-
return clickgo.tool.blob2DataUrl(blob);
|
|
1781
|
-
},
|
|
1782
|
-
execCommand: function (ac) {
|
|
1783
|
-
clickgo.tool.execCommand(ac);
|
|
1784
|
-
}
|
|
1785
|
-
},
|
|
1786
|
-
'zip': {
|
|
1787
|
-
get: function (data) {
|
|
1788
|
-
return clickgo.zip.get(data);
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
};
|
|
1792
|
-
}
|
|
1793
|
-
else {
|
|
1794
|
-
invoke.invokeClickgo = clickgo;
|
|
1795
|
-
}
|
|
1796
|
-
const preprocess = clickgo.getSafe() ? function (code, path) {
|
|
1797
|
-
const exec = /eval\W/.exec(code);
|
|
1798
|
-
if (exec) {
|
|
1799
|
-
notify({
|
|
1800
|
-
'title': 'Error',
|
|
1801
|
-
'content': `The "eval" is prohibited.\nFile: "${path}".`,
|
|
1802
|
-
'type': 'danger'
|
|
1803
|
-
});
|
|
1804
|
-
return '';
|
|
1805
|
-
}
|
|
1806
|
-
return code;
|
|
1807
|
-
} : undefined;
|
|
1808
|
-
const components = yield control.init(t.id, formId, newBase, preprocess, invoke);
|
|
1462
|
+
const components = control.buildComponents(t.id, formId, (_a = opt.path) !== null && _a !== void 0 ? _a : '');
|
|
1809
1463
|
if (!components) {
|
|
1810
|
-
|
|
1811
|
-
form.vroot.$refs.form.maskFor = undefined;
|
|
1812
|
-
}
|
|
1813
|
-
return -5;
|
|
1814
|
-
}
|
|
1815
|
-
let style = opt.style;
|
|
1816
|
-
let layout = opt.layout;
|
|
1817
|
-
if (filePath) {
|
|
1818
|
-
if (!filePath.startsWith('/package/')) {
|
|
1819
|
-
return -6;
|
|
1820
|
-
}
|
|
1821
|
-
const file = filePath.slice(8);
|
|
1822
|
-
const layoutFile = app.files[file + '.xml'];
|
|
1823
|
-
if (layoutFile) {
|
|
1824
|
-
layout = layoutFile.replace(/^\ufeff/, '');
|
|
1825
|
-
}
|
|
1826
|
-
const styleFile = app.files[file + '.css'];
|
|
1827
|
-
if (styleFile) {
|
|
1828
|
-
style = styleFile.replace(/^\ufeff/, '');
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
if (layout === undefined) {
|
|
1832
|
-
if ((form === null || form === void 0 ? void 0 : form.vroot.$refs.form.maskFor) !== undefined) {
|
|
1833
|
-
form.vroot.$refs.form.maskFor = undefined;
|
|
1834
|
-
}
|
|
1835
|
-
return -7;
|
|
1464
|
+
return -3;
|
|
1836
1465
|
}
|
|
1837
1466
|
let data = {};
|
|
1838
|
-
let methods =
|
|
1467
|
+
let methods = undefined;
|
|
1839
1468
|
let computed = {};
|
|
1840
|
-
let watch = {};
|
|
1841
1469
|
let beforeCreate = undefined;
|
|
1842
1470
|
let created = undefined;
|
|
1843
1471
|
let beforeMount = undefined;
|
|
@@ -1846,46 +1474,29 @@ function create(opt) {
|
|
|
1846
1474
|
let updated = undefined;
|
|
1847
1475
|
let beforeUnmount = undefined;
|
|
1848
1476
|
let unmounted = undefined;
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
}
|
|
1864
|
-
}
|
|
1865
|
-
if (expo) {
|
|
1866
|
-
data = (_d = expo.data) !== null && _d !== void 0 ? _d : {};
|
|
1867
|
-
methods = expo.methods || {};
|
|
1868
|
-
computed = expo.computed || {};
|
|
1869
|
-
watch = expo.watch || {};
|
|
1870
|
-
beforeCreate = expo.beforeCreate;
|
|
1871
|
-
created = expo.created;
|
|
1872
|
-
beforeMount = expo.beforeMount;
|
|
1873
|
-
mounted = expo.mounted;
|
|
1874
|
-
beforeUpdate = expo.beforeUpdate;
|
|
1875
|
-
updated = expo.updated;
|
|
1876
|
-
beforeUnmount = expo.beforeUnmount;
|
|
1877
|
-
unmounted = expo.unmounted;
|
|
1878
|
-
receive = expo.receive;
|
|
1879
|
-
}
|
|
1477
|
+
if (opt.code) {
|
|
1478
|
+
data = (_b = opt.code.data) !== null && _b !== void 0 ? _b : {};
|
|
1479
|
+
methods = opt.code.methods;
|
|
1480
|
+
computed = (_c = opt.code.computed) !== null && _c !== void 0 ? _c : {};
|
|
1481
|
+
beforeCreate = opt.code.beforeCreate;
|
|
1482
|
+
created = opt.code.created;
|
|
1483
|
+
beforeMount = opt.code.beforeMount;
|
|
1484
|
+
mounted = opt.code.mounted;
|
|
1485
|
+
beforeUpdate = opt.code.beforeUpdate;
|
|
1486
|
+
updated = opt.code.updated;
|
|
1487
|
+
beforeUnmount = opt.code.beforeUnmount;
|
|
1488
|
+
unmounted = opt.code.unmounted;
|
|
1489
|
+
}
|
|
1490
|
+
let style = '';
|
|
1880
1491
|
let prep = '';
|
|
1881
|
-
if (style) {
|
|
1882
|
-
const r = tool.stylePrepend(style);
|
|
1492
|
+
if (opt.style) {
|
|
1493
|
+
const r = tool.stylePrepend(opt.style);
|
|
1883
1494
|
prep = r.prep;
|
|
1884
|
-
style = yield tool.styleUrl2DataUrl(
|
|
1495
|
+
style = yield tool.styleUrl2DataUrl((_d = opt.path) !== null && _d !== void 0 ? _d : '/', r.style, t.app.files);
|
|
1885
1496
|
}
|
|
1886
|
-
layout = tool.purify(layout);
|
|
1497
|
+
let layout = tool.purify(opt.layout);
|
|
1887
1498
|
layout = tool.layoutAddTagClassAndReTagName(layout, true);
|
|
1888
|
-
layout = tool.layoutInsertAttr(layout, ':
|
|
1499
|
+
layout = tool.layoutInsertAttr(layout, ':form-focus=\'formFocus\'', {
|
|
1889
1500
|
'include': [/^cg-.+/]
|
|
1890
1501
|
});
|
|
1891
1502
|
const prepList = ['cg-task' + opt.taskId.toString() + '_'];
|
|
@@ -1896,19 +1507,6 @@ function create(opt) {
|
|
|
1896
1507
|
layout = tool.eventsAttrWrap(layout);
|
|
1897
1508
|
elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${opt.taskId.toString()}"></div>`);
|
|
1898
1509
|
const el = elements.list.children.item(elements.list.children.length - 1);
|
|
1899
|
-
computed.taskId = {
|
|
1900
|
-
get: function () {
|
|
1901
|
-
return taskId;
|
|
1902
|
-
},
|
|
1903
|
-
set: function () {
|
|
1904
|
-
notify({
|
|
1905
|
-
'title': 'Error',
|
|
1906
|
-
'content': `The software tries to modify the system variable "taskId".\nPath: ${this.cgPath}`,
|
|
1907
|
-
'type': 'danger'
|
|
1908
|
-
});
|
|
1909
|
-
return;
|
|
1910
|
-
}
|
|
1911
|
-
};
|
|
1912
1510
|
computed.formId = {
|
|
1913
1511
|
get: function () {
|
|
1914
1512
|
return formId;
|
|
@@ -1916,124 +1514,68 @@ function create(opt) {
|
|
|
1916
1514
|
set: function () {
|
|
1917
1515
|
notify({
|
|
1918
1516
|
'title': 'Error',
|
|
1919
|
-
'content': `The software tries to modify the system variable "formId".\nPath: ${this.
|
|
1517
|
+
'content': `The software tries to modify the system variable "formId".\nPath: ${this.filename}`,
|
|
1920
1518
|
'type': 'danger'
|
|
1921
1519
|
});
|
|
1922
1520
|
return;
|
|
1923
1521
|
}
|
|
1924
1522
|
};
|
|
1925
|
-
|
|
1523
|
+
data._formFocus = false;
|
|
1524
|
+
computed.path = {
|
|
1926
1525
|
get: function () {
|
|
1927
|
-
|
|
1526
|
+
var _a;
|
|
1527
|
+
return (_a = opt.path) !== null && _a !== void 0 ? _a : '';
|
|
1928
1528
|
},
|
|
1929
1529
|
set: function () {
|
|
1930
1530
|
notify({
|
|
1931
1531
|
'title': 'Error',
|
|
1932
|
-
'content': `The software tries to modify the system variable "
|
|
1532
|
+
'content': `The software tries to modify the system variable "path".\nPath: ${this.filename}`,
|
|
1933
1533
|
'type': 'danger'
|
|
1934
1534
|
});
|
|
1935
1535
|
return;
|
|
1936
1536
|
}
|
|
1937
1537
|
};
|
|
1938
|
-
|
|
1939
|
-
computed.cgFocus = {
|
|
1940
|
-
get: function () {
|
|
1941
|
-
return this._cgFocus;
|
|
1942
|
-
},
|
|
1943
|
-
set: function () {
|
|
1944
|
-
notify({
|
|
1945
|
-
'title': 'Error',
|
|
1946
|
-
'content': `The software tries to modify the system variable "cgFocus".\nPath: ${this.cgPath}`,
|
|
1947
|
-
'type': 'danger'
|
|
1948
|
-
});
|
|
1949
|
-
return;
|
|
1950
|
-
}
|
|
1951
|
-
};
|
|
1952
|
-
computed.cgPath = {
|
|
1953
|
-
get: function () {
|
|
1954
|
-
return newBase;
|
|
1955
|
-
},
|
|
1956
|
-
set: function () {
|
|
1957
|
-
notify({
|
|
1958
|
-
'title': 'Error',
|
|
1959
|
-
'content': `The software tries to modify the system variable "cgPath".\nPath: ${this.cgPath}`,
|
|
1960
|
-
'type': 'danger'
|
|
1961
|
-
});
|
|
1962
|
-
return;
|
|
1963
|
-
}
|
|
1964
|
-
};
|
|
1965
|
-
computed.cgPrep = {
|
|
1538
|
+
computed.prep = {
|
|
1966
1539
|
get: function () {
|
|
1967
1540
|
return prep;
|
|
1968
1541
|
},
|
|
1969
1542
|
set: function () {
|
|
1970
1543
|
notify({
|
|
1971
1544
|
'title': 'Error',
|
|
1972
|
-
'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this.
|
|
1973
|
-
'type': 'danger'
|
|
1974
|
-
});
|
|
1975
|
-
return;
|
|
1976
|
-
}
|
|
1977
|
-
};
|
|
1978
|
-
data._cgCustomZIndex = false;
|
|
1979
|
-
computed.cgCustomZIndex = {
|
|
1980
|
-
get: function () {
|
|
1981
|
-
return this._cgCustomZIndex;
|
|
1982
|
-
},
|
|
1983
|
-
set: function () {
|
|
1984
|
-
notify({
|
|
1985
|
-
'title': 'Error',
|
|
1986
|
-
'content': `The software tries to modify the system variable "cgCustomZIndex".\nPath: ${this.cgPath}`,
|
|
1545
|
+
'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this.filename}`,
|
|
1987
1546
|
'type': 'danger'
|
|
1988
1547
|
});
|
|
1989
1548
|
return;
|
|
1990
1549
|
}
|
|
1991
1550
|
};
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
}
|
|
1995
|
-
else {
|
|
1996
|
-
data._cgTopMost = false;
|
|
1997
|
-
}
|
|
1998
|
-
computed.cgTopMost = {
|
|
1551
|
+
data._topMost = false;
|
|
1552
|
+
computed.topMost = {
|
|
1999
1553
|
get: function () {
|
|
2000
|
-
return this.
|
|
1554
|
+
return this._topMost;
|
|
2001
1555
|
},
|
|
2002
|
-
set: function () {
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
1556
|
+
set: function (v) {
|
|
1557
|
+
const form = t.forms[formId];
|
|
1558
|
+
if (!form) {
|
|
1559
|
+
return;
|
|
1560
|
+
}
|
|
1561
|
+
if (v) {
|
|
1562
|
+
form.vroot.$data._topMost = true;
|
|
1563
|
+
if (!form.vroot._formFocus) {
|
|
1564
|
+
changeFocus(form.id);
|
|
1565
|
+
}
|
|
1566
|
+
else {
|
|
1567
|
+
form.vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
else {
|
|
1571
|
+
form.vroot.$data._topMost = false;
|
|
1572
|
+
form.vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
1573
|
+
}
|
|
2008
1574
|
return;
|
|
2009
1575
|
}
|
|
2010
1576
|
};
|
|
2011
|
-
computed.cgLocale = function () {
|
|
2012
|
-
if (task.list[this.taskId].locale.lang === '') {
|
|
2013
|
-
return core.config.locale;
|
|
2014
|
-
}
|
|
2015
|
-
return task.list[this.taskId].locale.lang;
|
|
2016
|
-
};
|
|
2017
|
-
computed.l = function () {
|
|
2018
|
-
return (key) => {
|
|
2019
|
-
var _a, _b, _c, _d;
|
|
2020
|
-
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';
|
|
2021
|
-
};
|
|
2022
|
-
};
|
|
2023
|
-
methods.cgClassPrepend = function (cla) {
|
|
2024
|
-
if (typeof cla !== 'string') {
|
|
2025
|
-
return cla;
|
|
2026
|
-
}
|
|
2027
|
-
return `cg-task${this.taskId}_${cla} ${this.cgPrep}${cla}`;
|
|
2028
|
-
};
|
|
2029
|
-
methods.cgAllowEvent = function (e) {
|
|
2030
|
-
return dom.allowEvent(e);
|
|
2031
|
-
};
|
|
2032
|
-
methods.cgReceive = function (obj) {
|
|
2033
|
-
receive === null || receive === void 0 ? void 0 : receive.call(this, obj);
|
|
2034
|
-
};
|
|
2035
1577
|
if (style) {
|
|
2036
|
-
dom.pushStyle(taskId, style, 'form', formId);
|
|
1578
|
+
dom.pushStyle(opt.taskId, style, 'form', formId);
|
|
2037
1579
|
}
|
|
2038
1580
|
const rtn = yield new Promise(function (resolve) {
|
|
2039
1581
|
const vapp = clickgo.vue.createApp({
|
|
@@ -2043,16 +1585,18 @@ function create(opt) {
|
|
|
2043
1585
|
},
|
|
2044
1586
|
'methods': methods,
|
|
2045
1587
|
'computed': computed,
|
|
2046
|
-
'watch': watch,
|
|
2047
1588
|
'beforeCreate': beforeCreate,
|
|
2048
1589
|
'created': created,
|
|
2049
1590
|
'beforeMount': beforeMount,
|
|
2050
1591
|
'mounted': function () {
|
|
2051
1592
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2052
1593
|
yield this.$nextTick();
|
|
2053
|
-
if (this.$refs.form.icon
|
|
2054
|
-
const icon = yield
|
|
2055
|
-
|
|
1594
|
+
if (this.$refs.form.icon) {
|
|
1595
|
+
const icon = yield fs.getContent(this.$refs.form.icon, {
|
|
1596
|
+
'current': t.current,
|
|
1597
|
+
'files': t.app.files
|
|
1598
|
+
});
|
|
1599
|
+
this.$refs.form.iconData = (icon instanceof Blob) ? yield tool.blob2DataUrl(icon) : '';
|
|
2056
1600
|
}
|
|
2057
1601
|
resolve({
|
|
2058
1602
|
'vapp': vapp,
|
|
@@ -2061,48 +1605,45 @@ function create(opt) {
|
|
|
2061
1605
|
});
|
|
2062
1606
|
},
|
|
2063
1607
|
'beforeUpdate': beforeUpdate,
|
|
2064
|
-
'updated':
|
|
2065
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2066
|
-
yield this.$nextTick();
|
|
2067
|
-
updated === null || updated === void 0 ? void 0 : updated.call(this);
|
|
2068
|
-
});
|
|
2069
|
-
},
|
|
1608
|
+
'updated': updated,
|
|
2070
1609
|
'beforeUnmount': beforeUnmount,
|
|
2071
|
-
'unmounted': unmounted
|
|
1610
|
+
'unmounted': unmounted
|
|
2072
1611
|
});
|
|
2073
1612
|
vapp.config.errorHandler = function (err, vm, info) {
|
|
2074
1613
|
notify({
|
|
2075
1614
|
'title': 'Runtime Error',
|
|
2076
|
-
'content': `Message: ${err.message}\
|
|
1615
|
+
'content': `Message: ${err.message}\nTask id: ${vm.taskId}\nForm id: ${vm.formId}`,
|
|
2077
1616
|
'type': 'danger'
|
|
2078
1617
|
});
|
|
2079
|
-
core.trigger('error', vm.taskId, vm.formId, err, info);
|
|
1618
|
+
core.trigger('error', vm.taskId, vm.formId, err, info + '(-3,' + vm.taskId + ',' + vm.formId + ')');
|
|
2080
1619
|
};
|
|
2081
1620
|
for (const key in components) {
|
|
2082
1621
|
vapp.component(key, components[key]);
|
|
2083
1622
|
}
|
|
2084
|
-
|
|
1623
|
+
try {
|
|
1624
|
+
vapp.mount(el);
|
|
1625
|
+
}
|
|
1626
|
+
catch (err) {
|
|
1627
|
+
notify({
|
|
1628
|
+
'title': 'Runtime Error',
|
|
1629
|
+
'content': `Message: ${err.message}\nTask id: ${opt.taskId}\nForm id: ${formId}`,
|
|
1630
|
+
'type': 'danger'
|
|
1631
|
+
});
|
|
1632
|
+
core.trigger('error', opt.taskId, formId, err, err.message + '(-2)');
|
|
1633
|
+
}
|
|
2085
1634
|
});
|
|
2086
1635
|
const nform = {
|
|
2087
1636
|
'id': formId,
|
|
2088
1637
|
'vapp': rtn.vapp,
|
|
2089
|
-
'vroot': rtn.vroot
|
|
2090
|
-
'events': {}
|
|
1638
|
+
'vroot': rtn.vroot
|
|
2091
1639
|
};
|
|
2092
1640
|
t.forms[formId] = nform;
|
|
2093
|
-
if (opt.mask && form) {
|
|
2094
|
-
form.vroot.$refs.form.maskFor = formId;
|
|
2095
|
-
nform.vroot.$refs.form.maskFrom = form.id;
|
|
2096
|
-
}
|
|
2097
1641
|
yield tool.sleep(34);
|
|
2098
1642
|
if (mounted) {
|
|
2099
1643
|
try {
|
|
2100
1644
|
yield mounted.call(rtn.vroot, opt.data);
|
|
2101
1645
|
}
|
|
2102
1646
|
catch (err) {
|
|
2103
|
-
if ((nform === null || nform === void 0 ? void 0 : nform.vroot.$refs.form.maskFor) !== undefined) {
|
|
2104
|
-
nform.vroot.$refs.form.maskFor = undefined;
|
|
2105
|
-
}
|
|
2106
1647
|
core.trigger('error', rtn.vroot.taskId, rtn.vroot.formId, err, 'Create form mounted error.');
|
|
2107
1648
|
t.forms[formId] = undefined;
|
|
2108
1649
|
delete t.forms[formId];
|
|
@@ -2112,24 +1653,8 @@ function create(opt) {
|
|
|
2112
1653
|
return -8;
|
|
2113
1654
|
}
|
|
2114
1655
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
if (rtn.vroot.$refs.form.left === -1) {
|
|
2118
|
-
rtn.vroot.$refs.form.setPropData('left', (area.width - rtn.vroot.$el.offsetWidth) / 2);
|
|
2119
|
-
}
|
|
2120
|
-
if (rtn.vroot.$refs.form.top === -1) {
|
|
2121
|
-
rtn.vroot.$refs.form.setPropData('top', (area.height - rtn.vroot.$el.offsetHeight) / 2);
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
if (rtn.vroot.$refs.form.zIndex !== -1) {
|
|
2125
|
-
rtn.vroot._cgCustomZIndex = true;
|
|
2126
|
-
}
|
|
2127
|
-
if (rtn.vroot.$refs.form.$data.show !== false) {
|
|
2128
|
-
rtn.vroot.$refs.form.$data.showData = true;
|
|
2129
|
-
}
|
|
2130
|
-
core.trigger('formCreated', taskId, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconData);
|
|
2131
|
-
changeFocus(formId);
|
|
2132
|
-
return nform;
|
|
1656
|
+
core.trigger('formCreated', opt.taskId, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconData);
|
|
1657
|
+
return formId;
|
|
2133
1658
|
});
|
|
2134
1659
|
}
|
|
2135
1660
|
exports.create = create;
|
|
@@ -2141,49 +1666,56 @@ function dialog(opt) {
|
|
|
2141
1666
|
'content': opt
|
|
2142
1667
|
};
|
|
2143
1668
|
}
|
|
2144
|
-
const
|
|
2145
|
-
|
|
1669
|
+
const nopt = opt;
|
|
1670
|
+
const taskId = nopt.taskId;
|
|
1671
|
+
if (!taskId) {
|
|
2146
1672
|
resolve('');
|
|
2147
1673
|
return;
|
|
2148
1674
|
}
|
|
2149
|
-
const taskId = getTaskId(formId);
|
|
2150
1675
|
const t = task.list[taskId];
|
|
2151
1676
|
if (!t) {
|
|
2152
1677
|
resolve('');
|
|
2153
1678
|
return;
|
|
2154
1679
|
}
|
|
2155
|
-
const locale = t.
|
|
2156
|
-
if (
|
|
2157
|
-
|
|
1680
|
+
const locale = t.locale.lang || core.config.locale;
|
|
1681
|
+
if (nopt.buttons === undefined) {
|
|
1682
|
+
nopt.buttons = [(_b = (_a = info.locale[locale]) === null || _a === void 0 ? void 0 : _a.ok) !== null && _b !== void 0 ? _b : info.locale['en'].ok];
|
|
2158
1683
|
}
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
this.go = false;
|
|
2174
|
-
}
|
|
2175
|
-
};
|
|
2176
|
-
(_b = (_a = opt).select) === null || _b === void 0 ? void 0 : _b.call(_a, event, button);
|
|
2177
|
-
if (event.go) {
|
|
2178
|
-
close(this.formId);
|
|
2179
|
-
resolve(button);
|
|
2180
|
-
}
|
|
1684
|
+
const cls = class extends AbstractForm {
|
|
1685
|
+
constructor() {
|
|
1686
|
+
super(...arguments);
|
|
1687
|
+
this.buttons = nopt.buttons;
|
|
1688
|
+
}
|
|
1689
|
+
get taskId() {
|
|
1690
|
+
return taskId;
|
|
1691
|
+
}
|
|
1692
|
+
select(button) {
|
|
1693
|
+
var _a;
|
|
1694
|
+
const event = {
|
|
1695
|
+
'go': true,
|
|
1696
|
+
preventDefault: function () {
|
|
1697
|
+
this.go = false;
|
|
2181
1698
|
}
|
|
1699
|
+
};
|
|
1700
|
+
(_a = nopt.select) === null || _a === void 0 ? void 0 : _a.call(nopt, event, button);
|
|
1701
|
+
if (event.go) {
|
|
1702
|
+
this.dialogResult = button;
|
|
1703
|
+
close(this.formId);
|
|
2182
1704
|
}
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
}).
|
|
2186
|
-
|
|
1705
|
+
}
|
|
1706
|
+
};
|
|
1707
|
+
cls.create(undefined, `<form title="${(_c = nopt.title) !== null && _c !== void 0 ? _c : 'dialog'}" min="false" max="false" resize="false" height="0" border="${nopt.title ? 'normal' : 'plain'}" direction="v"><dialog :buttons="buttons" @select="select"${nopt.direction ? ` direction="${nopt.direction}"` : ''}>${nopt.content}</dialog></form>`).then((frm) => {
|
|
1708
|
+
if (typeof frm === 'number') {
|
|
1709
|
+
resolve('');
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
frm.showDialog().then((v) => {
|
|
1713
|
+
resolve(v);
|
|
1714
|
+
}).catch(() => {
|
|
1715
|
+
resolve('');
|
|
1716
|
+
});
|
|
1717
|
+
}).catch(() => {
|
|
1718
|
+
resolve('');
|
|
2187
1719
|
});
|
|
2188
1720
|
});
|
|
2189
1721
|
}
|
|
@@ -2196,22 +1728,21 @@ function confirm(opt) {
|
|
|
2196
1728
|
'content': opt
|
|
2197
1729
|
};
|
|
2198
1730
|
}
|
|
2199
|
-
const
|
|
2200
|
-
if (!
|
|
1731
|
+
const taskId = opt.taskId;
|
|
1732
|
+
if (!taskId) {
|
|
2201
1733
|
return false;
|
|
2202
1734
|
}
|
|
2203
|
-
const taskId = getTaskId(formId);
|
|
2204
1735
|
const t = task.list[taskId];
|
|
2205
1736
|
if (!t) {
|
|
2206
1737
|
return false;
|
|
2207
1738
|
}
|
|
2208
|
-
const locale = t.
|
|
1739
|
+
const locale = t.locale.lang || core.config.locale;
|
|
2209
1740
|
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];
|
|
2210
1741
|
if (opt.cancel) {
|
|
2211
1742
|
buttons.push((_f = (_e = info.locale[locale]) === null || _e === void 0 ? void 0 : _e.cancel) !== null && _f !== void 0 ? _f : info.locale['en'].cancel);
|
|
2212
1743
|
}
|
|
2213
1744
|
const res = yield dialog({
|
|
2214
|
-
'
|
|
1745
|
+
'taskId': taskId,
|
|
2215
1746
|
'content': opt.content,
|
|
2216
1747
|
'buttons': buttons
|
|
2217
1748
|
});
|
|
@@ -2225,37 +1756,18 @@ function confirm(opt) {
|
|
|
2225
1756
|
});
|
|
2226
1757
|
}
|
|
2227
1758
|
exports.confirm = confirm;
|
|
2228
|
-
function
|
|
2229
|
-
|
|
2230
|
-
if (!form) {
|
|
1759
|
+
function flash(formId, taskId) {
|
|
1760
|
+
if (!taskId) {
|
|
2231
1761
|
return;
|
|
2232
1762
|
}
|
|
2233
|
-
form.vroot.$data._cgCustomZIndex = false;
|
|
2234
|
-
if (top) {
|
|
2235
|
-
form.vroot.$data._cgTopMost = true;
|
|
2236
|
-
if (!form.vroot.cgFocus) {
|
|
2237
|
-
changeFocus(form.id);
|
|
2238
|
-
}
|
|
2239
|
-
else {
|
|
2240
|
-
form.vroot.$refs.form.setPropData('zIndex', ++info.topLastZIndex);
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
else {
|
|
2244
|
-
form.vroot.$data._cgTopMost = false;
|
|
2245
|
-
form.vroot.$refs.form.setPropData('zIndex', ++info.lastZIndex);
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
exports.setTopMost = setTopMost;
|
|
2249
|
-
function flash(formId, taskId) {
|
|
2250
|
-
var _a;
|
|
2251
1763
|
const form = getForm(taskId, formId);
|
|
2252
1764
|
if (!form) {
|
|
2253
1765
|
return;
|
|
2254
1766
|
}
|
|
2255
|
-
if (!form.vroot.
|
|
1767
|
+
if (!form.vroot._formFocus) {
|
|
2256
1768
|
changeFocus(form.id);
|
|
2257
1769
|
}
|
|
2258
|
-
if (
|
|
1770
|
+
if (form.vroot.$refs.form.flashTimer) {
|
|
2259
1771
|
clearTimeout(form.vroot.$refs.form.flashTimer);
|
|
2260
1772
|
form.vroot.$refs.form.flashTimer = undefined;
|
|
2261
1773
|
}
|
|
@@ -2267,22 +1779,6 @@ function flash(formId, taskId) {
|
|
|
2267
1779
|
core.trigger('formFlash', taskId, formId);
|
|
2268
1780
|
}
|
|
2269
1781
|
exports.flash = flash;
|
|
2270
|
-
function show(formId, taskId) {
|
|
2271
|
-
const form = getForm(taskId, formId);
|
|
2272
|
-
if (!form) {
|
|
2273
|
-
return;
|
|
2274
|
-
}
|
|
2275
|
-
form.vroot.$refs.form.$data.showData = true;
|
|
2276
|
-
}
|
|
2277
|
-
exports.show = show;
|
|
2278
|
-
function hide(formId, taskId) {
|
|
2279
|
-
const form = getForm(taskId, formId);
|
|
2280
|
-
if (!form) {
|
|
2281
|
-
return;
|
|
2282
|
-
}
|
|
2283
|
-
form.vroot.$refs.form.$data.showData = false;
|
|
2284
|
-
}
|
|
2285
|
-
exports.hide = hide;
|
|
2286
1782
|
function showLauncher() {
|
|
2287
1783
|
elements.launcher.style.display = 'flex';
|
|
2288
1784
|
requestAnimationFrame(function () {
|