1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
shaoying 2020-07-12 10:32:48 +08:00
parent c76417c81a
commit d98fc1a667
4 changed files with 32 additions and 6 deletions

View File

@ -28,7 +28,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, meta,
},
active: function(can, msg, cmd, cb) { can._output.innerHTML = ""
function search(word) { cmd[1] = word
function search(word) { cmd[1] = word || ""
var ev = {}; var res = can.request(ev); res.Copy(msg)
can.run(ev, cmd, function(res) { can.ui.content.innerHTML = ""
can.onappend.table(can, can.ui.content, "table", res, function(value, key, index, line) {
@ -47,7 +47,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, meta,
if (event.key == "Enter") {
search(event.target.value)
}
}], value: cmd[1]},
}], value: cmd[1]||""},
{view: "content"},
])
can.page.Modify(can, can._target, {style: {display: "block"}})

View File

@ -13,6 +13,9 @@ fieldset.editor>div.action>div.file.select {
background-color:green;
}
fieldset.editor>div.output {
max-height:560px; overflow:auto;
}
fieldset.editor>div.output>div.project {
max-height:400px; overflow:auto;
max-width:120px;
@ -47,7 +50,7 @@ fieldset.editor>div.output div.content {
font-size:16px; font-family:monospace;
border-left:solid 2px red;
min-height:200px;
max-width:200px;
overflow:auto;
float:left;
}
fieldset.editor>div.output div.content>pre.item {
@ -56,6 +59,10 @@ fieldset.editor>div.output div.content>pre.item {
padding-left:10px;
min-width:120px;
}
fieldset.editor>div.output div.content>div.item.select {
background-color:red;
border:solid 1px yellow;
}
fieldset.editor>div.output div.content>pre.item span.comment {
color:cyan; background-color:blue;
}

View File

@ -7,7 +7,7 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
{view: "project"}, {view: "profile"},
{view: "holdon", list: [
{view: "preview"}, {view: "content", style: {"max-width": can.Conf("width")-240+"px"}},
{view: "preview"}, {view: "content", style: {"max-width": can.Conf("width")-260+"px"}},
]},
{view: ["editor", "textarea"], onkeydown: function(event) {
@ -58,7 +58,20 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
can.onkeymap._remote(event, can, "运行")
}, oncontextmenu: function(event) {
can.user.carte(can, null, ["保存", "运行"])
}}]).first.click()
}, draggable: true,
ondragstart: function(event) { var target = event.target; can.drop = function(event, tab) { td.append(target)
can.onaction.modifyTask(event, can, task, "begin_time", time, task.begin_time)
} },
ondragover: function(event) { event.preventDefault()
can.page.Select(can, can.ui.content, "td", function(item) {
can.page.ClassList.del(can, item, "over")
}), can.page.ClassList.add(can, event.target, "over")
},
ondrop: function(event) { event.preventDefault()
can.drop(event, event.target)
},
}]).first.click()
}, true)
},
project: function(can, path) { can.Option({path: path}), can.ui.project.innerHTML = ""
@ -644,7 +657,11 @@ Volcanos("onaction", {help: "控件交互", list: [
can.page.Remove(can, ls[ls.length-1]), can.max--
},
selectLine: function(can, target) { if (target !== 0 && !target) { return }
can.page.Select(can, can.ui.content, "pre.item", function(item, index) { if (item != target && index != target) { return }
can.page.Select(can, can.ui.content, "pre.item", function(item, index) {
can.page.ClassList.del(can, item, "select")
if (item != target && index != target) { return }
can.page.ClassList.add(can, item, "select")
target = item, can.Status("当前行", can.onexport.position(can, index))
can.page.Select(can, can.ui.preview, "div.item", function(item, i) {
can.page.ClassList[index==i? "add": "del"](can, item, "select")

View File

@ -8,6 +8,8 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
return typeof cb == "function" && cb(msg)
},
field: function(can, item, target) { var meta = can.base.Obj(item.meta)
meta.width = can.Conf("width")
meta.height = can.Conf("height")
can.onappend._init(can, meta, Volcanos.meta.libs.concat(["/plugin/state.js"]), function(sub) {
sub.run = function(event, cmds, cb, silent) {
can.run(event, (cmds[0] == "search"? []: ["action", "story", item.type, item.name, item.text]).concat(cmds), cb, true)