1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-26 01:04:06 +08:00
This commit is contained in:
shaoying 2021-07-27 22:52:50 +08:00
parent d29978c582
commit 254ed07ce0
3 changed files with 18 additions and 2 deletions

View File

@ -343,12 +343,19 @@ 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) {
can.run(event, [ctx.ACTION, cli.RUN].concat(cmds), cb, true)
}
}, target)
}
}
return {text: [value, "td"], onclick: function(event) { var target = event.target
if (target.tagName == "INPUT" && target.type == "button") { 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)
return can.run(event, ["action", target.name], function(msg) { can.run() }, true)
return can.run(event, [ctx.ACTION, target.name], function(msg) { can.run() }, true)
}
can.sup.onaction.change(event, can.sup, key, value, function(msg) {
@ -357,7 +364,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
}, ondblclick: function(event) { var target = event.target
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, ["action", "modify", key == "value"? line.key||line.name: key, value], function(msg) { can.run() }, true)
can.run(event, [ctx.ACTION, mdb.MODIFY, key == "value"? line.key||line.name: key, value], function(msg) { can.run() }, true)
})
}}
}); table && can.page.Modify(can, table, {className: "content"})

View File

@ -128,6 +128,7 @@ input[type=button]:hover {
}
td>input[type=button][name=remove] {
background-color:red;
}
td>input[type=button][name=create] {
background-color:blue;
@ -357,6 +358,9 @@ fieldset>form.option {
fieldset>div.action {
float:left;
}
fieldset>div.status {
border-top:1px solid darkcyan;
}
fieldset>form.option>div.item {
float:left; margin-right:3px;
min-height:25px; vertical-align:middle;

View File

@ -113,6 +113,8 @@ var kit = {
MDB_TEXT: "text",
MDB_LINK: "link",
}
var ice = {
}
var ctx = {
CONTEXT: "context",
COMMAND: "command",
@ -122,3 +124,6 @@ var ctx = {
var cli = {
RUN: "run",
}
var mdb = {
MODIFY: "modify",
}