Comparing version
@@ -65,3 +65,4 @@ "use strict"; | ||
'focus': flist[fid].focus, | ||
'flash': false | ||
'flash': false, | ||
'showInTask': flist[fid].showInSystemTask | ||
}; | ||
@@ -71,3 +72,3 @@ } | ||
} | ||
onFormCreated(taskId, formId, title, icon) { | ||
onFormCreated(taskId, formId, title, icon, showInSystemTask) { | ||
this.flist[formId] = { | ||
@@ -80,5 +81,6 @@ 'title': title, | ||
'focus': false, | ||
'flash': false | ||
'flash': false, | ||
'showInTask': true | ||
}; | ||
this.pushConsole('formCreated', `taskId: ${taskId}, formId: ${formId}, title: ${title}, icon: ${icon ? icon.slice(0, 10) + '...' : 'null'}`); | ||
this.pushConsole('formCreated', `taskId: ${taskId}, formId: ${formId}, title: ${title}, icon: ${icon ? icon.slice(0, 10) + '...' : 'null'}, sist: ${showInSystemTask ? 'true' : 'false'}`); | ||
} | ||
@@ -156,3 +158,10 @@ onFormRemoved(taskId, formId, title, icon) { | ||
} | ||
onFormShowInSystemTaskChange(taskId, formId, value) { | ||
if (!this.flist[formId]) { | ||
return; | ||
} | ||
this.flist[formId].title = value; | ||
this.pushConsole('formShowInSystemTaskChange', `taskId: ${taskId}, formId: ${formId}, value: ${value}`); | ||
} | ||
} | ||
exports.default = default_1; |
@@ -81,3 +81,11 @@ "use strict"; | ||
} | ||
back() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (clickgo.core.back()) { | ||
return; | ||
} | ||
yield clickgo.form.dialog('No permission.'); | ||
}); | ||
} | ||
} | ||
exports.default = default_1; |
@@ -44,3 +44,2 @@ "use strict"; | ||
this.dr = ''; | ||
this.setTopMostValue = false; | ||
} | ||
@@ -229,6 +228,2 @@ min() { | ||
} | ||
setTopMost() { | ||
this.setTopMostValue = !this.setTopMostValue; | ||
this.topMost = this.setTopMostValue; | ||
} | ||
flash() { | ||
@@ -235,0 +230,0 @@ clickgo.form.flash(this.formId); |
@@ -147,3 +147,4 @@ "use strict"; | ||
const task = tasks[taskId]; | ||
let appIndex = this.getAppIndexByPath(task.path); | ||
let app = undefined; | ||
const appIndex = this.getAppIndexByPath(task.path); | ||
if (appIndex >= 0) { | ||
@@ -153,3 +154,3 @@ this.apps[appIndex].opened = true; | ||
else { | ||
this.apps.push({ | ||
app = { | ||
'name': task.name, | ||
@@ -163,4 +164,3 @@ 'path': task.path, | ||
'pin': false | ||
}); | ||
appIndex = this.apps.length - 1; | ||
}; | ||
} | ||
@@ -170,11 +170,17 @@ const forms = clickgo.form.getList(parseInt(taskId)); | ||
const form = forms[formId]; | ||
this.apps[appIndex].forms[formId] = { | ||
if (!form.showInSystemTask) { | ||
continue; | ||
} | ||
(app !== null && app !== void 0 ? app : this.apps[appIndex]).forms[formId] = { | ||
'title': form.title, | ||
'icon': form.icon || this.apps[appIndex].icon | ||
'icon': form.icon || (app !== null && app !== void 0 ? app : this.apps[appIndex]).icon | ||
}; | ||
} | ||
this.apps[appIndex].formCount = Object.keys(this.apps[appIndex].forms).length; | ||
(app !== null && app !== void 0 ? app : this.apps[appIndex]).formCount = Object.keys((app !== null && app !== void 0 ? app : this.apps[appIndex]).forms).length; | ||
if (app === null || app === void 0 ? void 0 : app.formCount) { | ||
this.apps.push(app); | ||
} | ||
} | ||
} | ||
onFormCreated(taskId, formId, title, icon) { | ||
onFormCreated(taskId, formId, title, icon, sist) { | ||
if (taskId === this.taskId) { | ||
@@ -187,2 +193,5 @@ return; | ||
} | ||
if (!sist) { | ||
return; | ||
} | ||
let appIndex = this.getAppIndexByPath(task.path); | ||
@@ -220,2 +229,5 @@ if (appIndex >= 0) { | ||
} | ||
if (!this.apps[appIndex].forms[formId]) { | ||
return; | ||
} | ||
delete this.apps[appIndex].forms[formId]; | ||
@@ -284,2 +296,54 @@ --this.apps[appIndex].formCount; | ||
} | ||
onFormShowInSystemTaskChange(taskId, formId, value) { | ||
const task = clickgo.task.get(taskId); | ||
if (!task) { | ||
return; | ||
} | ||
if (value) { | ||
const form = clickgo.form.get(formId); | ||
if (!form) { | ||
return; | ||
} | ||
let appIndex = this.getAppIndexByPath(task.path); | ||
if (appIndex >= 0) { | ||
this.apps[appIndex].opened = true; | ||
} | ||
else { | ||
this.apps.push({ | ||
'name': task.name, | ||
'path': task.path, | ||
'icon': task.icon, | ||
'selected': false, | ||
'opened': true, | ||
'forms': {}, | ||
'formCount': 0, | ||
'pin': false | ||
}); | ||
appIndex = this.apps.length - 1; | ||
} | ||
this.apps[appIndex].forms[formId] = { | ||
'title': form.title, | ||
'icon': form.icon || this.apps[appIndex].icon | ||
}; | ||
++this.apps[appIndex].formCount; | ||
} | ||
else { | ||
const appIndex = this.getAppIndexByPath(task.path); | ||
if (appIndex < 0) { | ||
return; | ||
} | ||
delete this.apps[appIndex].forms[formId]; | ||
--this.apps[appIndex].formCount; | ||
if (this.apps[appIndex].formCount > 0) { | ||
return; | ||
} | ||
const pinPaths = Object.keys(clickgo.core.config['task.pin']); | ||
if (pinPaths.includes(this.apps[appIndex].path)) { | ||
this.apps[appIndex].opened = false; | ||
} | ||
else { | ||
this.apps.splice(appIndex, 1); | ||
} | ||
} | ||
} | ||
onConfigChanged(n, v) { | ||
@@ -286,0 +350,0 @@ if (n !== 'task.pin') { |
@@ -27,3 +27,3 @@ "use strict"; | ||
exports.zip = exports.tool = exports.theme = exports.task = exports.native = exports.fs = exports.form = exports.dom = exports.core = exports.control = exports.vue = exports.hasFrame = exports.isImmersion = exports.getPlatform = exports.isNative = exports.getVersion = void 0; | ||
const version = '3.5.2'; | ||
const version = '3.5.3'; | ||
function getVersion() { | ||
@@ -30,0 +30,0 @@ return version; |
@@ -16,3 +16,3 @@ /** | ||
*/ | ||
const version = '3.5.2'; | ||
const version = '3.5.3'; | ||
export function getVersion(): string { | ||
@@ -19,0 +19,0 @@ return version; |
@@ -73,2 +73,5 @@ "use strict"; | ||
} | ||
onFormShowInSystemTaskChange() { | ||
return; | ||
} | ||
onTaskStarted() { | ||
@@ -75,0 +78,0 @@ return; |
@@ -63,3 +63,5 @@ // npm publish --tag dev --access public | ||
/** --- 窗体创建事件 --- */ | ||
public onFormCreated(taskId: number, formId: number, title: string, icon: string): void | Promise<void>; | ||
public onFormCreated( | ||
taskId: number, formId: number, title: string, icon: string, showInSystemTask: boolean | ||
): void | Promise<void>; | ||
public onFormCreated(): void { | ||
@@ -123,2 +125,8 @@ return; | ||
/** --- 窗体是否显示在任务栏属性改变事件 --- */ | ||
public onFormShowInSystemTaskChange(taskId: number, formId: number, value: boolean): void | Promise<void>; | ||
public onFormShowInSystemTaskChange(): void { | ||
return; | ||
} | ||
/** --- 任务开始事件 --- */ | ||
@@ -125,0 +133,0 @@ public onTaskStarted(taskId: number): void | Promise<void>; |
@@ -35,3 +35,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLocation = exports.location = exports.getHash = exports.hash = exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.getModule = exports.regModule = exports.boot = exports.getCdn = exports.AbstractApp = exports.config = void 0; | ||
exports.back = exports.getLocation = exports.location = exports.getHash = exports.hash = exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.getModule = exports.regModule = exports.boot = exports.getCdn = exports.AbstractApp = exports.config = void 0; | ||
const clickgo = __importStar(require("../clickgo")); | ||
@@ -119,2 +119,5 @@ const fs = __importStar(require("./fs")); | ||
} | ||
onFormShowInSystemTaskChange() { | ||
return; | ||
} | ||
onTaskStarted() { | ||
@@ -343,4 +346,4 @@ return; | ||
}; | ||
function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '') { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15; | ||
function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '', param3 = true) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20; | ||
const eventName = 'on' + name[0].toUpperCase() + name.slice(1); | ||
@@ -390,9 +393,9 @@ switch (name) { | ||
case 'formRemoved': { | ||
(_l = (_k = globalEvents)[name]) === null || _l === void 0 ? void 0 : _l.call(_k, taskId, formId, param1, param2); | ||
exports.boot === null || exports.boot === void 0 ? void 0 : exports.boot[eventName](taskId, formId, param1, param2); | ||
(_l = (_k = globalEvents)[name]) === null || _l === void 0 ? void 0 : _l.call(_k, taskId, formId, param1, param2, param3); | ||
exports.boot === null || exports.boot === void 0 ? void 0 : exports.boot[eventName](taskId, formId, param1, param2, param3); | ||
for (const tid in task.list) { | ||
const t = task.list[tid]; | ||
(_m = t.class) === null || _m === void 0 ? void 0 : _m[eventName](taskId, formId, param1, param2); | ||
(_m = t.class) === null || _m === void 0 ? void 0 : _m[eventName](taskId, formId, param1, param2, param3); | ||
for (const fid in t.forms) { | ||
(_p = (_o = t.forms[fid].vroot)[eventName]) === null || _p === void 0 ? void 0 : _p.call(_o, taskId, formId, param1, param2); | ||
(_p = (_o = t.forms[fid].vroot)[eventName]) === null || _p === void 0 ? void 0 : _p.call(_o, taskId, formId, param1, param2, param3); | ||
} | ||
@@ -443,11 +446,23 @@ } | ||
} | ||
case 'formShowInSystemTaskChange': { | ||
(_6 = (_5 = globalEvents)[name]) === null || _6 === void 0 ? void 0 : _6.call(_5, taskId, formId, param1); | ||
exports.boot === null || exports.boot === void 0 ? void 0 : exports.boot[eventName](taskId, formId, param1); | ||
for (const tid in task.list) { | ||
const t = task.list[tid]; | ||
(_7 = t.class) === null || _7 === void 0 ? void 0 : _7[eventName](taskId, formId, param1); | ||
for (const fid in t.forms) { | ||
(_9 = (_8 = t.forms[fid].vroot)[eventName]) === null || _9 === void 0 ? void 0 : _9.call(_8, taskId, formId, param1); | ||
} | ||
} | ||
break; | ||
} | ||
case 'taskStarted': | ||
case 'taskEnded': { | ||
(_6 = (_5 = globalEvents)[name]) === null || _6 === void 0 ? void 0 : _6.call(_5, taskId, formId); | ||
(_11 = (_10 = globalEvents)[name]) === null || _11 === void 0 ? void 0 : _11.call(_10, taskId, formId); | ||
exports.boot === null || exports.boot === void 0 ? void 0 : exports.boot[eventName](taskId, formId); | ||
for (const tid in task.list) { | ||
const t = task.list[tid]; | ||
(_7 = t.class) === null || _7 === void 0 ? void 0 : _7[eventName](taskId); | ||
(_12 = t.class) === null || _12 === void 0 ? void 0 : _12[eventName](taskId); | ||
for (const fid in t.forms) { | ||
(_9 = (_8 = t.forms[fid].vroot)[eventName]) === null || _9 === void 0 ? void 0 : _9.call(_8, taskId); | ||
(_14 = (_13 = t.forms[fid].vroot)[eventName]) === null || _14 === void 0 ? void 0 : _14.call(_13, taskId); | ||
} | ||
@@ -467,5 +482,5 @@ } | ||
const t = task.list[tid]; | ||
(_10 = t.class) === null || _10 === void 0 ? void 0 : _10[eventName](taskId, formId); | ||
(_15 = t.class) === null || _15 === void 0 ? void 0 : _15[eventName](taskId, formId); | ||
for (const fid in t.forms) { | ||
(_12 = (_11 = t.forms[fid].vroot)[eventName]) === null || _12 === void 0 ? void 0 : _12.call(_11, taskId, formId); | ||
(_17 = (_16 = t.forms[fid].vroot)[eventName]) === null || _17 === void 0 ? void 0 : _17.call(_16, taskId, formId); | ||
} | ||
@@ -482,5 +497,5 @@ } | ||
const t = task.list[tid]; | ||
(_13 = t.class) === null || _13 === void 0 ? void 0 : _13[eventName](taskId); | ||
(_18 = t.class) === null || _18 === void 0 ? void 0 : _18[eventName](taskId); | ||
for (const fid in t.forms) { | ||
(_15 = (_14 = t.forms[fid].vroot)[eventName]) === null || _15 === void 0 ? void 0 : _15.call(_14, taskId); | ||
(_20 = (_19 = t.forms[fid].vroot)[eventName]) === null || _20 === void 0 ? void 0 : _20.call(_19, taskId); | ||
} | ||
@@ -686,3 +701,5 @@ } | ||
'width': window.innerWidth, | ||
'height': window.innerHeight - 46 | ||
'height': window.innerHeight - 46, | ||
'owidth': window.innerWidth, | ||
'oheight': window.innerHeight | ||
}; | ||
@@ -728,3 +745,5 @@ } | ||
'width': width, | ||
'height': height | ||
'height': height, | ||
'owidth': window.innerWidth, | ||
'oheight': window.innerHeight | ||
}; | ||
@@ -772,4 +791,19 @@ } | ||
exports.getLocation = getLocation; | ||
function back(taskId) { | ||
if (!taskId) { | ||
return false; | ||
} | ||
const t = task.list[taskId]; | ||
if (!t) { | ||
return false; | ||
} | ||
if (!t.runtime.permissions.includes('root') && !t.runtime.permissions.includes('location')) { | ||
return false; | ||
} | ||
window.history.back(); | ||
return true; | ||
} | ||
exports.back = back; | ||
window.addEventListener('hashchange', function () { | ||
trigger('hashChanged', window.location.hash ? decodeURIComponent(window.location.hash.slice(1)) : ''); | ||
}); |
@@ -99,3 +99,5 @@ /** | ||
/** --- 窗体创建事件 --- */ | ||
public onFormCreated(taskId: number, formId: number, title: string, icon: string): void | Promise<void>; | ||
public onFormCreated( | ||
taskId: number, formId: number, title: string, icon: string, showInSystemTask: boolean | ||
): void | Promise<void>; | ||
public onFormCreated(): void { | ||
@@ -159,2 +161,8 @@ return; | ||
/** --- 窗体是否显示在任务栏属性改变事件 --- */ | ||
public onFormShowInSystemTaskChange(taskId: number, formId: number, value: boolean): void | Promise<void>; | ||
public onFormShowInSystemTaskChange(): void { | ||
return; | ||
} | ||
/** --- 任务开始事件 --- */ | ||
@@ -421,3 +429,3 @@ public onTaskStarted(taskId: number): void | Promise<void>; | ||
*/ | ||
export function trigger(name: types.TGlobalEvent, taskId: number | string | boolean = 0, formId: number | string | boolean | Record<string, any> | null = 0, param1: boolean | Error | string = '', param2: string = ''): void { | ||
export function trigger(name: types.TGlobalEvent, taskId: number | string | boolean = 0, formId: number | string | boolean | Record<string, any> | null = 0, param1: boolean | Error | string = '', param2: string = '', param3: boolean = true): void { | ||
const eventName = 'on' + name[0].toUpperCase() + name.slice(1); | ||
@@ -467,9 +475,9 @@ switch (name) { | ||
case 'formRemoved': { | ||
(globalEvents as any)[name]?.(taskId, formId, param1, param2); | ||
(boot as any)?.[eventName](taskId, formId, param1, param2); | ||
(globalEvents as any)[name]?.(taskId, formId, param1, param2, param3); | ||
(boot as any)?.[eventName](taskId, formId, param1, param2, param3); | ||
for (const tid in task.list) { | ||
const t = task.list[tid]; | ||
(t.class as any)?.[eventName](taskId, formId, param1, param2); | ||
(t.class as any)?.[eventName](taskId, formId, param1, param2, param3); | ||
for (const fid in t.forms) { | ||
t.forms[fid].vroot[eventName]?.(taskId, formId, param1, param2); | ||
t.forms[fid].vroot[eventName]?.(taskId, formId, param1, param2, param3); | ||
} | ||
@@ -520,2 +528,14 @@ } | ||
} | ||
case 'formShowInSystemTaskChange': { | ||
(globalEvents as any)[name]?.(taskId, formId, param1); | ||
(boot as any)?.[eventName](taskId, formId, param1); | ||
for (const tid in task.list) { | ||
const t = task.list[tid]; | ||
(t.class as any)?.[eventName](taskId, formId, param1); | ||
for (const fid in t.forms) { | ||
t.forms[fid].vroot[eventName]?.(taskId, formId, param1); | ||
} | ||
} | ||
break; | ||
} | ||
case 'taskStarted': | ||
@@ -783,3 +803,5 @@ case 'taskEnded': { | ||
'width': window.innerWidth, | ||
'height': window.innerHeight - 46 | ||
'height': window.innerHeight - 46, | ||
'owidth': window.innerWidth, | ||
'oheight': window.innerHeight | ||
}; | ||
@@ -825,3 +847,5 @@ } | ||
'width': width, | ||
'height': height | ||
'height': height, | ||
'owidth': window.innerWidth, | ||
'oheight': window.innerHeight | ||
}; | ||
@@ -885,4 +909,23 @@ } | ||
/** | ||
* --- 对浏览器做返回操作 --- | ||
* @param taskId 基任务,App 模式下无效 | ||
*/ | ||
export function back(taskId?: number): boolean { | ||
if (!taskId) { | ||
return false; | ||
} | ||
const t = task.list[taskId]; | ||
if (!t) { | ||
return false; | ||
} | ||
if (!t.runtime.permissions.includes('root') && !t.runtime.permissions.includes('location')) { | ||
return false; | ||
} | ||
window.history.back(); | ||
return true; | ||
} | ||
window.addEventListener('hashchange', function() { | ||
trigger('hashChanged', window.location.hash ? decodeURIComponent(window.location.hash.slice(1)) : ''); | ||
}); |
{ | ||
"name": "clickgo", | ||
"version": "3.5.2", | ||
"version": "3.5.3", | ||
"description": "Background interface, software interface, mobile phone APP interface operation library.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -31,3 +31,3 @@ # ClickGo | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.0/dist/loader.min.js?path=index&npm={'clickgo':'3.5.2'}"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.0/dist/loader.min.js?path=index&npm={'clickgo':'3.5.3'}"></script> | ||
``` | ||
@@ -34,0 +34,0 @@ |
@@ -83,6 +83,8 @@ export * as control from '../dist/lib/control'; | ||
'height': number; | ||
'owidth': number; | ||
'oheight': number; | ||
} | ||
/** --- 全局事件类型 --- */ | ||
export type TGlobalEvent = 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'taskStarted' | 'taskEnded' | 'launcherFolderNameChanged' | 'hashChanged'; | ||
export type TGlobalEvent = 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'formShowInSystemTaskChange' | 'taskStarted' | 'taskEnded' | 'launcherFolderNameChanged' | 'hashChanged'; | ||
@@ -315,2 +317,3 @@ /** --- 现场下载 app 的参数 --- */ | ||
'focus': boolean; | ||
'showInSystemTask': boolean; | ||
} | ||
@@ -317,0 +320,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1374682
0.63%28383
1.18%203
-1.93%