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

opt render

This commit is contained in:
harveyshao 2022-02-24 17:30:41 +08:00
parent 95aad80057
commit 53793ec8cd
5 changed files with 38 additions and 32 deletions

View File

@ -229,7 +229,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
!silent && can.onappend._output(can, msg, msg.Option(ice.MSG_DISPLAY)||meta.display||meta.feature.display)
})
},
_output: function(can, msg, display, output) { display = display||chat.PLUGIN_TABLE_JS, output = output||can._output
_output: function(can, msg, display, output, action) { display = display||chat.PLUGIN_TABLE_JS, output = output||can._output
Volcanos(display, {_follow: can.core.Keys(can._follow, display), _display: display, _target: output, _fields: can._target,
_option: can._option, _action: can._action, _output: can._output, _status: can._status, _legend: can._legend, _inputs: {},
Update: can.Update, Option: can.Option, Action: can.Action, Status: can.Status,
@ -237,7 +237,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
table.run = function(event, cmds, cb, silent) { var msg = can.request(event)
if (msg.RunAction(event, table, cmds)) { return }
return can.Update(event, can.Input(cmds, silent), cb, silent)
}, can._outputs.push(table), table.sup = can, table._msg = msg
}, can._outputs && can._outputs.push(table), table.sup = can, table._msg = msg
if (can.Conf(ctx.INDEX) == "can.code.inner.plugin" && table.onimport && table.onimport.list.length > 0) {
can.onmotion.clear(can, can._option), can.onappend._option(can, {inputs: table.onimport.list})
@ -245,8 +245,8 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
table._trans = can.base.Copy(table._trans||{}, can.core.Value(table, "onaction._trans"))
can.core.CallFunc([table, chat.ONIMPORT, "_init"], {can: table, msg: msg, list: msg.result||msg.append||[], cb: function(msg) {
table.onappend._action(table, msg.Option(ice.MSG_ACTION)||can.Conf(ice.MSG_ACTION))
table.onappend._status(table, msg.Option(ice.MSG_STATUS))
action === false || table.onappend._action(table, msg.Option(ice.MSG_ACTION)||can.Conf(ice.MSG_ACTION), action)
action === false || table.onappend._status(table, msg.Option(ice.MSG_STATUS))
}, target: output})
})
},
@ -307,7 +307,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
node[name] || (node[name] = can.page.Append(can, node[last], [{view: [html.ITEM, html.DIV, value+(index==array.length-1?"":split)], onclick: function(event) {
index < array.length - 1? can.onmotion.toggle(can, node[name]): can.base.isFunc(cb) && cb(event, item)
}}, {view: html.LIST, style: {display: html.NONE}}]).last)
}}, {view: html.LIST, style: {display: html.NONE}, _init: function(list) { item.expand && can.page.style(can, list, html.DISPLAY, html.BLOCK) }}]).last)
})
}); return node
},

View File

@ -1,3 +1,6 @@
fieldset.inner.output.simple>legend {
display:block;
}
fieldset.inner>div.action div.tabs {
border:solid 2px red; padding:2px; font-size:1.21rem;
}

View File

