clickgo 3.11.0 → 3.11.1
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/form/control/panel/test1.js +4 -0
- package/dist/app/demo/form/control/panel/test1.xml +1 -0
- package/dist/app/demo/form/main.js +2 -0
- package/dist/app/demo/form/main.xml +1 -1
- package/dist/app/demo/form/method/aform/aform.js +23 -0
- package/dist/app/demo/form/method/aform/aform.xml +10 -1
- package/dist/app/demo/form/method/dom/dom.xml +3 -3
- package/dist/app/demo/form/method/form/form.js +1 -1
- package/dist/app/demo/form/solution/backpanel/backpanel.js +9 -4
- package/dist/clickgo.js +1 -1
- package/dist/clickgo.ts +1 -1
- package/dist/control/common.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/lib/form.js +146 -46
- package/dist/lib/form.ts +132 -29
- package/dist/lib/task.ts +1 -1
- package/dist/theme/light.cgt +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ Load the module loader first, and then load it using the module loader.
|
|
|
28
28
|
**index.html**
|
|
29
29
|
|
|
30
30
|
```html
|
|
31
|
-
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.1/dist/loader.min.js?path=index&npm={'clickgo':'3.11.
|
|
31
|
+
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.1/dist/loader.min.js?path=index&npm={'clickgo':'3.11.1'}"></script>
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
**index.js**
|
|
@@ -38,6 +38,7 @@ class default_1 extends clickgo.form.AbstractPanel {
|
|
|
38
38
|
super(...arguments);
|
|
39
39
|
this.scount = 0;
|
|
40
40
|
this.data = {};
|
|
41
|
+
this.rootMountData = 'none';
|
|
41
42
|
}
|
|
42
43
|
onShow(d) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -68,5 +69,8 @@ class default_1 extends clickgo.form.AbstractPanel {
|
|
|
68
69
|
yield clickgo.form.dialog('Hello panel!');
|
|
69
70
|
});
|
|
70
71
|
}
|
|
72
|
+
onMounted() {
|
|
73
|
+
this.rootMountData = this.rootForm.mountData;
|
|
74
|
+
}
|
|
71
75
|
}
|
|
72
76
|
exports.default = default_1;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<label>Data: {{data}}</label>
|
|
5
5
|
<label>Parent data: {{rootForm.parentData}}</label>
|
|
6
6
|
<label>Qs: {{qs}}</label>
|
|
7
|
+
<label>rootMountData: {{rootMountData}}</label>
|
|
7
8
|
<button @click="click" style="height: 30px;">Hi</button>
|
|
8
9
|
<layout>
|
|
9
10
|
<button style="padding: 15px 30px;" area="split">
|
|
@@ -99,6 +99,7 @@ class default_1 extends clickgo.form.AbstractForm {
|
|
|
99
99
|
}
|
|
100
100
|
openForm(name, data) {
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
this.loading = true;
|
|
102
103
|
let frm;
|
|
103
104
|
switch (name) {
|
|
104
105
|
case 'cblock': {
|
|
@@ -343,6 +344,7 @@ class default_1 extends clickgo.form.AbstractForm {
|
|
|
343
344
|
frm = yield clickgo.form.create(backpanel_1.default, data);
|
|
344
345
|
}
|
|
345
346
|
}
|
|
347
|
+
this.loading = false;
|
|
346
348
|
frm.show();
|
|
347
349
|
});
|
|
348
350
|
}
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<flow v-else class="inner" direction="v">
|
|
117
117
|
<layout gutter="10" direction="v">
|
|
118
118
|
<button @click="openForm('sbackpanel')">Backend panel</button>
|
|
119
|
-
<button @click="openForm('sbackpanel', {'hash': '
|
|
119
|
+
<button @click="openForm('sbackpanel', {'hash': 'test1?a=1&b=2'})">Backend panel with hash</button>
|
|
120
120
|
</layout>
|
|
121
121
|
</flow>
|
|
122
122
|
</tab>
|
|
@@ -71,6 +71,29 @@ class default_1 extends clickgo.form.AbstractForm {
|
|
|
71
71
|
this.loading = false;
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
+
toEnterStep() {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const rtn = yield this.enterStep([
|
|
77
|
+
{
|
|
78
|
+
'value': 'step1',
|
|
79
|
+
'label': 'step1'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
'value': 'step2'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
'icon': '/package/res/marker.svg',
|
|
86
|
+
'value': 'icon'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
'label': 'successful',
|
|
90
|
+
'value': 'step3',
|
|
91
|
+
'desc': 'qq'
|
|
92
|
+
}
|
|
93
|
+
]);
|
|
94
|
+
yield clickgo.form.dialog('Result: ' + (rtn ? 'true' : 'false'));
|
|
95
|
+
});
|
|
96
|
+
}
|
|
74
97
|
onMounted() {
|
|
75
98
|
this.watch('test', () => __awaiter(this, void 0, void 0, function* () {
|
|
76
99
|
yield clickgo.form.dialog('test changed.');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<form width="
|
|
1
|
+
<form width="550" height="400" title="Abstract Form">
|
|
2
2
|
<flow direction="v" style="flex: 1; padding: 10px;">
|
|
3
3
|
<layout gutter="10" direction="v" style="flex: 1;">
|
|
4
4
|
<label>filename: {{filename}}</label>
|
|
@@ -42,6 +42,15 @@
|
|
|
42
42
|
<label>result: {{dr}}</label>
|
|
43
43
|
</layout>
|
|
44
44
|
<button @click="close">close()</button>
|
|
45
|
+
<label>enterStep: [ {{formHash}} ]</label>
|
|
46
|
+
<button @click="toEnterStep">enterStep</button>
|
|
47
|
+
<layout gutter="10">
|
|
48
|
+
<button @click="formHash = 'step1'" style="flex: 1;">fh = 'step1'</button>
|
|
49
|
+
<button @click="formHash = 'step2'" style="flex: 1;">step2</button>
|
|
50
|
+
<button @click="formHash = 'step3'" style="flex: 1;">step3</button>
|
|
51
|
+
<button @click="formHash = 'step4'" style="flex: 1;">step4</button>
|
|
52
|
+
<button @click="doneStep()" style="flex: 1;">done</button>
|
|
53
|
+
</layout>
|
|
45
54
|
</layout>
|
|
46
55
|
</flow>
|
|
47
56
|
</form>
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
</layout>
|
|
16
16
|
<layout gutter="10">
|
|
17
17
|
<layout ref="watch" align-v="center" align-h="center" style="flex: 1; background: var(--g-plain-background); border: solid 1px var(--g-plain-border-color);">{{watchInner ? 'inner' : 'Inner'}}</layout>
|
|
18
|
-
<button @click="wwatch"
|
|
19
|
-
<button @click="watchInner = !watchInner"
|
|
18
|
+
<button @click="wwatch">{{watchText ? '' : '!'}}watch</button>
|
|
19
|
+
<button @click="watchInner = !watchInner">Change</button>
|
|
20
20
|
</layout>
|
|
21
21
|
<layout gutter="10">
|
|
22
22
|
<button style="flex: 1;" @click="getWatchCount()">getWatchCount()</button>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<button @click="isWatchStyle" >isWatchStyle(this.refs.watchStyle.$el)</button>
|
|
27
27
|
<!-- getWatchInfo -->
|
|
28
28
|
<text :model-value="getWatchInfoText" readonly multi style="height: 300px;"></text>
|
|
29
|
-
<button @click="getWatchInfo" :disabled="getWatchInfoDisabled"
|
|
29
|
+
<button @click="getWatchInfo" :disabled="getWatchInfoDisabled">getWatchInfo 20s</button>
|
|
30
30
|
<block @mousedown="bindGesture" @touchstart="bindGesture" style="height: 50px; display: flex; justify-content: center; align-items: center; font-size: 14px; background: var(--g-plain-background); border: solid 1px var(--g-plain-border-color);">{{bindGestureText ? bindGestureText : 'bindGesture(e: Touch | Mouse, { ... })'}}</block>
|
|
31
31
|
<block @wheel="bindGestureWheel" style="height: 50px; display: flex; justify-content: center; align-items: center; font-size: 14px; background: var(--g-plain-background); border: solid 1px var(--g-plain-border-color);">{{bindGestureWheelText ? bindGestureWheelText : 'bindGesture(e: Wheel, { ... })'}}</block>
|
|
32
32
|
<button @click="bindLong" ref="bindLong" @mousedown="bindLongDown" @touchstart="bindLongDown" >{{bindLongText ? 'Yeah!' : 'bindLong(e, () => { ... })'}}</button>
|
|
@@ -71,7 +71,7 @@ class default_1 extends clickgo.form.AbstractForm {
|
|
|
71
71
|
}
|
|
72
72
|
hashBack() {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
yield clickgo.form.dialog(JSON.stringify(clickgo.form.hashBack(parseInt(this.fid))));
|
|
74
|
+
yield clickgo.form.dialog(JSON.stringify(yield clickgo.form.hashBack(parseInt(this.fid))));
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
tohash() {
|
|
@@ -42,6 +42,7 @@ class default_1 extends clickgo.form.AbstractForm {
|
|
|
42
42
|
super(...arguments);
|
|
43
43
|
this.fh = '';
|
|
44
44
|
this.name = '';
|
|
45
|
+
this.mountData = 'none';
|
|
45
46
|
this.map = {
|
|
46
47
|
'test1': test1_1.default,
|
|
47
48
|
'test2': '../../control/panel/test2'
|
|
@@ -60,10 +61,14 @@ class default_1 extends clickgo.form.AbstractForm {
|
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
63
|
onMounted(data) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
if (!data.hash) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.formHash = data.hash;
|
|
69
|
+
yield clickgo.tool.sleep(500);
|
|
70
|
+
this.mountData = 'ok';
|
|
71
|
+
});
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
74
|
exports.default = default_1;
|
package/dist/clickgo.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.zip = exports.tool = exports.theme = exports.task = exports.storage = exports.native = exports.fs = exports.form = exports.dom = exports.core = exports.control = exports.vue = exports.hasFrame = exports.isImmersion = exports.getPlatform = exports.isNative = exports.getVersion = void 0;
|
|
27
|
-
const version = '3.11.
|
|
27
|
+
const version = '3.11.1';
|
|
28
28
|
function getVersion() {
|
|
29
29
|
return version;
|
|
30
30
|
}
|
package/dist/clickgo.ts
CHANGED
package/dist/control/common.cgc
CHANGED
|
Binary file
|
package/dist/control/form.cgc
CHANGED
|
Binary file
|
package/dist/lib/form.js
CHANGED
|
@@ -55,84 +55,96 @@ const info = {
|
|
|
55
55
|
'yes': 'Yes',
|
|
56
56
|
'no': 'No',
|
|
57
57
|
'cancel': 'Cancel',
|
|
58
|
-
'search': 'Search'
|
|
58
|
+
'search': 'Search',
|
|
59
|
+
'confirmExitStep': 'This operation will exit the current process. Are you sure you want to exit?'
|
|
59
60
|
},
|
|
60
61
|
'sc': {
|
|
61
62
|
'ok': '好',
|
|
62
63
|
'yes': '是',
|
|
63
64
|
'no': '否',
|
|
64
65
|
'cancel': '取消',
|
|
65
|
-
'search': '搜索'
|
|
66
|
+
'search': '搜索',
|
|
67
|
+
'confirmExitStep': '此操作将退出当前流程,确定退出吗?'
|
|
66
68
|
},
|
|
67
69
|
'tc': {
|
|
68
70
|
'ok': '好',
|
|
69
71
|
'yes': '是',
|
|
70
72
|
'no': '否',
|
|
71
73
|
'cancel': '取消',
|
|
72
|
-
'search': '檢索'
|
|
74
|
+
'search': '檢索',
|
|
75
|
+
'confirmExitStep': '此操作將結束目前的流程,確定退出嗎?'
|
|
73
76
|
},
|
|
74
77
|
'ja': {
|
|
75
78
|
'ok': '好',
|
|
76
79
|
'yes': 'はい',
|
|
77
80
|
'no': 'いいえ',
|
|
78
81
|
'cancel': 'キャンセル',
|
|
79
|
-
'search': '検索'
|
|
82
|
+
'search': '検索',
|
|
83
|
+
'confirmExitStep': 'この操作は現在のプロセスを終了します。本当に終了しますか?'
|
|
80
84
|
},
|
|
81
85
|
'ko': {
|
|
82
86
|
'ok': '확인',
|
|
83
87
|
'yes': '예',
|
|
84
88
|
'no': '아니오',
|
|
85
89
|
'cancel': '취소',
|
|
86
|
-
'search': '검색'
|
|
90
|
+
'search': '검색',
|
|
91
|
+
'confirmExitStep': '이 작업은 현재 프로세스를 종료합니다. 종료하시겠습니까?'
|
|
87
92
|
},
|
|
88
93
|
'th': {
|
|
89
94
|
'ok': 'ตกลง',
|
|
90
95
|
'yes': 'ใช่',
|
|
91
96
|
'no': 'ไม่',
|
|
92
97
|
'cancel': 'ยกเลิก',
|
|
93
|
-
'search': 'ค้นหา'
|
|
98
|
+
'search': 'ค้นหา',
|
|
99
|
+
'confirmExitStep': 'การดำเนินการนี้จะออกจากกระบวนการปัจจุบัน ยืนยันที่จะออกไหม?'
|
|
94
100
|
},
|
|
95
101
|
'es': {
|
|
96
102
|
'ok': 'Aceptar',
|
|
97
103
|
'yes': 'Sí',
|
|
98
104
|
'no': 'No',
|
|
99
105
|
'cancel': 'Cancelar',
|
|
100
|
-
'search': 'Buscar'
|
|
106
|
+
'search': 'Buscar',
|
|
107
|
+
'confirmExitStep': 'Esta operación cerrará el proceso actual. ¿Estás seguro de que quieres salir?'
|
|
101
108
|
},
|
|
102
109
|
'de': {
|
|
103
110
|
'ok': 'OK',
|
|
104
111
|
'yes': 'Ja',
|
|
105
112
|
'no': 'Nein',
|
|
106
113
|
'cancel': 'Abbrechen',
|
|
107
|
-
'search': 'Suchen'
|
|
114
|
+
'search': 'Suchen',
|
|
115
|
+
'confirmExitStep': 'Diese Aktion beendet den aktuellen Prozess. Möchten Sie wirklich beenden?'
|
|
108
116
|
},
|
|
109
117
|
'fr': {
|
|
110
118
|
'ok': 'OK',
|
|
111
119
|
'yes': 'Oui',
|
|
112
120
|
'no': 'Non',
|
|
113
121
|
'cancel': 'Annuler',
|
|
114
|
-
'search': 'Rechercher'
|
|
122
|
+
'search': 'Rechercher',
|
|
123
|
+
'confirmExitStep': 'Cette opération va quitter le processus en cours. Êtes-vous sûr de vouloir quitter ?'
|
|
115
124
|
},
|
|
116
125
|
'pt': {
|
|
117
126
|
'ok': 'OK',
|
|
118
127
|
'yes': 'Sim',
|
|
119
128
|
'no': 'Não',
|
|
120
129
|
'cancel': 'Cancelar',
|
|
121
|
-
'search': 'Buscar'
|
|
130
|
+
'search': 'Buscar',
|
|
131
|
+
'confirmExitStep': 'Esta operação encerrará o processo atual. Você tem certeza de que deseja sair?'
|
|
122
132
|
},
|
|
123
133
|
'ru': {
|
|
124
134
|
'ok': 'OK',
|
|
125
135
|
'yes': 'Да',
|
|
126
136
|
'no': 'Нет',
|
|
127
137
|
'cancel': 'Отмена',
|
|
128
|
-
'search': 'Поиск'
|
|
138
|
+
'search': 'Поиск',
|
|
139
|
+
'confirmExitStep': 'Эта операция завершит текущий процесс. Вы уверены, что хотите выйти?'
|
|
129
140
|
},
|
|
130
141
|
'vi': {
|
|
131
142
|
'ok': 'OK',
|
|
132
143
|
'yes': 'Có',
|
|
133
144
|
'no': 'Không',
|
|
134
145
|
'cancel': 'Hủy bỏ',
|
|
135
|
-
'search': 'Tìm kiếm'
|
|
146
|
+
'search': 'Tìm kiếm',
|
|
147
|
+
'confirmExitStep': 'Thao tác này sẽ thoát khỏi quy trình hiện tại. Bạn có chắc chắn muốn thoát không?'
|
|
136
148
|
}
|
|
137
149
|
}
|
|
138
150
|
};
|
|
@@ -282,8 +294,10 @@ class AbstractForm extends AbstractCommon {
|
|
|
282
294
|
constructor() {
|
|
283
295
|
super(...arguments);
|
|
284
296
|
this.isNativeSync = false;
|
|
297
|
+
this.isReady = false;
|
|
285
298
|
this.loading = false;
|
|
286
299
|
this._inStep = false;
|
|
300
|
+
this._stepValues = [];
|
|
287
301
|
this._firstShow = true;
|
|
288
302
|
this.dialogResult = '';
|
|
289
303
|
}
|
|
@@ -315,33 +329,82 @@ class AbstractForm extends AbstractCommon {
|
|
|
315
329
|
}
|
|
316
330
|
set showInSystemTask(v) {
|
|
317
331
|
}
|
|
332
|
+
ready(cb) {
|
|
333
|
+
cb();
|
|
334
|
+
}
|
|
318
335
|
formHashBack() {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (v.$data.
|
|
322
|
-
v.$data._formHash
|
|
323
|
-
|
|
336
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
337
|
+
const v = this;
|
|
338
|
+
if (!v.$data._historyHash.length) {
|
|
339
|
+
if (v.$data._formHash) {
|
|
340
|
+
if (this.inStep) {
|
|
341
|
+
if (!(yield clickgo.form.confirm({
|
|
342
|
+
'taskId': this.taskId,
|
|
343
|
+
'content': info.locale[this.locale].confirmExitStep
|
|
344
|
+
}))) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
this._inStep = false;
|
|
348
|
+
this.refs.form.stepHide();
|
|
349
|
+
}
|
|
350
|
+
v.$data._formHash = '';
|
|
351
|
+
core.trigger('formHashChange', this.taskId, this.formId, '');
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
324
354
|
return;
|
|
325
355
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
356
|
+
const parent = v.$data._historyHash[v.$data._historyHash.length - 1];
|
|
357
|
+
if (this.inStep) {
|
|
358
|
+
if (this._stepValues.includes(parent)) {
|
|
359
|
+
this.refs.form.stepValue = parent;
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
if (!(yield clickgo.form.confirm({
|
|
363
|
+
'taskId': this.taskId,
|
|
364
|
+
'content': info.locale[this.locale].confirmExitStep
|
|
365
|
+
}))) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
this._inStep = false;
|
|
369
|
+
this.refs.form.stepHide();
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
v.$data._formHash = parent;
|
|
373
|
+
v.$data._historyHash.splice(-1);
|
|
374
|
+
core.trigger('formHashChange', this.taskId, this.formId, parent);
|
|
375
|
+
});
|
|
332
376
|
}
|
|
333
377
|
get inStep() {
|
|
334
378
|
return this._inStep;
|
|
335
379
|
}
|
|
336
|
-
enterStep(
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
380
|
+
enterStep(list) {
|
|
381
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
382
|
+
if (this._inStep) {
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
if (list[0].value !== this.formHash) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
this._inStep = true;
|
|
389
|
+
this._stepValues.length = 0;
|
|
390
|
+
for (const item of list) {
|
|
391
|
+
this._stepValues.push(item.value);
|
|
392
|
+
}
|
|
393
|
+
this.refs.form.stepData = list;
|
|
394
|
+
this.refs.form.stepValue = this.formHash;
|
|
395
|
+
yield this.nextTick();
|
|
396
|
+
this.refs.form.stepShow();
|
|
397
|
+
return true;
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
doneStep() {
|
|
401
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
402
|
+
if (!this._inStep) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
this._inStep = false;
|
|
406
|
+
yield this.refs.form.stepDone();
|
|
407
|
+
});
|
|
345
408
|
}
|
|
346
409
|
show() {
|
|
347
410
|
const v = this;
|
|
@@ -1008,20 +1071,22 @@ function getHash(formId) {
|
|
|
1008
1071
|
}
|
|
1009
1072
|
exports.getHash = getHash;
|
|
1010
1073
|
function hashBack(formId) {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1074
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1075
|
+
const taskId = getTaskId(formId);
|
|
1076
|
+
if (taskId === 0) {
|
|
1077
|
+
return false;
|
|
1078
|
+
}
|
|
1079
|
+
const t = task.list[taskId];
|
|
1080
|
+
if (!t) {
|
|
1081
|
+
return false;
|
|
1082
|
+
}
|
|
1083
|
+
const item = task.list[taskId].forms[formId];
|
|
1084
|
+
if (!item) {
|
|
1085
|
+
return false;
|
|
1086
|
+
}
|
|
1087
|
+
yield item.vroot.formHashBack();
|
|
1088
|
+
return true;
|
|
1089
|
+
});
|
|
1025
1090
|
}
|
|
1026
1091
|
exports.hashBack = hashBack;
|
|
1027
1092
|
function changeFocus(formId = 0) {
|
|
@@ -2241,6 +2306,29 @@ function create(cls, data, opt = {}, taskId) {
|
|
|
2241
2306
|
if (v === this._formHash) {
|
|
2242
2307
|
return;
|
|
2243
2308
|
}
|
|
2309
|
+
if (this.inStep) {
|
|
2310
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
2311
|
+
if (this._stepValues.includes(v)) {
|
|
2312
|
+
this.$refs.form.stepValue = v;
|
|
2313
|
+
}
|
|
2314
|
+
else {
|
|
2315
|
+
if (!(yield clickgo.form.confirm({
|
|
2316
|
+
'taskId': this.taskId,
|
|
2317
|
+
'content': info.locale[this.locale].confirmExitStep
|
|
2318
|
+
}))) {
|
|
2319
|
+
return;
|
|
2320
|
+
}
|
|
2321
|
+
this._inStep = false;
|
|
2322
|
+
this.$refs.form.stepHide();
|
|
2323
|
+
}
|
|
2324
|
+
if (this._formHash) {
|
|
2325
|
+
this._historyHash.push(this._formHash);
|
|
2326
|
+
}
|
|
2327
|
+
this._formHash = v;
|
|
2328
|
+
core.trigger('formHashChange', t.id, formId, v);
|
|
2329
|
+
}))();
|
|
2330
|
+
return;
|
|
2331
|
+
}
|
|
2244
2332
|
if (this._formHash) {
|
|
2245
2333
|
this._historyHash.push(this._formHash);
|
|
2246
2334
|
}
|
|
@@ -2258,6 +2346,14 @@ function create(cls, data, opt = {}, taskId) {
|
|
|
2258
2346
|
core.trigger('formShowInSystemTaskChange', t.id, formId, v);
|
|
2259
2347
|
}
|
|
2260
2348
|
};
|
|
2349
|
+
const cbs = [];
|
|
2350
|
+
methods.ready = function (cb) {
|
|
2351
|
+
if (this.isReady) {
|
|
2352
|
+
cb();
|
|
2353
|
+
return;
|
|
2354
|
+
}
|
|
2355
|
+
cbs.push(cb);
|
|
2356
|
+
};
|
|
2261
2357
|
exports.elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${t.id.toString()}"></div>`);
|
|
2262
2358
|
exports.elements.popList.insertAdjacentHTML('beforeend', `<div data-form-id="${formId.toString()}" data-task-id="${t.id.toString()}"></div>`);
|
|
2263
2359
|
if (style) {
|
|
@@ -2378,6 +2474,10 @@ function create(cls, data, opt = {}, taskId) {
|
|
|
2378
2474
|
rtn.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
2379
2475
|
});
|
|
2380
2476
|
}
|
|
2477
|
+
rtn.vroot.isReady = true;
|
|
2478
|
+
for (const cb of cbs) {
|
|
2479
|
+
cb.call(rtn.vroot);
|
|
2480
|
+
}
|
|
2381
2481
|
return rtn.vroot;
|
|
2382
2482
|
});
|
|
2383
2483
|
}
|
package/dist/lib/form.ts
CHANGED
|
@@ -45,6 +45,7 @@ const info: {
|
|
|
45
45
|
'no': string;
|
|
46
46
|
'cancel': string;
|
|
47
47
|
'search': string;
|
|
48
|
+
'confirmExitStep': string;
|
|
48
49
|
}>;
|
|
49
50
|
} = {
|
|
50
51
|
'lastId': 0,
|
|
@@ -58,84 +59,96 @@ const info: {
|
|
|
58
59
|
'yes': 'Yes',
|
|
59
60
|
'no': 'No',
|
|
60
61
|
'cancel': 'Cancel',
|
|
61
|
-
'search': 'Search'
|
|
62
|
+
'search': 'Search',
|
|
63
|
+
'confirmExitStep': 'This operation will exit the current process. Are you sure you want to exit?'
|
|
62
64
|
},
|
|
63
65
|
'sc': {
|
|
64
66
|
'ok': '好',
|
|
65
67
|
'yes': '是',
|
|
66
68
|
'no': '否',
|
|
67
69
|
'cancel': '取消',
|
|
68
|
-
'search': '搜索'
|
|
70
|
+
'search': '搜索',
|
|
71
|
+
'confirmExitStep': '此操作将退出当前流程,确定退出吗?'
|
|
69
72
|
},
|
|
70
73
|
'tc': {
|
|
71
74
|
'ok': '好',
|
|
72
75
|
'yes': '是',
|
|
73
76
|
'no': '否',
|
|
74
77
|
'cancel': '取消',
|
|
75
|
-
'search': '檢索'
|
|
78
|
+
'search': '檢索',
|
|
79
|
+
'confirmExitStep': '此操作將結束目前的流程,確定退出嗎?'
|
|
76
80
|
},
|
|
77
81
|
'ja': {
|
|
78
82
|
'ok': '好',
|
|
79
83
|
'yes': 'はい',
|
|
80
84
|
'no': 'いいえ',
|
|
81
85
|
'cancel': 'キャンセル',
|
|
82
|
-
'search': '検索'
|
|
86
|
+
'search': '検索',
|
|
87
|
+
'confirmExitStep': 'この操作は現在のプロセスを終了します。本当に終了しますか?'
|
|
83
88
|
},
|
|
84
89
|
'ko': {
|
|
85
90
|
'ok': '확인',
|
|
86
91
|
'yes': '예',
|
|
87
92
|
'no': '아니오',
|
|
88
93
|
'cancel': '취소',
|
|
89
|
-
'search': '검색'
|
|
94
|
+
'search': '검색',
|
|
95
|
+
'confirmExitStep': '이 작업은 현재 프로세스를 종료합니다. 종료하시겠습니까?'
|
|
90
96
|
},
|
|
91
97
|
'th': {
|
|
92
98
|
'ok': 'ตกลง',
|
|
93
99
|
'yes': 'ใช่',
|
|
94
100
|
'no': 'ไม่',
|
|
95
101
|
'cancel': 'ยกเลิก',
|
|
96
|
-
'search': 'ค้นหา'
|
|
102
|
+
'search': 'ค้นหา',
|
|
103
|
+
'confirmExitStep': 'การดำเนินการนี้จะออกจากกระบวนการปัจจุบัน ยืนยันที่จะออกไหม?'
|
|
97
104
|
},
|
|
98
105
|
'es': {
|
|
99
106
|
'ok': 'Aceptar',
|
|
100
107
|
'yes': 'Sí',
|
|
101
108
|
'no': 'No',
|
|
102
109
|
'cancel': 'Cancelar',
|
|
103
|
-
'search': 'Buscar'
|
|
110
|
+
'search': 'Buscar',
|
|
111
|
+
'confirmExitStep': 'Esta operación cerrará el proceso actual. ¿Estás seguro de que quieres salir?'
|
|
104
112
|
},
|
|
105
113
|
'de': {
|
|
106
114
|
'ok': 'OK',
|
|
107
115
|
'yes': 'Ja',
|
|
108
116
|
'no': 'Nein',
|
|
109
117
|
'cancel': 'Abbrechen',
|
|
110
|
-
'search': 'Suchen'
|
|
118
|
+
'search': 'Suchen',
|
|
119
|
+
'confirmExitStep': 'Diese Aktion beendet den aktuellen Prozess. Möchten Sie wirklich beenden?'
|
|
111
120
|
},
|
|
112
121
|
'fr': {
|
|
113
122
|
'ok': 'OK',
|
|
114
123
|
'yes': 'Oui',
|
|
115
124
|
'no': 'Non',
|
|
116
125
|
'cancel': 'Annuler',
|
|
117
|
-
'search': 'Rechercher'
|
|
126
|
+
'search': 'Rechercher',
|
|
127
|
+
'confirmExitStep': 'Cette opération va quitter le processus en cours. Êtes-vous sûr de vouloir quitter ?'
|
|
118
128
|
},
|
|
119
129
|
'pt': {
|
|
120
130
|
'ok': 'OK',
|
|
121
131
|
'yes': 'Sim',
|
|
122
132
|
'no': 'Não',
|
|
123
133
|
'cancel': 'Cancelar',
|
|
124
|
-
'search': 'Buscar'
|
|
134
|
+
'search': 'Buscar',
|
|
135
|
+
'confirmExitStep': 'Esta operação encerrará o processo atual. Você tem certeza de que deseja sair?'
|
|
125
136
|
},
|
|
126
137
|
'ru': {
|
|
127
138
|
'ok': 'OK',
|
|
128
139
|
'yes': 'Да',
|
|
129
140
|
'no': 'Нет',
|
|
130
141
|
'cancel': 'Отмена',
|
|
131
|
-
'search': 'Поиск'
|
|
142
|
+
'search': 'Поиск',
|
|
143
|
+
'confirmExitStep': 'Эта операция завершит текущий процесс. Вы уверены, что хотите выйти?'
|
|
132
144
|
},
|
|
133
145
|
'vi': {
|
|
134
146
|
'ok': 'OK',
|
|
135
147
|
'yes': 'Có',
|
|
136
148
|
'no': 'Không',
|
|
137
149
|
'cancel': 'Hủy bỏ',
|
|
138
|
-
'search': 'Tìm kiếm'
|
|
150
|
+
'search': 'Tìm kiếm',
|
|
151
|
+
'confirmExitStep': 'Thao tác này sẽ thoát khỏi quy trình hiện tại. Bạn có chắc chắn muốn thoát không?'
|
|
139
152
|
}
|
|
140
153
|
}
|
|
141
154
|
};
|
|
@@ -389,6 +402,9 @@ export abstract class AbstractForm extends AbstractCommon {
|
|
|
389
402
|
|
|
390
403
|
// --- 以下为窗体有,但 control 没有 ---
|
|
391
404
|
|
|
405
|
+
/** --- 当前是否完全创建完毕 --- */
|
|
406
|
+
public isReady: boolean = false;
|
|
407
|
+
|
|
392
408
|
/** --- 获取 form 的 hash 值,不是浏览器的 hash --- */
|
|
393
409
|
public get formHash(): string {
|
|
394
410
|
return '';
|
|
@@ -443,11 +459,27 @@ export abstract class AbstractForm extends AbstractCommon {
|
|
|
443
459
|
// --- 会进行重写 ---
|
|
444
460
|
}
|
|
445
461
|
|
|
462
|
+
/** --- 将在 form 完全装载完后执行,如果已经装载完则立即执行 --- */
|
|
463
|
+
public ready(cb: () => void | Promise<void>): void {
|
|
464
|
+
// --- 会进行重写 ---
|
|
465
|
+
cb() as any;
|
|
466
|
+
}
|
|
467
|
+
|
|
446
468
|
/** --- form hash 回退 --- */
|
|
447
|
-
public formHashBack(): void {
|
|
469
|
+
public async formHashBack(): Promise<void> {
|
|
448
470
|
const v = this as any;
|
|
449
471
|
if (!v.$data._historyHash.length) {
|
|
450
472
|
if (v.$data._formHash) {
|
|
473
|
+
if (this.inStep) {
|
|
474
|
+
if (!await clickgo.form.confirm({
|
|
475
|
+
'taskId': this.taskId,
|
|
476
|
+
'content': info.locale[this.locale].confirmExitStep
|
|
477
|
+
})) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
this._inStep = false;
|
|
481
|
+
this.refs.form.stepHide();
|
|
482
|
+
}
|
|
451
483
|
v.$data._formHash = '';
|
|
452
484
|
core.trigger('formHashChange', this.taskId, this.formId, '');
|
|
453
485
|
return;
|
|
@@ -455,6 +487,21 @@ export abstract class AbstractForm extends AbstractCommon {
|
|
|
455
487
|
return;
|
|
456
488
|
}
|
|
457
489
|
const parent = v.$data._historyHash[v.$data._historyHash.length - 1];
|
|
490
|
+
if (this.inStep) {
|
|
491
|
+
if (this._stepValues.includes(parent)) {
|
|
492
|
+
this.refs.form.stepValue = parent;
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
if (!await clickgo.form.confirm({
|
|
496
|
+
'taskId': this.taskId,
|
|
497
|
+
'content': info.locale[this.locale].confirmExitStep
|
|
498
|
+
})) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
this._inStep = false;
|
|
502
|
+
this.refs.form.stepHide();
|
|
503
|
+
}
|
|
504
|
+
}
|
|
458
505
|
v.$data._formHash = parent;
|
|
459
506
|
v.$data._historyHash.splice(-1);
|
|
460
507
|
core.trigger('formHashChange', this.taskId, this.formId, parent);
|
|
@@ -472,27 +519,43 @@ export abstract class AbstractForm extends AbstractCommon {
|
|
|
472
519
|
return this._inStep;
|
|
473
520
|
}
|
|
474
521
|
|
|
475
|
-
/** ---
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}): boolean {
|
|
522
|
+
/** --- 序列化后的 step value 值 --- */
|
|
523
|
+
private readonly _stepValues: string[] = [];
|
|
524
|
+
|
|
525
|
+
/** --- 进入 form hash 为源的步进条 --- */
|
|
526
|
+
public async enterStep(list: Array<{
|
|
527
|
+
/** --- 步骤 hash,第一个必须为当前 hash --- */
|
|
528
|
+
'value': string;
|
|
529
|
+
'label'?: string;
|
|
530
|
+
'icon'?: string;
|
|
531
|
+
'desc'?: string;
|
|
532
|
+
}>): Promise<boolean> {
|
|
487
533
|
if (this._inStep) {
|
|
488
534
|
return false;
|
|
489
535
|
}
|
|
490
|
-
if (
|
|
536
|
+
if (list[0].value !== this.formHash) {
|
|
491
537
|
return false;
|
|
492
538
|
}
|
|
493
539
|
// --- 进入当前页面步骤 ---
|
|
494
540
|
this._inStep = true;
|
|
495
|
-
|
|
541
|
+
this._stepValues.length = 0;
|
|
542
|
+
for (const item of list) {
|
|
543
|
+
this._stepValues.push(item.value);
|
|
544
|
+
}
|
|
545
|
+
this.refs.form.stepData = list;
|
|
546
|
+
this.refs.form.stepValue = this.formHash;
|
|
547
|
+
await this.nextTick();
|
|
548
|
+
this.refs.form.stepShow();
|
|
549
|
+
return true;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/** --- 完成当前步骤条 --- */
|
|
553
|
+
public async doneStep(): Promise<void> {
|
|
554
|
+
if (!this._inStep) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
this._inStep = false;
|
|
558
|
+
await this.refs.form.stepDone();
|
|
496
559
|
}
|
|
497
560
|
|
|
498
561
|
/** --- 当前是不是初次显示 --- */
|
|
@@ -1390,7 +1453,7 @@ export function getHash(formId: number): string {
|
|
|
1390
1453
|
/**
|
|
1391
1454
|
* --- 将窗体的 hash 退回上一个 ---
|
|
1392
1455
|
*/
|
|
1393
|
-
export function hashBack(formId: number): boolean {
|
|
1456
|
+
export async function hashBack(formId: number): Promise<boolean> {
|
|
1394
1457
|
const taskId = getTaskId(formId);
|
|
1395
1458
|
if (taskId === 0) {
|
|
1396
1459
|
return false;
|
|
@@ -1403,7 +1466,7 @@ export function hashBack(formId: number): boolean {
|
|
|
1403
1466
|
if (!item) {
|
|
1404
1467
|
return false;
|
|
1405
1468
|
}
|
|
1406
|
-
item.vroot.formHashBack();
|
|
1469
|
+
await item.vroot.formHashBack();
|
|
1407
1470
|
return true;
|
|
1408
1471
|
}
|
|
1409
1472
|
|
|
@@ -2889,6 +2952,32 @@ export async function create<T extends AbstractForm>(
|
|
|
2889
2952
|
if (v === this._formHash) {
|
|
2890
2953
|
return;
|
|
2891
2954
|
}
|
|
2955
|
+
if (this.inStep) {
|
|
2956
|
+
// --- 在 step 中,要判断 step 是否正确 ---
|
|
2957
|
+
(async (): Promise<void> => {
|
|
2958
|
+
if (this._stepValues.includes(v)) {
|
|
2959
|
+
this.$refs.form.stepValue = v;
|
|
2960
|
+
}
|
|
2961
|
+
else {
|
|
2962
|
+
// --- 不应该 ---
|
|
2963
|
+
if (!await clickgo.form.confirm({
|
|
2964
|
+
'taskId': this.taskId,
|
|
2965
|
+
'content': info.locale[this.locale].confirmExitStep
|
|
2966
|
+
})) {
|
|
2967
|
+
return;
|
|
2968
|
+
}
|
|
2969
|
+
// --- 退出了 ---
|
|
2970
|
+
this._inStep = false;
|
|
2971
|
+
this.$refs.form.stepHide();
|
|
2972
|
+
}
|
|
2973
|
+
if (this._formHash) {
|
|
2974
|
+
this._historyHash.push(this._formHash);
|
|
2975
|
+
}
|
|
2976
|
+
this._formHash = v;
|
|
2977
|
+
core.trigger('formHashChange', t.id, formId, v);
|
|
2978
|
+
})() as any;
|
|
2979
|
+
return;
|
|
2980
|
+
}
|
|
2892
2981
|
if (this._formHash) {
|
|
2893
2982
|
this._historyHash.push(this._formHash);
|
|
2894
2983
|
}
|
|
@@ -2907,6 +2996,15 @@ export async function create<T extends AbstractForm>(
|
|
|
2907
2996
|
core.trigger('formShowInSystemTaskChange', t.id, formId, v);
|
|
2908
2997
|
}
|
|
2909
2998
|
};
|
|
2999
|
+
// --- ready 方法 ---
|
|
3000
|
+
const cbs: Array<() => void | Promise<void>> = [];
|
|
3001
|
+
methods.ready = function(cb: () => void | Promise<void>): void {
|
|
3002
|
+
if (this.isReady) {
|
|
3003
|
+
cb() as any;
|
|
3004
|
+
return;
|
|
3005
|
+
}
|
|
3006
|
+
cbs.push(cb);
|
|
3007
|
+
};
|
|
2910
3008
|
|
|
2911
3009
|
// --- 插入 dom ---
|
|
2912
3010
|
elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${t.id.toString()}"></div>`);
|
|
@@ -3042,6 +3140,11 @@ export async function create<T extends AbstractForm>(
|
|
|
3042
3140
|
rtn.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
3043
3141
|
});
|
|
3044
3142
|
}
|
|
3143
|
+
// --- 完全创建完毕 ---
|
|
3144
|
+
rtn.vroot.isReady = true;
|
|
3145
|
+
for (const cb of cbs) {
|
|
3146
|
+
cb.call(rtn.vroot) as any;
|
|
3147
|
+
}
|
|
3045
3148
|
return rtn.vroot as any;
|
|
3046
3149
|
}
|
|
3047
3150
|
|
package/dist/lib/task.ts
CHANGED
|
@@ -710,7 +710,7 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
710
710
|
getHash: function(formId: number): string {
|
|
711
711
|
return form.getHash(formId);
|
|
712
712
|
},
|
|
713
|
-
hashBack: function(formId: number): boolean {
|
|
713
|
+
hashBack: function(formId: number): Promise<boolean> {
|
|
714
714
|
return form.hashBack(formId);
|
|
715
715
|
},
|
|
716
716
|
changeFocus: function(fid: number = 0): void {
|
package/dist/theme/light.cgt
CHANGED
|
Binary file
|