clickgo 3.1.0-dev9 → 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/dist/app/demo/form/control/dialog/dialog.js +10 -6
- package/dist/app/demo/form/main.js +14 -0
- package/dist/app/demo/form/main.xml +3 -3
- package/dist/app/demo/form/method/form/form.js +103 -101
- package/dist/app/demo/form/method/form/form.xml +9 -10
- 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.ts +1 -1
- package/dist/lib/form.js +77 -51
- package/dist/lib/form.ts +90 -56
- package/dist/lib/task.js +3 -0
- package/dist/lib/task.ts +3 -0
- package/dist/lib/tool.ts +1 -0
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +1 -1
- package/types/index.d.ts +10 -10
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const clickgo = require("clickgo");
|
|
4
|
+
class default_1 extends clickgo.form.AbstractForm {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.message = 'message';
|
|
8
|
+
this.buttons = ['OK'];
|
|
9
|
+
this.btn = 'none';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.default = default_1;
|
|
@@ -11,6 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const clickgo = require("clickgo");
|
|
13
13
|
const form_1 = require("./control/form/form");
|
|
14
|
+
const dialog_1 = require("./control/dialog/dialog");
|
|
15
|
+
const form_2 = require("./method/form/form");
|
|
14
16
|
class default_1 extends clickgo.form.AbstractForm {
|
|
15
17
|
constructor() {
|
|
16
18
|
super(...arguments);
|
|
@@ -20,10 +22,22 @@ class default_1 extends clickgo.form.AbstractForm {
|
|
|
20
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
23
|
let frm = 0;
|
|
22
24
|
switch (name) {
|
|
25
|
+
case 'cblock': {
|
|
26
|
+
frm = yield this.createForm('control/block/block');
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
23
29
|
case 'cform': {
|
|
24
30
|
frm = yield form_1.default.create();
|
|
25
31
|
break;
|
|
26
32
|
}
|
|
33
|
+
case 'cdialog': {
|
|
34
|
+
frm = yield dialog_1.default.create();
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case 'mform': {
|
|
38
|
+
frm = yield form_2.default.create();
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
27
41
|
}
|
|
28
42
|
if (typeof frm === 'number') {
|
|
29
43
|
return;
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
<button @click="openForm('control', 'tab')">Tab</button>
|
|
12
12
|
<button @click="openForm('control', 'label')">Label</button>
|
|
13
13
|
<button @click="openForm('control', 'loading')">Loading</button>
|
|
14
|
-
<button @click="openForm('
|
|
14
|
+
<button @click="openForm('cdialog')">Dialog</button>
|
|
15
15
|
<button @click="openForm('control', 'file')">File</button>
|
|
16
|
-
<button @click="openForm('
|
|
16
|
+
<button @click="openForm('cblock')">Block</button>
|
|
17
17
|
<button @click="openForm('control', 'overflow')">Overflow</button>
|
|
18
18
|
<button @click="openForm('control', 'view')">View</button>
|
|
19
19
|
<button @click="openForm('control', 'greatview')">Greatview</button>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<layout class="buttons" gutter="10" direction="v">
|
|
31
31
|
<button @click="openForm('method', 'core')">Library core</button>
|
|
32
32
|
<button @click="openForm('method', 'dom')">Library dom</button>
|
|
33
|
-
<button @click="openForm('
|
|
33
|
+
<button @click="openForm('mform')">Library form</button>
|
|
34
34
|
<button @click="openForm('method', 'fs')">Library fs</button>
|
|
35
35
|
<button @click="openForm('method', 'task')">Library task</button>
|
|
36
36
|
<button @click="openForm('method', 'theme')">Library theme</button>
|
|
@@ -9,76 +9,76 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.mounted = exports.receive = exports.methods = exports.data = void 0;
|
|
13
12
|
const clickgo = require("clickgo");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
class default_1 extends clickgo.form.AbstractForm {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.fid = '0';
|
|
17
|
+
this.sendValue = 'sendValue';
|
|
18
|
+
this.tid = '0';
|
|
19
|
+
this.type = 'primary';
|
|
20
|
+
this.progress = 'noraml';
|
|
21
|
+
this.dr = '';
|
|
22
|
+
this.setTopMostValue = false;
|
|
23
|
+
}
|
|
24
|
+
min() {
|
|
25
|
+
clickgo.form.min(this.formId);
|
|
26
|
+
}
|
|
27
|
+
max() {
|
|
28
|
+
clickgo.form.max(this.formId);
|
|
29
|
+
}
|
|
30
|
+
close() {
|
|
31
|
+
clickgo.form.close(this.formId);
|
|
32
|
+
}
|
|
33
|
+
bindResize(e) {
|
|
34
34
|
clickgo.form.bindResize(e, 'rb');
|
|
35
|
-
}
|
|
36
|
-
bindDrag
|
|
35
|
+
}
|
|
36
|
+
bindDrag(e) {
|
|
37
37
|
clickgo.form.bindDrag(e);
|
|
38
|
-
}
|
|
39
|
-
getTaskId
|
|
38
|
+
}
|
|
39
|
+
getTaskId() {
|
|
40
40
|
clickgo.form.dialog(clickgo.form.getTaskId(parseInt(this.fid)).toString()).catch((e) => { throw e; });
|
|
41
|
-
}
|
|
42
|
-
get
|
|
41
|
+
}
|
|
42
|
+
get() {
|
|
43
43
|
clickgo.form.dialog(JSON.stringify(clickgo.form.get(parseInt(this.fid)))).catch((e) => { throw e; });
|
|
44
|
-
}
|
|
45
|
-
send
|
|
44
|
+
}
|
|
45
|
+
send() {
|
|
46
46
|
clickgo.form.send(parseInt(this.fid), {
|
|
47
47
|
'key': this.sendValue
|
|
48
48
|
});
|
|
49
|
-
}
|
|
50
|
-
changeFocus
|
|
49
|
+
}
|
|
50
|
+
changeFocus() {
|
|
51
51
|
clickgo.form.changeFocus(parseInt(this.fid));
|
|
52
|
-
}
|
|
53
|
-
getList
|
|
52
|
+
}
|
|
53
|
+
getList() {
|
|
54
54
|
let str = JSON.stringify(clickgo.form.getList(this.taskId));
|
|
55
55
|
str = str.replace(/"icon":"(.*?)"/g, function (t, t1) {
|
|
56
56
|
return `"icon":"${t1 ? (t1.slice(0, 10) + '...') : t1}"`;
|
|
57
57
|
});
|
|
58
58
|
clickgo.form.dialog(`<overflow direction="v" style="width: 200px; height: 80px;">${str}</overflow>`).catch((e) => { throw e; });
|
|
59
|
-
}
|
|
60
|
-
getMaxZIndexID
|
|
59
|
+
}
|
|
60
|
+
getMaxZIndexID() {
|
|
61
61
|
const fid = clickgo.form.getMaxZIndexID();
|
|
62
62
|
clickgo.form.dialog(JSON.stringify(fid)).catch((e) => { throw e; });
|
|
63
|
-
}
|
|
64
|
-
getRectByBorder
|
|
63
|
+
}
|
|
64
|
+
getRectByBorder() {
|
|
65
65
|
const size = clickgo.form.getRectByBorder('rb');
|
|
66
66
|
clickgo.form.dialog(JSON.stringify(size)).catch((e) => { throw e; });
|
|
67
|
-
}
|
|
68
|
-
showCircular
|
|
67
|
+
}
|
|
68
|
+
showCircular(e) {
|
|
69
69
|
clickgo.form.showCircular(e.clientX, e.clientY);
|
|
70
|
-
}
|
|
71
|
-
showRectangle
|
|
70
|
+
}
|
|
71
|
+
showRectangle(e) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
73
|
clickgo.form.showRectangle(e.clientX, e.clientY, 'rb');
|
|
74
74
|
yield clickgo.tool.sleep(1000);
|
|
75
75
|
clickgo.form.hideRectangle();
|
|
76
76
|
});
|
|
77
|
-
}
|
|
78
|
-
showDrag
|
|
77
|
+
}
|
|
78
|
+
showDrag() {
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
clickgo.form.showDrag();
|
|
81
|
-
const rect = this
|
|
81
|
+
const rect = this.refs.showDrag.$el.getBoundingClientRect();
|
|
82
82
|
clickgo.form.moveDrag({
|
|
83
83
|
'left': rect.left,
|
|
84
84
|
'top': rect.top,
|
|
@@ -88,8 +88,8 @@ exports.methods = {
|
|
|
88
88
|
yield clickgo.tool.sleep(1000);
|
|
89
89
|
clickgo.form.hideDrag();
|
|
90
90
|
});
|
|
91
|
-
}
|
|
92
|
-
notify
|
|
91
|
+
}
|
|
92
|
+
notify() {
|
|
93
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
94
|
let icon = null;
|
|
95
95
|
if (this.progress === 'progress + icon') {
|
|
@@ -117,56 +117,59 @@ exports.methods = {
|
|
|
117
117
|
clickgo.form.notifyProgress(nid, 100);
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
-
}
|
|
121
|
-
showPop
|
|
120
|
+
}
|
|
121
|
+
showPop(e) {
|
|
122
122
|
if (!e.currentTarget) {
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
clickgo.form.showPop(e.currentTarget, this
|
|
126
|
-
}
|
|
127
|
-
createParam
|
|
125
|
+
clickgo.form.showPop(e.currentTarget, this.refs.pop, 'v');
|
|
126
|
+
}
|
|
127
|
+
createParam() {
|
|
128
128
|
clickgo.form.create({
|
|
129
129
|
'layout': '<form width=\'300\' height=\'300\' title=\'normal\'></form>'
|
|
130
130
|
}).catch((e) => { throw e; });
|
|
131
|
-
}
|
|
132
|
-
createPath
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
createTop
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
'
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
}
|
|
132
|
+
createPath() {
|
|
133
|
+
this.createForm('test').then((e) => { console.log(e); }).catch((e) => { throw e; });
|
|
134
|
+
}
|
|
135
|
+
createTop() {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
const frm = yield this.createForm('test');
|
|
138
|
+
if (typeof frm === 'number') {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
frm.topMost = true;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
dialog() {
|
|
142
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
this.
|
|
146
|
+
this.dr = yield clickgo.form.dialog('Hello world!');
|
|
144
147
|
});
|
|
145
|
-
}
|
|
146
|
-
dialogLong
|
|
148
|
+
}
|
|
149
|
+
dialogLong() {
|
|
147
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
-
this.
|
|
151
|
+
this.dr = yield clickgo.form.dialog('longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong');
|
|
149
152
|
});
|
|
150
|
-
}
|
|
151
|
-
dialogTitle
|
|
153
|
+
}
|
|
154
|
+
dialogTitle() {
|
|
152
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
this.
|
|
156
|
+
this.dr = yield clickgo.form.dialog({
|
|
154
157
|
'title': 'Title',
|
|
155
158
|
'content': 'Hello world!'
|
|
156
159
|
});
|
|
157
160
|
});
|
|
158
|
-
}
|
|
159
|
-
dialogButtons
|
|
161
|
+
}
|
|
162
|
+
dialogButtons() {
|
|
160
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
this.
|
|
164
|
+
this.dr = yield clickgo.form.dialog({
|
|
162
165
|
'content': 'Hello world!',
|
|
163
166
|
'buttons': ['A', 'B', 'C']
|
|
164
167
|
});
|
|
165
168
|
});
|
|
166
|
-
}
|
|
167
|
-
dialogCannot
|
|
169
|
+
}
|
|
170
|
+
dialogCannot() {
|
|
168
171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
-
this.
|
|
172
|
+
this.dr = yield clickgo.form.dialog({
|
|
170
173
|
'content': 'Hello world!',
|
|
171
174
|
'buttons': ['Do not close', 'Close'],
|
|
172
175
|
'select': (e, button) => {
|
|
@@ -176,42 +179,41 @@ exports.methods = {
|
|
|
176
179
|
}
|
|
177
180
|
});
|
|
178
181
|
});
|
|
179
|
-
}
|
|
180
|
-
confirm
|
|
182
|
+
}
|
|
183
|
+
confirm(cancel) {
|
|
181
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
this.
|
|
185
|
+
this.dr = yield clickgo.form.confirm({
|
|
183
186
|
'content': 'Hello world?',
|
|
184
187
|
'cancel': cancel
|
|
185
188
|
});
|
|
186
|
-
if (typeof this.
|
|
187
|
-
this.
|
|
189
|
+
if (typeof this.dr === 'boolean') {
|
|
190
|
+
this.dr = this.dr ? 'true (boolean)' : 'false (boolean)';
|
|
188
191
|
}
|
|
189
192
|
else {
|
|
190
|
-
this.
|
|
193
|
+
this.dr = this.dr.toString() + ' (number)';
|
|
191
194
|
}
|
|
192
195
|
});
|
|
193
|
-
}
|
|
194
|
-
setTopMost
|
|
196
|
+
}
|
|
197
|
+
setTopMost() {
|
|
195
198
|
this.setTopMostValue = !this.setTopMostValue;
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
flash
|
|
199
|
-
clickgo.form.flash();
|
|
200
|
-
}
|
|
201
|
-
|
|
199
|
+
this.topMost = this.setTopMostValue;
|
|
200
|
+
}
|
|
201
|
+
flash() {
|
|
202
|
+
clickgo.form.flash(this.formId);
|
|
203
|
+
}
|
|
204
|
+
hhide() {
|
|
202
205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
-
|
|
206
|
+
this.hide();
|
|
204
207
|
yield clickgo.tool.sleep(1000);
|
|
205
|
-
|
|
208
|
+
this.show();
|
|
206
209
|
});
|
|
207
210
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
exports.mounted = mounted;
|
|
211
|
+
onReceive(obj) {
|
|
212
|
+
clickgo.form.dialog(JSON.stringify(obj)).catch((e) => { throw e; });
|
|
213
|
+
}
|
|
214
|
+
onMounted() {
|
|
215
|
+
this.fid = this.formId.toString();
|
|
216
|
+
this.tid = this.taskId.toString();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.default = default_1;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<form width="350" height="400" title="Library form"
|
|
2
|
-
<overflow direction="v" style="flex: 1;">
|
|
1
|
+
<form width="350" height="400" title="Library form">
|
|
2
|
+
<overflow direction="v" style="flex: 1; padding: 10px;">
|
|
3
3
|
<layout gutter="10" direction="v" style="flex: 1;">
|
|
4
|
-
<button @click="min" style="height: 30px;">min()</button>
|
|
5
|
-
<button @click="max" style="height: 30px;">max()</button>
|
|
6
|
-
<button @click="close" style="height: 30px;">close()</button>
|
|
4
|
+
<button @click="min" style="height: 30px;">min({{formId}})</button>
|
|
5
|
+
<button @click="max" style="height: 30px;">max({{formId}})</button>
|
|
6
|
+
<button @click="close" style="height: 30px;">close({{formId}})</button>
|
|
7
7
|
<label @mousedown="bindResize" @touchstart="bindResize" style="padding: 20px; background: rgba(0, 0, 0, .1); cursor: se-resize;">bindResize(e, 'rb')</label>
|
|
8
|
-
<label @mousedown="bindDrag" @touchstart="bindDrag" style="padding: 20px; background: rgba(0, 0, 0, .1);">bindDrag(e)</label>
|
|
8
|
+
<label @mousedown="bindDrag" @touchstart="bindDrag" style="padding: 20px; background: rgba(0, 0, 0, .1); cursor: move;">bindDrag(e)</label>
|
|
9
9
|
<layout gutter="10" align-v="center">
|
|
10
10
|
<label>Form ID:</label>
|
|
11
11
|
<text v-model="fid" style="flex: 1; width: 0; height: 30px;"></text>
|
|
@@ -37,10 +37,9 @@
|
|
|
37
37
|
<teleport to="#cg-pop-list">
|
|
38
38
|
<block ref="pop" data-cg-pop style="border: solid 1px #000; background: #FFF; width: 200px; height: 100px; display: flex; justify-content: center; align-items: center;">$refs.pop</block>
|
|
39
39
|
</teleport>
|
|
40
|
-
<button @click="createParam" style="height: 30px;">create({'layout':'xxx'})</button>
|
|
41
40
|
<button @click="createPath" style="height: 30px;">create('test')</button>
|
|
42
41
|
<button @click="createTop" style="height: 30px;">create({'layout':'xxx','topMost':true})</button>
|
|
43
|
-
<label>Dialog result: {{
|
|
42
|
+
<label>Dialog result: {{dr}}.</label>
|
|
44
43
|
<button @click="dialog" style="height: 30px;">dialog('Hello world!')</button>
|
|
45
44
|
<button @click="dialogLong">dialog('long...')</button>
|
|
46
45
|
<button @click="dialogTitle" style="height: 30px;">dialog({'title':'Title','content':'Hello world!'})</button>
|
|
@@ -49,8 +48,8 @@
|
|
|
49
48
|
<button @click="confirm(false)" style="height: 30px;">confirm('confirm')</button>
|
|
50
49
|
<button @click="confirm(true)" style="height: 30px;">confirm({'content':'confirm','cancel':true})</button>
|
|
51
50
|
<button @click="setTopMost" style="height: 30px;">setTopMost({{setTopMostValue ? 'false' : 'true'}})</button>
|
|
52
|
-
<button @click="flash" style="height: 30px;">flash()</button>
|
|
53
|
-
<button @click="
|
|
51
|
+
<button @click="flash" style="height: 30px;">flash({{formId}})</button>
|
|
52
|
+
<button @click="hhide" style="height: 30px;">hide({{formId}}) and show({{formId}})</button>
|
|
54
53
|
</layout>
|
|
55
54
|
</overflow>
|
|
56
55
|
</form>
|
package/dist/control/common.cgc
CHANGED
|
Binary file
|
package/dist/control/form.cgc
CHANGED
|
Binary file
|
package/dist/control/monaco.cgc
CHANGED
|
Binary file
|
|
Binary file
|
package/dist/control/task.cgc
CHANGED
|
Binary file
|
package/dist/index.ts
CHANGED
package/dist/lib/form.js
CHANGED
|
@@ -58,7 +58,7 @@ class AbstractForm {
|
|
|
58
58
|
this._firstShow = true;
|
|
59
59
|
this.dialogResult = '';
|
|
60
60
|
}
|
|
61
|
-
static create(data) {
|
|
61
|
+
static create(data, layout) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
63
|
const frm = new this();
|
|
64
64
|
const code = {
|
|
@@ -98,9 +98,12 @@ class AbstractForm {
|
|
|
98
98
|
for (const item of cdata) {
|
|
99
99
|
code.data[item[0]] = item[1];
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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;
|
|
104
107
|
}
|
|
105
108
|
const prot = tool.getClassPrototype(frm);
|
|
106
109
|
code.methods = prot.method;
|
|
@@ -197,6 +200,21 @@ class AbstractForm {
|
|
|
197
200
|
}
|
|
198
201
|
core.trigger(name, this.taskId, this.formId, param1, param2);
|
|
199
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
|
+
}
|
|
200
218
|
get topMost() {
|
|
201
219
|
return false;
|
|
202
220
|
}
|
|
@@ -812,31 +830,31 @@ function changeFocus(formId = 0) {
|
|
|
812
830
|
}
|
|
813
831
|
const taskId = parseInt((_b = el.getAttribute('data-task-id')) !== null && _b !== void 0 ? _b : '0');
|
|
814
832
|
const t = task.list[taskId];
|
|
815
|
-
if (t.forms[formId].vroot._topMost) {
|
|
816
|
-
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
817
|
-
}
|
|
818
|
-
else {
|
|
819
|
-
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
820
|
-
}
|
|
821
833
|
if (t.runtime.dialogFormIds.length) {
|
|
822
834
|
const dialogFormId = t.runtime.dialogFormIds[t.runtime.dialogFormIds.length - 1];
|
|
835
|
+
if (get(dialogFormId).stateMin) {
|
|
836
|
+
min(dialogFormId);
|
|
837
|
+
}
|
|
838
|
+
if (t.forms[dialogFormId].vroot._topMost) {
|
|
839
|
+
t.forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
t.forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
843
|
+
}
|
|
844
|
+
t.forms[dialogFormId].vapp._container.dataset.formFocus = '';
|
|
845
|
+
t.forms[dialogFormId].vroot._formFocus = true;
|
|
846
|
+
core.trigger('formFocused', taskId, dialogFormId);
|
|
823
847
|
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;
|
|
829
|
-
}
|
|
830
|
-
else {
|
|
831
|
-
task.list[taskId].forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
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
848
|
clickgo.form.flash(dialogFormId, taskId);
|
|
837
849
|
}
|
|
838
850
|
}
|
|
839
851
|
else {
|
|
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
|
+
}
|
|
840
858
|
t.forms[formId].vapp._container.dataset.formFocus = '';
|
|
841
859
|
t.forms[formId].vroot._formFocus = true;
|
|
842
860
|
core.trigger('formFocused', taskId, formId);
|
|
@@ -1648,7 +1666,8 @@ function dialog(opt) {
|
|
|
1648
1666
|
'content': opt
|
|
1649
1667
|
};
|
|
1650
1668
|
}
|
|
1651
|
-
const
|
|
1669
|
+
const nopt = opt;
|
|
1670
|
+
const taskId = nopt.taskId;
|
|
1652
1671
|
if (!taskId) {
|
|
1653
1672
|
resolve('');
|
|
1654
1673
|
return;
|
|
@@ -1659,37 +1678,44 @@ function dialog(opt) {
|
|
|
1659
1678
|
return;
|
|
1660
1679
|
}
|
|
1661
1680
|
const locale = t.locale.lang || core.config.locale;
|
|
1662
|
-
if (
|
|
1663
|
-
|
|
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];
|
|
1664
1683
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
(_b = (_a = opt).select) === null || _b === void 0 ? void 0 : _b.call(_a, event, button);
|
|
1680
|
-
if (event.go) {
|
|
1681
|
-
this.dialogResult = button;
|
|
1682
|
-
close(this.formId);
|
|
1683
|
-
}
|
|
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;
|
|
1684
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);
|
|
1685
1704
|
}
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
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('');
|
|
1693
1719
|
});
|
|
1694
1720
|
});
|
|
1695
1721
|
}
|
package/dist/lib/form.ts
CHANGED
|
@@ -78,7 +78,12 @@ const info: {
|
|
|
78
78
|
/** --- 窗体的抽象类 --- */
|
|
79
79
|
export class AbstractForm {
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
/**
|
|
82
|
+
* --- 创建窗体工厂函数 ---
|
|
83
|
+
* @param data 要传递的对象
|
|
84
|
+
* @param layout 是否使用此参数替换 layout 值
|
|
85
|
+
*/
|
|
86
|
+
public static async create(data?: Record<string, any>, layout?: string): Promise<AbstractForm | number> {
|
|
82
87
|
const frm = new this();
|
|
83
88
|
/** --- 要挂载的 vue 参数 --- */
|
|
84
89
|
const code: types.IFormCreateCode = {
|
|
@@ -118,9 +123,12 @@ export class AbstractForm {
|
|
|
118
123
|
for (const item of cdata) {
|
|
119
124
|
code.data![item[0]] = item[1];
|
|
120
125
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
126
|
+
if (!layout) {
|
|
127
|
+
const l = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'xml'];
|
|
128
|
+
if (typeof l !== 'string') {
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
layout = l;
|
|
124
132
|
}
|
|
125
133
|
const prot = tool.getClassPrototype(frm);
|
|
126
134
|
code.methods = prot.method;
|
|
@@ -285,6 +293,26 @@ export class AbstractForm {
|
|
|
285
293
|
|
|
286
294
|
// --- 以下为窗体有,但 control 没有 ---
|
|
287
295
|
|
|
296
|
+
/**
|
|
297
|
+
* --- 无 js 文件的窗体创建 ---
|
|
298
|
+
* @param path 包内相对于本窗体的路径或包内绝对路径,不含扩展名
|
|
299
|
+
* @param data 要传递的值
|
|
300
|
+
*/
|
|
301
|
+
public async createForm(path: string, data?: Record<string, any>): Promise<AbstractForm | number> {
|
|
302
|
+
path = tool.urlResolve(this.filename, path);
|
|
303
|
+
const taskId = this.taskId;
|
|
304
|
+
const cls = class extends AbstractForm {
|
|
305
|
+
public get filename(): string {
|
|
306
|
+
return path + '.js';
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
public get taskId(): number {
|
|
310
|
+
return taskId;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
return cls.create(data);
|
|
314
|
+
}
|
|
315
|
+
|
|
288
316
|
/** --- 是否是置顶 --- */
|
|
289
317
|
public get topMost(): boolean {
|
|
290
318
|
// --- 将在初始化时系统自动重写本函数 ---
|
|
@@ -1106,40 +1134,39 @@ export function changeFocus(formId: number = 0): void {
|
|
|
1106
1134
|
// --- 获取所属的 taskId ---
|
|
1107
1135
|
const taskId: number = parseInt(el.getAttribute('data-task-id') ?? '0');
|
|
1108
1136
|
const t = task.list[taskId];
|
|
1109
|
-
// --- 如果不是自定义的 zindex,则设置 zIndex 为最大 ---
|
|
1110
|
-
if (t.forms[formId].vroot._topMost) {
|
|
1111
|
-
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
1112
|
-
}
|
|
1113
|
-
else {
|
|
1114
|
-
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
1115
|
-
}
|
|
1116
1137
|
// --- 检测是否有 dialog mask 层 ---
|
|
1117
1138
|
if (t.runtime.dialogFormIds.length) {
|
|
1118
1139
|
// --- 有 dialog ---
|
|
1119
1140
|
const dialogFormId = t.runtime.dialogFormIds[t.runtime.dialogFormIds.length - 1];
|
|
1120
|
-
// ---
|
|
1141
|
+
// --- 如果是最小化状态的话,需要还原 ---
|
|
1142
|
+
if (get(dialogFormId)!.stateMin) {
|
|
1143
|
+
min(dialogFormId);
|
|
1144
|
+
}
|
|
1145
|
+
if (t.forms[dialogFormId].vroot._topMost) {
|
|
1146
|
+
t.forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
1147
|
+
}
|
|
1148
|
+
else {
|
|
1149
|
+
t.forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
1150
|
+
}
|
|
1151
|
+
// --- 开启 focus ---
|
|
1152
|
+
t.forms[dialogFormId].vapp._container.dataset.formFocus = '';
|
|
1153
|
+
t.forms[dialogFormId].vroot._formFocus = true;
|
|
1154
|
+
// --- 触发 formFocused 事件 ---
|
|
1155
|
+
core.trigger('formFocused', taskId, dialogFormId);
|
|
1156
|
+
// --- 判断点击的窗体是不是就是 dialog mask 窗体本身 ---
|
|
1121
1157
|
if (dialogFormId !== formId) {
|
|
1122
|
-
// --- 如果是最小化状态的话,需要还原 ---
|
|
1123
|
-
if (get(dialogFormId)!.stateMin) {
|
|
1124
|
-
min(dialogFormId);
|
|
1125
|
-
}
|
|
1126
|
-
// --- 如果不是自定义的 zindex,则设置 zIndex 为最大 ---
|
|
1127
|
-
if (task.list[taskId].forms[dialogFormId].vroot._topMost) {
|
|
1128
|
-
task.list[taskId].forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
1129
|
-
}
|
|
1130
|
-
else {
|
|
1131
|
-
task.list[taskId].forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
1132
|
-
}
|
|
1133
|
-
// --- 开启 focus ---
|
|
1134
|
-
task.list[taskId].forms[dialogFormId].vapp._container.dataset.formFocus = '';
|
|
1135
|
-
task.list[taskId].forms[dialogFormId].vroot._formFocus = true;
|
|
1136
|
-
// --- 触发 formFocused 事件 ---
|
|
1137
|
-
core.trigger('formFocused', taskId, dialogFormId);
|
|
1138
1158
|
// --- 闪烁 ---
|
|
1139
1159
|
clickgo.form.flash(dialogFormId, taskId);
|
|
1140
1160
|
}
|
|
1141
1161
|
}
|
|
1142
1162
|
else {
|
|
1163
|
+
// --- 没有 dialog,才修改 zindex ---
|
|
1164
|
+
if (t.forms[formId].vroot._topMost) {
|
|
1165
|
+
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex;
|
|
1166
|
+
}
|
|
1167
|
+
else {
|
|
1168
|
+
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex;
|
|
1169
|
+
}
|
|
1143
1170
|
// --- 正常开启 focus ---
|
|
1144
1171
|
t.forms[formId].vapp._container.dataset.formFocus = '';
|
|
1145
1172
|
t.forms[formId].vroot._formFocus = true;
|
|
@@ -2118,7 +2145,8 @@ export function dialog(opt: string | types.IFormDialogOptions): Promise<string>
|
|
|
2118
2145
|
'content': opt
|
|
2119
2146
|
};
|
|
2120
2147
|
}
|
|
2121
|
-
const
|
|
2148
|
+
const nopt = opt;
|
|
2149
|
+
const taskId = nopt.taskId;
|
|
2122
2150
|
if (!taskId) {
|
|
2123
2151
|
resolve('');
|
|
2124
2152
|
return;
|
|
@@ -2129,36 +2157,42 @@ export function dialog(opt: string | types.IFormDialogOptions): Promise<string>
|
|
|
2129
2157
|
return;
|
|
2130
2158
|
}
|
|
2131
2159
|
const locale = t.locale.lang || core.config.locale;
|
|
2132
|
-
if (
|
|
2133
|
-
|
|
2160
|
+
if (nopt.buttons === undefined) {
|
|
2161
|
+
nopt.buttons = [info.locale[locale]?.ok ?? info.locale['en'].ok];
|
|
2134
2162
|
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
};
|
|
2148
|
-
(opt as types.IFormDialogOptions).select?.(event as unknown as Event, button);
|
|
2149
|
-
if (event.go) {
|
|
2150
|
-
this.dialogResult = button;
|
|
2151
|
-
close(this.formId);
|
|
2152
|
-
}
|
|
2163
|
+
const cls = class extends AbstractForm {
|
|
2164
|
+
public buttons = nopt.buttons;
|
|
2165
|
+
|
|
2166
|
+
public get taskId(): number {
|
|
2167
|
+
return taskId;
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
public select(button: string): void {
|
|
2171
|
+
const event = {
|
|
2172
|
+
'go': true,
|
|
2173
|
+
preventDefault: function() {
|
|
2174
|
+
this.go = false;
|
|
2153
2175
|
}
|
|
2176
|
+
};
|
|
2177
|
+
nopt.select?.(event as unknown as Event, button);
|
|
2178
|
+
if (event.go) {
|
|
2179
|
+
this.dialogResult = button;
|
|
2180
|
+
close(this.formId);
|
|
2154
2181
|
}
|
|
2155
|
-
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2182
|
+
}
|
|
2183
|
+
};
|
|
2184
|
+
cls.create(undefined, `<form title="${nopt.title ?? '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) => {
|
|
2185
|
+
if (typeof frm === 'number') {
|
|
2186
|
+
resolve('');
|
|
2187
|
+
return;
|
|
2188
|
+
}
|
|
2189
|
+
frm.showDialog().then((v) => {
|
|
2190
|
+
resolve(v);
|
|
2191
|
+
}).catch(() => {
|
|
2192
|
+
resolve('');
|
|
2193
|
+
});
|
|
2194
|
+
}).catch(() => {
|
|
2195
|
+
resolve('');
|
|
2162
2196
|
});
|
|
2163
2197
|
});
|
|
2164
2198
|
}
|
package/dist/lib/task.js
CHANGED
|
@@ -736,6 +736,9 @@ function run(url, opt = {}) {
|
|
|
736
736
|
getBoolean: function (param) {
|
|
737
737
|
return clickgo.tool.getBoolean(param);
|
|
738
738
|
},
|
|
739
|
+
getNumber: function (param) {
|
|
740
|
+
return clickgo.tool.getNumber(param);
|
|
741
|
+
},
|
|
739
742
|
escapeHTML: function (html) {
|
|
740
743
|
return clickgo.tool.escapeHTML(html);
|
|
741
744
|
},
|
package/dist/lib/task.ts
CHANGED
|
@@ -836,6 +836,9 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
836
836
|
getBoolean: function(param: boolean | string | number): boolean {
|
|
837
837
|
return clickgo.tool.getBoolean(param);
|
|
838
838
|
},
|
|
839
|
+
getNumber: function(param: string | number): number {
|
|
840
|
+
return clickgo.tool.getNumber(param);
|
|
841
|
+
},
|
|
839
842
|
escapeHTML: function(html: string): string {
|
|
840
843
|
return clickgo.tool.escapeHTML(html);
|
|
841
844
|
},
|
package/dist/lib/tool.ts
CHANGED
package/dist/theme/familiar.cgt
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
1
|
+
export * as control from '../dist/lib/control';
|
|
2
|
+
export * as core from '../dist/lib/core';
|
|
3
|
+
export * as dom from '../dist/lib/dom';
|
|
4
|
+
export * as form from '../dist/lib/form';
|
|
5
|
+
export * as fs from '../dist/lib/fs';
|
|
6
|
+
export * as native from '../dist/lib/native';
|
|
7
|
+
export * as task from '../dist/lib/task';
|
|
8
|
+
export * as theme from '../dist/lib/theme';
|
|
9
|
+
export * as tool from '../dist/lib/tool';
|
|
10
|
+
export * as zip from '../dist/lib/zip';
|
|
11
11
|
|
|
12
12
|
export function getVersion(): string;
|
|
13
13
|
export function getNative(): boolean;
|