@ -1,5 +1,5 @@
Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target) {
if (!can.user.isMobile) { can.page.style(can, can._action, html.HEIGHT, "31", html.DISPLAY, "block") }
// if (!can.user.isMobile) { can.page.style(can, can._action, html.HEIGHT, "31", html.DISPLAY, "block") }
can.onengine.plugin(can, "can.code.inner.plugin", shy("插件", {}, [{type: "button", name: "list", action: "auto"}, "back"], function(msg, cmds) {}))
var paths = can.core.Split(can.Option(nfs.PATH), ice.FS); can.Option(nfs.PATH, paths[0])
@ -13,13 +13,6 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target
can.onimport._display(can, can.ui.display)
can.base.isFunc(cb) && cb(msg)
if (can.page.ClassList.has(can, can._fields, chat.FLOAT) || can.page.ClassList.has(can, can._fields, chat.PLUGIN)) {
if (!can.user.mod.isCmd) {
can.page.style(can, can.ui.project, html.MIN_HEIGHT, can.ConfHeight())
can.page.style(can, can.ui.content, html.MIN_HEIGHT, can.ConfHeight())
}
}
can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.Option(nfs.LINE))
can.Conf("mode") == "simple"? can.onimport._simple(can): can.onimport.project(can, paths, function() {
can.onimport._toolkit(can, can.ui.toolkit), can.onimport._session(can, msg), can.onimport._keydown(can)
@ -33,6 +26,7 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target
_simple: function(can, target) {
can.Conf(html.HEIGHT, ""), can.ui.project._toggle()
can.page.ClassList.add(can, can._fields, chat.OUTPUT)
can.page.ClassList.add(can, can._fields, "simple")
},
_project: function(can, target) {
target._toggle = function(event) { can.onmotion.toggle(can, target), can.onimport.layout(can) }
@ -104,14 +98,13 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target
}}, {view: html.LIST}]); list = ui.list
if (index > 0) { ui.item.click() }
}
can.run(can.request({}, {dir_root: path, dir_deep: true})._event, [ice.PWD], function(msg) {
can.onappend.tree(can, can._file = msg.Table(), nfs.PATH, ice.PS, function(event, item) {
can.run(can.request({}, {dir_root: path, dir_deep: true})._event, [ice.PWD], function(msg) { can._file = msg.Table()
can.core.List(can._file, function(item) { if (can.Option(nfs.FILE).indexOf(item.path) == 0) { item.expand = true } })
can.onappend.tree(can, can._file, nfs.PATH, ice.PS, function(event, item) {
can.onimport.tabview(can, path, item.path)
}, list), can.onimport.layout(can), can.Status("文件数", msg.Length()), next()
}, true)
}, function() {
can.base.isFunc(cb) && cb()
})
}, function() { can.base.isFunc(cb) && cb() })
},
tabview: function(can, path, file, line, cb, skip, skip2) { var key = can.onexport.keys(can, file, path)
if (!skip && can.tabview[key]) { can.user.mod.isCmd && can.user.title(path+file)
@ -167,15 +160,15 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target
can.onmotion.clear(can, target)
if (msg.Option("_process") == "_field") {
msg.Table(function(meta) { meta.display = msg.Option("_display")
// delete(Volcanos.meta.cache[meta.display])
can.onimport.plugin(can, meta, target, function(sub) {
can.onimport.plugin(can, meta, target, function(sub) { width && sub.ConfWidth(width)
can.onmotion.focus(can, can.page.Select(can, sub._option, html.OPTION_ARGS)[0])
width && sub.ConfWidth(width)
})
})
} else if (msg.Option("_display") != "") {
can.onappend._output(can, msg, msg.Option("_display"), target, false)
} else {
can.onappend.table(can, msg, null, target)
can.onappend.board(can, msg.Result(), target)
can.onappend.board(can, msg, target)
}
},
plugin: function(can, meta, target, cb) {
@ -264,8 +257,14 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
p && p.render && can.onaction["展示"]({}, can)
p && p.engine && can.onaction["执行"]({}, can)
}
if (can.page.ClassList.has(can, can._fields, chat.FLOAT) || can.page.ClassList.has(can, can._fields, chat.PLUGIN)) {
if (!can.user.mod.isCmd) {
can.page.style(can, can.ui.project, html.MIN_HEIGHT, can.ConfHeight()-200)
can.page.style(can, can.ui.content, html.MIN_HEIGHT, can.ConfHeight()-200)
}
}
}
can.Conf("plug") && (can.onsyntax[can.parse] = can.Conf("plug"))
var p = can.onsyntax[can.parse]; !p? can.run({}, [ctx.ACTION, mdb.PLUGIN, can.parse, msg.Option(nfs.FILE), msg.Option(nfs.PATH)], function(msg) {
init(p = can.onsyntax[can.parse] = can.base.Obj(msg.Result()))
}, true): init(p)

View File

@ -1,23 +1,26 @@
fieldset.plugin div.output div.item div.item {
fieldset.plugin div.output.json div.item:hover {
background-color:#0000;
}
fieldset.plugin div.output.json div.item div.item {
border:solid 1px #0000000d;
border-left:dashed 1px lightblue;
margin-left:5px; padding-left:15px;
cursor:pointer;
}
fieldset.plugin div.output div.item div.item:hover {
fieldset.plugin div.output.json div.item div.item:hover {
border:solid 1px red;
}
fieldset.plugin div.output div.item span.nonce {
color:lightblue;
fieldset.plugin div.output.json div.item span.nonce {
color:#9cbeca4f;
cursor:pointer;
}
fieldset.plugin div.output div.item span.key {
fieldset.plugin div.output.json div.item span.key {
color:yellow;
}
fieldset.plugin div.output div.item span.string {
fieldset.plugin div.output.json div.item span.string {
color:magenta;
}
fieldset.plugin div.output div.item span.const {
fieldset.plugin div.output.json div.item span.const {
color:cyan;
}

View File

@ -1,6 +1,7 @@
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) {
can.onmotion.clear(can), can.base.isFunc(cb) && cb(msg)
can.onimport.show(can, can.base.Obj(msg.Result(), {}), target)
can.page.ClassList.add(can, target, "json")
can.onmotion.clear(can, target), can.base.isFunc(cb) && cb(msg)
can.onappend.table(can, msg), can.onimport.show(can, can.base.Obj(msg.Result(), {}), target)
},
show: function(can, data, target) {
function show(data, target, index, total) { var list