1
0
forked from x/volcanos
This commit is contained in:
shaoying 2021-07-28 01:21:48 +08:00
parent c788c1aadf
commit 6b9e8d3c0f
4 changed files with 31 additions and 21 deletions

View File

@ -343,15 +343,13 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
var table = can.page.AppendTable(can, msg, target||can._output, msg.append, cb||function(value, key, index, line, array) {
if (key == "value") { key = line.key||line.name, line = {}
can.core.List(array, function(item, index) { line[item.key||line.name] = item.value })
if (key == "extra.cmd") {
can.onappend.plugin(can, {ctx: line["extra.ctx"], cmd: line["extra.cmd"], arg: line["extra.arg"]}, function(sub) {
sub.run = function(event, cmds, cb) { var msg = can.request(event, can.Option(), line)
can.run(event, (cmds[0] == "_search"? []: [ctx.ACTION, cli.RUN]).concat(cmds), function(msg) {
cb(msg)
}, true)
}
}, target)
}
key == "extra.cmd" && can.onappend.plugin(can, {ctx: line["extra.ctx"], cmd: line["extra.cmd"], arg: line["extra.arg"]}, function(sub) {
sub.run = function(event, cmds, cb) { var msg = can.request(event, can.Option(), line)
can.run(event, (cmds[0] == "_search"? []: [ctx.ACTION, cli.RUN]).concat(cmds), function(msg) {
can.base.isFunc(cb) && cb(msg)
}, true)
}
}, target)
}
return {text: [value, "td"], onclick: function(event) { var target = event.target
@ -364,10 +362,16 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
can.onimport._init(can, msg, [], cb, can._output)
})
}, ondblclick: function(event) { var target = event.target
var item = can.core.List(can.Conf("feature.insert"), function(item) {
var list = can.core.Split(item.value, "@=", "@=")
var pkey = list[0], pval = list[1]||""
if (item.name == key) { return {name: key, value: "@"+pkey+"="+value} }
})[0]||{name: key, value: "@key="+value}
can.onmotion.modify(can, target, function(event, value, old) { var msg = can.sup.request(event, can.Option())
key == "value"? can.core.List(array, function(item, index) { msg.Option(item.key, item.value) }): msg.Option(line)
can.run(event, [ctx.ACTION, mdb.MODIFY, key == "value"? line.key||line.name: key, value], function(msg) { can.run() }, true)
})
}, item)
}}
}); table && can.page.Modify(can, table, {className: "content"})
@ -644,7 +648,7 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
}
})
},
modify: function(can, target, cb) { var back = target.innerHTML
modify: function(can, target, cb, item) { var back = target.innerHTML
if (back.length > 120 || back.indexOf("\n") > -1) {
return can.onmotion.modifys(can, target, cb)
}
@ -662,6 +666,9 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
default:
can.onkeypop.input(event, can)
}
}, _init: function(target) {
item && can.onappend.figure(can, item, item.value, function() {
}, target)
}}]); ui.first.focus(), ui.first.setSelectionRange(0, -1)
},
modifys: function(can, target, cb) { var back = target.innerHTML

View File

@ -178,7 +178,7 @@ Volcanos("user", {help: "用户操作", agent: {
var msg = can.request(event, can.Option())
var ui = can.page.Append(can, document.body, [{view: ["input"], style: {left: 0, top: 0}, list: [
{view: ["option", "table"], list: can.core.List(form, function(item) {
(item._input == "textarea") && (item = {type: "textarea", data: item, name: item.name, _trans: item._trans});
(item._input == "textarea") && (item = {type: "textarea", data: item, name: item.name, _trans: item._trans, value: item.value});
(item._input == "select"||item.values) && (item = {select: [[item.name].concat(item.values)], data: item, name: item.name, _trans: item._trans});
item = typeof item == "string"? {input: item, name: item}: item.length > 0? {select: [item], name: item[0]}: item
item.type = item.type||"input", item.type == "input" && (item.data=item.data||{}, item.data.type = item.data.type||"text")

View File

@ -301,10 +301,12 @@ div.input {
z-index:50;
}
div.input textarea {
border-radius:6px;
border:2px solid #14a58e;
width:144px; height:60px;
box-shadow: 4px 4px 10px 1px #626bd0;
border:2px inset #14a58e;
width:145px; height:60px;
background-color: cyan;
padding:4px;
}
div.input div.item {
float:left;
@ -553,6 +555,10 @@ body.white input[type=text] {
body.white input[type=text]:hover {
background-color:cyan;
}
body.white div.input textarea {
border-radius:6px;
border:2px solid #14a58e;
}
body.white select {
background-color:#99CC66; color:white;
border-radius:10px 10px 10px 10px;

View File

@ -84,12 +84,9 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
} },
}]) })
task["extra.cmd"] && can.onappend.plugin(can, {
index: task["extra.ctx"]+"."+task["extra.cmd"], args: task["extra.arg"],
}, function(sub, meta) {
sub.run = function(event, cmds, cb) {
var msg = can.request(event, {"task.zone": task.zone, "task.id": task.id})
can.run(event, [ctx.ACTION, "command", "run", meta.index].concat(cmds), function(msg) {
task["extra.cmd"] && can.onappend.plugin(can, {ctx: task["extra.ctx"], cmd: task["extra.cmd"], arg: task["extra.arg"]}, function(sub, meta) {
sub.run = function(event, cmds, cb) { var msg = can.request(event, {"task.zone": task.zone, "task.id": task.id})
can.run(event, (cmds[0] == "_search"? []: [ctx.ACTION, cli.RUN]).concat(cmds), function(msg) {
can.base.isFunc(cb) && cb(msg)
}, true)
}