Comparing version 3.1.0-dev9 to 3.1.1-dev10
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.data = void 0; | ||
exports.data = { | ||
'message': 'message', | ||
'buttons': ['OK'], | ||
'btn': 'none' | ||
}; | ||
const clickgo = require("clickgo"); | ||
class default_1 extends clickgo.form.AbstractForm { | ||
constructor() { | ||
super(...arguments); | ||
this.message = 'message'; | ||
this.buttons = ['OK']; | ||
this.btn = 'none'; | ||
} | ||
} | ||
exports.default = default_1; |
@@ -14,2 +14,4 @@ "use strict"; | ||
const form_1 = require("./control/form/form"); | ||
const dialog_1 = require("./control/dialog/dialog"); | ||
const form_2 = require("./method/form/form"); | ||
class default_1 extends clickgo.form.AbstractForm { | ||
@@ -24,2 +26,6 @@ constructor() { | ||
switch (name) { | ||
case 'cblock': { | ||
frm = yield this.createForm('control/block/block'); | ||
break; | ||
} | ||
case 'cform': { | ||
@@ -29,2 +35,10 @@ frm = yield form_1.default.create(); | ||
} | ||
case 'cdialog': { | ||
frm = yield dialog_1.default.create(); | ||
break; | ||
} | ||
case 'mform': { | ||
frm = yield form_2.default.create(); | ||
break; | ||
} | ||
} | ||
@@ -31,0 +45,0 @@ if (typeof frm === 'number') { |
@@ -12,44 +12,44 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mounted = exports.receive = exports.methods = exports.data = void 0; | ||
const clickgo = require("clickgo"); | ||
exports.data = { | ||
'fid': '0', | ||
'sendValue': 'sendValue', | ||
'tid': '0', | ||
'type': 'primary', | ||
'progress': 'noraml', | ||
'dialogResult': '', | ||
'setTopMostValue': false | ||
}; | ||
exports.methods = { | ||
min: function () { | ||
clickgo.form.min(); | ||
}, | ||
max: function () { | ||
clickgo.form.max(); | ||
}, | ||
close: function () { | ||
clickgo.form.close(); | ||
}, | ||
bindResize: function (e) { | ||
class default_1 extends clickgo.form.AbstractForm { | ||
constructor() { | ||
super(...arguments); | ||
this.fid = '0'; | ||
this.sendValue = 'sendValue'; | ||
this.tid = '0'; | ||
this.type = 'primary'; | ||
this.progress = 'noraml'; | ||
this.dr = ''; | ||
this.setTopMostValue = false; | ||
} | ||
min() { | ||
clickgo.form.min(this.formId); | ||
} | ||
max() { | ||
clickgo.form.max(this.formId); | ||
} | ||
close() { | ||
clickgo.form.close(this.formId); | ||
} | ||
bindResize(e) { | ||
clickgo.form.bindResize(e, 'rb'); | ||
}, | ||
bindDrag: function (e) { | ||
} | ||
bindDrag(e) { | ||
clickgo.form.bindDrag(e); | ||
}, | ||
getTaskId: function () { | ||
} | ||
getTaskId() { | ||
clickgo.form.dialog(clickgo.form.getTaskId(parseInt(this.fid)).toString()).catch((e) => { throw e; }); | ||
}, | ||
get: function () { | ||
} | ||
get() { | ||
clickgo.form.dialog(JSON.stringify(clickgo.form.get(parseInt(this.fid)))).catch((e) => { throw e; }); | ||
}, | ||
send: function () { | ||
} | ||
send() { | ||
clickgo.form.send(parseInt(this.fid), { | ||
'key': this.sendValue | ||
}); | ||
}, | ||
changeFocus: function () { | ||
} | ||
changeFocus() { | ||
clickgo.form.changeFocus(parseInt(this.fid)); | ||
}, | ||
getList: function () { | ||
} | ||
getList() { | ||
let str = JSON.stringify(clickgo.form.getList(this.taskId)); | ||
@@ -60,15 +60,15 @@ str = str.replace(/"icon":"(.*?)"/g, function (t, t1) { | ||
clickgo.form.dialog(`<overflow direction="v" style="width: 200px; height: 80px;">${str}</overflow>`).catch((e) => { throw e; }); | ||
}, | ||
getMaxZIndexID: function () { | ||
} | ||
getMaxZIndexID() { | ||
const fid = clickgo.form.getMaxZIndexID(); | ||
clickgo.form.dialog(JSON.stringify(fid)).catch((e) => { throw e; }); | ||
}, | ||
getRectByBorder: function () { | ||
} | ||
getRectByBorder() { | ||
const size = clickgo.form.getRectByBorder('rb'); | ||
clickgo.form.dialog(JSON.stringify(size)).catch((e) => { throw e; }); | ||
}, | ||
showCircular: function (e) { | ||
} | ||
showCircular(e) { | ||
clickgo.form.showCircular(e.clientX, e.clientY); | ||
}, | ||
showRectangle: function (e) { | ||
} | ||
showRectangle(e) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -79,7 +79,7 @@ clickgo.form.showRectangle(e.clientX, e.clientY, 'rb'); | ||
}); | ||
}, | ||
showDrag: function () { | ||
} | ||
showDrag() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
clickgo.form.showDrag(); | ||
const rect = this.$refs.showDrag.$el.getBoundingClientRect(); | ||
const rect = this.refs.showDrag.$el.getBoundingClientRect(); | ||
clickgo.form.moveDrag({ | ||
@@ -94,4 +94,4 @@ 'left': rect.left, | ||
}); | ||
}, | ||
notify: function () { | ||
} | ||
notify() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -124,36 +124,39 @@ let icon = null; | ||
}); | ||
}, | ||
showPop: function (e) { | ||
} | ||
showPop(e) { | ||
if (!e.currentTarget) { | ||
return; | ||
} | ||
clickgo.form.showPop(e.currentTarget, this.$refs.pop, 'v'); | ||
}, | ||
createParam: function () { | ||
clickgo.form.showPop(e.currentTarget, this.refs.pop, 'v'); | ||
} | ||
createParam() { | ||
clickgo.form.create({ | ||
'layout': '<form width=\'300\' height=\'300\' title=\'normal\'></form>' | ||
}).catch((e) => { throw e; }); | ||
}, | ||
createPath: function () { | ||
clickgo.form.create('test').then((e) => { console.log(e); }).catch((e) => { throw e; }); | ||
}, | ||
createTop: function () { | ||
clickgo.form.create({ | ||
'layout': '<form width=\'300\' height=\'300\' title=\'normal\'></form>', | ||
'topMost': true | ||
}).catch((e) => { throw e; }); | ||
}, | ||
dialog: function () { | ||
} | ||
createPath() { | ||
this.createForm('test').then((e) => { console.log(e); }).catch((e) => { throw e; }); | ||
} | ||
createTop() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.dialogResult = yield clickgo.form.dialog('Hello world!'); | ||
const frm = yield this.createForm('test'); | ||
if (typeof frm === 'number') { | ||
return; | ||
} | ||
frm.topMost = true; | ||
}); | ||
}, | ||
dialogLong: function () { | ||
} | ||
dialog() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.dialogResult = yield clickgo.form.dialog('longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong'); | ||
this.dr = yield clickgo.form.dialog('Hello world!'); | ||
}); | ||
}, | ||
dialogTitle: function () { | ||
} | ||
dialogLong() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.dialogResult = yield clickgo.form.dialog({ | ||
this.dr = yield clickgo.form.dialog('longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong'); | ||
}); | ||
} | ||
dialogTitle() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.dr = yield clickgo.form.dialog({ | ||
'title': 'Title', | ||
@@ -163,6 +166,6 @@ 'content': 'Hello world!' | ||
}); | ||
}, | ||
dialogButtons: function () { | ||
} | ||
dialogButtons() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.dialogResult = yield clickgo.form.dialog({ | ||
this.dr = yield clickgo.form.dialog({ | ||
'content': 'Hello world!', | ||
@@ -172,6 +175,6 @@ 'buttons': ['A', 'B', 'C'] | ||
}); | ||
}, | ||
dialogCannot: function () { | ||
} | ||
dialogCannot() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.dialogResult = yield clickgo.form.dialog({ | ||
this.dr = yield clickgo.form.dialog({ | ||
'content': 'Hello world!', | ||
@@ -186,40 +189,39 @@ 'buttons': ['Do not close', 'Close'], | ||
}); | ||
}, | ||
confirm: function (cancel) { | ||
} | ||
confirm(cancel) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.dialogResult = yield clickgo.form.confirm({ | ||
this.dr = yield clickgo.form.confirm({ | ||
'content': 'Hello world?', | ||
'cancel': cancel | ||
}); | ||
if (typeof this.dialogResult === 'boolean') { | ||
this.dialogResult = this.dialogResult ? 'true (boolean)' : 'false (boolean)'; | ||
if (typeof this.dr === 'boolean') { | ||
this.dr = this.dr ? 'true (boolean)' : 'false (boolean)'; | ||
} | ||
else { | ||
this.dialogResult = this.dialogResult.toString() + ' (number)'; | ||
this.dr = this.dr.toString() + ' (number)'; | ||
} | ||
}); | ||
}, | ||
setTopMost: function () { | ||
} | ||
setTopMost() { | ||
this.setTopMostValue = !this.setTopMostValue; | ||
clickgo.form.setTopMost(this.setTopMostValue); | ||
}, | ||
flash: function () { | ||
clickgo.form.flash(); | ||
}, | ||
hide: function () { | ||
this.topMost = this.setTopMostValue; | ||
} | ||
flash() { | ||
clickgo.form.flash(this.formId); | ||
} | ||
hhide() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
clickgo.form.hide(); | ||
this.hide(); | ||
yield clickgo.tool.sleep(1000); | ||
clickgo.form.show(); | ||
this.show(); | ||
}); | ||
} | ||
}; | ||
const receive = function (obj) { | ||
clickgo.form.dialog(JSON.stringify(obj)).catch((e) => { throw e; }); | ||
}; | ||
exports.receive = receive; | ||
const mounted = function () { | ||
this.fid = this.formId; | ||
this.tid = this.taskId; | ||
}; | ||
exports.mounted = mounted; | ||
onReceive(obj) { | ||
clickgo.form.dialog(JSON.stringify(obj)).catch((e) => { throw e; }); | ||
} | ||
onMounted() { | ||
this.fid = this.formId.toString(); | ||
this.tid = this.taskId.toString(); | ||
} | ||
} | ||
exports.default = default_1; |
// npm publish --tag dev --access public | ||
import * as types from '~/types'; | ||
import * as types from '../types/index'; | ||
@@ -4,0 +4,0 @@ // --- 以下不会真正加载,最终会在底部进行赋值 --- |
@@ -61,3 +61,3 @@ "use strict"; | ||
} | ||
static create(data) { | ||
static create(data, layout) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -102,5 +102,8 @@ const frm = new this(); | ||
} | ||
const layout = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'xml']; | ||
if (typeof layout !== 'string') { | ||
return 0; | ||
if (!layout) { | ||
const l = task.list[frm.taskId].app.files[frm.filename.slice(0, -2) + 'xml']; | ||
if (typeof l !== 'string') { | ||
return 0; | ||
} | ||
layout = l; | ||
} | ||
@@ -202,2 +205,17 @@ const prot = tool.getClassPrototype(frm); | ||
} | ||
createForm(path, data) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
path = tool.urlResolve(this.filename, path); | ||
const taskId = this.taskId; | ||
const cls = class extends AbstractForm { | ||
get filename() { | ||
return path + '.js'; | ||
} | ||
get taskId() { | ||
return taskId; | ||
} | ||
}; | ||
return cls.create(data); | ||
}); | ||
} | ||
get topMost() { | ||
@@ -818,23 +836,17 @@ return false; | ||
const t = task.list[taskId]; | ||
if (t.forms[formId].vroot._topMost) { | ||
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex; | ||
} | ||
else { | ||
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex; | ||
} | ||
if (t.runtime.dialogFormIds.length) { | ||
const dialogFormId = t.runtime.dialogFormIds[t.runtime.dialogFormIds.length - 1]; | ||
if (get(dialogFormId).stateMin) { | ||
min(dialogFormId); | ||
} | ||
if (t.forms[dialogFormId].vroot._topMost) { | ||
t.forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex; | ||
} | ||
else { | ||
t.forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex; | ||
} | ||
t.forms[dialogFormId].vapp._container.dataset.formFocus = ''; | ||
t.forms[dialogFormId].vroot._formFocus = true; | ||
core.trigger('formFocused', taskId, dialogFormId); | ||
if (dialogFormId !== formId) { | ||
if (get(dialogFormId).stateMin) { | ||
min(dialogFormId); | ||
} | ||
if (task.list[taskId].forms[dialogFormId].vroot._topMost) { | ||
task.list[taskId].forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex; | ||
} | ||
else { | ||
task.list[taskId].forms[dialogFormId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex; | ||
} | ||
task.list[taskId].forms[dialogFormId].vapp._container.dataset.formFocus = ''; | ||
task.list[taskId].forms[dialogFormId].vroot._formFocus = true; | ||
core.trigger('formFocused', taskId, dialogFormId); | ||
clickgo.form.flash(dialogFormId, taskId); | ||
@@ -844,2 +856,8 @@ } | ||
else { | ||
if (t.forms[formId].vroot._topMost) { | ||
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.topLastZIndex; | ||
} | ||
else { | ||
t.forms[formId].vroot.$refs.form.$data.zIndexData = ++info.lastZIndex; | ||
} | ||
t.forms[formId].vapp._container.dataset.formFocus = ''; | ||
@@ -1656,3 +1674,4 @@ t.forms[formId].vroot._formFocus = true; | ||
} | ||
const taskId = opt.taskId; | ||
const nopt = opt; | ||
const taskId = nopt.taskId; | ||
if (!taskId) { | ||
@@ -1668,33 +1687,40 @@ resolve(''); | ||
const locale = t.locale.lang || core.config.locale; | ||
if (opt.buttons === undefined) { | ||
opt.buttons = [(_b = (_a = info.locale[locale]) === null || _a === void 0 ? void 0 : _a.ok) !== null && _b !== void 0 ? _b : info.locale['en'].ok]; | ||
if (nopt.buttons === undefined) { | ||
nopt.buttons = [(_b = (_a = info.locale[locale]) === null || _a === void 0 ? void 0 : _a.ok) !== null && _b !== void 0 ? _b : info.locale['en'].ok]; | ||
} | ||
create({ | ||
'code': { | ||
data: { | ||
'buttons': opt.buttons | ||
}, | ||
methods: { | ||
select: function (button) { | ||
var _a, _b; | ||
const event = { | ||
'go': true, | ||
preventDefault: function () { | ||
this.go = false; | ||
} | ||
}; | ||
(_b = (_a = opt).select) === null || _b === void 0 ? void 0 : _b.call(_a, event, button); | ||
if (event.go) { | ||
this.dialogResult = button; | ||
close(this.formId); | ||
} | ||
const cls = class extends AbstractForm { | ||
constructor() { | ||
super(...arguments); | ||
this.buttons = nopt.buttons; | ||
} | ||
get taskId() { | ||
return taskId; | ||
} | ||
select(button) { | ||
var _a; | ||
const event = { | ||
'go': true, | ||
preventDefault: function () { | ||
this.go = false; | ||
} | ||
}; | ||
(_a = nopt.select) === null || _a === void 0 ? void 0 : _a.call(nopt, event, button); | ||
if (event.go) { | ||
this.dialogResult = button; | ||
close(this.formId); | ||
} | ||
}, | ||
'layout': `<form title="${(_c = opt.title) !== null && _c !== void 0 ? _c : 'dialog'}" :min="false" :max="false" :resize="false" border="${opt.title ? 'normal' : 'plain'}" direction="v"><dialog :buttons="buttons" @select="select"${opt.direction ? ` direction="${opt.direction}"` : ''}>${opt.content}</dialog></form>`, | ||
'taskId': taskId | ||
}).then((fid) => __awaiter(this, void 0, void 0, function* () { | ||
resolve(yield t.forms[fid].vroot.showDialog()); | ||
})).catch((e) => { | ||
throw e; | ||
} | ||
}; | ||
cls.create(undefined, `<form title="${(_c = nopt.title) !== null && _c !== void 0 ? _c : 'dialog'}" min="false" max="false" resize="false" height="0" border="${nopt.title ? 'normal' : 'plain'}" direction="v"><dialog :buttons="buttons" @select="select"${nopt.direction ? ` direction="${nopt.direction}"` : ''}>${nopt.content}</dialog></form>`).then((frm) => { | ||
if (typeof frm === 'number') { | ||
resolve(''); | ||
return; | ||
} | ||
frm.showDialog().then((v) => { | ||
resolve(v); | ||
}).catch(() => { | ||
resolve(''); | ||
}); | ||
}).catch(() => { | ||
resolve(''); | ||
}); | ||
@@ -1701,0 +1727,0 @@ }); |
@@ -739,2 +739,5 @@ "use strict"; | ||
}, | ||
getNumber: function (param) { | ||
return clickgo.tool.getNumber(param); | ||
}, | ||
escapeHTML: function (html) { | ||
@@ -741,0 +744,0 @@ return clickgo.tool.escapeHTML(html); |
@@ -839,2 +839,5 @@ /** | ||
}, | ||
getNumber: function(param: string | number): number { | ||
return clickgo.tool.getNumber(param); | ||
}, | ||
escapeHTML: function(html: string): string { | ||
@@ -841,0 +844,0 @@ return clickgo.tool.escapeHTML(html); |
@@ -634,3 +634,4 @@ /** | ||
} | ||
// eslint-disable-next-line deprecation/deprecation | ||
document.execCommand(ac); | ||
} |
{ | ||
"name": "clickgo", | ||
"version": "3.1.0-dev9", | ||
"version": "3.1.1-dev10", | ||
"description": "Background interface, software interface, mobile phone APP interface operation library.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,11 +0,11 @@ | ||
export let control: typeof import('../dist/lib/control'); | ||
export let core: typeof import('../dist/lib/core'); | ||
export let dom: typeof import('../dist/lib/dom'); | ||
export let form: typeof import('../dist/lib/form'); | ||
export let fs: typeof import('../dist/lib/fs'); | ||
export let native: typeof import('../dist/lib/native'); | ||
export let task: typeof import('../dist/lib/task'); | ||
export let theme: typeof import('../dist/lib/theme'); | ||
export let tool: typeof import('../dist/lib/tool'); | ||
export let zip: typeof import('../dist/lib/zip'); | ||
export * as control from '../dist/lib/control'; | ||
export * as core from '../dist/lib/core'; | ||
export * as dom from '../dist/lib/dom'; | ||
export * as form from '../dist/lib/form'; | ||
export * as fs from '../dist/lib/fs'; | ||
export * as native from '../dist/lib/native'; | ||
export * as task from '../dist/lib/task'; | ||
export * as theme from '../dist/lib/theme'; | ||
export * as tool from '../dist/lib/tool'; | ||
export * as zip from '../dist/lib/zip'; | ||
@@ -12,0 +12,0 @@ export function getVersion(): string; |
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 not supported yet
978634
20508