1
0
forked from x/volcanos
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-01-25 09:33:19 +08:00
parent 8ec1f532b1
commit 9230c610a4
3 changed files with 6 additions and 2 deletions

View File

@ -327,6 +327,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
can.onmotion.modifys(can, event.target, function(event, value, old) { run(event, mdb.MODIFY, [key, value]) }, item)
}}
}); table && can.onappend.style(can, chat.CONTENT, table), msg.append && msg.append[msg.append.length-1] == ctx.ACTION && can.onappend.style(can, ctx.ACTION, table)
table.offsetWidth > can.ConfWidth() / 2 && can.onappend.style(can, "full", table)
return keys && can.page.RangeTable(can, table, can.core.List(keys, function(key) { return can.page.Select(can, table, html.TH, function(th, index) { if (th.innerHTML == key) { return index } })[0] })), table
},
board: function(can, text, target) { text && text.Result && (text = text.Result()); if (!text) { return }
@ -440,7 +441,7 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro
var rect = event.target == document.body? {left: can.page.width()/2, top: can.page.height()/2, right: can.page.width()/2, bottom: can.page.height()/2}: event.target.getBoundingClientRect()
var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom}
can.getActionSize(function(left, top, width, height) { left = left||0, top = top||0, height = can.base.Max(height, can.page.height()-top)
can.page.style(can, target, html.MAX_HEIGHT, can.base.Max(top+height-layout.top, height/2))
can.page.style(can, target, html.MAX_HEIGHT, can.base.Max(top+height-layout.top, height/4*3))
if (layout.top+target.offsetHeight > top+height) { layout.top = top+height-target.offsetHeight }
if (layout.left+target.offsetWidth > left+width) { layout.left = left+width-target.offsetWidth }
}); return can.onmotion.move(can, target, layout), layout

View File

@ -41,6 +41,7 @@ table.content th { background-color:steelblue; padding:2px 5px; }
table.content td { padding:2px 5px; }
table.content.action th:last-child { position:sticky; right:2px; }
table.content.action td:last-child { background-color:steelblue; position:sticky; right:2px; }
table.content.full { width:100%; }
div.code { background-color:#343a3445; font-size:14px; padding:10px; border:green solid 1px; }
div.story[data-type=spark] { background-color:#2169a9a6; color:white; padding:5px 10px; border-left:blue solid 5px; margin:10px; }
h1 { text-align:center; margin:20px 0; } h2 { margin:20px 0; } h3 { margin:20px 0; } ul { padding-left:40px; margin:20px 0; }

View File

@ -11,7 +11,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
}); return }
var cbs = can.onimport[can.Conf(ctx.STYLE)||msg.Option(ctx.STYLE)]; if (can.base.isFunc(cbs)) {
can.onappend.style(can, can._args[ctx.STYLE], target), can.core.CallFunc(cbs, {can: can, msg: msg, target: target})
} else { can.onappend.table(can, msg, null, target), can.onappend.board(can, msg, target) } can.onmotion.story.auto(can, target)
} else {
can.onappend.table(can, msg, null, target), can.onappend.board(can, msg, target)
} can.onmotion.story.auto(can, target)
},
_system_app: function(can, msg, target) { can.page.Appends(can, target, msg.Table(function(item) { var name = item.name||item.text
return {view: html.ITEM, style: {"text-align": "center", margin: 10, width: 100, "float": "left"}, list: [