clickgo 3.1.4-dev13 → 3.1.5-dev14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/app/demo/app.js +1 -1
- package/dist/app/demo/config.json +5 -2
- package/dist/app/demo/form/control/text/text.js +1 -0
- package/dist/app/demo/form/control/text/text.xml +1 -1
- package/dist/app/demo/form/main.js +47 -52
- package/dist/app/demo/form/method/aform/aform.js +1 -13
- package/dist/app/demo/form/method/aform/aform.xml +0 -1
- package/dist/app/demo/form/method/aform/sd.js +1 -4
- package/dist/app/demo/form/method/form/form.js +5 -6
- package/dist/app/demo/form/method/form/form.xml +1 -0
- package/dist/app/demo/form/method/{aform → form}/test.xml +0 -0
- package/dist/app/demo/form/method/fs/fs.js +1 -4
- package/dist/app/demo/form/method/tool/tool.js +3 -0
- package/dist/app/demo/form/method/tool/tool.xml +1 -0
- package/dist/app/demo/form/method/zip/zip.js +1 -4
- package/dist/app/task/app.js +1 -1
- package/dist/control/common.cgc +0 -0
- package/dist/lib/core.js +0 -5
- package/dist/lib/core.ts +1 -7
- package/dist/lib/form.js +163 -182
- package/dist/lib/form.ts +200 -212
- package/dist/lib/fs.js +1 -1
- package/dist/lib/fs.ts +1 -1
- package/dist/lib/task.js +16 -3
- package/dist/lib/task.ts +24 -3
- package/dist/lib/tool.js +39 -1
- package/dist/lib/tool.ts +45 -0
- package/package.json +2 -2
- package/types/index.d.ts +9 -36
package/dist/lib/fs.ts
CHANGED
|
@@ -9,7 +9,7 @@ import * as types from '../../types';
|
|
|
9
9
|
import * as tool from './tool';
|
|
10
10
|
import * as task from './task';
|
|
11
11
|
|
|
12
|
-
const clickgoFiles = ['/app/', '/app/demo/', '/app/demo/app.js', '/app/demo/config.json', '/app/demo/form/', '/app/demo/form/control/', '/app/demo/form/control/block/', '/app/demo/form/control/block/block.css', '/app/demo/form/control/block/block.xml', '/app/demo/form/control/button/', '/app/demo/form/control/button/button.css', '/app/demo/form/control/button/button.js', '/app/demo/form/control/button/button.xml', '/app/demo/form/control/check/', '/app/demo/form/control/check/check.js', '/app/demo/form/control/check/check.xml', '/app/demo/form/control/dialog/', '/app/demo/form/control/dialog/dialog.js', '/app/demo/form/control/dialog/dialog.xml', '/app/demo/form/control/file/', '/app/demo/form/control/file/file.js', '/app/demo/form/control/file/file.xml', '/app/demo/form/control/flow/', '/app/demo/form/control/flow/flow.css', '/app/demo/form/control/flow/flow.js', '/app/demo/form/control/flow/flow.xml', '/app/demo/form/control/form/', '/app/demo/form/control/form/form.css', '/app/demo/form/control/form/form.js', '/app/demo/form/control/form/form.xml', '/app/demo/form/control/img/', '/app/demo/form/control/img/img.xml', '/app/demo/form/control/label/', '/app/demo/form/control/label/label.xml', '/app/demo/form/control/list/', '/app/demo/form/control/list/list.css', '/app/demo/form/control/list/list.js', '/app/demo/form/control/list/list.xml', '/app/demo/form/control/loading/', '/app/demo/form/control/loading/loading.xml', '/app/demo/form/control/marquee/', '/app/demo/form/control/marquee/marquee.js', '/app/demo/form/control/marquee/marquee.xml', '/app/demo/form/control/menu/', '/app/demo/form/control/menu/menu.js', '/app/demo/form/control/menu/menu.xml', '/app/demo/form/control/monaco/', '/app/demo/form/control/monaco/monaco.js', '/app/demo/form/control/monaco/monaco.xml', '/app/demo/form/control/property/', '/app/demo/form/control/property/property.js', '/app/demo/form/control/property/property.xml', '/app/demo/form/control/radio/', '/app/demo/form/control/radio/radio.js', '/app/demo/form/control/radio/radio.xml', '/app/demo/form/control/scroll/', '/app/demo/form/control/scroll/scroll.js', '/app/demo/form/control/scroll/scroll.xml', '/app/demo/form/control/select/', '/app/demo/form/control/select/select.js', '/app/demo/form/control/select/select.xml', '/app/demo/form/control/tab/', '/app/demo/form/control/tab/tab.js', '/app/demo/form/control/tab/tab.xml', '/app/demo/form/control/text/', '/app/demo/form/control/text/text.js', '/app/demo/form/control/text/text.xml', '/app/demo/form/control/vflow/', '/app/demo/form/control/vflow/vflow.css', '/app/demo/form/control/vflow/vflow.js', '/app/demo/form/control/vflow/vflow.xml', '/app/demo/form/event/', '/app/demo/form/event/form/', '/app/demo/form/event/form/form.css', '/app/demo/form/event/form/form.js', '/app/demo/form/event/form/form.xml', '/app/demo/form/event/other/', '/app/demo/form/event/other/other.js', '/app/demo/form/event/other/other.xml', '/app/demo/form/event/screen/', '/app/demo/form/event/screen/screen.js', '/app/demo/form/event/screen/screen.xml', '/app/demo/form/event/task/', '/app/demo/form/event/task/task.js', '/app/demo/form/event/task/task.xml', '/app/demo/form/main.css', '/app/demo/form/main.js', '/app/demo/form/main.xml', '/app/demo/form/method/', '/app/demo/form/method/aform/', '/app/demo/form/method/aform/aform.js', '/app/demo/form/method/aform/aform.xml', '/app/demo/form/method/aform/sd.js', '/app/demo/form/method/aform/sd.xml', '/app/demo/form/method/
|
|
12
|
+
const clickgoFiles = ['/app/', '/app/demo/', '/app/demo/app.js', '/app/demo/config.json', '/app/demo/form/', '/app/demo/form/control/', '/app/demo/form/control/block/', '/app/demo/form/control/block/block.css', '/app/demo/form/control/block/block.xml', '/app/demo/form/control/button/', '/app/demo/form/control/button/button.css', '/app/demo/form/control/button/button.js', '/app/demo/form/control/button/button.xml', '/app/demo/form/control/check/', '/app/demo/form/control/check/check.js', '/app/demo/form/control/check/check.xml', '/app/demo/form/control/dialog/', '/app/demo/form/control/dialog/dialog.js', '/app/demo/form/control/dialog/dialog.xml', '/app/demo/form/control/file/', '/app/demo/form/control/file/file.js', '/app/demo/form/control/file/file.xml', '/app/demo/form/control/flow/', '/app/demo/form/control/flow/flow.css', '/app/demo/form/control/flow/flow.js', '/app/demo/form/control/flow/flow.xml', '/app/demo/form/control/form/', '/app/demo/form/control/form/form.css', '/app/demo/form/control/form/form.js', '/app/demo/form/control/form/form.xml', '/app/demo/form/control/img/', '/app/demo/form/control/img/img.xml', '/app/demo/form/control/label/', '/app/demo/form/control/label/label.xml', '/app/demo/form/control/list/', '/app/demo/form/control/list/list.css', '/app/demo/form/control/list/list.js', '/app/demo/form/control/list/list.xml', '/app/demo/form/control/loading/', '/app/demo/form/control/loading/loading.xml', '/app/demo/form/control/marquee/', '/app/demo/form/control/marquee/marquee.js', '/app/demo/form/control/marquee/marquee.xml', '/app/demo/form/control/menu/', '/app/demo/form/control/menu/menu.js', '/app/demo/form/control/menu/menu.xml', '/app/demo/form/control/monaco/', '/app/demo/form/control/monaco/monaco.js', '/app/demo/form/control/monaco/monaco.xml', '/app/demo/form/control/property/', '/app/demo/form/control/property/property.js', '/app/demo/form/control/property/property.xml', '/app/demo/form/control/radio/', '/app/demo/form/control/radio/radio.js', '/app/demo/form/control/radio/radio.xml', '/app/demo/form/control/scroll/', '/app/demo/form/control/scroll/scroll.js', '/app/demo/form/control/scroll/scroll.xml', '/app/demo/form/control/select/', '/app/demo/form/control/select/select.js', '/app/demo/form/control/select/select.xml', '/app/demo/form/control/tab/', '/app/demo/form/control/tab/tab.js', '/app/demo/form/control/tab/tab.xml', '/app/demo/form/control/text/', '/app/demo/form/control/text/text.js', '/app/demo/form/control/text/text.xml', '/app/demo/form/control/vflow/', '/app/demo/form/control/vflow/vflow.css', '/app/demo/form/control/vflow/vflow.js', '/app/demo/form/control/vflow/vflow.xml', '/app/demo/form/event/', '/app/demo/form/event/form/', '/app/demo/form/event/form/form.css', '/app/demo/form/event/form/form.js', '/app/demo/form/event/form/form.xml', '/app/demo/form/event/other/', '/app/demo/form/event/other/other.js', '/app/demo/form/event/other/other.xml', '/app/demo/form/event/screen/', '/app/demo/form/event/screen/screen.js', '/app/demo/form/event/screen/screen.xml', '/app/demo/form/event/task/', '/app/demo/form/event/task/task.js', '/app/demo/form/event/task/task.xml', '/app/demo/form/main.css', '/app/demo/form/main.js', '/app/demo/form/main.xml', '/app/demo/form/method/', '/app/demo/form/method/aform/', '/app/demo/form/method/aform/aform.js', '/app/demo/form/method/aform/aform.xml', '/app/demo/form/method/aform/sd.js', '/app/demo/form/method/aform/sd.xml', '/app/demo/form/method/core/', '/app/demo/form/method/core/core.js', '/app/demo/form/method/core/core.xml', '/app/demo/form/method/dom/', '/app/demo/form/method/dom/dom.css', '/app/demo/form/method/dom/dom.js', '/app/demo/form/method/dom/dom.xml', '/app/demo/form/method/form/', '/app/demo/form/method/form/form.css', '/app/demo/form/method/form/form.js', '/app/demo/form/method/form/form.xml', '/app/demo/form/method/form/test.xml', '/app/demo/form/method/fs/', '/app/demo/form/method/fs/fs.js', '/app/demo/form/method/fs/fs.xml', '/app/demo/form/method/fs/text.js', '/app/demo/form/method/fs/text.xml', '/app/demo/form/method/native/', '/app/demo/form/method/native/native.js', '/app/demo/form/method/native/native.xml', '/app/demo/form/method/system/', '/app/demo/form/method/system/system.js', '/app/demo/form/method/system/system.xml', '/app/demo/form/method/task/', '/app/demo/form/method/task/locale1.json', '/app/demo/form/method/task/locale2.json', '/app/demo/form/method/task/task.js', '/app/demo/form/method/task/task.xml', '/app/demo/form/method/theme/', '/app/demo/form/method/theme/theme.js', '/app/demo/form/method/theme/theme.xml', '/app/demo/form/method/tool/', '/app/demo/form/method/tool/tool.js', '/app/demo/form/method/tool/tool.xml', '/app/demo/form/method/zip/', '/app/demo/form/method/zip/zip.js', '/app/demo/form/method/zip/zip.xml', '/app/demo/global.css', '/app/demo/res/', '/app/demo/res/icon.svg', '/app/demo/res/img.jpg', '/app/demo/res/r-1.svg', '/app/demo/res/r-2.svg', '/app/demo/res/sql.svg', '/app/demo/res/txt.svg', '/app/demo/res/zip.svg', '/app/task/', '/app/task/app.js', '/app/task/config.json', '/app/task/form/', '/app/task/form/bar/', '/app/task/form/bar/bar.js', '/app/task/form/bar/bar.xml', '/app/task/form/desktop/', '/app/task/form/desktop/desktop.xml', '/app/task/locale/', '/app/task/locale/en.json', '/app/task/locale/ja.json', '/app/task/locale/sc.json', '/app/task/locale/tc.json', '/clickgo.js', '/clickgo.ts', '/control/', '/control/common.cgc', '/control/form.cgc', '/control/monaco.cgc', '/control/property.cgc', '/control/task.cgc', '/global.css', '/icon.png', '/index.js', '/index.ts', '/lib/', '/lib/control.js', '/lib/control.ts', '/lib/core.js', '/lib/core.ts', '/lib/dom.js', '/lib/dom.ts', '/lib/form.js', '/lib/form.ts', '/lib/fs.js', '/lib/fs.ts', '/lib/native.js', '/lib/native.ts', '/lib/task.js', '/lib/task.ts', '/lib/theme.js', '/lib/theme.ts', '/lib/tool.js', '/lib/tool.ts', '/lib/zip.js', '/lib/zip.ts', '/theme/', '/theme/familiar.cgt'];
|
|
13
13
|
|
|
14
14
|
/** --- 已经挂载的列表 --- */
|
|
15
15
|
const mounts: Record<string, types.IMountHandler> = {};
|
package/dist/lib/task.js
CHANGED
|
@@ -537,6 +537,9 @@ function run(url, opt = {}) {
|
|
|
537
537
|
hidePop: function (pop) {
|
|
538
538
|
form.hidePop(pop);
|
|
539
539
|
},
|
|
540
|
+
create: function (cls, data, opt) {
|
|
541
|
+
return form.create(cls, data, opt, taskId);
|
|
542
|
+
},
|
|
540
543
|
dialog: function (opt) {
|
|
541
544
|
if (typeof opt === 'string') {
|
|
542
545
|
opt = {
|
|
@@ -899,6 +902,9 @@ function run(url, opt = {}) {
|
|
|
899
902
|
escapeHTML: function (html) {
|
|
900
903
|
return tool.escapeHTML(html);
|
|
901
904
|
},
|
|
905
|
+
rgb2hsl: function (rgb) {
|
|
906
|
+
return tool.rgb2hsl(rgb);
|
|
907
|
+
},
|
|
902
908
|
request: function (url, opt) {
|
|
903
909
|
return tool.request(url, opt);
|
|
904
910
|
},
|
|
@@ -908,6 +914,9 @@ function run(url, opt = {}) {
|
|
|
908
914
|
urlResolve: function (from, to) {
|
|
909
915
|
return tool.urlResolve(from, to);
|
|
910
916
|
},
|
|
917
|
+
urlAtom: function (url) {
|
|
918
|
+
return tool.urlAtom(url);
|
|
919
|
+
},
|
|
911
920
|
blob2Text: function (blob) {
|
|
912
921
|
return tool.blob2Text(blob);
|
|
913
922
|
},
|
|
@@ -986,13 +995,17 @@ function run(url, opt = {}) {
|
|
|
986
995
|
}
|
|
987
996
|
let expo = [];
|
|
988
997
|
try {
|
|
998
|
+
const map = {
|
|
999
|
+
'clickgo': '/invoke/clickgo'
|
|
1000
|
+
};
|
|
1001
|
+
if (app.config.map) {
|
|
1002
|
+
Object.assign(map, app.config.map);
|
|
1003
|
+
}
|
|
989
1004
|
expo = loader.require('/app.js', app.files, {
|
|
990
1005
|
'dir': '/',
|
|
991
1006
|
'invoke': invoke,
|
|
992
1007
|
'preprocess': preprocess,
|
|
993
|
-
'map':
|
|
994
|
-
'clickgo': '/invoke/clickgo'
|
|
995
|
-
}
|
|
1008
|
+
'map': map
|
|
996
1009
|
})[0];
|
|
997
1010
|
}
|
|
998
1011
|
catch (e) {
|
package/dist/lib/task.ts
CHANGED
|
@@ -632,6 +632,17 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
632
632
|
hidePop: function(pop?: HTMLElement): void {
|
|
633
633
|
form.hidePop(pop);
|
|
634
634
|
},
|
|
635
|
+
create: function<T extends form.AbstractForm>(
|
|
636
|
+
cls: string | (new () => T),
|
|
637
|
+
data?: Record<string, any>,
|
|
638
|
+
opt?: {
|
|
639
|
+
'layout'?: string;
|
|
640
|
+
'style'?: string;
|
|
641
|
+
'path'?: string;
|
|
642
|
+
}
|
|
643
|
+
): Promise<T> {
|
|
644
|
+
return form.create(cls, data, opt, taskId);
|
|
645
|
+
},
|
|
635
646
|
dialog: function(opt: string | types.IFormDialogOptions): Promise<string> {
|
|
636
647
|
if (typeof opt === 'string') {
|
|
637
648
|
opt = {
|
|
@@ -1005,6 +1016,9 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
1005
1016
|
escapeHTML: function(html: string): string {
|
|
1006
1017
|
return tool.escapeHTML(html);
|
|
1007
1018
|
},
|
|
1019
|
+
rgb2hsl: function(rgb: string): number[] {
|
|
1020
|
+
return tool.rgb2hsl(rgb);
|
|
1021
|
+
},
|
|
1008
1022
|
request: function(url: string, opt: types.IRequestOptions): Promise<null | any> {
|
|
1009
1023
|
return tool.request(url, opt);
|
|
1010
1024
|
},
|
|
@@ -1014,6 +1028,9 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
1014
1028
|
urlResolve: function(from: string, to: string): string {
|
|
1015
1029
|
return tool.urlResolve(from, to);
|
|
1016
1030
|
},
|
|
1031
|
+
urlAtom: function(url: string): string {
|
|
1032
|
+
return tool.urlAtom(url);
|
|
1033
|
+
},
|
|
1017
1034
|
blob2Text: function(blob: Blob): Promise<string> {
|
|
1018
1035
|
return tool.blob2Text(blob);
|
|
1019
1036
|
},
|
|
@@ -1101,13 +1118,17 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
1101
1118
|
}
|
|
1102
1119
|
let expo: any = [];
|
|
1103
1120
|
try {
|
|
1121
|
+
const map = {
|
|
1122
|
+
'clickgo': '/invoke/clickgo'
|
|
1123
|
+
};
|
|
1124
|
+
if (app.config.map) {
|
|
1125
|
+
Object.assign(map, app.config.map);
|
|
1126
|
+
}
|
|
1104
1127
|
expo = loader.require('/app.js', app.files, {
|
|
1105
1128
|
'dir': '/',
|
|
1106
1129
|
'invoke': invoke,
|
|
1107
1130
|
'preprocess': preprocess,
|
|
1108
|
-
'map':
|
|
1109
|
-
'clickgo': '/invoke/clickgo'
|
|
1110
|
-
}
|
|
1131
|
+
'map': map
|
|
1111
1132
|
})[0];
|
|
1112
1133
|
}
|
|
1113
1134
|
catch (e: any) {
|
package/dist/lib/tool.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.execCommand = exports.blob2DataUrl = exports.blob2Text = exports.urlResolve = exports.parseUrl = exports.request = exports.escapeHTML = exports.getArray = exports.getNumber = exports.getBoolean = exports.random = exports.RANDOM_LUNS = exports.RANDOM_V = exports.RANDOM_LUN = exports.RANDOM_LU = exports.RANDOM_LN = exports.RANDOM_UN = exports.RANDOM_L = exports.RANDOM_U = exports.RANDOM_N = exports.rand = exports.getMimeByPath = exports.stylePrepend = exports.teleportGlue = exports.eventsAttrWrap = exports.layoutClassPrepend = exports.layoutInsertAttr = exports.layoutAddTagClassAndReTagName = exports.styleUrl2DataUrl = exports.purify = exports.sleepFrame = exports.nextFrame = exports.sleep = exports.clone = exports.blob2ArrayBuffer = exports.getClassPrototype = void 0;
|
|
12
|
+
exports.execCommand = exports.blob2DataUrl = exports.blob2Text = exports.urlAtom = exports.urlResolve = exports.parseUrl = exports.request = exports.rgb2hsl = exports.escapeHTML = exports.getArray = exports.getNumber = exports.getBoolean = exports.random = exports.RANDOM_LUNS = exports.RANDOM_V = exports.RANDOM_LUN = exports.RANDOM_LU = exports.RANDOM_LN = exports.RANDOM_UN = exports.RANDOM_L = exports.RANDOM_U = exports.RANDOM_N = exports.rand = exports.getMimeByPath = exports.stylePrepend = exports.teleportGlue = exports.eventsAttrWrap = exports.layoutClassPrepend = exports.layoutInsertAttr = exports.layoutAddTagClassAndReTagName = exports.styleUrl2DataUrl = exports.purify = exports.sleepFrame = exports.nextFrame = exports.sleep = exports.clone = exports.blob2ArrayBuffer = exports.getClassPrototype = void 0;
|
|
13
13
|
function getClassPrototype(obj, over = [], level = 0) {
|
|
14
14
|
if (level === 0) {
|
|
15
15
|
return getClassPrototype(Object.getPrototypeOf(obj), over, level + 1);
|
|
@@ -430,6 +430,40 @@ function escapeHTML(html) {
|
|
|
430
430
|
return html.replace(/</g, '<').replace(/>/g, '>');
|
|
431
431
|
}
|
|
432
432
|
exports.escapeHTML = escapeHTML;
|
|
433
|
+
function rgb2hsl(rgb) {
|
|
434
|
+
if (rgb.includes('(')) {
|
|
435
|
+
const match = /[0-9., ]+/.exec(rgb);
|
|
436
|
+
if (!match) {
|
|
437
|
+
return [0, 0, 0];
|
|
438
|
+
}
|
|
439
|
+
rgb = match[0];
|
|
440
|
+
}
|
|
441
|
+
const arr = rgb.split(',');
|
|
442
|
+
const [r, g, b] = arr.map(v => parseInt(v) / 255);
|
|
443
|
+
const max = Math.max(r, g, b);
|
|
444
|
+
const min = Math.min(r, g, b);
|
|
445
|
+
const diff = max - min;
|
|
446
|
+
let h = 0;
|
|
447
|
+
const l = (max + min) / 2;
|
|
448
|
+
const s2 = 1 - Math.abs(max + min - 1);
|
|
449
|
+
const s = s2 ? (diff / s2) : 0;
|
|
450
|
+
switch (min) {
|
|
451
|
+
case max:
|
|
452
|
+
h = 0;
|
|
453
|
+
break;
|
|
454
|
+
case r:
|
|
455
|
+
h = (60 * ((b - g) / diff)) + 180;
|
|
456
|
+
break;
|
|
457
|
+
case g:
|
|
458
|
+
h = (60 * ((r - b) / diff)) + 300;
|
|
459
|
+
break;
|
|
460
|
+
case b:
|
|
461
|
+
h = (60 * ((g - r) / diff)) + 60;
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
return [h, s, l];
|
|
465
|
+
}
|
|
466
|
+
exports.rgb2hsl = rgb2hsl;
|
|
433
467
|
function request(url, opt) {
|
|
434
468
|
return new Promise(function (resove) {
|
|
435
469
|
var _a;
|
|
@@ -541,6 +575,10 @@ function urlResolve(from, to) {
|
|
|
541
575
|
return loader.urlResolve(from, to);
|
|
542
576
|
}
|
|
543
577
|
exports.urlResolve = urlResolve;
|
|
578
|
+
function urlAtom(url) {
|
|
579
|
+
return loader.urlAtom(url);
|
|
580
|
+
}
|
|
581
|
+
exports.urlAtom = urlAtom;
|
|
544
582
|
function blob2Text(blob) {
|
|
545
583
|
return loader.blob2Text(blob);
|
|
546
584
|
}
|
package/dist/lib/tool.ts
CHANGED
|
@@ -573,6 +573,47 @@ export function escapeHTML(html: string): string {
|
|
|
573
573
|
return html.replace(/</g, '<').replace(/>/g, '>');
|
|
574
574
|
}
|
|
575
575
|
|
|
576
|
+
/**
|
|
577
|
+
* --- rgb 字符串转 hsl 数组 ---
|
|
578
|
+
* @param rgb rgb(x, x, x) 或直接 x,x,x
|
|
579
|
+
*/
|
|
580
|
+
export function rgb2hsl(rgb: string): number[] {
|
|
581
|
+
if (rgb.includes('(')) {
|
|
582
|
+
const match = /[0-9., ]+/.exec(rgb);
|
|
583
|
+
if (!match) {
|
|
584
|
+
return [0, 0, 0];
|
|
585
|
+
}
|
|
586
|
+
rgb = match[0];
|
|
587
|
+
}
|
|
588
|
+
const arr = rgb.split(',');
|
|
589
|
+
const [r, g, b] = arr.map(v => parseInt(v) / 255);
|
|
590
|
+
|
|
591
|
+
const max = Math.max(r, g, b);
|
|
592
|
+
const min = Math.min(r, g, b);
|
|
593
|
+
const diff = max - min;
|
|
594
|
+
|
|
595
|
+
let h = 0 ;
|
|
596
|
+
const l = (max + min) / 2;
|
|
597
|
+
const s2 = 1 - Math.abs(max + min - 1);
|
|
598
|
+
const s = s2 ? (diff / s2) : 0;
|
|
599
|
+
|
|
600
|
+
switch (min) {
|
|
601
|
+
case max:
|
|
602
|
+
h = 0 ;
|
|
603
|
+
break;
|
|
604
|
+
case r:
|
|
605
|
+
h = (60 * ((b - g) / diff)) + 180;
|
|
606
|
+
break;
|
|
607
|
+
case g:
|
|
608
|
+
h = (60 * ((r - b) / diff)) + 300;
|
|
609
|
+
break;
|
|
610
|
+
case b:
|
|
611
|
+
h = (60 * ((g - r) / diff)) + 60;
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
return [h, s, l] ;
|
|
615
|
+
}
|
|
616
|
+
|
|
576
617
|
/**
|
|
577
618
|
* --- 发起一个网络请求 ---
|
|
578
619
|
* @param url 网址
|
|
@@ -680,6 +721,10 @@ export function urlResolve(from: string, to: string): string {
|
|
|
680
721
|
return loader.urlResolve(from, to);
|
|
681
722
|
}
|
|
682
723
|
|
|
724
|
+
export function urlAtom(url: string): string {
|
|
725
|
+
return loader.urlAtom(url);
|
|
726
|
+
}
|
|
727
|
+
|
|
683
728
|
export function blob2Text(blob: Blob): Promise<string> {
|
|
684
729
|
return loader.blob2Text(blob);
|
|
685
730
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clickgo",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5-dev14",
|
|
4
4
|
"description": "Background interface, software interface, mobile phone APP interface operation library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deskrt",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@litert/eslint-plugin-rules": "^0.1.0",
|
|
22
|
-
"@litert/loader": "^3.4.
|
|
22
|
+
"@litert/loader": "^3.4.4",
|
|
23
23
|
"@types/node": "^18.11.14",
|
|
24
24
|
"electron": "^19.1.3",
|
|
25
25
|
"typescript": "^4.8.4"
|
package/types/index.d.ts
CHANGED
|
@@ -129,6 +129,8 @@ export interface IAppConfig {
|
|
|
129
129
|
|
|
130
130
|
/** --- 将要加载的非 js 文件列表,打包为 cga 模式下此配置可省略 --- */
|
|
131
131
|
'files'?: string[];
|
|
132
|
+
/** --- import 的目录映射关系 --- */
|
|
133
|
+
'map'?: Record<string, string>;
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
// -------------------------
|
|
@@ -284,39 +286,6 @@ export interface IFormInfo {
|
|
|
284
286
|
'focus': boolean;
|
|
285
287
|
}
|
|
286
288
|
|
|
287
|
-
/** --- 窗体创建选项 --- */
|
|
288
|
-
export interface IFormCreateOptions {
|
|
289
|
-
'code'?: IFormCreateCode;
|
|
290
|
-
'layout': string;
|
|
291
|
-
'style'?: string;
|
|
292
|
-
|
|
293
|
-
/** --- 当前窗体的基准路径,不以 / 结尾,仅用作传值,App 内无法填写 --- */
|
|
294
|
-
'path'?: string;
|
|
295
|
-
/** --- 传递到 onMounted 的数据 --- */
|
|
296
|
-
'data'?: Record<string, any>;
|
|
297
|
-
/** --- APP 内无法填写 --- */
|
|
298
|
-
'taskId'?: number;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/** --- 窗体的 code 参数 --- */
|
|
302
|
-
export interface IFormCreateCode {
|
|
303
|
-
'data'?: Record<string, any>;
|
|
304
|
-
'access'?: Record<string, any>;
|
|
305
|
-
'methods'?: Record<string, any>;
|
|
306
|
-
'computed'?: Record<string, {
|
|
307
|
-
'get'?: any;
|
|
308
|
-
'set'?: any;
|
|
309
|
-
}>;
|
|
310
|
-
'beforeCreate'?: any;
|
|
311
|
-
'created'?: any;
|
|
312
|
-
'beforeMount'?: any;
|
|
313
|
-
'mounted'?: any;
|
|
314
|
-
'beforeUpdate'?: any;
|
|
315
|
-
'updated'?: any;
|
|
316
|
-
'beforeUnmount'?: any;
|
|
317
|
-
'unmounted'?: any;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
289
|
// --------------------------
|
|
321
290
|
// --------- fs lib ---------
|
|
322
291
|
// --------------------------
|
|
@@ -572,15 +541,19 @@ export interface IZipMetadata {
|
|
|
572
541
|
|
|
573
542
|
/** --- Dialog 选项 --- */
|
|
574
543
|
export interface IFormDialogOptions {
|
|
575
|
-
/** --- 当前的 taskId,App 模式下无效 --- */
|
|
576
|
-
'taskId'?: number;
|
|
577
|
-
|
|
578
544
|
'title'?: string;
|
|
579
545
|
'content': string;
|
|
580
546
|
'buttons'?: string[];
|
|
581
547
|
'direction'?: 'h' | 'v';
|
|
582
548
|
|
|
549
|
+
'style'?: string;
|
|
550
|
+
/** --- 路径基,以 / 结束或文件路径则以文件的基路径为准,可留空 --- */
|
|
551
|
+
'path'?: string;
|
|
552
|
+
|
|
583
553
|
'select'?: (e: Event, button: string) => void;
|
|
554
|
+
|
|
555
|
+
/** --- 当前的 taskId,App 模式下无效 --- */
|
|
556
|
+
'taskId'?: number;
|
|
584
557
|
}
|
|
585
558
|
|
|
586
559
|
/** --- Confirm 选项 --- */
|