clickgo 3.16.27 → 4.0.0
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 +20 -9
- package/dist/app/{demo/res/video.mp4 → demo.cga} +0 -0
- package/dist/app/task.cga +0 -0
- package/dist/control/arteditor.cgc +0 -0
- package/dist/control/box.cgc +0 -0
- package/dist/control/captcha.cgc +0 -0
- package/dist/control/common.cgc +0 -0
- package/dist/control/desc.cgc +0 -0
- package/dist/control/drawer.cgc +0 -0
- package/dist/control/echarts.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/iconview.cgc +0 -0
- package/dist/control/jodit.cgc +0 -0
- package/dist/control/map.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/mpegts.cgc +0 -0
- package/dist/control/nav.cgc +0 -0
- package/dist/control/novnc.cgc +0 -0
- package/dist/control/page.cgc +0 -0
- package/dist/control/pdf.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/qrcode.cgc +0 -0
- package/dist/control/table.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/control/tplink.cgc +0 -0
- package/dist/control/tuieditor.cgc +0 -0
- package/dist/control/tuiviewer.cgc +0 -0
- package/dist/control/tums.cgc +0 -0
- package/dist/control/xterm.cgc +0 -0
- package/dist/ext/tums-player/audio.wasm +0 -0
- package/dist/ext/tums-player/decoder.worker.js +129 -0
- package/dist/ext/tums-player/libaudio.js +1 -0
- package/dist/ext/tums-player/libaudio.wasm +0 -0
- package/dist/ext/tums-player/libffmpeg.js +1 -0
- package/dist/ext/tums-player/libffmpeg.wasm +0 -0
- package/dist/ext/tums-player/libs.worker.js +92 -0
- package/dist/ext/tums-player/tums-player.umd.min.js +35 -0
- package/dist/ext/tums-player/webgl.js +2 -0
- package/dist/ext/tums-player/webgl.worker.js +42 -0
- package/dist/global.css +1 -1
- package/dist/index.js +1 -187
- package/dist/theme/dark.cgt +0 -0
- package/dist/theme/light.cgt +0 -0
- package/package.json +16 -10
- package/dist/app/demo/app.js +0 -60
- package/dist/app/demo/config.json +0 -249
- package/dist/app/demo/form/control/alayout2/alayout2.js +0 -43
- package/dist/app/demo/form/control/alayout2/alayout2.xml +0 -16
- package/dist/app/demo/form/control/alert/alert.js +0 -43
- package/dist/app/demo/form/control/alert/alert.xml +0 -32
- package/dist/app/demo/form/control/arteditor/arteditor.js +0 -75
- package/dist/app/demo/form/control/arteditor/arteditor.xml +0 -12
- package/dist/app/demo/form/control/arteditor/img.js +0 -61
- package/dist/app/demo/form/control/arteditor/img.xml +0 -6
- package/dist/app/demo/form/control/block/block.css +0 -1
- package/dist/app/demo/form/control/block/block.scss +0 -17
- package/dist/app/demo/form/control/block/block.xml +0 -7
- package/dist/app/demo/form/control/box/box.js +0 -87
- package/dist/app/demo/form/control/box/box.xml +0 -23
- package/dist/app/demo/form/control/button/button.css +0 -1
- package/dist/app/demo/form/control/button/button.js +0 -62
- package/dist/app/demo/form/control/button/button.scss +0 -18
- package/dist/app/demo/form/control/button/button.xml +0 -133
- package/dist/app/demo/form/control/calendar/calendar.js +0 -62
- package/dist/app/demo/form/control/calendar/calendar.xml +0 -34
- package/dist/app/demo/form/control/captcha/captcha.js +0 -60
- package/dist/app/demo/form/control/captcha/captcha.xml +0 -10
- package/dist/app/demo/form/control/check/check.js +0 -65
- package/dist/app/demo/form/control/check/check.xml +0 -17
- package/dist/app/demo/form/control/circle/circle.xml +0 -36
- package/dist/app/demo/form/control/content/content.js +0 -58
- package/dist/app/demo/form/control/content/content.xml +0 -16
- package/dist/app/demo/form/control/date/date.js +0 -56
- package/dist/app/demo/form/control/date/date.xml +0 -28
- package/dist/app/demo/form/control/datepanel/datepanel.js +0 -63
- package/dist/app/demo/form/control/datepanel/datepanel.xml +0 -32
- package/dist/app/demo/form/control/daterange/daterange.js +0 -54
- package/dist/app/demo/form/control/daterange/daterange.xml +0 -22
- package/dist/app/demo/form/control/delete/delete.js +0 -58
- package/dist/app/demo/form/control/delete/delete.xml +0 -20
- package/dist/app/demo/form/control/desc/desc.js +0 -82
- package/dist/app/demo/form/control/desc/desc.xml +0 -44
- package/dist/app/demo/form/control/dialog/dialog.js +0 -47
- package/dist/app/demo/form/control/dialog/dialog.xml +0 -32
- package/dist/app/demo/form/control/drawer/drawer.js +0 -45
- package/dist/app/demo/form/control/drawer/drawer.xml +0 -34
- package/dist/app/demo/form/control/echarts/echarts.js +0 -137
- package/dist/app/demo/form/control/echarts/echarts.xml +0 -12
- package/dist/app/demo/form/control/empty/empty.js +0 -44
- package/dist/app/demo/form/control/empty/empty.xml +0 -9
- package/dist/app/demo/form/control/file/file.js +0 -60
- package/dist/app/demo/form/control/file/file.xml +0 -25
- package/dist/app/demo/form/control/flow/flow.css +0 -1
- package/dist/app/demo/form/control/flow/flow.js +0 -97
- package/dist/app/demo/form/control/flow/flow.scss +0 -18
- package/dist/app/demo/form/control/flow/flow.xml +0 -101
- package/dist/app/demo/form/control/form/form.css +0 -1
- package/dist/app/demo/form/control/form/form.js +0 -77
- package/dist/app/demo/form/control/form/form.scss +0 -5
- package/dist/app/demo/form/control/form/form.xml +0 -29
- package/dist/app/demo/form/control/grid/grid.js +0 -45
- package/dist/app/demo/form/control/grid/grid.xml +0 -27
- package/dist/app/demo/form/control/group/group.js +0 -50
- package/dist/app/demo/form/control/group/group.xml +0 -46
- package/dist/app/demo/form/control/hske/hske.js +0 -44
- package/dist/app/demo/form/control/hske/hske.xml +0 -19
- package/dist/app/demo/form/control/html/html.js +0 -70
- package/dist/app/demo/form/control/html/html.xml +0 -18
- package/dist/app/demo/form/control/icon/icon.xml +0 -49
- package/dist/app/demo/form/control/iconview/iconview.js +0 -191
- package/dist/app/demo/form/control/iconview/iconview.xml +0 -45
- package/dist/app/demo/form/control/img/img.xml +0 -26
- package/dist/app/demo/form/control/imgviewer/imgviewer.js +0 -46
- package/dist/app/demo/form/control/imgviewer/imgviewer.xml +0 -9
- package/dist/app/demo/form/control/jodit/jodit.js +0 -75
- package/dist/app/demo/form/control/jodit/jodit.xml +0 -24
- package/dist/app/demo/form/control/label/label.js +0 -51
- package/dist/app/demo/form/control/label/label.xml +0 -34
- package/dist/app/demo/form/control/layout/layout.js +0 -45
- package/dist/app/demo/form/control/layout/layout.xml +0 -18
- package/dist/app/demo/form/control/link/link.js +0 -53
- package/dist/app/demo/form/control/link/link.xml +0 -30
- package/dist/app/demo/form/control/list/list.css +0 -1
- package/dist/app/demo/form/control/list/list.js +0 -394
- package/dist/app/demo/form/control/list/list.scss +0 -7
- package/dist/app/demo/form/control/list/list.xml +0 -150
- package/dist/app/demo/form/control/loading/loading.xml +0 -8
- package/dist/app/demo/form/control/map/map.js +0 -217
- package/dist/app/demo/form/control/map/map.xml +0 -44
- package/dist/app/demo/form/control/marquee/marquee.js +0 -64
- package/dist/app/demo/form/control/marquee/marquee.xml +0 -33
- package/dist/app/demo/form/control/menu/menu.js +0 -67
- package/dist/app/demo/form/control/menu/menu.xml +0 -125
- package/dist/app/demo/form/control/monaco/monaco.js +0 -136
- package/dist/app/demo/form/control/monaco/monaco.xml +0 -28
- package/dist/app/demo/form/control/mpegts/mpegts.js +0 -70
- package/dist/app/demo/form/control/mpegts/mpegts.xml +0 -11
- package/dist/app/demo/form/control/nav/nav.js +0 -71
- package/dist/app/demo/form/control/nav/nav.xml +0 -106
- package/dist/app/demo/form/control/page/page.js +0 -51
- package/dist/app/demo/form/control/page/page.xml +0 -22
- package/dist/app/demo/form/control/palette/palette.js +0 -46
- package/dist/app/demo/form/control/palette/palette.xml +0 -16
- package/dist/app/demo/form/control/panel/panel.js +0 -117
- package/dist/app/demo/form/control/panel/panel.xml +0 -16
- package/dist/app/demo/form/control/panel/test1.js +0 -105
- package/dist/app/demo/form/control/panel/test1.xml +0 -22
- package/dist/app/demo/form/control/panel/test2.xml +0 -4
- package/dist/app/demo/form/control/pdf/pdf.js +0 -78
- package/dist/app/demo/form/control/pdf/pdf.xml +0 -12
- package/dist/app/demo/form/control/pdf/test.pdf +0 -0
- package/dist/app/demo/form/control/progress/progress.js +0 -63
- package/dist/app/demo/form/control/progress/progress.xml +0 -9
- package/dist/app/demo/form/control/property/property.js +0 -166
- package/dist/app/demo/form/control/property/property.xml +0 -6
- package/dist/app/demo/form/control/qrcode/qrcode.js +0 -45
- package/dist/app/demo/form/control/qrcode/qrcode.xml +0 -13
- package/dist/app/demo/form/control/radio/radio.js +0 -62
- package/dist/app/demo/form/control/radio/radio.xml +0 -15
- package/dist/app/demo/form/control/scroll/scroll.js +0 -52
- package/dist/app/demo/form/control/scroll/scroll.xml +0 -38
- package/dist/app/demo/form/control/select/select.js +0 -286
- package/dist/app/demo/form/control/select/select.xml +0 -141
- package/dist/app/demo/form/control/setting/setting.xml +0 -11
- package/dist/app/demo/form/control/sgroup/sgroup.xml +0 -28
- package/dist/app/demo/form/control/step/step.js +0 -61
- package/dist/app/demo/form/control/step/step.xml +0 -16
- package/dist/app/demo/form/control/svg/svg.js +0 -61
- package/dist/app/demo/form/control/svg/svg.xml +0 -24
- package/dist/app/demo/form/control/switch/switch.js +0 -64
- package/dist/app/demo/form/control/switch/switch.xml +0 -29
- package/dist/app/demo/form/control/tab/tab.js +0 -113
- package/dist/app/demo/form/control/tab/tab.xml +0 -22
- package/dist/app/demo/form/control/table/table.js +0 -233
- package/dist/app/demo/form/control/table/table.xml +0 -97
- package/dist/app/demo/form/control/tag/tag.js +0 -44
- package/dist/app/demo/form/control/tag/tag.xml +0 -52
- package/dist/app/demo/form/control/text/text.js +0 -127
- package/dist/app/demo/form/control/text/text.xml +0 -70
- package/dist/app/demo/form/control/timeline/timeline.js +0 -43
- package/dist/app/demo/form/control/timeline/timeline.xml +0 -19
- package/dist/app/demo/form/control/tip/tip.js +0 -43
- package/dist/app/demo/form/control/tip/tip.xml +0 -42
- package/dist/app/demo/form/control/tplink/tplink.js +0 -74
- package/dist/app/demo/form/control/tplink/tplink.xml +0 -13
- package/dist/app/demo/form/control/tuieditor/tuieditor.js +0 -73
- package/dist/app/demo/form/control/tuieditor/tuieditor.xml +0 -22
- package/dist/app/demo/form/control/tuiviewer/tuiviewer.js +0 -45
- package/dist/app/demo/form/control/tuiviewer/tuiviewer.xml +0 -14
- package/dist/app/demo/form/control/uploader/uploader.js +0 -91
- package/dist/app/demo/form/control/uploader/uploader.xml +0 -15
- package/dist/app/demo/form/control/vflow/vflow.css +0 -1
- package/dist/app/demo/form/control/vflow/vflow.js +0 -112
- package/dist/app/demo/form/control/vflow/vflow.scss +0 -22
- package/dist/app/demo/form/control/vflow/vflow.xml +0 -89
- package/dist/app/demo/form/control/video/video.js +0 -47
- package/dist/app/demo/form/control/video/video.xml +0 -14
- package/dist/app/demo/form/control/web/web.js +0 -43
- package/dist/app/demo/form/control/web/web.xml +0 -4
- package/dist/app/demo/form/control/xterm/xterm.js +0 -100
- package/dist/app/demo/form/control/xterm/xterm.xml +0 -6
- package/dist/app/demo/form/event/form/form.css +0 -1
- package/dist/app/demo/form/event/form/form.js +0 -180
- package/dist/app/demo/form/event/form/form.scss +0 -24
- package/dist/app/demo/form/event/form/form.xml +0 -16
- package/dist/app/demo/form/event/other/other.js +0 -78
- package/dist/app/demo/form/event/other/other.xml +0 -5
- package/dist/app/demo/form/event/screen/screen.js +0 -86
- package/dist/app/demo/form/event/screen/screen.xml +0 -9
- package/dist/app/demo/form/event/task/task.js +0 -111
- package/dist/app/demo/form/event/task/task.xml +0 -20
- package/dist/app/demo/form/main.css +0 -1
- package/dist/app/demo/form/main.js +0 -521
- package/dist/app/demo/form/main.scss +0 -9
- package/dist/app/demo/form/main.xml +0 -160
- package/dist/app/demo/form/method/acontrol/acontrol.js +0 -53
- package/dist/app/demo/form/method/acontrol/acontrol.xml +0 -5
- package/dist/app/demo/form/method/aform/aform.js +0 -123
- package/dist/app/demo/form/method/aform/aform.xml +0 -60
- package/dist/app/demo/form/method/aform/sd.js +0 -58
- package/dist/app/demo/form/method/aform/sd.xml +0 -7
- package/dist/app/demo/form/method/core/core.js +0 -111
- package/dist/app/demo/form/method/core/core.xml +0 -23
- package/dist/app/demo/form/method/dom/dom.css +0 -1
- package/dist/app/demo/form/method/dom/dom.js +0 -251
- package/dist/app/demo/form/method/dom/dom.scss +0 -10
- package/dist/app/demo/form/method/dom/dom.xml +0 -76
- package/dist/app/demo/form/method/form/form.js +0 -287
- package/dist/app/demo/form/method/form/form.xml +0 -74
- package/dist/app/demo/form/method/form/test.xml +0 -5
- package/dist/app/demo/form/method/fs/fs.js +0 -230
- package/dist/app/demo/form/method/fs/fs.xml +0 -18
- package/dist/app/demo/form/method/fs/text.js +0 -48
- package/dist/app/demo/form/method/fs/text.xml +0 -3
- package/dist/app/demo/form/method/native/native.js +0 -128
- package/dist/app/demo/form/method/native/native.xml +0 -22
- package/dist/app/demo/form/method/storage/storage.js +0 -95
- package/dist/app/demo/form/method/storage/storage.xml +0 -18
- package/dist/app/demo/form/method/system/system.js +0 -88
- package/dist/app/demo/form/method/system/system.xml +0 -14
- package/dist/app/demo/form/method/task/locale1.json +0 -3
- package/dist/app/demo/form/method/task/locale2.json +0 -3
- package/dist/app/demo/form/method/task/task.js +0 -196
- package/dist/app/demo/form/method/task/task.xml +0 -61
- package/dist/app/demo/form/method/theme/theme.js +0 -107
- package/dist/app/demo/form/method/theme/theme.xml +0 -12
- package/dist/app/demo/form/method/tool/tool.js +0 -143
- package/dist/app/demo/form/method/tool/tool.xml +0 -40
- package/dist/app/demo/form/method/zip/zip.js +0 -137
- package/dist/app/demo/form/method/zip/zip.xml +0 -12
- package/dist/app/demo/form/solution/backpanel/backpanel.js +0 -89
- package/dist/app/demo/form/solution/backpanel/backpanel.xml +0 -31
- package/dist/app/demo/global.css +0 -3
- package/dist/app/demo/res/custombtn.cgc +0 -0
- package/dist/app/demo/res/icon.svg +0 -5
- package/dist/app/demo/res/img.jpg +0 -0
- package/dist/app/demo/res/marker.svg +0 -5
- package/dist/app/demo/res/r-1.svg +0 -32
- package/dist/app/demo/res/r-2.svg +0 -38
- package/dist/app/demo/res/sql.svg +0 -25
- package/dist/app/demo/res/txt.svg +0 -21
- package/dist/app/demo/res/zip.svg +0 -21
- package/dist/app/task/app.js +0 -57
- package/dist/app/task/config.json +0 -29
- package/dist/app/task/form/bar/bar.js +0 -419
- package/dist/app/task/form/bar/bar.xml +0 -46
- package/dist/app/task/form/desktop/desktop.xml +0 -1
- package/dist/app/task/locale/en.json +0 -11
- package/dist/app/task/locale/ja.json +0 -11
- package/dist/app/task/locale/sc.json +0 -11
- package/dist/app/task/locale/tc.json +0 -11
- package/dist/clickgo.d.ts +0 -22
- package/dist/clickgo.js +0 -109
- package/dist/index.d.ts +0 -55
- package/dist/lib/control.d.ts +0 -53
- package/dist/lib/control.js +0 -606
- package/dist/lib/core.d.ts +0 -47
- package/dist/lib/core.js +0 -1028
- package/dist/lib/dom.d.ts +0 -75
- package/dist/lib/dom.js +0 -2176
- package/dist/lib/form.d.ts +0 -222
- package/dist/lib/form.js +0 -3033
- package/dist/lib/fs.d.ts +0 -35
- package/dist/lib/fs.js +0 -1241
- package/dist/lib/native.d.ts +0 -43
- package/dist/lib/native.js +0 -228
- package/dist/lib/storage.d.ts +0 -6
- package/dist/lib/storage.js +0 -227
- package/dist/lib/task.d.ts +0 -32
- package/dist/lib/task.js +0 -1875
- package/dist/lib/theme.d.ts +0 -8
- package/dist/lib/theme.js +0 -195
- package/dist/lib/tool.d.ts +0 -122
- package/dist/lib/tool.js +0 -1054
- package/dist/lib/zip.d.ts +0 -40
- package/dist/lib/zip.js +0 -397
- package/dist/theme/blue.cgt +0 -0
- package/dist/theme/byterun.cgt +0 -0
- package/types/index.d.ts +0 -1374
package/dist/lib/form.js
DELETED
|
@@ -1,3033 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.activePanels = exports.elements = exports.launcherRoot = exports.simpleSystemTaskRoot = exports.AbstractForm = exports.AbstractPanel = void 0;
|
|
46
|
-
exports.superConfirm = superConfirm;
|
|
47
|
-
exports.min = min;
|
|
48
|
-
exports.max = max;
|
|
49
|
-
exports.close = close;
|
|
50
|
-
exports.bindResize = bindResize;
|
|
51
|
-
exports.bindDrag = bindDrag;
|
|
52
|
-
exports.refreshMaxPosition = refreshMaxPosition;
|
|
53
|
-
exports.getTaskId = getTaskId;
|
|
54
|
-
exports.get = get;
|
|
55
|
-
exports.send = send;
|
|
56
|
-
exports.getList = getList;
|
|
57
|
-
exports.getFocus = getFocus;
|
|
58
|
-
exports.getActivePanel = getActivePanel;
|
|
59
|
-
exports.removeActivePanel = removeActivePanel;
|
|
60
|
-
exports.setActivePanel = setActivePanel;
|
|
61
|
-
exports.hash = hash;
|
|
62
|
-
exports.getHash = getHash;
|
|
63
|
-
exports.hashBack = hashBack;
|
|
64
|
-
exports.changeFocus = changeFocus;
|
|
65
|
-
exports.getMaxZIndexID = getMaxZIndexID;
|
|
66
|
-
exports.getRectByBorder = getRectByBorder;
|
|
67
|
-
exports.showCircular = showCircular;
|
|
68
|
-
exports.moveRectangle = moveRectangle;
|
|
69
|
-
exports.showRectangle = showRectangle;
|
|
70
|
-
exports.hideRectangle = hideRectangle;
|
|
71
|
-
exports.showDrag = showDrag;
|
|
72
|
-
exports.moveDrag = moveDrag;
|
|
73
|
-
exports.hideDrag = hideDrag;
|
|
74
|
-
exports.alert = alert;
|
|
75
|
-
exports.notify = notify;
|
|
76
|
-
exports.notifyProgress = notifyProgress;
|
|
77
|
-
exports.notifyContent = notifyContent;
|
|
78
|
-
exports.hideNotify = hideNotify;
|
|
79
|
-
exports.appendToPop = appendToPop;
|
|
80
|
-
exports.removeFromPop = removeFromPop;
|
|
81
|
-
exports.showPop = showPop;
|
|
82
|
-
exports.hidePop = hidePop;
|
|
83
|
-
exports.isJustPop = isJustPop;
|
|
84
|
-
exports.doFocusAndPopEvent = doFocusAndPopEvent;
|
|
85
|
-
exports.remove = remove;
|
|
86
|
-
exports.removePanel = removePanel;
|
|
87
|
-
exports.createPanel = createPanel;
|
|
88
|
-
exports.create = create;
|
|
89
|
-
exports.dialog = dialog;
|
|
90
|
-
exports.confirm = confirm;
|
|
91
|
-
exports.prompt = prompt;
|
|
92
|
-
exports.flash = flash;
|
|
93
|
-
exports.showLauncher = showLauncher;
|
|
94
|
-
exports.hideLauncher = hideLauncher;
|
|
95
|
-
const clickgo = __importStar(require("../clickgo"));
|
|
96
|
-
const core = __importStar(require("./core"));
|
|
97
|
-
const task = __importStar(require("./task"));
|
|
98
|
-
const tool = __importStar(require("./tool"));
|
|
99
|
-
const dom = __importStar(require("./dom"));
|
|
100
|
-
const control = __importStar(require("./control"));
|
|
101
|
-
const fs = __importStar(require("./fs"));
|
|
102
|
-
const native = __importStar(require("./native"));
|
|
103
|
-
let focusId = null;
|
|
104
|
-
const info = {
|
|
105
|
-
'lastId': 0,
|
|
106
|
-
'lastPanelId': 0,
|
|
107
|
-
'bottomLastZIndex': 999,
|
|
108
|
-
'lastZIndex': 999999,
|
|
109
|
-
'topLastZIndex': 99999999,
|
|
110
|
-
'locale': {
|
|
111
|
-
'en': {
|
|
112
|
-
'ok': 'OK',
|
|
113
|
-
'yes': 'Yes',
|
|
114
|
-
'no': 'No',
|
|
115
|
-
'cancel': 'Cancel',
|
|
116
|
-
'search': 'Search',
|
|
117
|
-
'confirmExitStep': 'This operation will exit the current process. Are you sure you want to exit?'
|
|
118
|
-
},
|
|
119
|
-
'sc': {
|
|
120
|
-
'ok': '好',
|
|
121
|
-
'yes': '是',
|
|
122
|
-
'no': '否',
|
|
123
|
-
'cancel': '取消',
|
|
124
|
-
'search': '搜索',
|
|
125
|
-
'confirmExitStep': '此操作将退出当前流程,确定退出吗?'
|
|
126
|
-
},
|
|
127
|
-
'tc': {
|
|
128
|
-
'ok': '好',
|
|
129
|
-
'yes': '是',
|
|
130
|
-
'no': '否',
|
|
131
|
-
'cancel': '取消',
|
|
132
|
-
'search': '檢索',
|
|
133
|
-
'confirmExitStep': '此操作將結束目前的流程,確定退出嗎?'
|
|
134
|
-
},
|
|
135
|
-
'ja': {
|
|
136
|
-
'ok': '好',
|
|
137
|
-
'yes': 'はい',
|
|
138
|
-
'no': 'いいえ',
|
|
139
|
-
'cancel': 'キャンセル',
|
|
140
|
-
'search': '検索',
|
|
141
|
-
'confirmExitStep': 'この操作は現在のプロセスを終了します。本当に終了しますか?'
|
|
142
|
-
},
|
|
143
|
-
'ko': {
|
|
144
|
-
'ok': '확인',
|
|
145
|
-
'yes': '예',
|
|
146
|
-
'no': '아니오',
|
|
147
|
-
'cancel': '취소',
|
|
148
|
-
'search': '검색',
|
|
149
|
-
'confirmExitStep': '이 작업은 현재 프로세스를 종료합니다. 종료하시겠습니까?'
|
|
150
|
-
},
|
|
151
|
-
'th': {
|
|
152
|
-
'ok': 'ตกลง',
|
|
153
|
-
'yes': 'ใช่',
|
|
154
|
-
'no': 'ไม่',
|
|
155
|
-
'cancel': 'ยกเลิก',
|
|
156
|
-
'search': 'ค้นหา',
|
|
157
|
-
'confirmExitStep': 'การดำเนินการนี้จะออกจากกระบวนการปัจจุบัน ยืนยันที่จะออกไหม?'
|
|
158
|
-
},
|
|
159
|
-
'es': {
|
|
160
|
-
'ok': 'Aceptar',
|
|
161
|
-
'yes': 'Sí',
|
|
162
|
-
'no': 'No',
|
|
163
|
-
'cancel': 'Cancelar',
|
|
164
|
-
'search': 'Buscar',
|
|
165
|
-
'confirmExitStep': 'Esta operación cerrará el proceso actual. ¿Estás seguro de que quieres salir?'
|
|
166
|
-
},
|
|
167
|
-
'de': {
|
|
168
|
-
'ok': 'OK',
|
|
169
|
-
'yes': 'Ja',
|
|
170
|
-
'no': 'Nein',
|
|
171
|
-
'cancel': 'Abbrechen',
|
|
172
|
-
'search': 'Suchen',
|
|
173
|
-
'confirmExitStep': 'Diese Aktion beendet den aktuellen Prozess. Möchten Sie wirklich beenden?'
|
|
174
|
-
},
|
|
175
|
-
'fr': {
|
|
176
|
-
'ok': 'OK',
|
|
177
|
-
'yes': 'Oui',
|
|
178
|
-
'no': 'Non',
|
|
179
|
-
'cancel': 'Annuler',
|
|
180
|
-
'search': 'Rechercher',
|
|
181
|
-
'confirmExitStep': 'Cette opération va quitter le processus en cours. Êtes-vous sûr de vouloir quitter ?'
|
|
182
|
-
},
|
|
183
|
-
'pt': {
|
|
184
|
-
'ok': 'OK',
|
|
185
|
-
'yes': 'Sim',
|
|
186
|
-
'no': 'Não',
|
|
187
|
-
'cancel': 'Cancelar',
|
|
188
|
-
'search': 'Buscar',
|
|
189
|
-
'confirmExitStep': 'Esta operação encerrará o processo atual. Você tem certeza de que deseja sair?'
|
|
190
|
-
},
|
|
191
|
-
'ru': {
|
|
192
|
-
'ok': 'OK',
|
|
193
|
-
'yes': 'Да',
|
|
194
|
-
'no': 'Нет',
|
|
195
|
-
'cancel': 'Отмена',
|
|
196
|
-
'search': 'Поиск',
|
|
197
|
-
'confirmExitStep': 'Эта операция завершит текущий процесс. Вы уверены, что хотите выйти?'
|
|
198
|
-
},
|
|
199
|
-
'vi': {
|
|
200
|
-
'ok': 'OK',
|
|
201
|
-
'yes': 'Có',
|
|
202
|
-
'no': 'Không',
|
|
203
|
-
'cancel': 'Hủy bỏ',
|
|
204
|
-
'search': 'Tìm kiếm',
|
|
205
|
-
'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?'
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
class AbstractCommon {
|
|
210
|
-
get filename() {
|
|
211
|
-
return '';
|
|
212
|
-
}
|
|
213
|
-
get controlName() {
|
|
214
|
-
return 'root';
|
|
215
|
-
}
|
|
216
|
-
set controlName(v) {
|
|
217
|
-
notify({
|
|
218
|
-
'title': 'Error',
|
|
219
|
-
'content': `The software tries to modify the system variable "controlName".\nPath: ${this.filename}`,
|
|
220
|
-
'type': 'danger'
|
|
221
|
-
});
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
get taskId() {
|
|
225
|
-
return 0;
|
|
226
|
-
}
|
|
227
|
-
get formId() {
|
|
228
|
-
return 0;
|
|
229
|
-
}
|
|
230
|
-
set formFocus(b) {
|
|
231
|
-
notify({
|
|
232
|
-
'title': 'Error',
|
|
233
|
-
'content': `The software tries to modify the system variable "formFocus".\nPath: ${this.filename}`,
|
|
234
|
-
'type': 'danger'
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
get path() {
|
|
238
|
-
return '';
|
|
239
|
-
}
|
|
240
|
-
get prep() {
|
|
241
|
-
return '';
|
|
242
|
-
}
|
|
243
|
-
get locale() {
|
|
244
|
-
return task.list[this.taskId].locale.lang || core.config.locale;
|
|
245
|
-
}
|
|
246
|
-
get l() {
|
|
247
|
-
return (key, data) => {
|
|
248
|
-
var _a, _b, _c, _d;
|
|
249
|
-
const loc = (_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]' + key;
|
|
250
|
-
if (!data) {
|
|
251
|
-
return loc;
|
|
252
|
-
}
|
|
253
|
-
let i = -1;
|
|
254
|
-
return loc.replace(/\?/g, function () {
|
|
255
|
-
++i;
|
|
256
|
-
if (!data[i]) {
|
|
257
|
-
return '';
|
|
258
|
-
}
|
|
259
|
-
return data[i];
|
|
260
|
-
});
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
get classPrepend() {
|
|
264
|
-
return (cla) => {
|
|
265
|
-
if (typeof cla !== 'string') {
|
|
266
|
-
return cla;
|
|
267
|
-
}
|
|
268
|
-
return `cg-task${this.taskId}_${cla}${this.prep ? (' ' + this.prep + cla) : ''}`;
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
watch(name, cb, opt = {}) {
|
|
272
|
-
return this.$watch(name, cb, opt);
|
|
273
|
-
}
|
|
274
|
-
get refs() {
|
|
275
|
-
return this.$refs;
|
|
276
|
-
}
|
|
277
|
-
get nextTick() {
|
|
278
|
-
return this.$nextTick;
|
|
279
|
-
}
|
|
280
|
-
allowEvent(e) {
|
|
281
|
-
return dom.allowEvent(e);
|
|
282
|
-
}
|
|
283
|
-
trigger(name, param1 = '', param2 = '') {
|
|
284
|
-
if (!['formTitleChanged', 'formIconChanged', 'formStateMinChanged', 'formStateMaxChanged', 'formShowChanged'].includes(name)) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
core.trigger(name, this.taskId, this.formId, param1, param2);
|
|
288
|
-
}
|
|
289
|
-
send(fid, obj) {
|
|
290
|
-
obj.taskId = this.taskId;
|
|
291
|
-
obj.formId = this.formId;
|
|
292
|
-
send(fid, obj);
|
|
293
|
-
}
|
|
294
|
-
onBeforeCreate() {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
onCreated() {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
onBeforeMount() {
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
onBeforeUpdate() {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
onUpdated() {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
onBeforeUnmount() {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
onUnmounted() {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
class AbstractPanel extends AbstractCommon {
|
|
317
|
-
constructor() {
|
|
318
|
-
super(...arguments);
|
|
319
|
-
this.qs = {};
|
|
320
|
-
}
|
|
321
|
-
get panelId() {
|
|
322
|
-
return 0;
|
|
323
|
-
}
|
|
324
|
-
get rootForm() {
|
|
325
|
-
return {};
|
|
326
|
-
}
|
|
327
|
-
get rootPanel() {
|
|
328
|
-
return {};
|
|
329
|
-
}
|
|
330
|
-
get formHash() {
|
|
331
|
-
return this.rootForm.formHash;
|
|
332
|
-
}
|
|
333
|
-
set formHash(fh) {
|
|
334
|
-
this.rootForm.formHash = fh;
|
|
335
|
-
}
|
|
336
|
-
get formHashData() {
|
|
337
|
-
return this.rootForm.formHashData;
|
|
338
|
-
}
|
|
339
|
-
set formHashData(v) {
|
|
340
|
-
this.rootForm.formHashData = v;
|
|
341
|
-
}
|
|
342
|
-
formHashBack() {
|
|
343
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
344
|
-
yield this.rootForm.formHashBack();
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
sendToRootPanel(data) {
|
|
348
|
-
this.rootPanel.send(data);
|
|
349
|
-
}
|
|
350
|
-
enterStep(list) {
|
|
351
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
352
|
-
return this.rootForm.enterStep(list);
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
doneStep() {
|
|
356
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
357
|
-
yield this.rootForm.doneStep();
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
clearQs() {
|
|
361
|
-
this.qs = {};
|
|
362
|
-
}
|
|
363
|
-
get formFocus() {
|
|
364
|
-
var _a;
|
|
365
|
-
return (_a = this.rootForm.formFocus) !== null && _a !== void 0 ? _a : false;
|
|
366
|
-
}
|
|
367
|
-
onShow() {
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
onShowed() {
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
onHide() {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
onMounted() {
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
onReceive() {
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
onQsChange() {
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
onQsChangeShow() {
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
exports.AbstractPanel = AbstractPanel;
|
|
390
|
-
class AbstractForm extends AbstractCommon {
|
|
391
|
-
constructor() {
|
|
392
|
-
super(...arguments);
|
|
393
|
-
this.isNativeSync = false;
|
|
394
|
-
this.isReady = false;
|
|
395
|
-
this._loading = false;
|
|
396
|
-
this.lockLoading = false;
|
|
397
|
-
this._inStep = false;
|
|
398
|
-
this._stepValues = [];
|
|
399
|
-
this._firstShow = true;
|
|
400
|
-
this.dialogResult = '';
|
|
401
|
-
}
|
|
402
|
-
get formHash() {
|
|
403
|
-
return '';
|
|
404
|
-
}
|
|
405
|
-
set formHash(v) {
|
|
406
|
-
}
|
|
407
|
-
get formHashData() {
|
|
408
|
-
return {};
|
|
409
|
-
}
|
|
410
|
-
set formHashData(v) {
|
|
411
|
-
}
|
|
412
|
-
get topMost() {
|
|
413
|
-
return false;
|
|
414
|
-
}
|
|
415
|
-
set topMost(v) {
|
|
416
|
-
}
|
|
417
|
-
get bottomMost() {
|
|
418
|
-
return false;
|
|
419
|
-
}
|
|
420
|
-
set bottomMost(v) {
|
|
421
|
-
}
|
|
422
|
-
get isMask() {
|
|
423
|
-
return !task.list[this.taskId].runtime.dialogFormIds.length ||
|
|
424
|
-
task.list[this.taskId].runtime.dialogFormIds[task.list[this.taskId].runtime.dialogFormIds.length - 1]
|
|
425
|
-
=== this.formId ? false : true;
|
|
426
|
-
}
|
|
427
|
-
get formFocus() {
|
|
428
|
-
return this._formFocus;
|
|
429
|
-
}
|
|
430
|
-
get showInSystemTask() {
|
|
431
|
-
return false;
|
|
432
|
-
}
|
|
433
|
-
set showInSystemTask(v) {
|
|
434
|
-
}
|
|
435
|
-
ready(cb) {
|
|
436
|
-
cb();
|
|
437
|
-
}
|
|
438
|
-
formHashBack() {
|
|
439
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
440
|
-
const v = this;
|
|
441
|
-
if (Date.now() - v.$data._lastFormHashData > 300) {
|
|
442
|
-
v.$data._formHashData = {};
|
|
443
|
-
}
|
|
444
|
-
if (!v.$data._historyHash.length) {
|
|
445
|
-
if (v.$data._formHash) {
|
|
446
|
-
if (this.inStep) {
|
|
447
|
-
if (!(yield clickgo.form.confirm({
|
|
448
|
-
'taskId': this.taskId,
|
|
449
|
-
'content': info.locale[this.locale].confirmExitStep
|
|
450
|
-
}))) {
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
this._inStep = false;
|
|
454
|
-
this.refs.form.stepHide();
|
|
455
|
-
}
|
|
456
|
-
v.$data._formHash = '';
|
|
457
|
-
core.trigger('formHashChange', this.taskId, this.formId, '', v.$data._formHashData);
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
const parent = v.$data._historyHash[v.$data._historyHash.length - 1];
|
|
463
|
-
if (this.inStep) {
|
|
464
|
-
if (this._stepValues.includes(parent)) {
|
|
465
|
-
this.refs.form.stepValue = parent;
|
|
466
|
-
}
|
|
467
|
-
else {
|
|
468
|
-
if (!(yield clickgo.form.confirm({
|
|
469
|
-
'taskId': this.taskId,
|
|
470
|
-
'content': info.locale[this.locale].confirmExitStep
|
|
471
|
-
}))) {
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
this._inStep = false;
|
|
475
|
-
this.refs.form.stepHide();
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
v.$data._formHash = parent;
|
|
479
|
-
v.$data._historyHash.splice(-1);
|
|
480
|
-
core.trigger('formHashChange', this.taskId, this.formId, parent, v.$data._formHashData);
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
sendToPanel(panel, data) {
|
|
484
|
-
panel.send(data);
|
|
485
|
-
}
|
|
486
|
-
get loading() {
|
|
487
|
-
return this._loading;
|
|
488
|
-
}
|
|
489
|
-
set loading(val) {
|
|
490
|
-
if (this.lockLoading) {
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
this._loading = val;
|
|
494
|
-
}
|
|
495
|
-
get inStep() {
|
|
496
|
-
return this._inStep;
|
|
497
|
-
}
|
|
498
|
-
enterStep(list) {
|
|
499
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
500
|
-
if (this._inStep) {
|
|
501
|
-
return false;
|
|
502
|
-
}
|
|
503
|
-
if (list[0].value !== this.formHash) {
|
|
504
|
-
return false;
|
|
505
|
-
}
|
|
506
|
-
this._inStep = true;
|
|
507
|
-
this._stepValues.length = 0;
|
|
508
|
-
for (const item of list) {
|
|
509
|
-
this._stepValues.push(item.value);
|
|
510
|
-
}
|
|
511
|
-
this.refs.form.stepData = list;
|
|
512
|
-
this.refs.form.stepValue = this.formHash;
|
|
513
|
-
yield this.nextTick();
|
|
514
|
-
this.refs.form.stepShow();
|
|
515
|
-
return true;
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
updateStep(index, value) {
|
|
519
|
-
if (this._inStep) {
|
|
520
|
-
return false;
|
|
521
|
-
}
|
|
522
|
-
if (this._stepValues[index] === undefined) {
|
|
523
|
-
return false;
|
|
524
|
-
}
|
|
525
|
-
this._stepValues[index] = value;
|
|
526
|
-
return true;
|
|
527
|
-
}
|
|
528
|
-
doneStep() {
|
|
529
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
530
|
-
if (!this._inStep) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
this._inStep = false;
|
|
534
|
-
yield this.refs.form.stepDone();
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
show() {
|
|
538
|
-
const v = this;
|
|
539
|
-
if (this._firstShow) {
|
|
540
|
-
this._firstShow = false;
|
|
541
|
-
const area = core.getAvailArea();
|
|
542
|
-
if (!v.$refs.form.stateMaxData) {
|
|
543
|
-
if (v.$refs.form.left === -1) {
|
|
544
|
-
v.$refs.form.setPropData('left', (area.width - v.$el.offsetWidth) / 2);
|
|
545
|
-
}
|
|
546
|
-
if (v.$refs.form.top === -1) {
|
|
547
|
-
v.$refs.form.setPropData('top', (area.height - v.$el.offsetHeight) / 2);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
v.$refs.form.$data.isShow = true;
|
|
551
|
-
changeFocus(this.formId);
|
|
552
|
-
}
|
|
553
|
-
else {
|
|
554
|
-
v.$refs.form.$data.isShow = true;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
showDialog() {
|
|
558
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
559
|
-
task.list[this.taskId].runtime.dialogFormIds.push(this.formId);
|
|
560
|
-
this.show();
|
|
561
|
-
this.topMost = true;
|
|
562
|
-
return new Promise((resolve) => {
|
|
563
|
-
this.cgDialogCallback = () => {
|
|
564
|
-
resolve(this.dialogResult);
|
|
565
|
-
};
|
|
566
|
-
});
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
hide() {
|
|
570
|
-
const v = this;
|
|
571
|
-
v.$refs.form.$data.isShow = false;
|
|
572
|
-
}
|
|
573
|
-
close() {
|
|
574
|
-
close(this.formId);
|
|
575
|
-
}
|
|
576
|
-
onMounted() {
|
|
577
|
-
return;
|
|
578
|
-
}
|
|
579
|
-
onReceive() {
|
|
580
|
-
return;
|
|
581
|
-
}
|
|
582
|
-
onScreenResize() {
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
onConfigChanged() {
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
onFormCreated() {
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
onFormRemoved() {
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
onFormTitleChanged() {
|
|
595
|
-
return;
|
|
596
|
-
}
|
|
597
|
-
onFormIconChanged() {
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
onFormStateMinChanged() {
|
|
601
|
-
return;
|
|
602
|
-
}
|
|
603
|
-
onFormStateMaxChanged() {
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
onFormShowChanged() {
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
onFormFocused() {
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
onFormBlurred() {
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
onFormFlash() {
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
onFormShowInSystemTaskChange() {
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
onFormHashChange() {
|
|
622
|
-
return;
|
|
623
|
-
}
|
|
624
|
-
onTaskStarted() {
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
onTaskEnded() {
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
630
|
-
onLauncherFolderNameChanged() {
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
|
-
onHashChanged() {
|
|
634
|
-
return;
|
|
635
|
-
}
|
|
636
|
-
onKeydown() {
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
onKeyup() {
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
exports.AbstractForm = AbstractForm;
|
|
644
|
-
const popInfo = {
|
|
645
|
-
'list': [],
|
|
646
|
-
'elList': [],
|
|
647
|
-
'wayList': [],
|
|
648
|
-
'time': [],
|
|
649
|
-
'lastZIndex': 0
|
|
650
|
-
};
|
|
651
|
-
let superConfirmHandler = undefined;
|
|
652
|
-
exports.elements = {
|
|
653
|
-
'wrap': document.createElement('div'),
|
|
654
|
-
'list': document.createElement('div'),
|
|
655
|
-
'popList': document.createElement('div'),
|
|
656
|
-
'circular': document.createElement('div'),
|
|
657
|
-
'rectangle': document.createElement('div'),
|
|
658
|
-
'gesture': document.createElement('div'),
|
|
659
|
-
'drag': document.createElement('div'),
|
|
660
|
-
'notify': document.createElement('div'),
|
|
661
|
-
'alert': document.createElement('div'),
|
|
662
|
-
'simpletask': document.createElement('div'),
|
|
663
|
-
'launcher': document.createElement('div'),
|
|
664
|
-
'confirm': document.createElement('div'),
|
|
665
|
-
'init': function () {
|
|
666
|
-
this.wrap.id = 'cg-wrap';
|
|
667
|
-
document.getElementsByTagName('body')[0].appendChild(this.wrap);
|
|
668
|
-
this.wrap.addEventListener('touchmove', function (e) {
|
|
669
|
-
if (e.target && dom.findParentByData(e.target, 'cg-scroll')) {
|
|
670
|
-
return;
|
|
671
|
-
}
|
|
672
|
-
if (e.cancelable) {
|
|
673
|
-
e.preventDefault();
|
|
674
|
-
}
|
|
675
|
-
}, {
|
|
676
|
-
'passive': false
|
|
677
|
-
});
|
|
678
|
-
this.wrap.addEventListener('wheel', function (e) {
|
|
679
|
-
if (e.target && ((e.target.dataset.cgScroll !== undefined) || dom.findParentByData(e.target, 'cg-scroll'))) {
|
|
680
|
-
return;
|
|
681
|
-
}
|
|
682
|
-
e.preventDefault();
|
|
683
|
-
}, {
|
|
684
|
-
'passive': false
|
|
685
|
-
});
|
|
686
|
-
this.wrap.addEventListener('contextmenu', function (e) {
|
|
687
|
-
e.preventDefault();
|
|
688
|
-
});
|
|
689
|
-
if (clickgo.isImmersion()) {
|
|
690
|
-
this.wrap.addEventListener('mouseenter', function () {
|
|
691
|
-
native.invoke('cg-mouse-ignore', native.getToken(), false);
|
|
692
|
-
});
|
|
693
|
-
this.wrap.addEventListener('mouseleave', function () {
|
|
694
|
-
native.invoke('cg-mouse-ignore', native.getToken(), true);
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
|
-
this.list.id = 'cg-form-list';
|
|
698
|
-
this.wrap.appendChild(this.list);
|
|
699
|
-
this.popList.id = 'cg-pop-list';
|
|
700
|
-
this.wrap.appendChild(this.popList);
|
|
701
|
-
this.circular.id = 'cg-circular';
|
|
702
|
-
this.wrap.appendChild(this.circular);
|
|
703
|
-
this.rectangle.setAttribute('data-pos', '');
|
|
704
|
-
this.rectangle.id = 'cg-rectangle';
|
|
705
|
-
this.wrap.appendChild(this.rectangle);
|
|
706
|
-
this.gesture.id = 'cg-gesture';
|
|
707
|
-
this.wrap.appendChild(this.gesture);
|
|
708
|
-
this.drag.id = 'cg-drag';
|
|
709
|
-
this.drag.innerHTML = '<svg width="16" height="16" viewBox="0 0 48 48" fill="none" stroke="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M8 8L40 40" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter"/><path d="M8 40L40 8" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter"/></svg>';
|
|
710
|
-
this.wrap.appendChild(this.drag);
|
|
711
|
-
this.notify.id = 'cg-notify';
|
|
712
|
-
this.wrap.appendChild(this.notify);
|
|
713
|
-
this.alert.id = 'cg-alert';
|
|
714
|
-
this.wrap.appendChild(this.alert);
|
|
715
|
-
this.simpletask.id = 'cg-simpletask';
|
|
716
|
-
this.wrap.appendChild(this.simpletask);
|
|
717
|
-
const simpletaskApp = clickgo.vue.createApp({
|
|
718
|
-
'template': '<div v-for="(item, formId) of forms" class="cg-simpletask-item" @click="click(parseInt(formId))"><div v-if="item.icon" class="cg-simpletask-icon" :style="{\'background-image\': \'url(\' + item.icon + \')\'}"></div><div>{{item.title}}</div></div>',
|
|
719
|
-
'data': function () {
|
|
720
|
-
return {
|
|
721
|
-
'forms': {}
|
|
722
|
-
};
|
|
723
|
-
},
|
|
724
|
-
'watch': {
|
|
725
|
-
'forms': {
|
|
726
|
-
handler: function () {
|
|
727
|
-
const length = Object.keys(this.forms).length;
|
|
728
|
-
if (length > 0) {
|
|
729
|
-
if (exports.elements.simpletask.style.bottom !== '0px') {
|
|
730
|
-
exports.elements.simpletask.style.bottom = '0px';
|
|
731
|
-
core.trigger('screenResize');
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
else {
|
|
735
|
-
if (exports.elements.simpletask.style.bottom === '0px') {
|
|
736
|
-
exports.elements.simpletask.style.bottom = '-46px';
|
|
737
|
-
core.trigger('screenResize');
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
},
|
|
741
|
-
'deep': true
|
|
742
|
-
}
|
|
743
|
-
},
|
|
744
|
-
'methods': {
|
|
745
|
-
click: function (formId) {
|
|
746
|
-
changeFocus(formId);
|
|
747
|
-
}
|
|
748
|
-
},
|
|
749
|
-
'mounted': function () {
|
|
750
|
-
exports.simpleSystemTaskRoot = this;
|
|
751
|
-
}
|
|
752
|
-
});
|
|
753
|
-
simpletaskApp.mount('#cg-simpletask');
|
|
754
|
-
this.launcher.id = 'cg-launcher';
|
|
755
|
-
this.wrap.appendChild(this.launcher);
|
|
756
|
-
const waiting = function () {
|
|
757
|
-
if (!core.config) {
|
|
758
|
-
setTimeout(function () {
|
|
759
|
-
waiting();
|
|
760
|
-
}, 150);
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
const launcherApp = clickgo.vue.createApp({
|
|
764
|
-
'template': `<div class="cg-launcher-search">` +
|
|
765
|
-
`<input v-if="folderName === ''" class="cg-launcher-sinput" :placeholder="search" v-model="name">` +
|
|
766
|
-
`<input v-else class="cg-launcher-foldername" :value="folderName" @change="folderNameChange">` +
|
|
767
|
-
`</div>` +
|
|
768
|
-
`<div class="cg-launcher-list" @mousedown="mousedown" @click="listClick" :class="[folderName === '' ? '' : 'cg-folder-open']">` +
|
|
769
|
-
`<div v-for="item of list" class="cg-launcher-item">` +
|
|
770
|
-
`<div class="cg-launcher-inner">` +
|
|
771
|
-
`<div v-if="!item.list || item.list.length === 0" class="cg-launcher-icon" :style="{'background-image': 'url(' + item.icon + ')'}" @click="iconClick($event, item)"></div>` +
|
|
772
|
-
`<div v-else class="cg-launcher-folder" @click="openFolder($event, item)">` +
|
|
773
|
-
`<div>` +
|
|
774
|
-
`<div v-for="sub of item.list" class="cg-launcher-item">` +
|
|
775
|
-
`<div class="cg-launcher-inner">` +
|
|
776
|
-
`<div class="cg-launcher-icon" :style="{'background-image': 'url(' + sub.icon + ')'}" @click="subIconClick($event, sub)"></div>` +
|
|
777
|
-
`<div class="cg-launcher-name">{{sub.name}}</div>` +
|
|
778
|
-
`</div>` +
|
|
779
|
-
`<div class="cg-launcher-space"></div>` +
|
|
780
|
-
`</div>` +
|
|
781
|
-
`</div>` +
|
|
782
|
-
`</div>` +
|
|
783
|
-
`<div class="cg-launcher-name">{{item.name}}</div>` +
|
|
784
|
-
`</div>` +
|
|
785
|
-
`<div class="cg-launcher-space"></div>` +
|
|
786
|
-
`</div>` +
|
|
787
|
-
`</div>`,
|
|
788
|
-
'data': function () {
|
|
789
|
-
return {
|
|
790
|
-
'name': '',
|
|
791
|
-
'folderName': '',
|
|
792
|
-
'folderItem': {}
|
|
793
|
-
};
|
|
794
|
-
},
|
|
795
|
-
'computed': {
|
|
796
|
-
'search': function () {
|
|
797
|
-
var _a, _b;
|
|
798
|
-
return (_b = (_a = info.locale[core.config.locale]) === null || _a === void 0 ? void 0 : _a.search) !== null && _b !== void 0 ? _b : info.locale['en'].search;
|
|
799
|
-
},
|
|
800
|
-
'list': function () {
|
|
801
|
-
if (this.name === '') {
|
|
802
|
-
return core.config['launcher.list'];
|
|
803
|
-
}
|
|
804
|
-
const list = [];
|
|
805
|
-
for (const item of core.config['launcher.list']) {
|
|
806
|
-
if (item.list && item.list.length > 0) {
|
|
807
|
-
for (const sub of item.list) {
|
|
808
|
-
if (sub.name.toLowerCase().includes(this.name.toLowerCase())) {
|
|
809
|
-
list.push(sub);
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
else {
|
|
814
|
-
if (item.name.toLowerCase().includes(this.name.toLowerCase())) {
|
|
815
|
-
list.push(item);
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
return list;
|
|
820
|
-
}
|
|
821
|
-
},
|
|
822
|
-
'methods': {
|
|
823
|
-
mousedown: function (e) {
|
|
824
|
-
this.md = e.pageX + e.pageY;
|
|
825
|
-
},
|
|
826
|
-
listClick: function (e) {
|
|
827
|
-
if (this.md !== e.pageX + e.pageY) {
|
|
828
|
-
return;
|
|
829
|
-
}
|
|
830
|
-
if (e.currentTarget !== e.target) {
|
|
831
|
-
return;
|
|
832
|
-
}
|
|
833
|
-
if (this.folderName === '') {
|
|
834
|
-
hideLauncher();
|
|
835
|
-
}
|
|
836
|
-
else {
|
|
837
|
-
this.closeFolder();
|
|
838
|
-
}
|
|
839
|
-
},
|
|
840
|
-
iconClick: function (e, item) {
|
|
841
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
842
|
-
if (this.md !== e.pageX + e.pageY) {
|
|
843
|
-
return;
|
|
844
|
-
}
|
|
845
|
-
hideLauncher();
|
|
846
|
-
yield clickgo.task.run(item.path, {
|
|
847
|
-
'icon': item.icon
|
|
848
|
-
});
|
|
849
|
-
});
|
|
850
|
-
},
|
|
851
|
-
subIconClick: function (e, item) {
|
|
852
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
853
|
-
if (this.md !== e.pageX + e.pageY) {
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
hideLauncher();
|
|
857
|
-
yield clickgo.task.run(item.path, {
|
|
858
|
-
'icon': item.icon
|
|
859
|
-
});
|
|
860
|
-
});
|
|
861
|
-
},
|
|
862
|
-
closeFolder: function () {
|
|
863
|
-
this.folderName = '';
|
|
864
|
-
const el = this.folderEl;
|
|
865
|
-
const rect = el.parentNode.getBoundingClientRect();
|
|
866
|
-
el.classList.remove('cg-show');
|
|
867
|
-
el.style.left = (rect.left + 30).toString() + 'px';
|
|
868
|
-
el.style.top = rect.top.toString() + 'px';
|
|
869
|
-
el.style.width = '';
|
|
870
|
-
el.style.height = '';
|
|
871
|
-
setTimeout(() => {
|
|
872
|
-
el.style.position = '';
|
|
873
|
-
el.style.left = '';
|
|
874
|
-
el.style.top = '';
|
|
875
|
-
}, 150);
|
|
876
|
-
},
|
|
877
|
-
openFolder: function (e, item) {
|
|
878
|
-
if (this.md !== e.pageX + e.pageY) {
|
|
879
|
-
return;
|
|
880
|
-
}
|
|
881
|
-
if (e.currentTarget.childNodes[0] !== e.target) {
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
if (this.folderName !== '') {
|
|
885
|
-
this.closeFolder();
|
|
886
|
-
return;
|
|
887
|
-
}
|
|
888
|
-
this.folderName = item.name;
|
|
889
|
-
this.folderItem = item;
|
|
890
|
-
const el = e.currentTarget.childNodes.item(0);
|
|
891
|
-
this.folderEl = el;
|
|
892
|
-
const searchEl = document.getElementsByClassName('cg-launcher-search')[0];
|
|
893
|
-
const rect = el.getBoundingClientRect();
|
|
894
|
-
el.style.left = rect.left.toString() + 'px';
|
|
895
|
-
el.style.top = rect.top.toString() + 'px';
|
|
896
|
-
el.style.position = 'fixed';
|
|
897
|
-
requestAnimationFrame(() => {
|
|
898
|
-
el.classList.add('cg-show');
|
|
899
|
-
el.style.left = '50px';
|
|
900
|
-
el.style.top = searchEl.offsetHeight.toString() + 'px';
|
|
901
|
-
el.style.width = 'calc(100% - 100px)';
|
|
902
|
-
el.style.height = 'calc(100% - 50px - ' + searchEl.offsetHeight.toString() + 'px)';
|
|
903
|
-
});
|
|
904
|
-
},
|
|
905
|
-
folderNameChange: function (e) {
|
|
906
|
-
var _a;
|
|
907
|
-
const input = e.target;
|
|
908
|
-
const val = input.value.trim();
|
|
909
|
-
if (val === '') {
|
|
910
|
-
input.value = this.folderName;
|
|
911
|
-
return;
|
|
912
|
-
}
|
|
913
|
-
this.folderName = val;
|
|
914
|
-
core.trigger('launcherFolderNameChanged', (_a = this.folderItem.id) !== null && _a !== void 0 ? _a : '', val);
|
|
915
|
-
}
|
|
916
|
-
},
|
|
917
|
-
'mounted': function () {
|
|
918
|
-
exports.launcherRoot = this;
|
|
919
|
-
}
|
|
920
|
-
});
|
|
921
|
-
launcherApp.mount('#cg-launcher');
|
|
922
|
-
};
|
|
923
|
-
waiting();
|
|
924
|
-
this.confirm.id = 'cg-confirm';
|
|
925
|
-
this.wrap.appendChild(this.confirm);
|
|
926
|
-
this.confirm.innerHTML = `<div class="cg-confirm-box">` +
|
|
927
|
-
`<div id="cg-confirm-content"></div>` +
|
|
928
|
-
`<div class="cg-confirm-controls">` +
|
|
929
|
-
`<div id="cg-confirm-cancel"></div>` +
|
|
930
|
-
`<div id="cg-confirm-ok"></div>` +
|
|
931
|
-
`</div>` +
|
|
932
|
-
`</div>`;
|
|
933
|
-
this.confirm.style.display = 'none';
|
|
934
|
-
document.getElementById('cg-confirm-cancel').addEventListener('click', () => {
|
|
935
|
-
superConfirmHandler === null || superConfirmHandler === void 0 ? void 0 : superConfirmHandler(false);
|
|
936
|
-
this.confirm.style.display = 'none';
|
|
937
|
-
const fid = getMaxZIndexID();
|
|
938
|
-
if (fid) {
|
|
939
|
-
changeFocus(fid);
|
|
940
|
-
}
|
|
941
|
-
});
|
|
942
|
-
document.getElementById('cg-confirm-ok').addEventListener('click', () => {
|
|
943
|
-
superConfirmHandler === null || superConfirmHandler === void 0 ? void 0 : superConfirmHandler(true);
|
|
944
|
-
this.confirm.style.display = 'none';
|
|
945
|
-
const fid = getMaxZIndexID();
|
|
946
|
-
if (fid) {
|
|
947
|
-
changeFocus(fid);
|
|
948
|
-
}
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
};
|
|
952
|
-
exports.elements.init();
|
|
953
|
-
function superConfirm(html) {
|
|
954
|
-
return new Promise((resolve) => {
|
|
955
|
-
var _a, _b, _c, _d;
|
|
956
|
-
if (superConfirmHandler !== undefined) {
|
|
957
|
-
resolve(false);
|
|
958
|
-
return;
|
|
959
|
-
}
|
|
960
|
-
exports.elements.confirm.style.display = 'flex';
|
|
961
|
-
document.getElementById('cg-confirm-content').innerHTML = html;
|
|
962
|
-
document.getElementById('cg-confirm-cancel').innerHTML = (_b = (_a = info.locale[core.config.locale]) === null || _a === void 0 ? void 0 : _a.cancel) !== null && _b !== void 0 ? _b : info.locale['en'].cancel;
|
|
963
|
-
document.getElementById('cg-confirm-ok').innerHTML = (_d = (_c = info.locale[core.config.locale]) === null || _c === void 0 ? void 0 : _c.ok) !== null && _d !== void 0 ? _d : info.locale['en'].ok;
|
|
964
|
-
superConfirmHandler = (result) => {
|
|
965
|
-
superConfirmHandler = undefined;
|
|
966
|
-
resolve(result);
|
|
967
|
-
};
|
|
968
|
-
});
|
|
969
|
-
}
|
|
970
|
-
function changeState(state, formId) {
|
|
971
|
-
const tid = getTaskId(formId);
|
|
972
|
-
const t = task.list[tid];
|
|
973
|
-
if (!t) {
|
|
974
|
-
return false;
|
|
975
|
-
}
|
|
976
|
-
switch (state) {
|
|
977
|
-
case 'max': {
|
|
978
|
-
t.forms[formId].vroot.$refs.form.maxMethod();
|
|
979
|
-
break;
|
|
980
|
-
}
|
|
981
|
-
case 'min': {
|
|
982
|
-
t.forms[formId].vroot.$refs.form.minMethod();
|
|
983
|
-
break;
|
|
984
|
-
}
|
|
985
|
-
default: {
|
|
986
|
-
remove(formId);
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
return true;
|
|
990
|
-
}
|
|
991
|
-
function min(formId) {
|
|
992
|
-
return changeState('min', formId);
|
|
993
|
-
}
|
|
994
|
-
function max(formId) {
|
|
995
|
-
return changeState('max', formId);
|
|
996
|
-
}
|
|
997
|
-
function close(formId) {
|
|
998
|
-
return changeState('close', formId);
|
|
999
|
-
}
|
|
1000
|
-
function bindResize(e, border) {
|
|
1001
|
-
const formWrap = dom.findParentByClass(e.target, 'cg-form-wrap');
|
|
1002
|
-
if (!formWrap) {
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
const formId = formWrap.dataset.formId;
|
|
1006
|
-
if (!formId) {
|
|
1007
|
-
return;
|
|
1008
|
-
}
|
|
1009
|
-
const fid = parseInt(formId);
|
|
1010
|
-
const tid = getTaskId(fid);
|
|
1011
|
-
const t = task.list[tid];
|
|
1012
|
-
if (!t) {
|
|
1013
|
-
return;
|
|
1014
|
-
}
|
|
1015
|
-
t.forms[fid].vroot.$refs.form.resizeMethod(e, border);
|
|
1016
|
-
}
|
|
1017
|
-
function bindDrag(e) {
|
|
1018
|
-
const formWrap = dom.findParentByClass(e.target, 'cg-form-wrap');
|
|
1019
|
-
if (!formWrap) {
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
const formId = formWrap.dataset.formId;
|
|
1023
|
-
if (!formId) {
|
|
1024
|
-
return;
|
|
1025
|
-
}
|
|
1026
|
-
const fid = parseInt(formId);
|
|
1027
|
-
const tid = getTaskId(fid);
|
|
1028
|
-
const t = task.list[tid];
|
|
1029
|
-
if (!t) {
|
|
1030
|
-
return;
|
|
1031
|
-
}
|
|
1032
|
-
t.forms[fid].vroot.$refs.form.moveMethod(e, true);
|
|
1033
|
-
}
|
|
1034
|
-
function refreshMaxPosition() {
|
|
1035
|
-
const area = core.getAvailArea();
|
|
1036
|
-
for (let i = 0; i < exports.elements.list.children.length; ++i) {
|
|
1037
|
-
const el = exports.elements.list.children.item(i);
|
|
1038
|
-
const ef = el.children.item(0);
|
|
1039
|
-
if (ef.dataset.cgMax === undefined) {
|
|
1040
|
-
continue;
|
|
1041
|
-
}
|
|
1042
|
-
const taskId = parseInt(el.getAttribute('data-task-id'));
|
|
1043
|
-
const formId = parseInt(el.getAttribute('data-form-id'));
|
|
1044
|
-
if (!task.list[taskId]) {
|
|
1045
|
-
continue;
|
|
1046
|
-
}
|
|
1047
|
-
const vroot = task.list[taskId].forms[formId].vroot;
|
|
1048
|
-
if (ef.dataset.cgBottomMost === undefined) {
|
|
1049
|
-
vroot.$refs.form.setPropData('left', area.left);
|
|
1050
|
-
vroot.$refs.form.setPropData('top', area.top);
|
|
1051
|
-
vroot.$refs.form.setPropData('width', area.width);
|
|
1052
|
-
vroot.$refs.form.setPropData('height', area.height);
|
|
1053
|
-
}
|
|
1054
|
-
else {
|
|
1055
|
-
vroot.$refs.form.setPropData('width', area.owidth);
|
|
1056
|
-
vroot.$refs.form.setPropData('height', area.oheight);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
function getTaskId(formId) {
|
|
1061
|
-
const formElement = exports.elements.list.querySelector(`[data-form-id='${formId}']`);
|
|
1062
|
-
if (!formElement) {
|
|
1063
|
-
return 0;
|
|
1064
|
-
}
|
|
1065
|
-
const taskIdAttr = formElement.getAttribute('data-task-id');
|
|
1066
|
-
if (!taskIdAttr) {
|
|
1067
|
-
return 0;
|
|
1068
|
-
}
|
|
1069
|
-
return parseInt(taskIdAttr);
|
|
1070
|
-
}
|
|
1071
|
-
function get(formId) {
|
|
1072
|
-
const taskId = getTaskId(formId);
|
|
1073
|
-
if (taskId === 0) {
|
|
1074
|
-
return null;
|
|
1075
|
-
}
|
|
1076
|
-
if (!task.list[taskId].forms[formId]) {
|
|
1077
|
-
return null;
|
|
1078
|
-
}
|
|
1079
|
-
const item = task.list[taskId].forms[formId];
|
|
1080
|
-
return {
|
|
1081
|
-
'taskId': taskId,
|
|
1082
|
-
'title': item.vroot.$refs.form.title,
|
|
1083
|
-
'icon': item.vroot.$refs.form.iconDataUrl,
|
|
1084
|
-
'stateMax': item.vroot.$refs.form.stateMaxData,
|
|
1085
|
-
'stateMin': item.vroot.$refs.form.stateMinData,
|
|
1086
|
-
'show': item.vroot.$refs.form.isShow,
|
|
1087
|
-
'focus': item.vroot.formFocus,
|
|
1088
|
-
'showInSystemTask': item.vroot.showInSystemTask
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
function send(formId, obj) {
|
|
1092
|
-
const taskId = getTaskId(formId);
|
|
1093
|
-
if (taskId === 0) {
|
|
1094
|
-
return;
|
|
1095
|
-
}
|
|
1096
|
-
const item = task.list[taskId].forms[formId];
|
|
1097
|
-
item.vroot.onReceive(obj);
|
|
1098
|
-
}
|
|
1099
|
-
function getList(taskId) {
|
|
1100
|
-
if (!task.list[taskId]) {
|
|
1101
|
-
return {};
|
|
1102
|
-
}
|
|
1103
|
-
const list = {};
|
|
1104
|
-
for (const fid in task.list[taskId].forms) {
|
|
1105
|
-
const item = task.list[taskId].forms[fid];
|
|
1106
|
-
list[fid] = {
|
|
1107
|
-
'taskId': taskId,
|
|
1108
|
-
'title': item.vroot.$refs.form.title,
|
|
1109
|
-
'icon': item.vroot.$refs.form.iconDataUrl,
|
|
1110
|
-
'stateMax': item.vroot.$refs.form.stateMaxData,
|
|
1111
|
-
'stateMin': item.vroot.$refs.form.stateMinData,
|
|
1112
|
-
'show': item.vroot.$refs.form.isShow,
|
|
1113
|
-
'focus': item.vroot.formFocus,
|
|
1114
|
-
'showInSystemTask': item.vroot.showInSystemTask
|
|
1115
|
-
};
|
|
1116
|
-
}
|
|
1117
|
-
return list;
|
|
1118
|
-
}
|
|
1119
|
-
function getFocus() {
|
|
1120
|
-
return focusId;
|
|
1121
|
-
}
|
|
1122
|
-
exports.activePanels = {};
|
|
1123
|
-
function getActivePanel(formId) {
|
|
1124
|
-
var _a;
|
|
1125
|
-
return (_a = exports.activePanels[formId]) !== null && _a !== void 0 ? _a : [];
|
|
1126
|
-
}
|
|
1127
|
-
function removeActivePanel(panelId, formId, taskId) {
|
|
1128
|
-
if (!taskId) {
|
|
1129
|
-
return false;
|
|
1130
|
-
}
|
|
1131
|
-
if (!task.list[taskId]) {
|
|
1132
|
-
return false;
|
|
1133
|
-
}
|
|
1134
|
-
if (!task.list[taskId].forms[formId]) {
|
|
1135
|
-
return false;
|
|
1136
|
-
}
|
|
1137
|
-
if (!exports.activePanels[formId]) {
|
|
1138
|
-
return true;
|
|
1139
|
-
}
|
|
1140
|
-
const io = exports.activePanels[formId].indexOf(panelId);
|
|
1141
|
-
if (io === -1) {
|
|
1142
|
-
return true;
|
|
1143
|
-
}
|
|
1144
|
-
exports.activePanels[formId].splice(io, 1);
|
|
1145
|
-
if (!exports.activePanels[formId].length) {
|
|
1146
|
-
delete exports.activePanels[formId];
|
|
1147
|
-
}
|
|
1148
|
-
return true;
|
|
1149
|
-
}
|
|
1150
|
-
function setActivePanel(panelId, formId, taskId) {
|
|
1151
|
-
if (!taskId) {
|
|
1152
|
-
return false;
|
|
1153
|
-
}
|
|
1154
|
-
if (!task.list[taskId]) {
|
|
1155
|
-
return false;
|
|
1156
|
-
}
|
|
1157
|
-
if (!task.list[taskId].forms[formId]) {
|
|
1158
|
-
return false;
|
|
1159
|
-
}
|
|
1160
|
-
if (!exports.activePanels[formId]) {
|
|
1161
|
-
exports.activePanels[formId] = [];
|
|
1162
|
-
}
|
|
1163
|
-
const io = exports.activePanels[formId].indexOf(panelId);
|
|
1164
|
-
if (io !== -1) {
|
|
1165
|
-
return true;
|
|
1166
|
-
}
|
|
1167
|
-
exports.activePanels[formId].push(panelId);
|
|
1168
|
-
return true;
|
|
1169
|
-
}
|
|
1170
|
-
function hash(hash, formId) {
|
|
1171
|
-
const taskId = getTaskId(formId);
|
|
1172
|
-
if (taskId === 0) {
|
|
1173
|
-
return false;
|
|
1174
|
-
}
|
|
1175
|
-
const t = task.list[taskId];
|
|
1176
|
-
if (!t) {
|
|
1177
|
-
return false;
|
|
1178
|
-
}
|
|
1179
|
-
const item = task.list[taskId].forms[formId];
|
|
1180
|
-
if (!item) {
|
|
1181
|
-
return false;
|
|
1182
|
-
}
|
|
1183
|
-
item.vroot.formHash = hash;
|
|
1184
|
-
return true;
|
|
1185
|
-
}
|
|
1186
|
-
function getHash(formId) {
|
|
1187
|
-
const taskId = getTaskId(formId);
|
|
1188
|
-
if (taskId === 0) {
|
|
1189
|
-
return '';
|
|
1190
|
-
}
|
|
1191
|
-
const t = task.list[taskId];
|
|
1192
|
-
if (!t) {
|
|
1193
|
-
return '';
|
|
1194
|
-
}
|
|
1195
|
-
const item = task.list[taskId].forms[formId];
|
|
1196
|
-
if (!item) {
|
|
1197
|
-
return '';
|
|
1198
|
-
}
|
|
1199
|
-
return item.vroot.$data._formHash;
|
|
1200
|
-
}
|
|
1201
|
-
function hashBack(formId) {
|
|
1202
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1203
|
-
const taskId = getTaskId(formId);
|
|
1204
|
-
if (taskId === 0) {
|
|
1205
|
-
return false;
|
|
1206
|
-
}
|
|
1207
|
-
const t = task.list[taskId];
|
|
1208
|
-
if (!t) {
|
|
1209
|
-
return false;
|
|
1210
|
-
}
|
|
1211
|
-
const item = task.list[taskId].forms[formId];
|
|
1212
|
-
if (!item) {
|
|
1213
|
-
return false;
|
|
1214
|
-
}
|
|
1215
|
-
yield item.vroot.formHashBack();
|
|
1216
|
-
return true;
|
|
1217
|
-
});
|
|
1218
|
-
}
|
|
1219
|
-
function changeFocus(formId = 0) {
|
|
1220
|
-
var _a;
|
|
1221
|
-
if (typeof formId === 'string') {
|
|
1222
|
-
formId = parseInt(formId);
|
|
1223
|
-
}
|
|
1224
|
-
const dataFormId = getFocus();
|
|
1225
|
-
if (dataFormId) {
|
|
1226
|
-
if (dataFormId === formId) {
|
|
1227
|
-
return;
|
|
1228
|
-
}
|
|
1229
|
-
else {
|
|
1230
|
-
const t = task.list[task.getFocus()];
|
|
1231
|
-
t.forms[dataFormId].vapp._container.removeAttribute('data-form-focus');
|
|
1232
|
-
t.forms[dataFormId].vroot._formFocus = false;
|
|
1233
|
-
core.trigger('formBlurred', t.id, dataFormId);
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
focusId = null;
|
|
1237
|
-
task.setFocus();
|
|
1238
|
-
if (formId === 0) {
|
|
1239
|
-
return;
|
|
1240
|
-
}
|
|
1241
|
-
const el = exports.elements.list.querySelector(`.cg-form-wrap[data-form-id='${formId}']`);
|
|
1242
|
-
if (!el) {
|
|
1243
|
-
return;
|
|
1244
|
-
}
|
|
1245
|
-
if (el.children.item(0).dataset.cgMin !== undefined) {
|
|
1246
|
-
min(formId);
|
|
1247
|
-
}
|
|
1248
|
-
const taskId = parseInt((_a = el.getAttribute('data-task-id')) !== null && _a !== void 0 ? _a : '0');
|
|
1249
|
-
const t = task.list[taskId];
|
|
1250
|
-
if (t.runtime.dialogFormIds.length) {
|
|
1251
|
-
const dialogFormId = t.runtime.dialogFormIds[t.runtime.dialogFormIds.length - 1];
|
|
1252
|
-
if (get(dialogFormId).stateMin) {
|
|
1253
|
-
min(dialogFormId);
|
|
1254
|
-
}
|
|
1255
|
-
if (t.forms[dialogFormId].vroot._topMost) {
|
|
1256
|
-
t.forms[dialogFormId].vroot.$refs.form.$data.zIndex = ++info.topLastZIndex;
|
|
1257
|
-
}
|
|
1258
|
-
else if (t.forms[dialogFormId].vroot._bottomMost) {
|
|
1259
|
-
t.forms[dialogFormId].vroot.$refs.form.$data.zIndex = ++info.bottomLastZIndex;
|
|
1260
|
-
}
|
|
1261
|
-
else {
|
|
1262
|
-
t.forms[dialogFormId].vroot.$refs.form.$data.zIndex = ++info.lastZIndex;
|
|
1263
|
-
}
|
|
1264
|
-
t.forms[dialogFormId].vapp._container.dataset.formFocus = '';
|
|
1265
|
-
t.forms[dialogFormId].vroot._formFocus = true;
|
|
1266
|
-
focusId = dialogFormId;
|
|
1267
|
-
task.setFocus(t.id);
|
|
1268
|
-
core.trigger('formFocused', taskId, dialogFormId);
|
|
1269
|
-
if (dialogFormId !== formId) {
|
|
1270
|
-
clickgo.form.flash(dialogFormId, taskId);
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
else {
|
|
1274
|
-
if (t.forms[formId].vroot._topMost) {
|
|
1275
|
-
t.forms[formId].vroot.$refs.form.$data.zIndex = ++info.topLastZIndex;
|
|
1276
|
-
}
|
|
1277
|
-
else if (t.forms[formId].vroot._bottomMost) {
|
|
1278
|
-
t.forms[formId].vroot.$refs.form.$data.zIndex = ++info.bottomLastZIndex;
|
|
1279
|
-
}
|
|
1280
|
-
else {
|
|
1281
|
-
t.forms[formId].vroot.$refs.form.$data.zIndex = ++info.lastZIndex;
|
|
1282
|
-
}
|
|
1283
|
-
t.forms[formId].vapp._container.dataset.formFocus = '';
|
|
1284
|
-
t.forms[formId].vroot._formFocus = true;
|
|
1285
|
-
focusId = formId;
|
|
1286
|
-
task.setFocus(t.id);
|
|
1287
|
-
core.trigger('formFocused', taskId, formId);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
function getMaxZIndexID(out = {}) {
|
|
1291
|
-
var _a, _b;
|
|
1292
|
-
let zIndex = 0;
|
|
1293
|
-
let formId = null;
|
|
1294
|
-
for (let i = 0; i < exports.elements.list.children.length; ++i) {
|
|
1295
|
-
const formWrap = exports.elements.list.children.item(i);
|
|
1296
|
-
const formInner = formWrap.children.item(0);
|
|
1297
|
-
if (!formInner) {
|
|
1298
|
-
continue;
|
|
1299
|
-
}
|
|
1300
|
-
const z = parseInt(formInner.style.zIndex);
|
|
1301
|
-
if (z < 1000000) {
|
|
1302
|
-
continue;
|
|
1303
|
-
}
|
|
1304
|
-
if (formInner.dataset.cgMin !== undefined) {
|
|
1305
|
-
continue;
|
|
1306
|
-
}
|
|
1307
|
-
const tid = parseInt(formWrap.getAttribute('data-task-id'));
|
|
1308
|
-
if (tid === task.systemTaskInfo.taskId) {
|
|
1309
|
-
continue;
|
|
1310
|
-
}
|
|
1311
|
-
if ((_a = out.taskIds) === null || _a === void 0 ? void 0 : _a.includes(tid)) {
|
|
1312
|
-
continue;
|
|
1313
|
-
}
|
|
1314
|
-
const fid = parseInt(formWrap.getAttribute('data-form-id'));
|
|
1315
|
-
if ((_b = out.formIds) === null || _b === void 0 ? void 0 : _b.includes(fid)) {
|
|
1316
|
-
continue;
|
|
1317
|
-
}
|
|
1318
|
-
if (z > zIndex) {
|
|
1319
|
-
zIndex = z;
|
|
1320
|
-
formId = fid;
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
return formId;
|
|
1324
|
-
}
|
|
1325
|
-
function getRectByBorder(border) {
|
|
1326
|
-
var _a, _b, _c, _d;
|
|
1327
|
-
const area = core.getAvailArea();
|
|
1328
|
-
let width, height, left, top;
|
|
1329
|
-
if (typeof border === 'string') {
|
|
1330
|
-
switch (border) {
|
|
1331
|
-
case 'lt': {
|
|
1332
|
-
width = area.width / 2;
|
|
1333
|
-
height = area.height / 2;
|
|
1334
|
-
left = area.left;
|
|
1335
|
-
top = area.top;
|
|
1336
|
-
break;
|
|
1337
|
-
}
|
|
1338
|
-
case 't': {
|
|
1339
|
-
width = area.width;
|
|
1340
|
-
height = area.height;
|
|
1341
|
-
left = area.left;
|
|
1342
|
-
top = area.top;
|
|
1343
|
-
break;
|
|
1344
|
-
}
|
|
1345
|
-
case 'tr': {
|
|
1346
|
-
width = area.width / 2;
|
|
1347
|
-
height = area.height / 2;
|
|
1348
|
-
left = area.left + area.width / 2;
|
|
1349
|
-
top = area.top;
|
|
1350
|
-
break;
|
|
1351
|
-
}
|
|
1352
|
-
case 'r': {
|
|
1353
|
-
width = area.width / 2;
|
|
1354
|
-
height = area.height;
|
|
1355
|
-
left = area.left + area.width / 2;
|
|
1356
|
-
top = area.top;
|
|
1357
|
-
break;
|
|
1358
|
-
}
|
|
1359
|
-
case 'rb': {
|
|
1360
|
-
width = area.width / 2;
|
|
1361
|
-
height = area.height / 2;
|
|
1362
|
-
left = area.left + area.width / 2;
|
|
1363
|
-
top = area.top + area.height / 2;
|
|
1364
|
-
break;
|
|
1365
|
-
}
|
|
1366
|
-
case 'b': {
|
|
1367
|
-
width = area.width;
|
|
1368
|
-
height = area.height / 2;
|
|
1369
|
-
left = area.left;
|
|
1370
|
-
top = area.top + area.height / 2;
|
|
1371
|
-
break;
|
|
1372
|
-
}
|
|
1373
|
-
case 'bl': {
|
|
1374
|
-
width = area.width / 2;
|
|
1375
|
-
height = area.height / 2;
|
|
1376
|
-
left = area.left;
|
|
1377
|
-
top = area.top + area.height / 2;
|
|
1378
|
-
break;
|
|
1379
|
-
}
|
|
1380
|
-
case 'l': {
|
|
1381
|
-
width = area.width / 2;
|
|
1382
|
-
height = area.height;
|
|
1383
|
-
left = area.left;
|
|
1384
|
-
top = area.top;
|
|
1385
|
-
break;
|
|
1386
|
-
}
|
|
1387
|
-
default: {
|
|
1388
|
-
break;
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
else {
|
|
1393
|
-
width = (_a = border.width) !== null && _a !== void 0 ? _a : area.width;
|
|
1394
|
-
height = (_b = border.height) !== null && _b !== void 0 ? _b : area.height;
|
|
1395
|
-
left = (_c = border.left) !== null && _c !== void 0 ? _c : area.left;
|
|
1396
|
-
top = (_d = border.top) !== null && _d !== void 0 ? _d : area.top;
|
|
1397
|
-
}
|
|
1398
|
-
return {
|
|
1399
|
-
'width': width,
|
|
1400
|
-
'height': height,
|
|
1401
|
-
'left': left,
|
|
1402
|
-
'top': top
|
|
1403
|
-
};
|
|
1404
|
-
}
|
|
1405
|
-
function showCircular(x, y) {
|
|
1406
|
-
exports.elements.circular.style.transition = 'none';
|
|
1407
|
-
requestAnimationFrame(function () {
|
|
1408
|
-
exports.elements.circular.style.width = '6px';
|
|
1409
|
-
exports.elements.circular.style.height = '6px';
|
|
1410
|
-
exports.elements.circular.style.left = (x - 3).toString() + 'px';
|
|
1411
|
-
exports.elements.circular.style.top = (y - 3).toString() + 'px';
|
|
1412
|
-
exports.elements.circular.style.opacity = '1';
|
|
1413
|
-
requestAnimationFrame(function () {
|
|
1414
|
-
exports.elements.circular.style.transition = 'all .3s var(--g-cubic)';
|
|
1415
|
-
requestAnimationFrame(function () {
|
|
1416
|
-
exports.elements.circular.style.width = '60px';
|
|
1417
|
-
exports.elements.circular.style.height = '60px';
|
|
1418
|
-
exports.elements.circular.style.left = (x - 30).toString() + 'px';
|
|
1419
|
-
exports.elements.circular.style.top = (y - 30).toString() + 'px';
|
|
1420
|
-
exports.elements.circular.style.opacity = '0';
|
|
1421
|
-
});
|
|
1422
|
-
});
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
function moveRectangle(border) {
|
|
1426
|
-
var _a, _b, _c, _d;
|
|
1427
|
-
const dataReady = (_a = exports.elements.rectangle.getAttribute('data-ready')) !== null && _a !== void 0 ? _a : '0';
|
|
1428
|
-
if (dataReady === '0') {
|
|
1429
|
-
return;
|
|
1430
|
-
}
|
|
1431
|
-
const dataBorder = (_b = exports.elements.rectangle.getAttribute('data-border')) !== null && _b !== void 0 ? _b : '';
|
|
1432
|
-
const setDataBorder = typeof border === 'string' ? border : `o-${border.left}-${(_c = border.top) !== null && _c !== void 0 ? _c : 'n'}-${border.width}-${(_d = border.height) !== null && _d !== void 0 ? _d : 'n'}`;
|
|
1433
|
-
if (dataBorder === setDataBorder) {
|
|
1434
|
-
return;
|
|
1435
|
-
}
|
|
1436
|
-
exports.elements.rectangle.setAttribute('data-dir', setDataBorder);
|
|
1437
|
-
const pos = getRectByBorder(border);
|
|
1438
|
-
const width = pos.width - 20;
|
|
1439
|
-
const height = pos.height - 20;
|
|
1440
|
-
const left = pos.left + 10;
|
|
1441
|
-
const top = pos.top + 10;
|
|
1442
|
-
if (width !== undefined && height !== undefined && left !== undefined && top !== undefined) {
|
|
1443
|
-
exports.elements.rectangle.style.width = width.toString() + 'px';
|
|
1444
|
-
exports.elements.rectangle.style.height = height.toString() + 'px';
|
|
1445
|
-
exports.elements.rectangle.style.left = left.toString() + 'px';
|
|
1446
|
-
exports.elements.rectangle.style.top = top.toString() + 'px';
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
function showRectangle(x, y, border) {
|
|
1450
|
-
exports.elements.rectangle.style.transition = 'none';
|
|
1451
|
-
requestAnimationFrame(function () {
|
|
1452
|
-
exports.elements.rectangle.style.width = '5px';
|
|
1453
|
-
exports.elements.rectangle.style.height = '5px';
|
|
1454
|
-
exports.elements.rectangle.style.left = (x - 10).toString() + 'px';
|
|
1455
|
-
exports.elements.rectangle.style.top = (y - 10).toString() + 'px';
|
|
1456
|
-
exports.elements.rectangle.style.opacity = '1';
|
|
1457
|
-
exports.elements.rectangle.setAttribute('data-ready', '0');
|
|
1458
|
-
exports.elements.rectangle.setAttribute('data-dir', '');
|
|
1459
|
-
requestAnimationFrame(function () {
|
|
1460
|
-
exports.elements.rectangle.style.transition = 'all .3s var(--g-cubic)';
|
|
1461
|
-
requestAnimationFrame(function () {
|
|
1462
|
-
exports.elements.rectangle.setAttribute('data-ready', '1');
|
|
1463
|
-
moveRectangle(border);
|
|
1464
|
-
});
|
|
1465
|
-
});
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
function hideRectangle() {
|
|
1469
|
-
exports.elements.rectangle.style.opacity = '0';
|
|
1470
|
-
}
|
|
1471
|
-
let dragTimeOut = 0;
|
|
1472
|
-
function showDrag() {
|
|
1473
|
-
if (dragTimeOut) {
|
|
1474
|
-
clearTimeout(dragTimeOut);
|
|
1475
|
-
dragTimeOut = 0;
|
|
1476
|
-
}
|
|
1477
|
-
exports.elements.drag.style.opacity = '1';
|
|
1478
|
-
exports.elements.drag.style.transform = 'perspective(100px) rotateX(15deg) translateZ(15px)';
|
|
1479
|
-
exports.elements.drag.style.borderBottomWidth = '2px';
|
|
1480
|
-
}
|
|
1481
|
-
function moveDrag(opt) {
|
|
1482
|
-
if (opt.top) {
|
|
1483
|
-
exports.elements.drag.style.top = opt.top.toString() + 'px';
|
|
1484
|
-
}
|
|
1485
|
-
if (opt.left) {
|
|
1486
|
-
exports.elements.drag.style.left = opt.left.toString() + 'px';
|
|
1487
|
-
}
|
|
1488
|
-
let perspective = 0;
|
|
1489
|
-
if (opt.width) {
|
|
1490
|
-
exports.elements.drag.style.width = opt.width.toString() + 'px';
|
|
1491
|
-
if (perspective < opt.width) {
|
|
1492
|
-
perspective = opt.width;
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1495
|
-
if (opt.height) {
|
|
1496
|
-
exports.elements.drag.style.height = opt.height.toString() + 'px';
|
|
1497
|
-
if (perspective < opt.height) {
|
|
1498
|
-
perspective = opt.height;
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
if (perspective) {
|
|
1502
|
-
exports.elements.drag.style.transform = 'perspective(' + (perspective + 50) + 'px) rotateX(15deg) translateZ(15px)';
|
|
1503
|
-
}
|
|
1504
|
-
if (opt.icon) {
|
|
1505
|
-
exports.elements.drag.childNodes[0].style.display = 'block';
|
|
1506
|
-
}
|
|
1507
|
-
else {
|
|
1508
|
-
exports.elements.drag.childNodes[0].style.display = 'none';
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
function hideDrag() {
|
|
1512
|
-
exports.elements.drag.style.transform = 'initial';
|
|
1513
|
-
exports.elements.drag.style.borderBottomWidth = '1px';
|
|
1514
|
-
dragTimeOut = window.setTimeout(() => {
|
|
1515
|
-
dragTimeOut = 0;
|
|
1516
|
-
exports.elements.drag.style.opacity = '0';
|
|
1517
|
-
}, 300);
|
|
1518
|
-
}
|
|
1519
|
-
let alertBottom = 0;
|
|
1520
|
-
let alertId = 0;
|
|
1521
|
-
function alert(content, type) {
|
|
1522
|
-
const nid = ++alertId;
|
|
1523
|
-
const timeout = 3000;
|
|
1524
|
-
const el = document.createElement('div');
|
|
1525
|
-
const y = alertBottom;
|
|
1526
|
-
el.classList.add('cg-alert-wrap');
|
|
1527
|
-
el.classList.add('cg-' + (type !== null && type !== void 0 ? type : 'default'));
|
|
1528
|
-
el.setAttribute('data-alertid', nid.toString());
|
|
1529
|
-
el.style.transform = `translateY(${y + 10}px)`;
|
|
1530
|
-
el.style.opacity = '0';
|
|
1531
|
-
el.innerHTML = `<div class="cg-alert-content">` +
|
|
1532
|
-
`<div class="cg-alert-icon"></div>` +
|
|
1533
|
-
`<div>${tool.escapeHTML(content)}</div>` +
|
|
1534
|
-
'</div>';
|
|
1535
|
-
exports.elements.alert.appendChild(el);
|
|
1536
|
-
alertBottom -= el.offsetHeight + 10;
|
|
1537
|
-
requestAnimationFrame(function () {
|
|
1538
|
-
el.style.transform = `translateY(${y}px)`;
|
|
1539
|
-
el.style.opacity = '1';
|
|
1540
|
-
const timer = window.setTimeout(function () {
|
|
1541
|
-
clearTimeout(timer);
|
|
1542
|
-
const alertHeight = el.offsetHeight;
|
|
1543
|
-
el.style.opacity = '0';
|
|
1544
|
-
setTimeout(function () {
|
|
1545
|
-
alertBottom += alertHeight + 10;
|
|
1546
|
-
const alertElementList = document.getElementsByClassName('cg-alert-wrap');
|
|
1547
|
-
let needSub = false;
|
|
1548
|
-
for (const alertElement of alertElementList) {
|
|
1549
|
-
if (alertElement === el) {
|
|
1550
|
-
needSub = true;
|
|
1551
|
-
continue;
|
|
1552
|
-
}
|
|
1553
|
-
if (needSub) {
|
|
1554
|
-
alertElement.style.transform = alertElement.style.transform.replace(/translateY\(([-0-9]+)px\)/, function (t, t1) {
|
|
1555
|
-
return `translateY(${parseInt(t1) + alertHeight + 10}px)`;
|
|
1556
|
-
});
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
el.remove();
|
|
1560
|
-
}, 100);
|
|
1561
|
-
}, timeout);
|
|
1562
|
-
});
|
|
1563
|
-
return nid;
|
|
1564
|
-
}
|
|
1565
|
-
let notifyBottom = -10;
|
|
1566
|
-
let notifyId = 0;
|
|
1567
|
-
function notify(opt) {
|
|
1568
|
-
var _a;
|
|
1569
|
-
const nid = ++notifyId;
|
|
1570
|
-
let timeout = 5000;
|
|
1571
|
-
const maxTimeout = 60000 * 10;
|
|
1572
|
-
if (opt.timeout !== undefined) {
|
|
1573
|
-
if (opt.timeout <= 0) {
|
|
1574
|
-
timeout = 5000;
|
|
1575
|
-
}
|
|
1576
|
-
else if (opt.timeout > maxTimeout) {
|
|
1577
|
-
timeout = maxTimeout;
|
|
1578
|
-
}
|
|
1579
|
-
else {
|
|
1580
|
-
timeout = opt.timeout;
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
if (opt.progress && !opt.type) {
|
|
1584
|
-
opt.type = 'progress';
|
|
1585
|
-
}
|
|
1586
|
-
const el = document.createElement('div');
|
|
1587
|
-
let y = notifyBottom;
|
|
1588
|
-
let x = -10;
|
|
1589
|
-
if (task.systemTaskInfo.taskId > 0) {
|
|
1590
|
-
if (core.config['task.position'] === 'bottom') {
|
|
1591
|
-
y -= task.systemTaskInfo.length;
|
|
1592
|
-
}
|
|
1593
|
-
else if (core.config['task.position'] === 'right') {
|
|
1594
|
-
x -= task.systemTaskInfo.length;
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
el.classList.add('cg-notify-wrap');
|
|
1598
|
-
el.setAttribute('data-notifyid', nid.toString());
|
|
1599
|
-
el.style.transform = `translateY(${y}px) translateX(280px)`;
|
|
1600
|
-
el.style.opacity = '0';
|
|
1601
|
-
el.classList.add((opt.title && opt.content) ? 'cg-notify-full' : 'cg-notify-only');
|
|
1602
|
-
el.innerHTML = `<div class="cg-notify-icon cg-${tool.escapeHTML((_a = opt.type) !== null && _a !== void 0 ? _a : 'primary')}"></div>` +
|
|
1603
|
-
'<div style="flex: 1;">' +
|
|
1604
|
-
(opt.title ? `<div class="cg-notify-title">${tool.escapeHTML(opt.title)}</div>` : '') +
|
|
1605
|
-
(opt.content ? `<div class="cg-notify-content">${tool.escapeHTML(opt.content).replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n/g, '<br>')}</div>` +
|
|
1606
|
-
`${opt.progress ? '<div class="cg-notify-progress"></div>' : ''}` : '') +
|
|
1607
|
-
'</div>';
|
|
1608
|
-
if (opt.icon) {
|
|
1609
|
-
el.childNodes.item(0).style.background = 'url(' + opt.icon + ')';
|
|
1610
|
-
el.childNodes.item(0).style.backgroundSize = '14px';
|
|
1611
|
-
}
|
|
1612
|
-
exports.elements.notify.appendChild(el);
|
|
1613
|
-
notifyBottom -= el.offsetHeight + 10;
|
|
1614
|
-
requestAnimationFrame(function () {
|
|
1615
|
-
el.style.transform = `translateY(${y}px) translateX(${x}px)`;
|
|
1616
|
-
el.style.opacity = '1';
|
|
1617
|
-
const timer = window.setTimeout(function () {
|
|
1618
|
-
hideNotify(nid);
|
|
1619
|
-
}, timeout);
|
|
1620
|
-
el.setAttribute('data-timer', timer.toString());
|
|
1621
|
-
});
|
|
1622
|
-
return nid;
|
|
1623
|
-
}
|
|
1624
|
-
function notifyProgress(notifyId, per) {
|
|
1625
|
-
const el = exports.elements.notify.querySelector(`[data-notifyid="${notifyId}"]`);
|
|
1626
|
-
if (!el) {
|
|
1627
|
-
return;
|
|
1628
|
-
}
|
|
1629
|
-
const progress = el.querySelector('.cg-notify-progress');
|
|
1630
|
-
if (!progress) {
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1633
|
-
if (per > 100) {
|
|
1634
|
-
per = 100;
|
|
1635
|
-
}
|
|
1636
|
-
if (per === 1) {
|
|
1637
|
-
const o = parseFloat(progress.style.width);
|
|
1638
|
-
if (o > 1) {
|
|
1639
|
-
per = 100;
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
if (per === 100) {
|
|
1643
|
-
progress.style.transitionDelay = '.1s';
|
|
1644
|
-
}
|
|
1645
|
-
progress.style.width = (per < 1 ? per * 100 : per).toString() + '%';
|
|
1646
|
-
}
|
|
1647
|
-
function notifyContent(notifyId, opt) {
|
|
1648
|
-
const el = exports.elements.notify.querySelector(`[data-notifyid="${notifyId}"]`);
|
|
1649
|
-
if (!el) {
|
|
1650
|
-
return;
|
|
1651
|
-
}
|
|
1652
|
-
if (opt.title) {
|
|
1653
|
-
const title = el.querySelector('.cg-notify-title');
|
|
1654
|
-
if (!title) {
|
|
1655
|
-
return;
|
|
1656
|
-
}
|
|
1657
|
-
title.innerHTML = tool.escapeHTML(opt.title);
|
|
1658
|
-
}
|
|
1659
|
-
if (opt.content) {
|
|
1660
|
-
const content = el.querySelector('.cg-notify-content');
|
|
1661
|
-
if (!content) {
|
|
1662
|
-
return;
|
|
1663
|
-
}
|
|
1664
|
-
content.innerHTML = tool.escapeHTML(opt.content);
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
function hideNotify(notifyId) {
|
|
1668
|
-
const el = exports.elements.notify.querySelector(`[data-notifyid="${notifyId}"]`);
|
|
1669
|
-
if (!el) {
|
|
1670
|
-
return;
|
|
1671
|
-
}
|
|
1672
|
-
clearTimeout(parseInt(el.getAttribute('data-timer')));
|
|
1673
|
-
const notifyHeight = el.offsetHeight;
|
|
1674
|
-
el.style.opacity = '0';
|
|
1675
|
-
setTimeout(function () {
|
|
1676
|
-
notifyBottom += notifyHeight + 10;
|
|
1677
|
-
const notifyElementList = document.getElementsByClassName('cg-notify-wrap');
|
|
1678
|
-
let needSub = false;
|
|
1679
|
-
for (const notifyElement of notifyElementList) {
|
|
1680
|
-
if (notifyElement === el) {
|
|
1681
|
-
needSub = true;
|
|
1682
|
-
continue;
|
|
1683
|
-
}
|
|
1684
|
-
if (needSub) {
|
|
1685
|
-
notifyElement.style.transform = notifyElement.style.transform.replace(/translateY\(([-0-9]+)px\)/, function (t, t1) {
|
|
1686
|
-
return `translateY(${parseInt(t1) + notifyHeight + 10}px)`;
|
|
1687
|
-
});
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
el.remove();
|
|
1691
|
-
}, 100);
|
|
1692
|
-
}
|
|
1693
|
-
function appendToPop(el) {
|
|
1694
|
-
exports.elements.popList.appendChild(el);
|
|
1695
|
-
}
|
|
1696
|
-
function removeFromPop(el) {
|
|
1697
|
-
exports.elements.popList.removeChild(el);
|
|
1698
|
-
}
|
|
1699
|
-
function refreshPopPosition(el, pop, direction, size = {}) {
|
|
1700
|
-
var _a, _b;
|
|
1701
|
-
const width = (_a = size.width) !== null && _a !== void 0 ? _a : pop.offsetWidth;
|
|
1702
|
-
const height = (_b = size.height) !== null && _b !== void 0 ? _b : pop.offsetHeight;
|
|
1703
|
-
let left, top;
|
|
1704
|
-
if (typeof direction === 'string') {
|
|
1705
|
-
const bcr = el.getBoundingClientRect();
|
|
1706
|
-
if (direction === 'v') {
|
|
1707
|
-
left = bcr.left;
|
|
1708
|
-
top = bcr.top + bcr.height;
|
|
1709
|
-
}
|
|
1710
|
-
else if (direction === 'h') {
|
|
1711
|
-
left = bcr.left + bcr.width - 2;
|
|
1712
|
-
top = bcr.top - 2;
|
|
1713
|
-
}
|
|
1714
|
-
else {
|
|
1715
|
-
pop.removeAttribute('data-pop-t-bottom');
|
|
1716
|
-
left = bcr.left + bcr.width / 2 - width / 2;
|
|
1717
|
-
top = bcr.top - height - 10;
|
|
1718
|
-
}
|
|
1719
|
-
if (width + left > window.innerWidth) {
|
|
1720
|
-
if (direction === 'v') {
|
|
1721
|
-
left = bcr.left + bcr.width - width;
|
|
1722
|
-
}
|
|
1723
|
-
else if (direction === 'h') {
|
|
1724
|
-
left = bcr.left - width + 2;
|
|
1725
|
-
}
|
|
1726
|
-
else {
|
|
1727
|
-
left = window.innerWidth - width;
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
if (height + top > window.innerHeight) {
|
|
1731
|
-
if (direction === 'v') {
|
|
1732
|
-
top = bcr.top - height;
|
|
1733
|
-
}
|
|
1734
|
-
else if (direction === 'h') {
|
|
1735
|
-
top = bcr.top + bcr.height - height + 2;
|
|
1736
|
-
}
|
|
1737
|
-
else {
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
else if (top < 0 && direction === 't') {
|
|
1741
|
-
top = bcr.top + bcr.height + 10;
|
|
1742
|
-
pop.dataset.popTBottom = '';
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
else {
|
|
1746
|
-
let x;
|
|
1747
|
-
let y;
|
|
1748
|
-
if (direction instanceof MouseEvent || direction.type === 'mousedown') {
|
|
1749
|
-
x = direction.clientX;
|
|
1750
|
-
y = direction.clientY;
|
|
1751
|
-
}
|
|
1752
|
-
else if (direction instanceof TouchEvent || direction.type === 'touchstart') {
|
|
1753
|
-
x = direction.touches[0].clientX;
|
|
1754
|
-
y = direction.touches[0].clientY;
|
|
1755
|
-
}
|
|
1756
|
-
else {
|
|
1757
|
-
x = direction.x;
|
|
1758
|
-
y = direction.y;
|
|
1759
|
-
}
|
|
1760
|
-
left = x + 5;
|
|
1761
|
-
top = y + 7;
|
|
1762
|
-
if (width + left > window.innerWidth) {
|
|
1763
|
-
left = x - width - 5;
|
|
1764
|
-
}
|
|
1765
|
-
if (height + top > window.innerHeight) {
|
|
1766
|
-
top = y - height - 5;
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
if (left < 0) {
|
|
1770
|
-
left = 0;
|
|
1771
|
-
}
|
|
1772
|
-
if (top < 0) {
|
|
1773
|
-
top = 0;
|
|
1774
|
-
}
|
|
1775
|
-
pop.style.left = left.toString() + 'px';
|
|
1776
|
-
pop.style.top = top.toString() + 'px';
|
|
1777
|
-
pop.style.zIndex = (++popInfo.lastZIndex).toString();
|
|
1778
|
-
if (size.width) {
|
|
1779
|
-
pop.style.width = size.width.toString() + 'px';
|
|
1780
|
-
}
|
|
1781
|
-
if (size.height) {
|
|
1782
|
-
pop.style.height = size.height.toString() + 'px';
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
let lastShowPopTime = 0;
|
|
1786
|
-
function showPop(el, pop, direction, opt = {}) {
|
|
1787
|
-
var _a, _b, _c, _d;
|
|
1788
|
-
if (!(el instanceof Element)) {
|
|
1789
|
-
if (!el.$el) {
|
|
1790
|
-
return;
|
|
1791
|
-
}
|
|
1792
|
-
el = el.$el;
|
|
1793
|
-
}
|
|
1794
|
-
if (pop && !(pop instanceof Element)) {
|
|
1795
|
-
if (!pop.$el) {
|
|
1796
|
-
return;
|
|
1797
|
-
}
|
|
1798
|
-
pop = pop.$el;
|
|
1799
|
-
}
|
|
1800
|
-
(_a = opt.null) !== null && _a !== void 0 ? _a : (opt.null = false);
|
|
1801
|
-
(_b = opt.size) !== null && _b !== void 0 ? _b : (opt.size = {});
|
|
1802
|
-
(_c = opt.flow) !== null && _c !== void 0 ? _c : (opt.flow = true);
|
|
1803
|
-
if (!pop && !opt.null) {
|
|
1804
|
-
return;
|
|
1805
|
-
}
|
|
1806
|
-
if (pop && !opt.flow) {
|
|
1807
|
-
pop.removeAttribute('data-cg-pop-none');
|
|
1808
|
-
pop.dataset.cgFlow = '';
|
|
1809
|
-
clickgo.tool.sleep(34).then(() => {
|
|
1810
|
-
if (pop.dataset.cgFlow === undefined) {
|
|
1811
|
-
return;
|
|
1812
|
-
}
|
|
1813
|
-
refreshPopPosition(el, pop, direction, opt.size);
|
|
1814
|
-
if (opt.autoPosition) {
|
|
1815
|
-
clickgo.dom.watchSize(pop, () => {
|
|
1816
|
-
refreshPopPosition(el, pop, direction, opt.size);
|
|
1817
|
-
});
|
|
1818
|
-
}
|
|
1819
|
-
pop.dataset.cgOpen = '';
|
|
1820
|
-
}).catch(() => {
|
|
1821
|
-
});
|
|
1822
|
-
return;
|
|
1823
|
-
}
|
|
1824
|
-
const now = Date.now();
|
|
1825
|
-
if (now - lastShowPopTime < 5) {
|
|
1826
|
-
lastShowPopTime = now;
|
|
1827
|
-
return;
|
|
1828
|
-
}
|
|
1829
|
-
lastShowPopTime = now;
|
|
1830
|
-
if (el.dataset.cgPopOpen !== undefined) {
|
|
1831
|
-
return;
|
|
1832
|
-
}
|
|
1833
|
-
const parentPop = dom.findParentByData(el, 'cg-pop');
|
|
1834
|
-
if ((parentPop === null || parentPop === void 0 ? void 0 : parentPop.dataset.cgLevel) !== undefined) {
|
|
1835
|
-
const nextlevel = parseInt(parentPop.dataset.cgLevel) + 1;
|
|
1836
|
-
if (popInfo.elList[nextlevel]) {
|
|
1837
|
-
hidePop(popInfo.elList[nextlevel]);
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
else {
|
|
1841
|
-
hidePop();
|
|
1842
|
-
}
|
|
1843
|
-
if (!pop) {
|
|
1844
|
-
popInfo.elList.push(el);
|
|
1845
|
-
el.dataset.cgPopOpen = '';
|
|
1846
|
-
el.dataset.cgLevel = (popInfo.elList.length - 1).toString();
|
|
1847
|
-
return;
|
|
1848
|
-
}
|
|
1849
|
-
pop.removeAttribute('data-cg-pop-none');
|
|
1850
|
-
popInfo.list.push(pop);
|
|
1851
|
-
popInfo.elList.push(el);
|
|
1852
|
-
popInfo.wayList.push((_d = opt.way) !== null && _d !== void 0 ? _d : 'normal');
|
|
1853
|
-
popInfo.time.push(Date.now());
|
|
1854
|
-
pop.dataset.cgLevel = (popInfo.list.length - 1).toString();
|
|
1855
|
-
el.dataset.cgLevel = (popInfo.elList.length - 1).toString();
|
|
1856
|
-
clickgo.tool.sleep(34).then(() => {
|
|
1857
|
-
if (pop.dataset.cgLevel === undefined) {
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
refreshPopPosition(el, pop, direction, opt.size);
|
|
1861
|
-
if (opt.autoPosition && typeof direction === 'string') {
|
|
1862
|
-
clickgo.dom.watchSize(pop, () => {
|
|
1863
|
-
refreshPopPosition(el, pop, direction, opt.size);
|
|
1864
|
-
});
|
|
1865
|
-
}
|
|
1866
|
-
if (opt.autoScroll && typeof direction === 'string') {
|
|
1867
|
-
clickgo.dom.watchPosition(el, () => {
|
|
1868
|
-
refreshPopPosition(el, pop, direction, opt.size);
|
|
1869
|
-
});
|
|
1870
|
-
}
|
|
1871
|
-
pop.dataset.cgOpen = '';
|
|
1872
|
-
el.dataset.cgPopOpen = '';
|
|
1873
|
-
}).catch(() => {
|
|
1874
|
-
});
|
|
1875
|
-
}
|
|
1876
|
-
function hidePop(pop) {
|
|
1877
|
-
if (pop && !(pop instanceof HTMLElement)) {
|
|
1878
|
-
if (!pop.$el) {
|
|
1879
|
-
return;
|
|
1880
|
-
}
|
|
1881
|
-
pop = pop.$el;
|
|
1882
|
-
}
|
|
1883
|
-
if (!pop) {
|
|
1884
|
-
if (popInfo.elList.length === 0) {
|
|
1885
|
-
return;
|
|
1886
|
-
}
|
|
1887
|
-
hidePop(popInfo.elList[0]);
|
|
1888
|
-
return;
|
|
1889
|
-
}
|
|
1890
|
-
if (pop.dataset.cgFlow !== undefined) {
|
|
1891
|
-
pop.removeAttribute('data-cg-flow');
|
|
1892
|
-
pop.removeAttribute('data-cg-open');
|
|
1893
|
-
clickgo.dom.unwatchSize(pop);
|
|
1894
|
-
clickgo.tool.sleep(334).then(() => {
|
|
1895
|
-
if (pop.dataset.cgFlow !== undefined) {
|
|
1896
|
-
return;
|
|
1897
|
-
}
|
|
1898
|
-
pop.dataset.cgPopNone = '';
|
|
1899
|
-
}).catch(() => {
|
|
1900
|
-
});
|
|
1901
|
-
return;
|
|
1902
|
-
}
|
|
1903
|
-
if (pop.dataset.cgLevel === undefined) {
|
|
1904
|
-
return;
|
|
1905
|
-
}
|
|
1906
|
-
const isPop = pop.dataset.cgPop !== undefined ? true : false;
|
|
1907
|
-
const level = pop.dataset.cgLevel ? parseInt(pop.dataset.cgLevel) : -1;
|
|
1908
|
-
if (level === -1) {
|
|
1909
|
-
return;
|
|
1910
|
-
}
|
|
1911
|
-
if (popInfo.elList[level + 1]) {
|
|
1912
|
-
hidePop(popInfo.elList[level + 1]);
|
|
1913
|
-
}
|
|
1914
|
-
if (isPop) {
|
|
1915
|
-
pop.removeAttribute('data-cg-open');
|
|
1916
|
-
pop.removeAttribute('data-cg-level');
|
|
1917
|
-
clickgo.dom.unwatchSize(pop);
|
|
1918
|
-
clickgo.dom.unwatchPosition(popInfo.elList[level]);
|
|
1919
|
-
popInfo.elList[level].removeAttribute('data-cg-pop-open');
|
|
1920
|
-
popInfo.elList[level].removeAttribute('data-cg-level');
|
|
1921
|
-
clickgo.tool.sleep(334).then(() => {
|
|
1922
|
-
if (pop.dataset.cgLevel !== undefined) {
|
|
1923
|
-
return;
|
|
1924
|
-
}
|
|
1925
|
-
pop.dataset.cgPopNone = '';
|
|
1926
|
-
}).catch(() => {
|
|
1927
|
-
});
|
|
1928
|
-
}
|
|
1929
|
-
else {
|
|
1930
|
-
if (popInfo.list[level]) {
|
|
1931
|
-
const opop = popInfo.list[level];
|
|
1932
|
-
opop.removeAttribute('data-cg-open');
|
|
1933
|
-
opop.removeAttribute('data-cg-level');
|
|
1934
|
-
clickgo.dom.unwatchSize(popInfo.list[level]);
|
|
1935
|
-
clickgo.dom.unwatchPosition(pop);
|
|
1936
|
-
clickgo.tool.sleep(334).then(() => {
|
|
1937
|
-
if (opop.dataset.cgLevel !== undefined) {
|
|
1938
|
-
return;
|
|
1939
|
-
}
|
|
1940
|
-
opop.dataset.cgPopNone = '';
|
|
1941
|
-
}).catch(() => {
|
|
1942
|
-
});
|
|
1943
|
-
}
|
|
1944
|
-
pop.removeAttribute('data-cg-pop-open');
|
|
1945
|
-
pop.removeAttribute('data-cg-level');
|
|
1946
|
-
}
|
|
1947
|
-
popInfo.list.splice(level);
|
|
1948
|
-
popInfo.elList.splice(level);
|
|
1949
|
-
popInfo.wayList.splice(level);
|
|
1950
|
-
popInfo.time.splice(level);
|
|
1951
|
-
}
|
|
1952
|
-
function isJustPop(el) {
|
|
1953
|
-
if (el instanceof HTMLElement) {
|
|
1954
|
-
const level = el.dataset.cgLevel;
|
|
1955
|
-
if (!level) {
|
|
1956
|
-
return false;
|
|
1957
|
-
}
|
|
1958
|
-
el = parseInt(level);
|
|
1959
|
-
}
|
|
1960
|
-
const time = popInfo.time[el];
|
|
1961
|
-
if (Date.now() - time >= 100) {
|
|
1962
|
-
return false;
|
|
1963
|
-
}
|
|
1964
|
-
return true;
|
|
1965
|
-
}
|
|
1966
|
-
function doFocusAndPopEvent(e) {
|
|
1967
|
-
var _a, _b;
|
|
1968
|
-
if (dom.hasTouchButMouse(e)) {
|
|
1969
|
-
return;
|
|
1970
|
-
}
|
|
1971
|
-
const target = e.target;
|
|
1972
|
-
if (!target) {
|
|
1973
|
-
return;
|
|
1974
|
-
}
|
|
1975
|
-
const paths = (_a = e.path) !== null && _a !== void 0 ? _a : (e.composedPath ? e.composedPath() : []);
|
|
1976
|
-
let isCgPopOpen = null;
|
|
1977
|
-
for (const item of paths) {
|
|
1978
|
-
if (!item.tagName) {
|
|
1979
|
-
continue;
|
|
1980
|
-
}
|
|
1981
|
-
if (item.dataset.cgLevel !== undefined && item.dataset.cgPop === undefined) {
|
|
1982
|
-
isCgPopOpen = item;
|
|
1983
|
-
continue;
|
|
1984
|
-
}
|
|
1985
|
-
if (item.classList.contains('cg-form-wrap')) {
|
|
1986
|
-
const formId = parseInt((_b = item.getAttribute('data-form-id')) !== null && _b !== void 0 ? _b : '0');
|
|
1987
|
-
changeFocus(formId);
|
|
1988
|
-
if (isCgPopOpen) {
|
|
1989
|
-
if (!isJustPop(isCgPopOpen)) {
|
|
1990
|
-
hidePop();
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
|
-
else {
|
|
1994
|
-
hidePop();
|
|
1995
|
-
}
|
|
1996
|
-
return;
|
|
1997
|
-
}
|
|
1998
|
-
if (item.tagName.toLowerCase() === 'body') {
|
|
1999
|
-
break;
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
for (const item of paths) {
|
|
2003
|
-
if (!item.tagName) {
|
|
2004
|
-
continue;
|
|
2005
|
-
}
|
|
2006
|
-
if (item.tagName.toLowerCase() === 'body') {
|
|
2007
|
-
break;
|
|
2008
|
-
}
|
|
2009
|
-
if (item.dataset.cgPop !== undefined) {
|
|
2010
|
-
if (item.dataset.cgLevel) {
|
|
2011
|
-
const nextlevel = parseInt(item.dataset.cgLevel) + 1;
|
|
2012
|
-
if (popInfo.wayList[nextlevel] === 'click' && !isJustPop(nextlevel)) {
|
|
2013
|
-
clickgo.form.hidePop(popInfo.list[nextlevel]);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
return;
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
hidePop();
|
|
2020
|
-
changeFocus();
|
|
2021
|
-
}
|
|
2022
|
-
window.addEventListener('touchstart', doFocusAndPopEvent, {
|
|
2023
|
-
'passive': true
|
|
2024
|
-
});
|
|
2025
|
-
window.addEventListener('mousedown', doFocusAndPopEvent);
|
|
2026
|
-
function remove(formId) {
|
|
2027
|
-
const taskId = getTaskId(formId);
|
|
2028
|
-
if (!task.list[taskId].forms[formId]) {
|
|
2029
|
-
return false;
|
|
2030
|
-
}
|
|
2031
|
-
if (task.list[taskId].forms[formId].closed) {
|
|
2032
|
-
return false;
|
|
2033
|
-
}
|
|
2034
|
-
task.list[taskId].forms[formId].closed = true;
|
|
2035
|
-
const title = task.list[taskId].forms[formId].vroot.$refs.form.title;
|
|
2036
|
-
const icon = task.list[taskId].forms[formId].vroot.$refs.form.iconDataUrl;
|
|
2037
|
-
const io = task.list[taskId].runtime.dialogFormIds.indexOf(formId);
|
|
2038
|
-
if (io > -1) {
|
|
2039
|
-
task.list[taskId].runtime.dialogFormIds.splice(io, 1);
|
|
2040
|
-
}
|
|
2041
|
-
task.list[taskId].forms[formId].vroot.$refs.form.$data.isShow = false;
|
|
2042
|
-
setTimeout(function () {
|
|
2043
|
-
var _a;
|
|
2044
|
-
const fid = getMaxZIndexID({
|
|
2045
|
-
'formIds': [formId]
|
|
2046
|
-
});
|
|
2047
|
-
if (fid) {
|
|
2048
|
-
changeFocus(fid);
|
|
2049
|
-
}
|
|
2050
|
-
else {
|
|
2051
|
-
changeFocus();
|
|
2052
|
-
}
|
|
2053
|
-
if (!task.list[taskId]) {
|
|
2054
|
-
return true;
|
|
2055
|
-
}
|
|
2056
|
-
task.list[taskId].forms[formId].vapp.unmount();
|
|
2057
|
-
task.list[taskId].forms[formId].vapp._container.remove();
|
|
2058
|
-
(_a = exports.elements.popList.querySelector('[data-form-id="' + formId.toString() + '"]')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2059
|
-
if (io > -1) {
|
|
2060
|
-
task.list[taskId].forms[formId].vroot.cgDialogCallback();
|
|
2061
|
-
}
|
|
2062
|
-
delete task.list[taskId].forms[formId];
|
|
2063
|
-
dom.removeStyle(taskId, 'form', formId);
|
|
2064
|
-
core.trigger('formRemoved', taskId, formId, title, icon);
|
|
2065
|
-
dom.clearWatchStyle(formId);
|
|
2066
|
-
dom.clearWatchProperty(formId);
|
|
2067
|
-
dom.clearWatchPosition(formId);
|
|
2068
|
-
native.clear(formId, taskId);
|
|
2069
|
-
delete exports.activePanels[formId];
|
|
2070
|
-
if (Object.keys(task.list[taskId].forms).length === 0) {
|
|
2071
|
-
task.end(taskId);
|
|
2072
|
-
}
|
|
2073
|
-
}, 300);
|
|
2074
|
-
return true;
|
|
2075
|
-
}
|
|
2076
|
-
function removePanel(id, vapp, el) {
|
|
2077
|
-
var _a;
|
|
2078
|
-
const formWrap = dom.findParentByClass(el, 'cg-form-wrap');
|
|
2079
|
-
if (!formWrap) {
|
|
2080
|
-
return false;
|
|
2081
|
-
}
|
|
2082
|
-
const formId = formWrap.dataset.formId;
|
|
2083
|
-
if (!formId) {
|
|
2084
|
-
return false;
|
|
2085
|
-
}
|
|
2086
|
-
const taskId = formWrap.dataset.taskId;
|
|
2087
|
-
if (!taskId) {
|
|
2088
|
-
return false;
|
|
2089
|
-
}
|
|
2090
|
-
const tid = parseInt(taskId);
|
|
2091
|
-
vapp.unmount();
|
|
2092
|
-
vapp._container.remove();
|
|
2093
|
-
(_a = el.querySelector('[data-panel-id="' + id.toString() + '"]')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2094
|
-
dom.removeStyle(tid, 'form', formId, id);
|
|
2095
|
-
dom.clearWatchStyle(formId, id);
|
|
2096
|
-
dom.clearWatchProperty(formId, id);
|
|
2097
|
-
dom.clearWatchPosition(formId, id);
|
|
2098
|
-
if (exports.activePanels[formId]) {
|
|
2099
|
-
const io = exports.activePanels[formId].indexOf(id);
|
|
2100
|
-
if (io >= 0) {
|
|
2101
|
-
exports.activePanels[formId].splice(io, 1);
|
|
2102
|
-
}
|
|
2103
|
-
if (!exports.activePanels[formId].length) {
|
|
2104
|
-
delete exports.activePanels[formId];
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
return true;
|
|
2108
|
-
}
|
|
2109
|
-
function getForm(taskId, formId) {
|
|
2110
|
-
const t = task.list[taskId];
|
|
2111
|
-
if (!t) {
|
|
2112
|
-
return null;
|
|
2113
|
-
}
|
|
2114
|
-
const form = t.forms[formId];
|
|
2115
|
-
if (!form) {
|
|
2116
|
-
return null;
|
|
2117
|
-
}
|
|
2118
|
-
return form;
|
|
2119
|
-
}
|
|
2120
|
-
function createPanel(rootPanel_1, cls_1) {
|
|
2121
|
-
return __awaiter(this, arguments, void 0, function* (rootPanel, cls, opt = {}, taskId) {
|
|
2122
|
-
var _a;
|
|
2123
|
-
if (rootPanel.element.dataset.cgControl !== 'panel') {
|
|
2124
|
-
const err = new Error('form.createPanel: -0');
|
|
2125
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2126
|
-
throw err;
|
|
2127
|
-
}
|
|
2128
|
-
const formWrap = dom.findParentByData(rootPanel.element, 'form-id');
|
|
2129
|
-
if (!formWrap) {
|
|
2130
|
-
const err = new Error('form.createPanel: -0');
|
|
2131
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2132
|
-
throw err;
|
|
2133
|
-
}
|
|
2134
|
-
const formId = parseInt(formWrap.dataset.formId);
|
|
2135
|
-
if (!taskId) {
|
|
2136
|
-
const err = new Error('form.createPanel: -1');
|
|
2137
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2138
|
-
throw err;
|
|
2139
|
-
}
|
|
2140
|
-
const t = task.list[taskId];
|
|
2141
|
-
if (!t) {
|
|
2142
|
-
const err = new Error('form.createPanel: -2');
|
|
2143
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2144
|
-
throw err;
|
|
2145
|
-
}
|
|
2146
|
-
let layout = '';
|
|
2147
|
-
if (opt.layout) {
|
|
2148
|
-
layout = opt.layout;
|
|
2149
|
-
}
|
|
2150
|
-
let style = '';
|
|
2151
|
-
let prep = '';
|
|
2152
|
-
if (opt.style) {
|
|
2153
|
-
style = opt.style;
|
|
2154
|
-
}
|
|
2155
|
-
let filename = '';
|
|
2156
|
-
if (typeof cls === 'string') {
|
|
2157
|
-
filename = tool.urlResolve((_a = opt.path) !== null && _a !== void 0 ? _a : '/', cls);
|
|
2158
|
-
if (!layout) {
|
|
2159
|
-
const l = t.app.files[filename + '.xml'];
|
|
2160
|
-
if (typeof l !== 'string') {
|
|
2161
|
-
const err = new Error('form.createPanel: -3');
|
|
2162
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2163
|
-
throw err;
|
|
2164
|
-
}
|
|
2165
|
-
layout = l;
|
|
2166
|
-
}
|
|
2167
|
-
if (!style) {
|
|
2168
|
-
const s = t.app.files[filename + '.css'];
|
|
2169
|
-
if (typeof s === 'string') {
|
|
2170
|
-
style = s;
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
cls = class extends AbstractPanel {
|
|
2174
|
-
get filename() {
|
|
2175
|
-
return filename + '.js';
|
|
2176
|
-
}
|
|
2177
|
-
get taskId() {
|
|
2178
|
-
return t.id;
|
|
2179
|
-
}
|
|
2180
|
-
};
|
|
2181
|
-
}
|
|
2182
|
-
const panelId = ++info.lastPanelId;
|
|
2183
|
-
const panel = new cls();
|
|
2184
|
-
if (!filename) {
|
|
2185
|
-
filename = panel.filename;
|
|
2186
|
-
}
|
|
2187
|
-
const lio = filename.lastIndexOf('/');
|
|
2188
|
-
const path = filename.slice(0, lio);
|
|
2189
|
-
if (!layout) {
|
|
2190
|
-
const l = t.app.files[filename.slice(0, -2) + 'xml'];
|
|
2191
|
-
if (typeof l !== 'string') {
|
|
2192
|
-
const err = new Error('form.createPanel: -4');
|
|
2193
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2194
|
-
throw err;
|
|
2195
|
-
}
|
|
2196
|
-
layout = l;
|
|
2197
|
-
}
|
|
2198
|
-
if (!style) {
|
|
2199
|
-
const s = t.app.files[filename.slice(0, -2) + 'css'];
|
|
2200
|
-
if (typeof s === 'string') {
|
|
2201
|
-
style = s;
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
if (style) {
|
|
2205
|
-
const r = tool.stylePrepend(style);
|
|
2206
|
-
prep = r.prep;
|
|
2207
|
-
style = yield tool.styleUrl2DataUrl(path + '/', r.style, t.app.files);
|
|
2208
|
-
}
|
|
2209
|
-
layout = tool.purify(layout);
|
|
2210
|
-
layout = tool.layoutAddTagClassAndReTagName(layout, true);
|
|
2211
|
-
const prepList = ['cg-task' + t.id.toString() + '_'];
|
|
2212
|
-
if (prep !== '') {
|
|
2213
|
-
prepList.push(prep);
|
|
2214
|
-
}
|
|
2215
|
-
layout = tool.layoutClassPrepend(layout, prepList);
|
|
2216
|
-
layout = tool.eventsAttrWrap(layout);
|
|
2217
|
-
if (layout.includes('<teleport')) {
|
|
2218
|
-
layout = tool.teleportGlue(layout, formId);
|
|
2219
|
-
}
|
|
2220
|
-
const components = control.buildComponents(t.id, formId, path);
|
|
2221
|
-
if (!components) {
|
|
2222
|
-
const err = new Error('form.createPanel: -5');
|
|
2223
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2224
|
-
throw err;
|
|
2225
|
-
}
|
|
2226
|
-
const idata = {};
|
|
2227
|
-
const cdata = Object.entries(panel);
|
|
2228
|
-
for (const item of cdata) {
|
|
2229
|
-
if (item[0] === 'access') {
|
|
2230
|
-
continue;
|
|
2231
|
-
}
|
|
2232
|
-
idata[item[0]] = item[1];
|
|
2233
|
-
}
|
|
2234
|
-
const prot = tool.getClassPrototype(panel);
|
|
2235
|
-
const methods = prot.method;
|
|
2236
|
-
const computed = prot.access;
|
|
2237
|
-
computed.formId = {
|
|
2238
|
-
get: function () {
|
|
2239
|
-
return formId;
|
|
2240
|
-
},
|
|
2241
|
-
set: function () {
|
|
2242
|
-
notify({
|
|
2243
|
-
'title': 'Error',
|
|
2244
|
-
'content': `The software tries to modify the system variable "formId".\nPath: ${this.filename}`,
|
|
2245
|
-
'type': 'danger'
|
|
2246
|
-
});
|
|
2247
|
-
return;
|
|
2248
|
-
}
|
|
2249
|
-
};
|
|
2250
|
-
computed.panelId = {
|
|
2251
|
-
get: function () {
|
|
2252
|
-
return panelId;
|
|
2253
|
-
},
|
|
2254
|
-
set: function () {
|
|
2255
|
-
notify({
|
|
2256
|
-
'title': 'Error',
|
|
2257
|
-
'content': `The software tries to modify the system variable "panelId".\nPath: ${this.filename}`,
|
|
2258
|
-
'type': 'danger'
|
|
2259
|
-
});
|
|
2260
|
-
return;
|
|
2261
|
-
}
|
|
2262
|
-
};
|
|
2263
|
-
computed.path = {
|
|
2264
|
-
get: function () {
|
|
2265
|
-
return path;
|
|
2266
|
-
},
|
|
2267
|
-
set: function () {
|
|
2268
|
-
notify({
|
|
2269
|
-
'title': 'Error',
|
|
2270
|
-
'content': `The software tries to modify the system variable "path".\nPath: ${this.filename}`,
|
|
2271
|
-
'type': 'danger'
|
|
2272
|
-
});
|
|
2273
|
-
return;
|
|
2274
|
-
}
|
|
2275
|
-
};
|
|
2276
|
-
computed.prep = {
|
|
2277
|
-
get: function () {
|
|
2278
|
-
return prep;
|
|
2279
|
-
},
|
|
2280
|
-
set: function () {
|
|
2281
|
-
notify({
|
|
2282
|
-
'title': 'Error',
|
|
2283
|
-
'content': `The software tries to modify the system variable "prep".\nPath: ${this.filename}`,
|
|
2284
|
-
'type': 'danger'
|
|
2285
|
-
});
|
|
2286
|
-
return;
|
|
2287
|
-
}
|
|
2288
|
-
};
|
|
2289
|
-
computed.rootForm = {
|
|
2290
|
-
get: function () {
|
|
2291
|
-
return t.forms[formId].vroot;
|
|
2292
|
-
},
|
|
2293
|
-
set: function () {
|
|
2294
|
-
notify({
|
|
2295
|
-
'title': 'Error',
|
|
2296
|
-
'content': `The software tries to modify the system variable "rootForm".\nPath: ${this.filename}`,
|
|
2297
|
-
'type': 'danger'
|
|
2298
|
-
});
|
|
2299
|
-
return;
|
|
2300
|
-
}
|
|
2301
|
-
};
|
|
2302
|
-
computed.rootPanel = {
|
|
2303
|
-
get: function () {
|
|
2304
|
-
return rootPanel;
|
|
2305
|
-
},
|
|
2306
|
-
set: function () {
|
|
2307
|
-
notify({
|
|
2308
|
-
'title': 'Error',
|
|
2309
|
-
'content': `The software tries to modify the system variable "rootPanel".\nPath: ${this.filename}`,
|
|
2310
|
-
'type': 'danger'
|
|
2311
|
-
});
|
|
2312
|
-
return;
|
|
2313
|
-
}
|
|
2314
|
-
};
|
|
2315
|
-
rootPanel.element.insertAdjacentHTML('beforeend', `<div data-panel-id="${panelId.toString()}"></div>`);
|
|
2316
|
-
if (style) {
|
|
2317
|
-
dom.pushStyle(t.id, style, 'form', formId, panelId);
|
|
2318
|
-
}
|
|
2319
|
-
const mel = rootPanel.element.children.item(rootPanel.element.children.length - 1);
|
|
2320
|
-
mel.style.position = 'absolute';
|
|
2321
|
-
mel.style.display = 'none';
|
|
2322
|
-
const rtn = yield new Promise(function (resolve) {
|
|
2323
|
-
const vapp = clickgo.vue.createApp({
|
|
2324
|
-
'template': layout.replace(/^<cg-panel([\s\S]+)-panel>$/, '<cg-layout$1-layout>'),
|
|
2325
|
-
'data': function () {
|
|
2326
|
-
return tool.clone(idata);
|
|
2327
|
-
},
|
|
2328
|
-
'methods': methods,
|
|
2329
|
-
'computed': computed,
|
|
2330
|
-
'beforeCreate': panel.onBeforeCreate,
|
|
2331
|
-
'created': function () {
|
|
2332
|
-
if (panel.access) {
|
|
2333
|
-
this.access = tool.clone(panel.access);
|
|
2334
|
-
}
|
|
2335
|
-
this.onCreated();
|
|
2336
|
-
},
|
|
2337
|
-
'beforeMount': function () {
|
|
2338
|
-
this.onBeforeMount();
|
|
2339
|
-
},
|
|
2340
|
-
'mounted': function () {
|
|
2341
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2342
|
-
yield this.$nextTick();
|
|
2343
|
-
mel.children.item(0).style.flex = '1';
|
|
2344
|
-
resolve({
|
|
2345
|
-
'vapp': vapp,
|
|
2346
|
-
'vroot': this
|
|
2347
|
-
});
|
|
2348
|
-
});
|
|
2349
|
-
},
|
|
2350
|
-
'beforeUpdate': function () {
|
|
2351
|
-
this.onBeforeUpdate();
|
|
2352
|
-
},
|
|
2353
|
-
'updated': function () {
|
|
2354
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2355
|
-
yield this.$nextTick();
|
|
2356
|
-
this.onUpdated();
|
|
2357
|
-
});
|
|
2358
|
-
},
|
|
2359
|
-
'beforeUnmount': function () {
|
|
2360
|
-
this.onBeforeUnmount();
|
|
2361
|
-
},
|
|
2362
|
-
'unmounted': function () {
|
|
2363
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2364
|
-
yield this.$nextTick();
|
|
2365
|
-
this.onUnmounted();
|
|
2366
|
-
});
|
|
2367
|
-
}
|
|
2368
|
-
});
|
|
2369
|
-
vapp.config.errorHandler = function (err, vm, info) {
|
|
2370
|
-
notify({
|
|
2371
|
-
'title': 'Runtime Error',
|
|
2372
|
-
'content': `Message: ${err.message}\nTask id: ${vm.taskId}\nForm id: ${vm.formId}`,
|
|
2373
|
-
'type': 'danger'
|
|
2374
|
-
});
|
|
2375
|
-
console.error('Runtime Error [form.createPanel.errorHandler]', `Message: ${err.message}\nTask id: ${vm.taskId}\nForm id: ${vm.formId}`, err, info);
|
|
2376
|
-
core.trigger('error', vm.taskId, vm.formId, err, info + '(-3,' + vm.taskId + ',' + vm.formId + ')');
|
|
2377
|
-
};
|
|
2378
|
-
for (const key in components) {
|
|
2379
|
-
vapp.component(key, components[key]);
|
|
2380
|
-
}
|
|
2381
|
-
try {
|
|
2382
|
-
vapp.mount(mel);
|
|
2383
|
-
}
|
|
2384
|
-
catch (err) {
|
|
2385
|
-
notify({
|
|
2386
|
-
'title': 'Runtime Error',
|
|
2387
|
-
'content': `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}`,
|
|
2388
|
-
'type': 'danger'
|
|
2389
|
-
});
|
|
2390
|
-
console.error('Runtime Error [form.createPanel.mount]', `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}`, err);
|
|
2391
|
-
core.trigger('error', t.id, formId, err, err.message);
|
|
2392
|
-
}
|
|
2393
|
-
});
|
|
2394
|
-
yield tool.sleep(34);
|
|
2395
|
-
try {
|
|
2396
|
-
yield panel.onMounted.call(rtn.vroot);
|
|
2397
|
-
}
|
|
2398
|
-
catch (err) {
|
|
2399
|
-
core.trigger('error', rtn.vroot.taskId, rtn.vroot.formId, err, 'Create panel mounted error: -6.');
|
|
2400
|
-
try {
|
|
2401
|
-
rtn.vapp.unmount();
|
|
2402
|
-
}
|
|
2403
|
-
catch (err) {
|
|
2404
|
-
const msg = `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}\nFunction: form.createPanel, unmount.`;
|
|
2405
|
-
notify({
|
|
2406
|
-
'title': 'Panel Unmount Error',
|
|
2407
|
-
'content': msg,
|
|
2408
|
-
'type': 'danger'
|
|
2409
|
-
});
|
|
2410
|
-
console.log('Panel Unmount Error', msg, err);
|
|
2411
|
-
}
|
|
2412
|
-
rtn.vapp._container.remove();
|
|
2413
|
-
dom.clearWatchStyle(rtn.vroot.formId, panelId);
|
|
2414
|
-
dom.clearWatchProperty(rtn.vroot.formId, panelId);
|
|
2415
|
-
dom.clearWatchPosition(rtn.vroot.formId, panelId);
|
|
2416
|
-
dom.removeStyle(rtn.vroot.taskId, 'form', rtn.vroot.formId, panelId);
|
|
2417
|
-
throw err;
|
|
2418
|
-
}
|
|
2419
|
-
return {
|
|
2420
|
-
'id': panelId,
|
|
2421
|
-
'vapp': rtn.vapp,
|
|
2422
|
-
'vroot': rtn.vroot
|
|
2423
|
-
};
|
|
2424
|
-
});
|
|
2425
|
-
}
|
|
2426
|
-
function create(cls_1, data_1) {
|
|
2427
|
-
return __awaiter(this, arguments, void 0, function* (cls, data, opt = {}, taskId) {
|
|
2428
|
-
var _a, _b;
|
|
2429
|
-
if (!taskId) {
|
|
2430
|
-
const err = new Error('form.create: -1');
|
|
2431
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2432
|
-
throw err;
|
|
2433
|
-
}
|
|
2434
|
-
const t = task.list[taskId];
|
|
2435
|
-
if (!t) {
|
|
2436
|
-
const err = new Error('form.create: -2');
|
|
2437
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2438
|
-
throw err;
|
|
2439
|
-
}
|
|
2440
|
-
let layout = '';
|
|
2441
|
-
if (opt.layout) {
|
|
2442
|
-
layout = opt.layout;
|
|
2443
|
-
}
|
|
2444
|
-
let style = '';
|
|
2445
|
-
let prep = '';
|
|
2446
|
-
if (opt.style) {
|
|
2447
|
-
style = opt.style;
|
|
2448
|
-
}
|
|
2449
|
-
let filename = '';
|
|
2450
|
-
if (typeof cls === 'string') {
|
|
2451
|
-
filename = tool.urlResolve((_a = opt.path) !== null && _a !== void 0 ? _a : '/', cls);
|
|
2452
|
-
if (!layout) {
|
|
2453
|
-
const l = t.app.files[filename + '.xml'];
|
|
2454
|
-
if (typeof l !== 'string') {
|
|
2455
|
-
const err = new Error('form.create: -3');
|
|
2456
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2457
|
-
throw err;
|
|
2458
|
-
}
|
|
2459
|
-
layout = l;
|
|
2460
|
-
}
|
|
2461
|
-
if (!style) {
|
|
2462
|
-
const s = t.app.files[filename + '.css'];
|
|
2463
|
-
if (typeof s === 'string') {
|
|
2464
|
-
style = s;
|
|
2465
|
-
}
|
|
2466
|
-
}
|
|
2467
|
-
cls = class extends AbstractForm {
|
|
2468
|
-
get filename() {
|
|
2469
|
-
return filename + '.js';
|
|
2470
|
-
}
|
|
2471
|
-
get taskId() {
|
|
2472
|
-
return t.id;
|
|
2473
|
-
}
|
|
2474
|
-
};
|
|
2475
|
-
}
|
|
2476
|
-
const formId = ++info.lastId;
|
|
2477
|
-
const frm = new cls();
|
|
2478
|
-
if (!filename) {
|
|
2479
|
-
filename = frm.filename;
|
|
2480
|
-
}
|
|
2481
|
-
const lio = filename.lastIndexOf('/');
|
|
2482
|
-
const path = filename.slice(0, lio);
|
|
2483
|
-
if (!layout) {
|
|
2484
|
-
const l = t.app.files[filename.slice(0, -2) + 'xml'];
|
|
2485
|
-
if (typeof l !== 'string') {
|
|
2486
|
-
const err = new Error('form.create: -4');
|
|
2487
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2488
|
-
throw err;
|
|
2489
|
-
}
|
|
2490
|
-
layout = l;
|
|
2491
|
-
}
|
|
2492
|
-
if (!style) {
|
|
2493
|
-
const s = t.app.files[filename.slice(0, -2) + 'css'];
|
|
2494
|
-
if (typeof s === 'string') {
|
|
2495
|
-
style = s;
|
|
2496
|
-
}
|
|
2497
|
-
}
|
|
2498
|
-
if (style) {
|
|
2499
|
-
const r = tool.stylePrepend(style);
|
|
2500
|
-
prep = r.prep;
|
|
2501
|
-
style = yield tool.styleUrl2DataUrl(path + '/', r.style, t.app.files);
|
|
2502
|
-
}
|
|
2503
|
-
layout = tool.purify(layout);
|
|
2504
|
-
layout = tool.layoutAddTagClassAndReTagName(layout, true);
|
|
2505
|
-
const prepList = ['cg-task' + t.id.toString() + '_'];
|
|
2506
|
-
if (prep !== '') {
|
|
2507
|
-
prepList.push(prep);
|
|
2508
|
-
}
|
|
2509
|
-
layout = tool.layoutClassPrepend(layout, prepList);
|
|
2510
|
-
layout = tool.eventsAttrWrap(layout);
|
|
2511
|
-
if (layout.includes('<teleport')) {
|
|
2512
|
-
layout = tool.teleportGlue(layout, formId);
|
|
2513
|
-
}
|
|
2514
|
-
const components = control.buildComponents(t.id, formId, path);
|
|
2515
|
-
if (!components) {
|
|
2516
|
-
const err = new Error('form.create: -5');
|
|
2517
|
-
core.trigger('error', 0, 0, err, err.message);
|
|
2518
|
-
throw err;
|
|
2519
|
-
}
|
|
2520
|
-
const idata = {};
|
|
2521
|
-
const cdata = Object.entries(frm);
|
|
2522
|
-
for (const item of cdata) {
|
|
2523
|
-
if (item[0] === 'access') {
|
|
2524
|
-
continue;
|
|
2525
|
-
}
|
|
2526
|
-
idata[item[0]] = item[1];
|
|
2527
|
-
}
|
|
2528
|
-
idata._formFocus = false;
|
|
2529
|
-
if (clickgo.isNative() && (formId === 1) && !clickgo.isImmersion() && !clickgo.hasFrame()) {
|
|
2530
|
-
idata.isNativeSync = true;
|
|
2531
|
-
}
|
|
2532
|
-
const prot = tool.getClassPrototype(frm);
|
|
2533
|
-
const methods = prot.method;
|
|
2534
|
-
const computed = prot.access;
|
|
2535
|
-
computed.formId = {
|
|
2536
|
-
get: function () {
|
|
2537
|
-
return formId;
|
|
2538
|
-
},
|
|
2539
|
-
set: function () {
|
|
2540
|
-
notify({
|
|
2541
|
-
'title': 'Error',
|
|
2542
|
-
'content': `The software tries to modify the system variable "formId".\nPath: ${this.filename}`,
|
|
2543
|
-
'type': 'danger'
|
|
2544
|
-
});
|
|
2545
|
-
return;
|
|
2546
|
-
}
|
|
2547
|
-
};
|
|
2548
|
-
computed.path = {
|
|
2549
|
-
get: function () {
|
|
2550
|
-
return path;
|
|
2551
|
-
},
|
|
2552
|
-
set: function () {
|
|
2553
|
-
notify({
|
|
2554
|
-
'title': 'Error',
|
|
2555
|
-
'content': `The software tries to modify the system variable "path".\nPath: ${this.filename}`,
|
|
2556
|
-
'type': 'danger'
|
|
2557
|
-
});
|
|
2558
|
-
return;
|
|
2559
|
-
}
|
|
2560
|
-
};
|
|
2561
|
-
computed.prep = {
|
|
2562
|
-
get: function () {
|
|
2563
|
-
return prep;
|
|
2564
|
-
},
|
|
2565
|
-
set: function () {
|
|
2566
|
-
notify({
|
|
2567
|
-
'title': 'Error',
|
|
2568
|
-
'content': `The software tries to modify the system variable "prep".\nPath: ${this.filename}`,
|
|
2569
|
-
'type': 'danger'
|
|
2570
|
-
});
|
|
2571
|
-
return;
|
|
2572
|
-
}
|
|
2573
|
-
};
|
|
2574
|
-
idata._bottomMost = false;
|
|
2575
|
-
computed.bottomMost = {
|
|
2576
|
-
get: function () {
|
|
2577
|
-
return this._bottomMost;
|
|
2578
|
-
},
|
|
2579
|
-
set: function (v) {
|
|
2580
|
-
if (v) {
|
|
2581
|
-
this._bottomMost = true;
|
|
2582
|
-
this.$el.dataset.cgBottomMost = '';
|
|
2583
|
-
if (this._topMost) {
|
|
2584
|
-
this._topMost = false;
|
|
2585
|
-
}
|
|
2586
|
-
this.$refs.form.$data.zIndex = ++info.bottomLastZIndex;
|
|
2587
|
-
}
|
|
2588
|
-
else {
|
|
2589
|
-
this._bottomMost = false;
|
|
2590
|
-
this.$el.removeAttribute('data-cg-bottom-most');
|
|
2591
|
-
this.$refs.form.$data.zIndex = ++info.lastZIndex;
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
};
|
|
2595
|
-
idata._topMost = false;
|
|
2596
|
-
computed.topMost = {
|
|
2597
|
-
get: function () {
|
|
2598
|
-
return this._topMost;
|
|
2599
|
-
},
|
|
2600
|
-
set: function (v) {
|
|
2601
|
-
if (v) {
|
|
2602
|
-
this._topMost = true;
|
|
2603
|
-
if (this._bottomMost) {
|
|
2604
|
-
this._bottomMost = false;
|
|
2605
|
-
this.$el.removeAttribute('data-cg-bottom-most');
|
|
2606
|
-
}
|
|
2607
|
-
if (!this._formFocus) {
|
|
2608
|
-
changeFocus(this.formId);
|
|
2609
|
-
}
|
|
2610
|
-
else {
|
|
2611
|
-
this.$refs.form.$data.zIndex = ++info.topLastZIndex;
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
else {
|
|
2615
|
-
this._topMost = false;
|
|
2616
|
-
this.$refs.form.$data.zIndex = ++info.lastZIndex;
|
|
2617
|
-
}
|
|
2618
|
-
}
|
|
2619
|
-
};
|
|
2620
|
-
idata._historyHash = [];
|
|
2621
|
-
idata._formHash = '';
|
|
2622
|
-
computed.formHash = {
|
|
2623
|
-
get: function () {
|
|
2624
|
-
return this._formHash;
|
|
2625
|
-
},
|
|
2626
|
-
set: function (v) {
|
|
2627
|
-
if (v === this._formHash) {
|
|
2628
|
-
return;
|
|
2629
|
-
}
|
|
2630
|
-
if (Date.now() - this._lastFormHashData > 300) {
|
|
2631
|
-
this._formHashData = {};
|
|
2632
|
-
}
|
|
2633
|
-
if (this.inStep) {
|
|
2634
|
-
(() => __awaiter(this, void 0, void 0, function* () {
|
|
2635
|
-
if (this._stepValues.includes(v)) {
|
|
2636
|
-
this.$refs.form.stepValue = v;
|
|
2637
|
-
}
|
|
2638
|
-
else {
|
|
2639
|
-
if (!(yield clickgo.form.confirm({
|
|
2640
|
-
'taskId': this.taskId,
|
|
2641
|
-
'content': info.locale[this.locale].confirmExitStep
|
|
2642
|
-
}))) {
|
|
2643
|
-
return;
|
|
2644
|
-
}
|
|
2645
|
-
this._inStep = false;
|
|
2646
|
-
this.$refs.form.stepHide();
|
|
2647
|
-
}
|
|
2648
|
-
if (this._formHash) {
|
|
2649
|
-
this._historyHash.push(this._formHash);
|
|
2650
|
-
}
|
|
2651
|
-
this._formHash = v;
|
|
2652
|
-
core.trigger('formHashChange', t.id, formId, v, this._formHashData);
|
|
2653
|
-
}))();
|
|
2654
|
-
return;
|
|
2655
|
-
}
|
|
2656
|
-
if (this._formHash) {
|
|
2657
|
-
this._historyHash.push(this._formHash);
|
|
2658
|
-
}
|
|
2659
|
-
this._formHash = v;
|
|
2660
|
-
core.trigger('formHashChange', t.id, formId, v, this._formHashData);
|
|
2661
|
-
}
|
|
2662
|
-
};
|
|
2663
|
-
idata._lastFormHashData = 0;
|
|
2664
|
-
idata._formHashData = {};
|
|
2665
|
-
computed.formHashData = {
|
|
2666
|
-
get: function () {
|
|
2667
|
-
return this._formHashData;
|
|
2668
|
-
},
|
|
2669
|
-
set: function (v) {
|
|
2670
|
-
this._formHashData = v;
|
|
2671
|
-
this._lastFormHashData = Date.now();
|
|
2672
|
-
}
|
|
2673
|
-
};
|
|
2674
|
-
idata._showInSystemTask = true;
|
|
2675
|
-
computed.showInSystemTask = {
|
|
2676
|
-
get: function () {
|
|
2677
|
-
return this._showInSystemTask;
|
|
2678
|
-
},
|
|
2679
|
-
set: function (v) {
|
|
2680
|
-
this._showInSystemTask = v;
|
|
2681
|
-
core.trigger('formShowInSystemTaskChange', t.id, formId, v);
|
|
2682
|
-
}
|
|
2683
|
-
};
|
|
2684
|
-
const cbs = [];
|
|
2685
|
-
methods.ready = function (cb) {
|
|
2686
|
-
if (this.isReady) {
|
|
2687
|
-
cb();
|
|
2688
|
-
return;
|
|
2689
|
-
}
|
|
2690
|
-
cbs.push(cb);
|
|
2691
|
-
};
|
|
2692
|
-
exports.elements.list.insertAdjacentHTML('beforeend', `<div class="cg-form-wrap" data-form-id="${formId.toString()}" data-task-id="${t.id.toString()}"></div>`);
|
|
2693
|
-
exports.elements.popList.insertAdjacentHTML('beforeend', `<div data-form-id="${formId.toString()}" data-task-id="${t.id.toString()}"></div>`);
|
|
2694
|
-
if (style) {
|
|
2695
|
-
dom.pushStyle(t.id, style, 'form', formId);
|
|
2696
|
-
}
|
|
2697
|
-
const el = exports.elements.list.children.item(exports.elements.list.children.length - 1);
|
|
2698
|
-
const rtn = yield new Promise(function (resolve) {
|
|
2699
|
-
const vapp = clickgo.vue.createApp({
|
|
2700
|
-
'template': layout.replace(/^<cg-form/, '<cg-form ref="form"'),
|
|
2701
|
-
'data': function () {
|
|
2702
|
-
return tool.clone(idata);
|
|
2703
|
-
},
|
|
2704
|
-
'methods': methods,
|
|
2705
|
-
'computed': computed,
|
|
2706
|
-
'beforeCreate': frm.onBeforeCreate,
|
|
2707
|
-
'created': function () {
|
|
2708
|
-
if (frm.access) {
|
|
2709
|
-
this.access = tool.clone(frm.access);
|
|
2710
|
-
}
|
|
2711
|
-
this.onCreated();
|
|
2712
|
-
},
|
|
2713
|
-
'beforeMount': function () {
|
|
2714
|
-
this.onBeforeMount();
|
|
2715
|
-
},
|
|
2716
|
-
'mounted': function () {
|
|
2717
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2718
|
-
yield this.$nextTick();
|
|
2719
|
-
if (this.$refs.form.icon) {
|
|
2720
|
-
const icon = yield fs.getContent(this.$refs.form.icon, undefined, taskId);
|
|
2721
|
-
this.$refs.form.iconDataUrl = (icon instanceof Blob) ? yield tool.blob2DataUrl(icon) : '';
|
|
2722
|
-
}
|
|
2723
|
-
resolve({
|
|
2724
|
-
'vapp': vapp,
|
|
2725
|
-
'vroot': this
|
|
2726
|
-
});
|
|
2727
|
-
});
|
|
2728
|
-
},
|
|
2729
|
-
'beforeUpdate': function () {
|
|
2730
|
-
this.onBeforeUpdate();
|
|
2731
|
-
},
|
|
2732
|
-
'updated': function () {
|
|
2733
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2734
|
-
yield this.$nextTick();
|
|
2735
|
-
this.onUpdated();
|
|
2736
|
-
});
|
|
2737
|
-
},
|
|
2738
|
-
'beforeUnmount': function () {
|
|
2739
|
-
this.onBeforeUnmount();
|
|
2740
|
-
},
|
|
2741
|
-
'unmounted': function () {
|
|
2742
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2743
|
-
yield this.$nextTick();
|
|
2744
|
-
this.onUnmounted();
|
|
2745
|
-
});
|
|
2746
|
-
}
|
|
2747
|
-
});
|
|
2748
|
-
vapp.config.errorHandler = function (err, vm, info) {
|
|
2749
|
-
notify({
|
|
2750
|
-
'title': 'Runtime Error',
|
|
2751
|
-
'content': `Message: ${err.message}\nTask id: ${vm.taskId}\nForm id: ${vm.formId}`,
|
|
2752
|
-
'type': 'danger'
|
|
2753
|
-
});
|
|
2754
|
-
console.error('Runtime Error [form.create.errorHandler]', `Message: ${err.message}\nTask id: ${vm.taskId}\nForm id: ${vm.formId}`, err, info);
|
|
2755
|
-
core.trigger('error', vm.taskId, vm.formId, err, info + '(-3,' + vm.taskId + ',' + vm.formId + ')');
|
|
2756
|
-
};
|
|
2757
|
-
for (const key in components) {
|
|
2758
|
-
vapp.component(key, components[key]);
|
|
2759
|
-
}
|
|
2760
|
-
try {
|
|
2761
|
-
vapp.mount(el);
|
|
2762
|
-
}
|
|
2763
|
-
catch (err) {
|
|
2764
|
-
notify({
|
|
2765
|
-
'title': 'Runtime Error',
|
|
2766
|
-
'content': `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}`,
|
|
2767
|
-
'type': 'danger'
|
|
2768
|
-
});
|
|
2769
|
-
console.error('Runtime Error [form.create.mount]', `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}`, err);
|
|
2770
|
-
core.trigger('error', t.id, formId, err, err.message);
|
|
2771
|
-
}
|
|
2772
|
-
});
|
|
2773
|
-
const nform = {
|
|
2774
|
-
'id': formId,
|
|
2775
|
-
'vapp': rtn.vapp,
|
|
2776
|
-
'vroot': rtn.vroot,
|
|
2777
|
-
'closed': false
|
|
2778
|
-
};
|
|
2779
|
-
t.forms[formId] = nform;
|
|
2780
|
-
yield tool.sleep(34);
|
|
2781
|
-
try {
|
|
2782
|
-
yield frm.onMounted.call(rtn.vroot, data !== null && data !== void 0 ? data : {});
|
|
2783
|
-
}
|
|
2784
|
-
catch (err) {
|
|
2785
|
-
core.trigger('error', rtn.vroot.taskId, rtn.vroot.formId, err, 'Create form mounted error: -6.');
|
|
2786
|
-
delete t.forms[formId];
|
|
2787
|
-
try {
|
|
2788
|
-
rtn.vapp.unmount();
|
|
2789
|
-
}
|
|
2790
|
-
catch (err) {
|
|
2791
|
-
const msg = `Message: ${err.message}\nTask id: ${t.id}\nForm id: ${formId}\nFunction: form.create, unmount.`;
|
|
2792
|
-
notify({
|
|
2793
|
-
'title': 'Form Unmount Error',
|
|
2794
|
-
'content': msg,
|
|
2795
|
-
'type': 'danger'
|
|
2796
|
-
});
|
|
2797
|
-
console.log('Form Unmount Error', msg, err);
|
|
2798
|
-
}
|
|
2799
|
-
rtn.vapp._container.remove();
|
|
2800
|
-
(_b = exports.elements.popList.querySelector('[data-form-id="' + rtn.vroot.formId + '"]')) === null || _b === void 0 ? void 0 : _b.remove();
|
|
2801
|
-
dom.clearWatchStyle(rtn.vroot.formId);
|
|
2802
|
-
dom.clearWatchProperty(rtn.vroot.formId);
|
|
2803
|
-
dom.clearWatchPosition(rtn.vroot.formId);
|
|
2804
|
-
native.clear(formId, t.id);
|
|
2805
|
-
dom.removeStyle(rtn.vroot.taskId, 'form', rtn.vroot.formId);
|
|
2806
|
-
throw err;
|
|
2807
|
-
}
|
|
2808
|
-
core.trigger('formCreated', t.id, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconDataUrl, rtn.vroot.showInSystemTask);
|
|
2809
|
-
if (rtn.vroot.isNativeSync) {
|
|
2810
|
-
yield native.invoke('cg-set-size', native.getToken(), rtn.vroot.$refs.form.$el.offsetWidth, rtn.vroot.$refs.form.$el.offsetHeight);
|
|
2811
|
-
window.addEventListener('resize', function () {
|
|
2812
|
-
rtn.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
2813
|
-
rtn.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
2814
|
-
});
|
|
2815
|
-
}
|
|
2816
|
-
rtn.vroot.isReady = true;
|
|
2817
|
-
for (const cb of cbs) {
|
|
2818
|
-
cb.call(rtn.vroot);
|
|
2819
|
-
}
|
|
2820
|
-
return rtn.vroot;
|
|
2821
|
-
});
|
|
2822
|
-
}
|
|
2823
|
-
function dialog(opt) {
|
|
2824
|
-
return new Promise(function (resolve) {
|
|
2825
|
-
var _a, _b, _c, _d, _e;
|
|
2826
|
-
if (typeof opt === 'string') {
|
|
2827
|
-
opt = {
|
|
2828
|
-
'content': opt
|
|
2829
|
-
};
|
|
2830
|
-
}
|
|
2831
|
-
const filename = tool.urlResolve((_a = opt.path) !== null && _a !== void 0 ? _a : '/', './tmp' + (Math.random() * 100000000000000).toFixed() + '.js');
|
|
2832
|
-
const nopt = opt;
|
|
2833
|
-
const taskId = nopt.taskId;
|
|
2834
|
-
if (!taskId) {
|
|
2835
|
-
resolve('');
|
|
2836
|
-
return;
|
|
2837
|
-
}
|
|
2838
|
-
const t = task.list[taskId];
|
|
2839
|
-
if (!t) {
|
|
2840
|
-
resolve('');
|
|
2841
|
-
return;
|
|
2842
|
-
}
|
|
2843
|
-
const locale = t.locale.lang || core.config.locale;
|
|
2844
|
-
(_b = nopt.buttons) !== null && _b !== void 0 ? _b : (nopt.buttons = [(_d = (_c = info.locale[locale]) === null || _c === void 0 ? void 0 : _c.ok) !== null && _d !== void 0 ? _d : info.locale['en'].ok]);
|
|
2845
|
-
const cls = class extends AbstractForm {
|
|
2846
|
-
constructor() {
|
|
2847
|
-
var _a, _b;
|
|
2848
|
-
super(...arguments);
|
|
2849
|
-
this.buttons = nopt.buttons;
|
|
2850
|
-
this.data = (_a = nopt.data) !== null && _a !== void 0 ? _a : {};
|
|
2851
|
-
this.methods = (_b = nopt.methods) !== null && _b !== void 0 ? _b : {};
|
|
2852
|
-
}
|
|
2853
|
-
get filename() {
|
|
2854
|
-
return filename;
|
|
2855
|
-
}
|
|
2856
|
-
get taskId() {
|
|
2857
|
-
return taskId;
|
|
2858
|
-
}
|
|
2859
|
-
select(button) {
|
|
2860
|
-
const event = {
|
|
2861
|
-
'go': true,
|
|
2862
|
-
preventDefault: function () {
|
|
2863
|
-
this.go = false;
|
|
2864
|
-
},
|
|
2865
|
-
'detail': {
|
|
2866
|
-
'button': button
|
|
2867
|
-
}
|
|
2868
|
-
};
|
|
2869
|
-
if (nopt.select) {
|
|
2870
|
-
nopt.select.call(this, event, button);
|
|
2871
|
-
}
|
|
2872
|
-
if (event.go) {
|
|
2873
|
-
if (nopt.autoDialogResult !== false) {
|
|
2874
|
-
this.dialogResult = button;
|
|
2875
|
-
}
|
|
2876
|
-
close(this.formId);
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
};
|
|
2880
|
-
create(cls, undefined, {
|
|
2881
|
-
'layout': `<form title="${(_e = nopt.title) !== null && _e !== void 0 ? _e : '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.gutter ? ` gutter="${nopt.gutter}"` : ''}>${nopt.content}</dialog></form>`,
|
|
2882
|
-
'style': nopt.style
|
|
2883
|
-
}, t.id).then((frm) => {
|
|
2884
|
-
if (typeof frm === 'number') {
|
|
2885
|
-
resolve('');
|
|
2886
|
-
return;
|
|
2887
|
-
}
|
|
2888
|
-
frm.showDialog().then((v) => {
|
|
2889
|
-
resolve(v);
|
|
2890
|
-
}).catch(() => {
|
|
2891
|
-
resolve('');
|
|
2892
|
-
});
|
|
2893
|
-
}).catch(() => {
|
|
2894
|
-
resolve('');
|
|
2895
|
-
});
|
|
2896
|
-
});
|
|
2897
|
-
}
|
|
2898
|
-
function confirm(opt) {
|
|
2899
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2900
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2901
|
-
if (typeof opt === 'string') {
|
|
2902
|
-
opt = {
|
|
2903
|
-
'content': opt
|
|
2904
|
-
};
|
|
2905
|
-
}
|
|
2906
|
-
const taskId = opt.taskId;
|
|
2907
|
-
if (!taskId) {
|
|
2908
|
-
return false;
|
|
2909
|
-
}
|
|
2910
|
-
const t = task.list[taskId];
|
|
2911
|
-
if (!t) {
|
|
2912
|
-
return false;
|
|
2913
|
-
}
|
|
2914
|
-
const locale = t.locale.lang || core.config.locale;
|
|
2915
|
-
const buttons = [(_b = (_a = info.locale[locale]) === null || _a === void 0 ? void 0 : _a.no) !== null && _b !== void 0 ? _b : info.locale['en'].no, (_d = (_c = info.locale[locale]) === null || _c === void 0 ? void 0 : _c.yes) !== null && _d !== void 0 ? _d : info.locale['en'].yes];
|
|
2916
|
-
if (opt.cancel) {
|
|
2917
|
-
buttons.unshift((_f = (_e = info.locale[locale]) === null || _e === void 0 ? void 0 : _e.cancel) !== null && _f !== void 0 ? _f : info.locale['en'].cancel);
|
|
2918
|
-
}
|
|
2919
|
-
const res = yield dialog({
|
|
2920
|
-
'taskId': taskId,
|
|
2921
|
-
'title': opt.title,
|
|
2922
|
-
'content': opt.content,
|
|
2923
|
-
'buttons': buttons
|
|
2924
|
-
});
|
|
2925
|
-
if (res === ((_h = (_g = info.locale[locale]) === null || _g === void 0 ? void 0 : _g.yes) !== null && _h !== void 0 ? _h : info.locale['en'].yes)) {
|
|
2926
|
-
return true;
|
|
2927
|
-
}
|
|
2928
|
-
if (res === ((_k = (_j = info.locale[locale]) === null || _j === void 0 ? void 0 : _j.cancel) !== null && _k !== void 0 ? _k : info.locale['en'].cancel)) {
|
|
2929
|
-
return 0;
|
|
2930
|
-
}
|
|
2931
|
-
return false;
|
|
2932
|
-
});
|
|
2933
|
-
}
|
|
2934
|
-
function prompt(opt) {
|
|
2935
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2936
|
-
var _a, _b, _c, _d, _e;
|
|
2937
|
-
if (typeof opt === 'string') {
|
|
2938
|
-
opt = {
|
|
2939
|
-
'content': opt
|
|
2940
|
-
};
|
|
2941
|
-
}
|
|
2942
|
-
const taskId = opt.taskId;
|
|
2943
|
-
if (!taskId) {
|
|
2944
|
-
return '';
|
|
2945
|
-
}
|
|
2946
|
-
const t = task.list[taskId];
|
|
2947
|
-
if (!t) {
|
|
2948
|
-
return '';
|
|
2949
|
-
}
|
|
2950
|
-
const locale = t.locale.lang || core.config.locale;
|
|
2951
|
-
const buttons = [(_b = (_a = info.locale[locale]) === null || _a === void 0 ? void 0 : _a.ok) !== null && _b !== void 0 ? _b : info.locale['en'].ok];
|
|
2952
|
-
const cancelBtn = (_d = (_c = info.locale[locale]) === null || _c === void 0 ? void 0 : _c.cancel) !== null && _d !== void 0 ? _d : info.locale['en'].cancel;
|
|
2953
|
-
if (opt.cancel === true || opt.cancel === undefined) {
|
|
2954
|
-
buttons.unshift(cancelBtn);
|
|
2955
|
-
}
|
|
2956
|
-
const res = yield dialog({
|
|
2957
|
-
'taskId': taskId,
|
|
2958
|
-
'title': opt.title,
|
|
2959
|
-
'direction': 'v',
|
|
2960
|
-
'gutter': 10,
|
|
2961
|
-
'content': '<block>' + opt.content + '</block><text v-model="data.text" />',
|
|
2962
|
-
'data': {
|
|
2963
|
-
'text': (_e = opt.text) !== null && _e !== void 0 ? _e : ''
|
|
2964
|
-
},
|
|
2965
|
-
'select': function (e, button) {
|
|
2966
|
-
var _a;
|
|
2967
|
-
const event = {
|
|
2968
|
-
'go': true,
|
|
2969
|
-
preventDefault: function () {
|
|
2970
|
-
this.go = false;
|
|
2971
|
-
},
|
|
2972
|
-
'detail': {
|
|
2973
|
-
'button': button,
|
|
2974
|
-
'value': this.data.text
|
|
2975
|
-
}
|
|
2976
|
-
};
|
|
2977
|
-
(_a = opt.select) === null || _a === void 0 ? void 0 : _a.call(this, event, button);
|
|
2978
|
-
if (!event.go) {
|
|
2979
|
-
e.preventDefault();
|
|
2980
|
-
}
|
|
2981
|
-
if (e.detail.button === cancelBtn) {
|
|
2982
|
-
this.dialogResult = '';
|
|
2983
|
-
return;
|
|
2984
|
-
}
|
|
2985
|
-
this.dialogResult = this.data.text;
|
|
2986
|
-
},
|
|
2987
|
-
'buttons': buttons,
|
|
2988
|
-
'autoDialogResult': false
|
|
2989
|
-
});
|
|
2990
|
-
return res;
|
|
2991
|
-
});
|
|
2992
|
-
}
|
|
2993
|
-
function flash(formId, taskId) {
|
|
2994
|
-
if (!taskId) {
|
|
2995
|
-
return;
|
|
2996
|
-
}
|
|
2997
|
-
const form = getForm(taskId, formId);
|
|
2998
|
-
if (!form) {
|
|
2999
|
-
return;
|
|
3000
|
-
}
|
|
3001
|
-
if (!form.vroot._formFocus) {
|
|
3002
|
-
changeFocus(form.id);
|
|
3003
|
-
}
|
|
3004
|
-
if (form.vroot.$refs.form.flashTimer) {
|
|
3005
|
-
clearTimeout(form.vroot.$refs.form.flashTimer);
|
|
3006
|
-
form.vroot.$refs.form.flashTimer = undefined;
|
|
3007
|
-
}
|
|
3008
|
-
form.vroot.$refs.form.flashTimer = setTimeout(() => {
|
|
3009
|
-
if (form.vroot.$refs.form) {
|
|
3010
|
-
form.vroot.$refs.form.flashTimer = undefined;
|
|
3011
|
-
}
|
|
3012
|
-
}, 1000);
|
|
3013
|
-
core.trigger('formFlash', taskId, formId);
|
|
3014
|
-
}
|
|
3015
|
-
function showLauncher() {
|
|
3016
|
-
exports.elements.launcher.style.display = 'flex';
|
|
3017
|
-
requestAnimationFrame(function () {
|
|
3018
|
-
exports.elements.launcher.classList.add('cg-show');
|
|
3019
|
-
});
|
|
3020
|
-
}
|
|
3021
|
-
function hideLauncher() {
|
|
3022
|
-
exports.elements.launcher.classList.remove('cg-show');
|
|
3023
|
-
setTimeout(function () {
|
|
3024
|
-
if (exports.launcherRoot.folderName !== '') {
|
|
3025
|
-
exports.launcherRoot.closeFolder();
|
|
3026
|
-
}
|
|
3027
|
-
exports.launcherRoot.name = '';
|
|
3028
|
-
exports.elements.launcher.style.display = 'none';
|
|
3029
|
-
}, 300);
|
|
3030
|
-
}
|
|
3031
|
-
window.addEventListener('resize', function () {
|
|
3032
|
-
task.refreshSystemPosition();
|
|
3033
|
-
});
|