clickgo 3.1.4-dev13 → 3.1.5-dev14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/app/demo/app.js +1 -1
- package/dist/app/demo/config.json +5 -2
- package/dist/app/demo/form/control/text/text.js +1 -0
- package/dist/app/demo/form/control/text/text.xml +1 -1
- package/dist/app/demo/form/main.js +47 -52
- package/dist/app/demo/form/method/aform/aform.js +1 -13
- package/dist/app/demo/form/method/aform/aform.xml +0 -1
- package/dist/app/demo/form/method/aform/sd.js +1 -4
- package/dist/app/demo/form/method/form/form.js +5 -6
- package/dist/app/demo/form/method/form/form.xml +1 -0
- package/dist/app/demo/form/method/{aform → form}/test.xml +0 -0
- package/dist/app/demo/form/method/fs/fs.js +1 -4
- package/dist/app/demo/form/method/tool/tool.js +3 -0
- package/dist/app/demo/form/method/tool/tool.xml +1 -0
- package/dist/app/demo/form/method/zip/zip.js +1 -4
- package/dist/app/task/app.js +1 -1
- package/dist/control/common.cgc +0 -0
- package/dist/lib/core.js +0 -5
- package/dist/lib/core.ts +1 -7
- package/dist/lib/form.js +163 -182
- package/dist/lib/form.ts +200 -212
- package/dist/lib/fs.js +1 -1
- package/dist/lib/fs.ts +1 -1
- package/dist/lib/task.js +16 -3
- package/dist/lib/task.ts +24 -3
- package/dist/lib/tool.js +39 -1
- package/dist/lib/tool.ts +45 -0
- package/package.json +2 -2
- package/types/index.d.ts +9 -36
package/dist/lib/form.js
CHANGED
|
@@ -60,80 +60,6 @@ class AbstractForm {
|
|
|
60
60
|
this._firstShow = true;
|
|
61
61
|
this.dialogResult = '';
|
|
62
62
|
}
|
|
63
|
-
static create(data, layout) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const frm = new this();
|
|
66
|
-
const code = {
|
|
67
|
-
'data': {},
|
|
68
|
-
'methods': {},
|
|
69
|
-
'computed': {},
|
|
70
|
-
beforeCreate: frm.onBeforeCreate,
|
|
71
|
-
created: function () {
|
|
72
|
-
this.onCreated();
|
|
73
|
-
},
|
|
74
|
-
beforeMount: function () {
|
|
75
|
-
this.onBeforeMount();
|
|
76
|
-
},
|
|
77
|
-
mounted: function (data) {
|
|
78
|
-
this.onMounted(data);
|
|
79
|
-
},
|
|
80
|
-
beforeUpdate: function () {
|
|
81
|
-
this.onBeforeUpdate();
|
|
82
|
-
},
|
|
83
|
-
updated: function () {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
yield this.$nextTick();
|
|
86
|
-
this.onUpdated();
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
beforeUnmount: function () {
|
|
90
|
-
this.onBeforeUnmount();
|
|
91
|
-
},
|
|
92
|
-
unmounted: function () {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
yield this.$nextTick();
|
|
95
|
-
this.onUnmounted();
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const cdata = Object.entries(frm);
|
|
100
|
-
for (const item of cdata) {
|
|
101
|
-
if (item[0] === 'access') {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
code.data[item[0]] = item[1];
|
|
105
|
-
}
|
|
106
|
-
if (!layout) {
|
|
107
|
-
const l = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'xml'];
|
|
108
|
-
if (typeof l !== 'string') {
|
|
109
|
-
return 0;
|
|
110
|
-
}
|
|
111
|
-
layout = l;
|
|
112
|
-
}
|
|
113
|
-
const prot = tool.getClassPrototype(frm);
|
|
114
|
-
code.methods = prot.method;
|
|
115
|
-
code.computed = prot.access;
|
|
116
|
-
let style = undefined;
|
|
117
|
-
const fstyle = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'css'];
|
|
118
|
-
if (typeof fstyle === 'string') {
|
|
119
|
-
style = fstyle;
|
|
120
|
-
}
|
|
121
|
-
const fid = yield create({
|
|
122
|
-
'code': code,
|
|
123
|
-
'layout': layout,
|
|
124
|
-
'style': style,
|
|
125
|
-
'path': frm.filename.slice(0, frm.filename.lastIndexOf('/')),
|
|
126
|
-
'data': data,
|
|
127
|
-
'taskId': frm.taskId
|
|
128
|
-
});
|
|
129
|
-
if (fid > 0) {
|
|
130
|
-
return task.list[frm.taskId].forms[fid].vroot;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
return fid;
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
63
|
get filename() {
|
|
138
64
|
return '';
|
|
139
65
|
}
|
|
@@ -205,21 +131,6 @@ class AbstractForm {
|
|
|
205
131
|
}
|
|
206
132
|
core.trigger(name, this.taskId, this.formId, param1, param2);
|
|
207
133
|
}
|
|
208
|
-
createForm(path, data) {
|
|
209
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
-
path = tool.urlResolve(this.filename, path);
|
|
211
|
-
const taskId = this.taskId;
|
|
212
|
-
const cls = class extends AbstractForm {
|
|
213
|
-
get filename() {
|
|
214
|
-
return path + '.js';
|
|
215
|
-
}
|
|
216
|
-
get taskId() {
|
|
217
|
-
return taskId;
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
return cls.create(data);
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
134
|
get topMost() {
|
|
224
135
|
return false;
|
|
225
136
|
}
|
|
@@ -237,7 +148,6 @@ class AbstractForm {
|
|
|
237
148
|
}
|
|
238
149
|
show() {
|
|
239
150
|
const v = this;
|
|
240
|
-
v.$refs.form.$data.isShow = true;
|
|
241
151
|
if (this._firstShow) {
|
|
242
152
|
this._firstShow = false;
|
|
243
153
|
const area = core.getAvailArea();
|
|
@@ -252,6 +162,9 @@ class AbstractForm {
|
|
|
252
162
|
v.$refs.form.$data.isShow = true;
|
|
253
163
|
changeFocus(this.formId);
|
|
254
164
|
}
|
|
165
|
+
else {
|
|
166
|
+
v.$refs.form.$data.isShow = true;
|
|
167
|
+
}
|
|
255
168
|
}
|
|
256
169
|
showDialog() {
|
|
257
170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1476,60 +1389,89 @@ function getForm(taskId, formId) {
|
|
|
1476
1389
|
}
|
|
1477
1390
|
return form;
|
|
1478
1391
|
}
|
|
1479
|
-
function create(opt) {
|
|
1480
|
-
var _a, _b
|
|
1392
|
+
function create(cls, data, opt = {}, taskId) {
|
|
1393
|
+
var _a, _b;
|
|
1481
1394
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1482
|
-
if (!
|
|
1483
|
-
|
|
1395
|
+
if (!taskId) {
|
|
1396
|
+
const err = new Error('form.create: -1');
|
|
1397
|
+
core.trigger('error', 0, 0, err, err.message);
|
|
1398
|
+
throw err;
|
|
1484
1399
|
}
|
|
1485
|
-
const t = task.list[
|
|
1400
|
+
const t = task.list[taskId];
|
|
1486
1401
|
if (!t) {
|
|
1487
|
-
|
|
1402
|
+
const err = new Error('form.create: -2');
|
|
1403
|
+
core.trigger('error', 0, 0, err, err.message);
|
|
1404
|
+
throw err;
|
|
1488
1405
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
return -3;
|
|
1493
|
-
}
|
|
1494
|
-
let data = {};
|
|
1495
|
-
let access = {};
|
|
1496
|
-
let methods = undefined;
|
|
1497
|
-
let computed = {};
|
|
1498
|
-
let beforeCreate = undefined;
|
|
1499
|
-
let created = undefined;
|
|
1500
|
-
let beforeMount = undefined;
|
|
1501
|
-
let mounted = undefined;
|
|
1502
|
-
let beforeUpdate = undefined;
|
|
1503
|
-
let updated = undefined;
|
|
1504
|
-
let beforeUnmount = undefined;
|
|
1505
|
-
let unmounted = undefined;
|
|
1506
|
-
if (opt.code) {
|
|
1507
|
-
data = (_b = opt.code.data) !== null && _b !== void 0 ? _b : {};
|
|
1508
|
-
access = (_c = opt.code.access) !== null && _c !== void 0 ? _c : {};
|
|
1509
|
-
methods = opt.code.methods;
|
|
1510
|
-
computed = (_d = opt.code.computed) !== null && _d !== void 0 ? _d : {};
|
|
1511
|
-
beforeCreate = opt.code.beforeCreate;
|
|
1512
|
-
created = opt.code.created;
|
|
1513
|
-
beforeMount = opt.code.beforeMount;
|
|
1514
|
-
mounted = opt.code.mounted;
|
|
1515
|
-
beforeUpdate = opt.code.beforeUpdate;
|
|
1516
|
-
updated = opt.code.updated;
|
|
1517
|
-
beforeUnmount = opt.code.beforeUnmount;
|
|
1518
|
-
unmounted = opt.code.unmounted;
|
|
1406
|
+
let layout = '';
|
|
1407
|
+
if (opt.layout) {
|
|
1408
|
+
layout = opt.layout;
|
|
1519
1409
|
}
|
|
1520
1410
|
let style = '';
|
|
1521
|
-
let prep = '';
|
|
1522
1411
|
if (opt.style) {
|
|
1523
|
-
|
|
1412
|
+
style = opt.style;
|
|
1413
|
+
}
|
|
1414
|
+
let prep = '';
|
|
1415
|
+
let filename = '';
|
|
1416
|
+
if (typeof cls === 'string') {
|
|
1417
|
+
filename = tool.urlResolve((_a = opt.path) !== null && _a !== void 0 ? _a : '/', cls);
|
|
1418
|
+
if (!layout) {
|
|
1419
|
+
const l = t.app.files[filename + '.xml'];
|
|
1420
|
+
if (typeof l !== 'string') {
|
|
1421
|
+
const err = new Error('form.create: -3');
|
|
1422
|
+
core.trigger('error', 0, 0, err, err.message);
|
|
1423
|
+
throw err;
|
|
1424
|
+
}
|
|
1425
|
+
layout = l;
|
|
1426
|
+
}
|
|
1427
|
+
if (!style) {
|
|
1428
|
+
const s = t.app.files[filename + '.css'];
|
|
1429
|
+
if (typeof s === 'string') {
|
|
1430
|
+
style = s;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
cls = class extends AbstractForm {
|
|
1434
|
+
get filename() {
|
|
1435
|
+
return filename + '.js';
|
|
1436
|
+
}
|
|
1437
|
+
get taskId() {
|
|
1438
|
+
return t.id;
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
const formId = ++info.lastId;
|
|
1443
|
+
const frm = new cls();
|
|
1444
|
+
if (!filename) {
|
|
1445
|
+
filename = frm.filename;
|
|
1446
|
+
}
|
|
1447
|
+
const lio = filename.lastIndexOf('/');
|
|
1448
|
+
const path = filename.slice(0, lio);
|
|
1449
|
+
if (!style) {
|
|
1450
|
+
const s = t.app.files[filename.slice(0, -2) + 'css'];
|
|
1451
|
+
if (typeof s === 'string') {
|
|
1452
|
+
style = s;
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
if (style) {
|
|
1456
|
+
const r = tool.stylePrepend(style);
|
|
1524
1457
|
prep = r.prep;
|
|
1525
|
-
style = yield tool.styleUrl2DataUrl(
|
|
1458
|
+
style = yield tool.styleUrl2DataUrl(path + '/', r.style, t.app.files);
|
|
1459
|
+
}
|
|
1460
|
+
if (!layout) {
|
|
1461
|
+
const l = t.app.files[frm.filename.slice(0, -2) + 'xml'];
|
|
1462
|
+
if (typeof l !== 'string') {
|
|
1463
|
+
const err = new Error('form.create: -4');
|
|
1464
|
+
core.trigger('error', 0, 0, err, err.message);
|
|
1465
|
+
throw err;
|
|
1466
|
+
}
|
|
1467
|
+
layout = l;
|
|
1526
1468
|
}
|
|
1527
|
-
|
|
1469
|
+
layout = tool.purify(layout);
|
|
1528
1470
|
layout = tool.layoutAddTagClassAndReTagName(layout, true);
|
|
1529
1471
|
layout = tool.layoutInsertAttr(layout, ':form-focus=\'formFocus\'', {
|
|
1530
1472
|
'include': [/^cg-.+/]
|
|
1531
1473
|
});
|
|
1532
|
-
const prepList = ['cg-task' +
|
|
1474
|
+
const prepList = ['cg-task' + t.id.toString() + '_'];
|
|
1533
1475
|
if (prep !== '') {
|
|
1534
1476
|
prepList.push(prep);
|
|
1535
1477
|
}
|
|
@@ -1538,9 +1480,27 @@ function create(opt) {
|
|
|
1538
1480
|
if (layout.includes('<teleport')) {
|
|
1539
1481
|
layout = tool.teleportGlue(layout, formId);
|
|
1540
1482
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1483
|
+
const components = control.buildComponents(t.id, formId, path);
|
|
1484
|
+
if (!components) {
|
|
1485
|
+
const err = new Error('form.create: -5');
|
|
1486
|
+
core.trigger('error', 0, 0, err, err.message);
|
|
1487
|
+
throw err;
|
|
1488
|
+
}
|
|
1489
|
+
const idata = {};
|
|
1490
|
+
const cdata = Object.entries(frm);
|
|
1491
|
+
for (const item of cdata) {
|
|
1492
|
+
if (item[0] === 'access') {
|
|
1493
|
+
continue;
|
|
1494
|
+
}
|
|
1495
|
+
idata[item[0]] = item[1];
|
|
1496
|
+
}
|
|
1497
|
+
idata._formFocus = false;
|
|
1498
|
+
if (clickgo.isNative() && (formId === 1) && !clickgo.isImmersion() && !clickgo.hasFrame()) {
|
|
1499
|
+
idata.isNativeSync = true;
|
|
1500
|
+
}
|
|
1501
|
+
const prot = tool.getClassPrototype(frm);
|
|
1502
|
+
const methods = prot.method;
|
|
1503
|
+
const computed = prot.access;
|
|
1544
1504
|
computed.formId = {
|
|
1545
1505
|
get: function () {
|
|
1546
1506
|
return formId;
|
|
@@ -1554,11 +1514,9 @@ function create(opt) {
|
|
|
1554
1514
|
return;
|
|
1555
1515
|
}
|
|
1556
1516
|
};
|
|
1557
|
-
data._formFocus = false;
|
|
1558
1517
|
computed.path = {
|
|
1559
1518
|
get: function () {
|
|
1560
|
-
|
|
1561
|
-
return (_a = opt.path) !== null && _a !== void 0 ? _a : '';
|
|
1519
|
+
return path;
|
|
1562
1520
|
},
|
|
1563
1521
|
set: function () {
|
|
1564
1522
|
notify({
|
|
@@ -1582,7 +1540,7 @@ function create(opt) {
|
|
|
1582
1540
|
return;
|
|
1583
1541
|
}
|
|
1584
1542
|
};
|
|
1585
|
-
|
|
1543
|
+
idata._topMost = false;
|
|
1586
1544
|
computed.topMost = {
|
|
1587
1545
|
get: function () {
|
|
1588
1546
|
return this._topMost;
|
|
@@ -1608,26 +1566,30 @@ function create(opt) {
|
|
|
1608
1566
|
return;
|
|
1609
1567
|
}
|
|
1610
1568
|
};
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
}
|
|
1569
|
+
exports.elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${t.id.toString()}"></div>`);
|
|
1570
|
+
exports.elements.popList.insertAdjacentHTML('beforeend', `<div data-form-id="${formId.toString()}" data-task-id="${t.id.toString()}"></div>`);
|
|
1614
1571
|
if (style) {
|
|
1615
|
-
dom.pushStyle(
|
|
1572
|
+
dom.pushStyle(t.id, style, 'form', formId);
|
|
1616
1573
|
}
|
|
1574
|
+
const el = exports.elements.list.children.item(exports.elements.list.children.length - 1);
|
|
1617
1575
|
const rtn = yield new Promise(function (resolve) {
|
|
1618
1576
|
const vapp = clickgo.vue.createApp({
|
|
1619
1577
|
'template': layout.replace(/^<cg-form/, '<cg-form ref="form"'),
|
|
1620
1578
|
'data': function () {
|
|
1621
|
-
return tool.clone(
|
|
1579
|
+
return tool.clone(idata);
|
|
1622
1580
|
},
|
|
1623
1581
|
'methods': methods,
|
|
1624
1582
|
'computed': computed,
|
|
1625
|
-
'beforeCreate':
|
|
1583
|
+
'beforeCreate': frm.onBeforeCreate,
|
|
1626
1584
|
'created': function () {
|
|
1627
|
-
|
|
1628
|
-
|
|
1585
|
+
if (frm.access) {
|
|
1586
|
+
this.access = tool.clone(frm.access);
|
|
1587
|
+
}
|
|
1588
|
+
this.onCreated();
|
|
1589
|
+
},
|
|
1590
|
+
'beforeMount': function () {
|
|
1591
|
+
this.onBeforeMount();
|
|
1629
1592
|
},
|
|
1630
|
-
'beforeMount': beforeMount,
|
|
1631
1593
|
'mounted': function () {
|
|
1632
1594
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1633
1595
|
yield this.$nextTick();
|
|
@@ -1644,10 +1606,24 @@ function create(opt) {
|
|
|
1644
1606
|
});
|
|
1645
1607
|
});
|
|
1646
1608
|
},
|
|
1647
|
-
'beforeUpdate':
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
'
|
|
1609
|
+
'beforeUpdate': function () {
|
|
1610
|
+
this.onBeforeUpdate();
|
|
1611
|
+
},
|
|
1612
|
+
'updated': function () {
|
|
1613
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1614
|
+
yield this.$nextTick();
|
|
1615
|
+
this.onUpdated();
|
|
1616
|
+
});
|
|
1617
|
+
},
|
|
1618
|
+
'beforeUnmount': function () {
|
|
1619
|
+
this.onBeforeUnmount();
|
|
1620
|
+
},
|
|
1621
|
+
'unmounted': function () {
|
|
1622
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1623
|
+
yield this.$nextTick();
|
|
1624
|
+
this.onUnmounted();
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1651
1627
|
});
|
|
1652
1628
|
vapp.config.errorHandler = function (err, vm, info) {
|
|
1653
1629
|
notify({
|
|
@@ -1666,10 +1642,10 @@ function create(opt) {
|
|
|
1666
1642
|
catch (err) {
|
|
1667
1643
|
notify({
|
|
1668
1644
|
'title': 'Runtime Error',
|
|
1669
|
-
'content': `Message: ${err.message}\nTask id: ${
|
|
1645
|
+
'content': `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}`,
|
|
1670
1646
|
'type': 'danger'
|
|
1671
1647
|
});
|
|
1672
|
-
core.trigger('error',
|
|
1648
|
+
core.trigger('error', t.id, formId, err, err.message);
|
|
1673
1649
|
}
|
|
1674
1650
|
});
|
|
1675
1651
|
const nform = {
|
|
@@ -1679,35 +1655,33 @@ function create(opt) {
|
|
|
1679
1655
|
};
|
|
1680
1656
|
t.forms[formId] = nform;
|
|
1681
1657
|
yield tool.sleep(34);
|
|
1682
|
-
|
|
1658
|
+
try {
|
|
1659
|
+
yield frm.onMounted.call(rtn.vroot, data !== null && data !== void 0 ? data : {});
|
|
1660
|
+
}
|
|
1661
|
+
catch (err) {
|
|
1662
|
+
core.trigger('error', rtn.vroot.taskId, rtn.vroot.formId, err, 'Create form mounted error: -7.');
|
|
1663
|
+
delete t.forms[formId];
|
|
1683
1664
|
try {
|
|
1684
|
-
|
|
1665
|
+
rtn.vapp.unmount();
|
|
1685
1666
|
}
|
|
1686
1667
|
catch (err) {
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
notify({
|
|
1695
|
-
'title': 'Form Unmount Error',
|
|
1696
|
-
'content': msg,
|
|
1697
|
-
'type': 'danger'
|
|
1698
|
-
});
|
|
1699
|
-
console.log('Form Unmount Error', msg, err);
|
|
1700
|
-
}
|
|
1701
|
-
rtn.vapp._container.remove();
|
|
1702
|
-
(_f = exports.elements.popList.querySelector('[data-form-id="' + rtn.vroot.formId + '"]')) === null || _f === void 0 ? void 0 : _f.remove();
|
|
1703
|
-
dom.clearWatchStyle(rtn.vroot.formId);
|
|
1704
|
-
dom.clearWatchProperty(rtn.vroot.formId);
|
|
1705
|
-
native.clear(formId, t.id);
|
|
1706
|
-
dom.removeStyle(rtn.vroot.taskId, 'form', rtn.vroot.formId);
|
|
1707
|
-
return -8;
|
|
1668
|
+
const msg = `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}\nFunction: form.create, unmount.`;
|
|
1669
|
+
notify({
|
|
1670
|
+
'title': 'Form Unmount Error',
|
|
1671
|
+
'content': msg,
|
|
1672
|
+
'type': 'danger'
|
|
1673
|
+
});
|
|
1674
|
+
console.log('Form Unmount Error', msg, err);
|
|
1708
1675
|
}
|
|
1709
|
-
|
|
1710
|
-
|
|
1676
|
+
rtn.vapp._container.remove();
|
|
1677
|
+
(_b = exports.elements.popList.querySelector('[data-form-id="' + rtn.vroot.formId + '"]')) === null || _b === void 0 ? void 0 : _b.remove();
|
|
1678
|
+
dom.clearWatchStyle(rtn.vroot.formId);
|
|
1679
|
+
dom.clearWatchProperty(rtn.vroot.formId);
|
|
1680
|
+
native.clear(formId, t.id);
|
|
1681
|
+
dom.removeStyle(rtn.vroot.taskId, 'form', rtn.vroot.formId);
|
|
1682
|
+
throw err;
|
|
1683
|
+
}
|
|
1684
|
+
core.trigger('formCreated', t.id, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconDataUrl);
|
|
1711
1685
|
if (rtn.vroot.isNativeSync) {
|
|
1712
1686
|
yield native.invoke('cg-set-size', native.getToken(), rtn.vroot.$refs.form.$el.offsetWidth, rtn.vroot.$refs.form.$el.offsetHeight);
|
|
1713
1687
|
window.addEventListener('resize', function () {
|
|
@@ -1715,18 +1689,19 @@ function create(opt) {
|
|
|
1715
1689
|
rtn.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
1716
1690
|
});
|
|
1717
1691
|
}
|
|
1718
|
-
return
|
|
1692
|
+
return rtn.vroot;
|
|
1719
1693
|
});
|
|
1720
1694
|
}
|
|
1721
1695
|
exports.create = create;
|
|
1722
1696
|
function dialog(opt) {
|
|
1723
1697
|
return new Promise(function (resolve) {
|
|
1724
|
-
var _a, _b, _c;
|
|
1698
|
+
var _a, _b, _c, _d;
|
|
1725
1699
|
if (typeof opt === 'string') {
|
|
1726
1700
|
opt = {
|
|
1727
1701
|
'content': opt
|
|
1728
1702
|
};
|
|
1729
1703
|
}
|
|
1704
|
+
const filename = tool.urlResolve((_a = opt.path) !== null && _a !== void 0 ? _a : '/', './tmp' + (Math.random() * 100000000000000).toFixed() + '.js');
|
|
1730
1705
|
const nopt = opt;
|
|
1731
1706
|
const taskId = nopt.taskId;
|
|
1732
1707
|
if (!taskId) {
|
|
@@ -1740,13 +1715,16 @@ function dialog(opt) {
|
|
|
1740
1715
|
}
|
|
1741
1716
|
const locale = t.locale.lang || core.config.locale;
|
|
1742
1717
|
if (nopt.buttons === undefined) {
|
|
1743
|
-
nopt.buttons = [(
|
|
1718
|
+
nopt.buttons = [(_c = (_b = info.locale[locale]) === null || _b === void 0 ? void 0 : _b.ok) !== null && _c !== void 0 ? _c : info.locale['en'].ok];
|
|
1744
1719
|
}
|
|
1745
1720
|
const cls = class extends AbstractForm {
|
|
1746
1721
|
constructor() {
|
|
1747
1722
|
super(...arguments);
|
|
1748
1723
|
this.buttons = nopt.buttons;
|
|
1749
1724
|
}
|
|
1725
|
+
get filename() {
|
|
1726
|
+
return filename;
|
|
1727
|
+
}
|
|
1750
1728
|
get taskId() {
|
|
1751
1729
|
return taskId;
|
|
1752
1730
|
}
|
|
@@ -1765,7 +1743,10 @@ function dialog(opt) {
|
|
|
1765
1743
|
}
|
|
1766
1744
|
}
|
|
1767
1745
|
};
|
|
1768
|
-
|
|
1746
|
+
create(cls, undefined, {
|
|
1747
|
+
'layout': `<form title="${(_d = nopt.title) !== null && _d !== void 0 ? _d : 'dialog'}" min="false" max="false" resize="false" height="0" width="0" border="${nopt.title ? 'normal' : 'plain'}" direction="v"><dialog :buttons="buttons" @select="select"${nopt.direction ? ` direction="${nopt.direction}"` : ''}>${nopt.content}</dialog></form>`,
|
|
1748
|
+
'style': nopt.style
|
|
1749
|
+
}, t.id).then((frm) => {
|
|
1769
1750
|
if (typeof frm === 'number') {
|
|
1770
1751
|
resolve('');
|
|
1771
1752
|
return;
|