1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00

opt trans

This commit is contained in:
shylinux 2021-11-20 14:13:57 +08:00
parent 6445947433
commit ffdb215c47
4 changed files with 42 additions and 3 deletions

View File

@ -332,10 +332,12 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
})
},
plugin: function(can, meta, cb, target) { meta = meta||{}, meta.index = meta.index||can.core.Keys(meta.ctx, meta.cmd)
meta.inputs && meta.inputs.length > 0? can.onappend._plugin(can, {meta: meta.meta, list: meta.list}, meta, cb, target):
var res = {}; function cbs(sub, meta, skip) { res.__proto__ = sub, cb(sub, meta, skip) }
meta.inputs && meta.inputs.length > 0? can.onappend._plugin(can, {meta: meta.meta, list: meta.list}, meta, cbs, target):
can.run({}, [ctx.ACTION, ctx.COMMAND, meta.index], function(msg) { msg.Table(function(value) {
can.onappend._plugin(can, value, meta, cb, target)
can.onappend._plugin(can, value, meta, cbs, target)
}) }, true)
return res
},
_plugin: function(can, value, meta, cb, target) {
meta.feature = meta.feature||can.base.Obj(value.meta, {})

View File

@ -32,9 +32,10 @@ div.story {
}
div.story[data-type=spark] {
background-color:#2169a9a6; color:white;
box-shadow: 4px 4px 10px 1px #626bd0;
box-shadow:4px 4px 10px 1px #626bd0;
padding:4px 10px; margin:10px 0px;
border-left:solid 4px blue;
font-family:monospace;
white-space:pre;
cursor:copy;
}

View File

@ -0,0 +1,34 @@
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) {
can.onmotion.clear(can)
can.from = can.onimport._plugin(can, nfs.DIR, html.LEFT, "from", "to")
can.to = can.onimport._plugin(can, nfs.DIR, html.RIGHT, "to", "from")
can.onimport._plugin(can, nfs.TRASH, html.LEFT, "from")
can.onimport._plugin(can, nfs.TRASH, html.RIGHT, "to")
},
_plugin: function(can, index, pos, from, to) {
return can.onappend.plugin(can, {type: chat.STORY, index: index}, function(sub) {
can.page.Modify(can, sub._target, {style: {float: pos, clear: pos}})
sub.Conf(html.WIDTH, can.Conf(html.WIDTH)/2)
sub._legend.innerHTML = can.Option(from)+ice.SP+index
can.page.Modify(can, sub._output, {style: {"max-width": can.Conf(html.WIDTH)/2}})
sub.run = function(event, cmds, cb) {
if (can.onaction[cmds[1]]) { return can.onaction[cmds[1]](can, from, to, event, cmds, cb) }
var msg = sub.request(event, {_pod: can.Option(from)})
can.run(event, can.misc.Concat([ctx.ACTION, ice.RUN, index], cmds), cb, true)
}
})
},
})
Volcanos("onaction", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) {
},
send: function(can, from, to, event, cmds, cb) { var _from = can[from], _to = can[to]
var path = can.request(event).Option(nfs.PATH)
var msg = can.request(event, {_handle: ice.TRUE,
from: can.Option(from), from_path: path,
to: can.Option(to), to_path: _to.Option(nfs.PATH)+path.split(ice.PS).pop(),
})
can.run(event, cmds, function() { _to.Update() }, true)
},
})

View File

@ -84,6 +84,7 @@ var ssh = {
}
var nfs = {
PATH: "path", FILE: "file", LINE: "line",
TRASH: "trash",
DIR: "dir", CAT: "cat",
DIR_ROOT: "dir_root",
}
@ -134,6 +135,7 @@ var html = {
INPUT: "input", INPUT_ARGS: ".args", TEXT: "text", TEXTAREA: "textarea", SELECT: "select", BUTTON: "button",
FORM: "form", FILE: "file", SPACE: "space", CLICK: "click",
SCROLL: "scroll", HEIGHT: "height", WIDTH: "width", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
TABLE: "table", TR: "tr", TH: "th", TD: "td", BR: "br",
DIV: "div", IMG: "img", CODE: "code", SPAN: "span", VIDEO: "video",