clickgo 3.0.7-dev8 → 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.
- package/README.md +1 -1
- package/dist/app/demo/app.js +93 -0
- 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 +20 -10
- package/dist/app/demo/form/main.xml +1 -1
- 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 +398 -928
- package/dist/lib/form.ts +630 -1075
- 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 +705 -182
- package/dist/lib/task.ts +775 -200
- package/dist/lib/theme.ts +2 -2
- package/dist/lib/tool.js +58 -48
- package/dist/lib/tool.ts +79 -64
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +5 -7
- package/types/index.d.ts +274 -325
- 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,272 @@ 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) {
|
|
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;
|
|
55
322
|
const popInfo = {
|
|
56
323
|
'list': [],
|
|
57
324
|
'elList': [],
|
|
@@ -356,9 +623,6 @@ const elements = {
|
|
|
356
623
|
};
|
|
357
624
|
elements.init();
|
|
358
625
|
function changeState(state, formId) {
|
|
359
|
-
if (!formId) {
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
626
|
const tid = getTaskId(formId);
|
|
363
627
|
const t = task.list[tid];
|
|
364
628
|
if (!t) {
|
|
@@ -473,7 +737,7 @@ function get(formId) {
|
|
|
473
737
|
'stateMax': item.vroot.$refs.form.stateMaxData,
|
|
474
738
|
'stateMin': item.vroot.$refs.form.stateMinData,
|
|
475
739
|
'show': item.vroot.$refs.form.showData,
|
|
476
|
-
'focus': item.vroot.
|
|
740
|
+
'focus': item.vroot.formFocus
|
|
477
741
|
};
|
|
478
742
|
}
|
|
479
743
|
exports.get = get;
|
|
@@ -483,10 +747,7 @@ function send(formId, obj) {
|
|
|
483
747
|
return;
|
|
484
748
|
}
|
|
485
749
|
const item = task.list[taskId].forms[formId];
|
|
486
|
-
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
item.vroot.cgReceive(obj);
|
|
750
|
+
item.vroot.onReceive(obj);
|
|
490
751
|
}
|
|
491
752
|
exports.send = send;
|
|
492
753
|
function getList(taskId) {
|
|
@@ -503,7 +764,7 @@ function getList(taskId) {
|
|
|
503
764
|
'stateMax': item.vroot.$refs.form.stateMaxData,
|
|
504
765
|
'stateMin': item.vroot.$refs.form.stateMinData,
|
|
505
766
|
'show': item.vroot.$refs.form.showData,
|
|
506
|
-
'focus': item.vroot.
|
|
767
|
+
'focus': item.vroot.formFocus
|
|
507
768
|
};
|
|
508
769
|
}
|
|
509
770
|
return list;
|
|
@@ -519,7 +780,7 @@ function changeFocus(formId = 0) {
|
|
|
519
780
|
});
|
|
520
781
|
return;
|
|
521
782
|
}
|
|
522
|
-
const focusElement = document.querySelector('#cg-form-list > [data-
|
|
783
|
+
const focusElement = document.querySelector('#cg-form-list > [data-form-focus]');
|
|
523
784
|
if (focusElement) {
|
|
524
785
|
const dataFormId = focusElement.getAttribute('data-form-id');
|
|
525
786
|
if (dataFormId) {
|
|
@@ -530,8 +791,8 @@ function changeFocus(formId = 0) {
|
|
|
530
791
|
else {
|
|
531
792
|
const taskId = parseInt((_a = focusElement.getAttribute('data-task-id')) !== null && _a !== void 0 ? _a : '0');
|
|
532
793
|
const t = task.list[taskId];
|
|
533
|
-
t.forms[dataFormIdNumber].vapp._container.removeAttribute('data-
|
|
534
|
-
t.forms[dataFormIdNumber].vroot.
|
|
794
|
+
t.forms[dataFormIdNumber].vapp._container.removeAttribute('data-form-focus');
|
|
795
|
+
t.forms[dataFormIdNumber].vroot._formFocus = false;
|
|
535
796
|
core.trigger('formBlurred', taskId, dataFormIdNumber);
|
|
536
797
|
}
|
|
537
798
|
}
|
|
@@ -551,35 +812,33 @@ function changeFocus(formId = 0) {
|
|
|
551
812
|
}
|
|
552
813
|
const taskId = parseInt((_b = el.getAttribute('data-task-id')) !== null && _b !== void 0 ? _b : '0');
|
|
553
814
|
const t = task.list[taskId];
|
|
554
|
-
if (
|
|
555
|
-
|
|
556
|
-
t.forms[formId].vroot.$refs.form.setPropData('zIndex', ++info.topLastZIndex);
|
|
557
|
-
}
|
|
558
|
-
else {
|
|
559
|
-
t.forms[formId].vroot.$refs.form.setPropData('zIndex', ++info.lastZIndex);
|
|
560
|
-
}
|
|
815
|
+
if (t.forms[formId].vroot._topMost) {
|
|
816
|
+
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
561
817
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
if (
|
|
568
|
-
if (
|
|
569
|
-
|
|
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;
|
|
570
829
|
}
|
|
571
830
|
else {
|
|
572
|
-
task.list[taskId].forms[
|
|
831
|
+
task.list[taskId].forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
573
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);
|
|
574
837
|
}
|
|
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
838
|
}
|
|
580
839
|
else {
|
|
581
|
-
t.forms[formId].vapp._container.dataset.
|
|
582
|
-
t.forms[formId].vroot.
|
|
840
|
+
t.forms[formId].vapp._container.dataset.formFocus = '';
|
|
841
|
+
t.forms[formId].vroot._formFocus = true;
|
|
583
842
|
core.trigger('formFocused', taskId, formId);
|
|
584
843
|
}
|
|
585
844
|
}
|
|
@@ -591,6 +850,9 @@ function getMaxZIndexID(out = {}) {
|
|
|
591
850
|
for (let i = 0; i < elements.list.children.length; ++i) {
|
|
592
851
|
const formWrap = elements.list.children.item(i);
|
|
593
852
|
const formInner = formWrap.children.item(0);
|
|
853
|
+
if (!formInner) {
|
|
854
|
+
continue;
|
|
855
|
+
}
|
|
594
856
|
const z = parseInt(formInner.style.zIndex);
|
|
595
857
|
if (z > 9999999) {
|
|
596
858
|
continue;
|
|
@@ -1120,9 +1382,9 @@ function remove(formId) {
|
|
|
1120
1382
|
if (task.list[taskId].forms[formId]) {
|
|
1121
1383
|
title = task.list[taskId].forms[formId].vroot.$refs.form.title;
|
|
1122
1384
|
icon = task.list[taskId].forms[formId].vroot.$refs.form.iconData;
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
task.list[taskId].
|
|
1385
|
+
const io = task.list[taskId].runtime.dialogFormIds.indexOf(formId);
|
|
1386
|
+
if (io > -1) {
|
|
1387
|
+
task.list[taskId].runtime.dialogFormIds.splice(io, 1);
|
|
1126
1388
|
}
|
|
1127
1389
|
task.list[taskId].forms[formId].vroot.$refs.form.$data.showData = false;
|
|
1128
1390
|
setTimeout(function () {
|
|
@@ -1140,6 +1402,9 @@ function remove(formId) {
|
|
|
1140
1402
|
}
|
|
1141
1403
|
task.list[taskId].forms[formId].vapp.unmount();
|
|
1142
1404
|
task.list[taskId].forms[formId].vapp._container.remove();
|
|
1405
|
+
if (io > -1) {
|
|
1406
|
+
task.list[taskId].forms[formId].vroot.cgDialogCallback();
|
|
1407
|
+
}
|
|
1143
1408
|
delete task.list[taskId].forms[formId];
|
|
1144
1409
|
dom.removeStyle(taskId, 'form', formId);
|
|
1145
1410
|
core.trigger('formRemoved', taskId, formId, title, icon);
|
|
@@ -1155,16 +1420,10 @@ function remove(formId) {
|
|
|
1155
1420
|
}
|
|
1156
1421
|
exports.remove = remove;
|
|
1157
1422
|
function getForm(taskId, formId) {
|
|
1158
|
-
if (!taskId) {
|
|
1159
|
-
return null;
|
|
1160
|
-
}
|
|
1161
1423
|
const t = task.list[taskId];
|
|
1162
1424
|
if (!t) {
|
|
1163
1425
|
return null;
|
|
1164
1426
|
}
|
|
1165
|
-
if (!formId) {
|
|
1166
|
-
return null;
|
|
1167
|
-
}
|
|
1168
1427
|
const form = t.forms[formId];
|
|
1169
1428
|
if (!form) {
|
|
1170
1429
|
return null;
|
|
@@ -1174,670 +1433,21 @@ function getForm(taskId, formId) {
|
|
|
1174
1433
|
function create(opt) {
|
|
1175
1434
|
var _a, _b, _c, _d;
|
|
1176
1435
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1177
|
-
if (typeof opt === 'string') {
|
|
1178
|
-
return 0;
|
|
1179
|
-
}
|
|
1180
1436
|
if (!opt.taskId) {
|
|
1181
1437
|
return -1;
|
|
1182
1438
|
}
|
|
1183
|
-
|
|
1184
|
-
return -2;
|
|
1185
|
-
}
|
|
1186
|
-
const taskId = opt.taskId;
|
|
1187
|
-
const t = task.list[taskId];
|
|
1439
|
+
const t = task.list[opt.taskId];
|
|
1188
1440
|
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;
|
|
1441
|
+
return -2;
|
|
1213
1442
|
}
|
|
1214
|
-
const app = t.app;
|
|
1215
1443
|
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);
|
|
1444
|
+
const components = control.buildComponents(t.id, formId, (_a = opt.path) !== null && _a !== void 0 ? _a : '');
|
|
1809
1445
|
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;
|
|
1446
|
+
return -3;
|
|
1836
1447
|
}
|
|
1837
1448
|
let data = {};
|
|
1838
|
-
let methods =
|
|
1449
|
+
let methods = undefined;
|
|
1839
1450
|
let computed = {};
|
|
1840
|
-
let watch = {};
|
|
1841
1451
|
let beforeCreate = undefined;
|
|
1842
1452
|
let created = undefined;
|
|
1843
1453
|
let beforeMount = undefined;
|
|
@@ -1846,46 +1456,29 @@ function create(opt) {
|
|
|
1846
1456
|
let updated = undefined;
|
|
1847
1457
|
let beforeUnmount = undefined;
|
|
1848
1458
|
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
|
-
}
|
|
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 = '';
|
|
1880
1473
|
let prep = '';
|
|
1881
|
-
if (style) {
|
|
1882
|
-
const r = tool.stylePrepend(style);
|
|
1474
|
+
if (opt.style) {
|
|
1475
|
+
const r = tool.stylePrepend(opt.style);
|
|
1883
1476
|
prep = r.prep;
|
|
1884
|
-
style = yield tool.styleUrl2DataUrl(
|
|
1477
|
+
style = yield tool.styleUrl2DataUrl((_d = opt.path) !== null && _d !== void 0 ? _d : '/', r.style, t.app.files);
|
|
1885
1478
|
}
|
|
1886
|
-
layout = tool.purify(layout);
|
|
1479
|
+
let layout = tool.purify(opt.layout);
|
|
1887
1480
|
layout = tool.layoutAddTagClassAndReTagName(layout, true);
|
|
1888
|
-
layout = tool.layoutInsertAttr(layout, ':
|
|
1481
|
+
layout = tool.layoutInsertAttr(layout, ':form-focus=\'formFocus\'', {
|
|
1889
1482
|
'include': [/^cg-.+/]
|
|
1890
1483
|
});
|
|
1891
1484
|
const prepList = ['cg-task' + opt.taskId.toString() + '_'];
|
|
@@ -1896,19 +1489,6 @@ function create(opt) {
|
|
|
1896
1489
|
layout = tool.eventsAttrWrap(layout);
|
|
1897
1490
|
elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${opt.taskId.toString()}"></div>`);
|
|
1898
1491
|
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
1492
|
computed.formId = {
|
|
1913
1493
|
get: function () {
|
|
1914
1494
|
return formId;
|
|
@@ -1916,124 +1496,68 @@ function create(opt) {
|
|
|
1916
1496
|
set: function () {
|
|
1917
1497
|
notify({
|
|
1918
1498
|
'title': 'Error',
|
|
1919
|
-
'content': `The software tries to modify the system variable "formId".\nPath: ${this.
|
|
1499
|
+
'content': `The software tries to modify the system variable "formId".\nPath: ${this.filename}`,
|
|
1920
1500
|
'type': 'danger'
|
|
1921
1501
|
});
|
|
1922
1502
|
return;
|
|
1923
1503
|
}
|
|
1924
1504
|
};
|
|
1925
|
-
|
|
1505
|
+
data._formFocus = false;
|
|
1506
|
+
computed.path = {
|
|
1926
1507
|
get: function () {
|
|
1927
|
-
|
|
1508
|
+
var _a;
|
|
1509
|
+
return (_a = opt.path) !== null && _a !== void 0 ? _a : '';
|
|
1928
1510
|
},
|
|
1929
1511
|
set: function () {
|
|
1930
1512
|
notify({
|
|
1931
1513
|
'title': 'Error',
|
|
1932
|
-
'content': `The software tries to modify the system variable "
|
|
1514
|
+
'content': `The software tries to modify the system variable "path".\nPath: ${this.filename}`,
|
|
1933
1515
|
'type': 'danger'
|
|
1934
1516
|
});
|
|
1935
1517
|
return;
|
|
1936
1518
|
}
|
|
1937
1519
|
};
|
|
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 = {
|
|
1520
|
+
computed.prep = {
|
|
1966
1521
|
get: function () {
|
|
1967
1522
|
return prep;
|
|
1968
1523
|
},
|
|
1969
1524
|
set: function () {
|
|
1970
1525
|
notify({
|
|
1971
1526
|
'title': 'Error',
|
|
1972
|
-
'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this.
|
|
1527
|
+
'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this.filename}`,
|
|
1973
1528
|
'type': 'danger'
|
|
1974
1529
|
});
|
|
1975
1530
|
return;
|
|
1976
1531
|
}
|
|
1977
1532
|
};
|
|
1978
|
-
data.
|
|
1979
|
-
computed.
|
|
1533
|
+
data._topMost = false;
|
|
1534
|
+
computed.topMost = {
|
|
1980
1535
|
get: function () {
|
|
1981
|
-
return this.
|
|
1536
|
+
return this._topMost;
|
|
1982
1537
|
},
|
|
1983
|
-
set: function () {
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
},
|
|
2002
|
-
set: function () {
|
|
2003
|
-
notify({
|
|
2004
|
-
'title': 'Error',
|
|
2005
|
-
'content': `The software tries to modify the system variable "cgTopMost".\nPath: ${this.cgPath}`,
|
|
2006
|
-
'type': 'danger'
|
|
2007
|
-
});
|
|
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
|
+
}
|
|
2008
1556
|
return;
|
|
2009
1557
|
}
|
|
2010
1558
|
};
|
|
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
1559
|
if (style) {
|
|
2036
|
-
dom.pushStyle(taskId, style, 'form', formId);
|
|
1560
|
+
dom.pushStyle(opt.taskId, style, 'form', formId);
|
|
2037
1561
|
}
|
|
2038
1562
|
const rtn = yield new Promise(function (resolve) {
|
|
2039
1563
|
const vapp = clickgo.vue.createApp({
|
|
@@ -2043,16 +1567,18 @@ function create(opt) {
|
|
|
2043
1567
|
},
|
|
2044
1568
|
'methods': methods,
|
|
2045
1569
|
'computed': computed,
|
|
2046
|
-
'watch': watch,
|
|
2047
1570
|
'beforeCreate': beforeCreate,
|
|
2048
1571
|
'created': created,
|
|
2049
1572
|
'beforeMount': beforeMount,
|
|
2050
1573
|
'mounted': function () {
|
|
2051
1574
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2052
1575
|
yield this.$nextTick();
|
|
2053
|
-
if (this.$refs.form.icon
|
|
2054
|
-
const icon = yield
|
|
2055
|
-
|
|
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) : '';
|
|
2056
1582
|
}
|
|
2057
1583
|
resolve({
|
|
2058
1584
|
'vapp': vapp,
|
|
@@ -2061,48 +1587,45 @@ function create(opt) {
|
|
|
2061
1587
|
});
|
|
2062
1588
|
},
|
|
2063
1589
|
'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
|
-
},
|
|
1590
|
+
'updated': updated,
|
|
2070
1591
|
'beforeUnmount': beforeUnmount,
|
|
2071
|
-
'unmounted': unmounted
|
|
1592
|
+
'unmounted': unmounted
|
|
2072
1593
|
});
|
|
2073
1594
|
vapp.config.errorHandler = function (err, vm, info) {
|
|
2074
1595
|
notify({
|
|
2075
1596
|
'title': 'Runtime Error',
|
|
2076
|
-
'content': `Message: ${err.message}\
|
|
1597
|
+
'content': `Message: ${err.message}\nTask id: ${vm.taskId}\nForm id: ${vm.formId}`,
|
|
2077
1598
|
'type': 'danger'
|
|
2078
1599
|
});
|
|
2079
|
-
core.trigger('error', vm.taskId, vm.formId, err, info);
|
|
1600
|
+
core.trigger('error', vm.taskId, vm.formId, err, info + '(-3,' + vm.taskId + ',' + vm.formId + ')');
|
|
2080
1601
|
};
|
|
2081
1602
|
for (const key in components) {
|
|
2082
1603
|
vapp.component(key, components[key]);
|
|
2083
1604
|
}
|
|
2084
|
-
|
|
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
|
+
}
|
|
2085
1616
|
});
|
|
2086
1617
|
const nform = {
|
|
2087
1618
|
'id': formId,
|
|
2088
1619
|
'vapp': rtn.vapp,
|
|
2089
|
-
'vroot': rtn.vroot
|
|
2090
|
-
'events': {}
|
|
1620
|
+
'vroot': rtn.vroot
|
|
2091
1621
|
};
|
|
2092
1622
|
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
1623
|
yield tool.sleep(34);
|
|
2098
1624
|
if (mounted) {
|
|
2099
1625
|
try {
|
|
2100
1626
|
yield mounted.call(rtn.vroot, opt.data);
|
|
2101
1627
|
}
|
|
2102
1628
|
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
1629
|
core.trigger('error', rtn.vroot.taskId, rtn.vroot.formId, err, 'Create form mounted error.');
|
|
2107
1630
|
t.forms[formId] = undefined;
|
|
2108
1631
|
delete t.forms[formId];
|
|
@@ -2112,24 +1635,8 @@ function create(opt) {
|
|
|
2112
1635
|
return -8;
|
|
2113
1636
|
}
|
|
2114
1637
|
}
|
|
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;
|
|
1638
|
+
core.trigger('formCreated', opt.taskId, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconData);
|
|
1639
|
+
return formId;
|
|
2133
1640
|
});
|
|
2134
1641
|
}
|
|
2135
1642
|
exports.create = create;
|
|
@@ -2141,25 +1648,21 @@ function dialog(opt) {
|
|
|
2141
1648
|
'content': opt
|
|
2142
1649
|
};
|
|
2143
1650
|
}
|
|
2144
|
-
const
|
|
2145
|
-
if (!
|
|
1651
|
+
const taskId = opt.taskId;
|
|
1652
|
+
if (!taskId) {
|
|
2146
1653
|
resolve('');
|
|
2147
1654
|
return;
|
|
2148
1655
|
}
|
|
2149
|
-
const taskId = getTaskId(formId);
|
|
2150
1656
|
const t = task.list[taskId];
|
|
2151
1657
|
if (!t) {
|
|
2152
1658
|
resolve('');
|
|
2153
1659
|
return;
|
|
2154
1660
|
}
|
|
2155
|
-
const locale = t.
|
|
1661
|
+
const locale = t.locale.lang || core.config.locale;
|
|
2156
1662
|
if (opt.buttons === undefined) {
|
|
2157
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];
|
|
2158
1664
|
}
|
|
2159
1665
|
create({
|
|
2160
|
-
'taskId': taskId,
|
|
2161
|
-
'formId': formId,
|
|
2162
|
-
'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>`,
|
|
2163
1666
|
'code': {
|
|
2164
1667
|
data: {
|
|
2165
1668
|
'buttons': opt.buttons
|
|
@@ -2175,14 +1678,17 @@ function dialog(opt) {
|
|
|
2175
1678
|
};
|
|
2176
1679
|
(_b = (_a = opt).select) === null || _b === void 0 ? void 0 : _b.call(_a, event, button);
|
|
2177
1680
|
if (event.go) {
|
|
1681
|
+
this.dialogResult = button;
|
|
2178
1682
|
close(this.formId);
|
|
2179
|
-
resolve(button);
|
|
2180
1683
|
}
|
|
2181
1684
|
}
|
|
2182
1685
|
}
|
|
2183
1686
|
},
|
|
2184
|
-
'
|
|
2185
|
-
|
|
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) => {
|
|
2186
1692
|
throw e;
|
|
2187
1693
|
});
|
|
2188
1694
|
});
|
|
@@ -2196,22 +1702,21 @@ function confirm(opt) {
|
|
|
2196
1702
|
'content': opt
|
|
2197
1703
|
};
|
|
2198
1704
|
}
|
|
2199
|
-
const
|
|
2200
|
-
if (!
|
|
1705
|
+
const taskId = opt.taskId;
|
|
1706
|
+
if (!taskId) {
|
|
2201
1707
|
return false;
|
|
2202
1708
|
}
|
|
2203
|
-
const taskId = getTaskId(formId);
|
|
2204
1709
|
const t = task.list[taskId];
|
|
2205
1710
|
if (!t) {
|
|
2206
1711
|
return false;
|
|
2207
1712
|
}
|
|
2208
|
-
const locale = t.
|
|
1713
|
+
const locale = t.locale.lang || core.config.locale;
|
|
2209
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];
|
|
2210
1715
|
if (opt.cancel) {
|
|
2211
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);
|
|
2212
1717
|
}
|
|
2213
1718
|
const res = yield dialog({
|
|
2214
|
-
'
|
|
1719
|
+
'taskId': taskId,
|
|
2215
1720
|
'content': opt.content,
|
|
2216
1721
|
'buttons': buttons
|
|
2217
1722
|
});
|
|
@@ -2225,37 +1730,18 @@ function confirm(opt) {
|
|
|
2225
1730
|
});
|
|
2226
1731
|
}
|
|
2227
1732
|
exports.confirm = confirm;
|
|
2228
|
-
function
|
|
2229
|
-
|
|
2230
|
-
if (!form) {
|
|
1733
|
+
function flash(formId, taskId) {
|
|
1734
|
+
if (!taskId) {
|
|
2231
1735
|
return;
|
|
2232
1736
|
}
|
|
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
1737
|
const form = getForm(taskId, formId);
|
|
2252
1738
|
if (!form) {
|
|
2253
1739
|
return;
|
|
2254
1740
|
}
|
|
2255
|
-
if (!form.vroot.
|
|
1741
|
+
if (!form.vroot._formFocus) {
|
|
2256
1742
|
changeFocus(form.id);
|
|
2257
1743
|
}
|
|
2258
|
-
if (
|
|
1744
|
+
if (form.vroot.$refs.form.flashTimer) {
|
|
2259
1745
|
clearTimeout(form.vroot.$refs.form.flashTimer);
|
|
2260
1746
|
form.vroot.$refs.form.flashTimer = undefined;
|
|
2261
1747
|
}
|
|
@@ -2267,22 +1753,6 @@ function flash(formId, taskId) {
|
|
|
2267
1753
|
core.trigger('formFlash', taskId, formId);
|
|
2268
1754
|
}
|
|
2269
1755
|
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
1756
|
function showLauncher() {
|
|
2287
1757
|
elements.launcher.style.display = 'flex';
|
|
2288
1758
|
requestAnimationFrame(function () {
|