1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
root 2024-10-13 18:25:41 +08:00
parent 4f80806c45
commit a158908876
3 changed files with 11 additions and 13 deletions

View File

@ -129,11 +129,8 @@ Volcanos("misc", {
_caller: function(skip) { msg.Option("log.caller") || msg.Option("log.caller", can.misc.fileLine((skip||2)+3).link); return msg }, _caller: function(skip) { msg.Option("log.caller") || msg.Option("log.caller", can.misc.fileLine((skip||2)+3).link); return msg },
isDebug: function() { return msg.Option(log.DEBUG) == ice.TRUE }, isDebug: function() { return msg.Option(log.DEBUG) == ice.TRUE },
}); return msg }, }); return msg },
Inputs: function(can, msg, cmds, cb, meta) { Inputs: function(can, msg, cmds, cb, meta) { var event = msg._event
var event = msg._event if (msg.Option(ice.MSG_HANDLE) != ice.TRUE && cmds && cmds[0] == ctx.ACTION && meta.feature[cmds[1]]) { msg.Option(ctx.ACTION, cmds[1])
if (msg.Option(ice.MSG_HANDLE) != ice.TRUE && cmds && cmds[0] == ctx.ACTION && meta.feature[cmds[1]]) {
// var msg = can.request(event, {action: cmds[1]})
msg.Option(ctx.ACTION, cmds[1])
var action = meta.feature[cmds[1]]; if (can.base.isFunc(action)) { cb = cb||function() { can.Update() } var action = meta.feature[cmds[1]]; if (can.base.isFunc(action)) { cb = cb||function() { can.Update() }
return action.list && action.list.length > 0? can.user.input(event, can, action.list, function(data) { return action.list && action.list.length > 0? can.user.input(event, can, action.list, function(data) {
can.core.CallFunc(action, {can: can, msg: can.request(event, data), arg: cmds.slice(2), cb: cb}) can.core.CallFunc(action, {can: can, msg: can.request(event, data), arg: cmds.slice(2), cb: cb})
@ -143,11 +140,9 @@ Volcanos("misc", {
can.onmotion.delay(can, function() { can.page.ClassList.add(can, input._target, html.PROCESS) }) can.onmotion.delay(can, function() { can.page.ClassList.add(can, input._target, html.PROCESS) })
can.Update(can.request(event, can.Option(), {_handle: ice.TRUE, _cancel: function(event) { can.Update(can.request(event, can.Option(), {_handle: ice.TRUE, _cancel: function(event) {
can.page.ClassList.del(can, input._target, html.PROCESS) can.page.ClassList.del(can, input._target, html.PROCESS)
}}, msg), cmds.slice(0, 2).concat(args), function(msg) { }}, msg), cmds.slice(0, 2).concat(args), function(msg) { can.page.ClassList.del(can, input._target, html.PROCESS)
can.page.ClassList.del(can, input._target, html.PROCESS) if (msg.IsErr()) { input.focus()
if (msg.IsErr()) {
can.onappend.style(can, "warn", can.user.toastFailure(can, msg.Result())._target) can.onappend.style(can, "warn", can.user.toastFailure(can, msg.Result())._target)
input.focus()
} else { } else {
if (cb && cb(msg)) { return } if (cb && cb(msg)) { return }
input.cancel({}, can) input.cancel({}, can)

View File

@ -5,7 +5,7 @@ const CURRENT_FILE = "web.code.inner:currentFile", SELECT_LINE = "selectLine"
const VIEW_CREATE = "tabview.view.create", VIEW_REMOVE = "tabview.view.remove", LINE_SELECT = "tabview.line.select" const VIEW_CREATE = "tabview.view.create", VIEW_REMOVE = "tabview.view.remove", LINE_SELECT = "tabview.line.select"
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg, cb) { can.onappend.style(can, code.INNER), can.Mode(msg.Option("mode")||can.Mode()) _init: function(can, msg, cb) { can.onappend.style(can, code.INNER), can.Mode(msg.Option("mode")||can.Mode())
if (can.Mode() == ice.MSG_RESULT) { can.Conf("_width", can.ConfWidth()) if (can.Mode() == ice.MSG_RESULT) { can.Conf("_width", can.base.Max(can.ConfWidth(), window.innerWidth-12))
msg.result = msg.result||[can._output.innerHTML], can.Mode(chat.SIMPLE), can.sup.Mode(chat.SIMPLE) msg.result = msg.result||[can._output.innerHTML], can.Mode(chat.SIMPLE), can.sup.Mode(chat.SIMPLE)
} }
can.onmotion.clear(can, can._output), msg.result = msg.result||[""] can.onmotion.clear(can, can._output), msg.result = msg.result||[""]

View File

@ -12,17 +12,20 @@ Volcanos(chat.ONIMPORT, {
}, },
card: function(can, msg, target, filter) { target = target||can.ui.content||can._output card: function(can, msg, target, filter) { target = target||can.ui.content||can._output
can.page.Append(can, target, msg.Table(function(value) { if (filter && filter(value)) { return } can.page.Append(can, target, msg.Table(function(value) { if (filter && filter(value)) { return }
var img = can.misc.Resource(can, value.icon = value.icons||value.icon||value.image) var img = can.misc.ResourceIcons(can, value.icon = value.icons||value.icon||value.image)
return {view: [[html.ITEM, value.type, value.status, "s-"+value.name]], list: [ return {view: [[html.ITEM, value.type, value.status, "s-"+value.name]], list: [
{view: [wiki.TITLE, html.DIV], list: [ {view: [wiki.TITLE, html.DIV], list: [
value.icon && {className: can.base.contains(img, ".jpg")? "jpg": "", img: img}, img && {className: can.base.contains(img, ".jpg")? "jpg": "", img: img},
{view: wiki.TITLE, list: [{text: value.name}, value.exists == "true" && {text: ["●", "", "exists"]}, can.onappend.label(can, value)]}, {view: wiki.TITLE, list: [{text: value.name}, value.exists == "true" && {text: ["●", "", "exists"]}, can.onappend.label(can, value)]},
]}, {view: [wiki.CONTENT, html.DIV, value.text]}, ]}, {view: [wiki.CONTENT, html.DIV, value.text]},
{view: html.ACTION, inner: value.action, _init: function(target) { can.onappend.mores(can, target, value, html.CARD_BUTTON) {view: html.ACTION, inner: value.action, _init: function(target) { can.onappend.mores(can, target, value, html.CARD_BUTTON)
can.page.Select(can, target, html.INPUT, function(target) { can.onappend.style(can, target.name, target) }) can.page.Select(can, target, html.INPUT, function(target) { can.onappend.style(can, target.name, target) })
}}, }},
]} ]}
})), can.onimport.layout = can.onimport.layout||function() { var height = can.onlayout.expand(can, target); can.sup.onexport.outputMargin = function() { return height } } })), can.onimport.layout = can.onimport.layout||function() {
var height = can.onlayout.expand(can, target); can.sup.onexport.outputMargin = function() { return height }
can.onmotion.delay(can, function() { can.onlayout.expand(can, target) })
}
}, },
icon: function(can, msg, target, cb) { msg.Table(function(value) { icon: function(can, msg, target, cb) { msg.Table(function(value) {
var icon = can.misc.Resource(can, value.icons||value.icon||can.page.drawText(can, value.name, 80), value.space||msg.Option(ice.MSG_USERPOD), msg.Option(ice.MSG_USERWEB)) var icon = can.misc.Resource(can, value.icons||value.icon||can.page.drawText(can, value.name, 80), value.space||msg.Option(ice.MSG_USERPOD), msg.Option(ice.MSG_USERWEB))