mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt panel
This commit is contained in:
parent
f3ad99fafa
commit
cfe7327bfe
34
frame.js
34
frame.js
@ -1,21 +1,21 @@
|
|||||||
var _can_name = "/frame.js"
|
var _can_name = "/frame.js"
|
||||||
Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta, list, cb, target) {
|
Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta, list, cb, target) {
|
||||||
can.core.Next(list, function(item, next) { item.type = "pane"
|
can.core.Next(list, function(item, next) { item.type = "panel"
|
||||||
can.onappend._init(can, item, item.list, function(pane) {
|
can.onappend._init(can, item, item.list, function(panel) {
|
||||||
pane.onaction && pane.onappend._action(pane, item.action||pane.onaction.list)
|
panel.onaction && panel.onappend._action(panel, item.action||panel.onaction.list)
|
||||||
pane.Status = pane.Status || function(key, value) { pane.run({}, ["search", "Footer.onimport."+key, value]) }
|
panel.Status = panel.Status || function(key, value) { panel.run({}, ["search", "Footer.onimport."+key, value]) }
|
||||||
|
|
||||||
pane.run = function(event, cmds, cb) { var msg = pane.request(event); cmds = cmds || []
|
panel.run = function(event, cmds, cb) { var msg = panel.request(event); cmds = cmds || []
|
||||||
return (can.onengine[cmds[0]]||can.onengine[meta.main.engine]||can.onengine.remote)(event, can, msg, pane, cmds, cb)
|
return (can.onengine[cmds[0]]||can.onengine[meta.main.engine]||can.onengine.remote)(event, can, msg, panel, cmds, cb)
|
||||||
}, can[item.name] = pane, next()
|
}, can[item.name] = panel, next()
|
||||||
}, target)
|
}, target)
|
||||||
}, function() {
|
}, function() {
|
||||||
var pane = can[meta.main.name], msg = can.request()
|
var panel = can[meta.main.name], msg = can.request()
|
||||||
pane.onmotion._init(pane, target), pane.onkeypop._init(pane, target)
|
panel.onmotion._init(panel, target), panel.onkeypop._init(panel, target)
|
||||||
pane.onaction._init(pane, msg, [], cb, pane._target)
|
panel.onaction._init(panel, msg, [], cb, panel._target)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
search: function(event, can, msg, pane, cmds, cb) {
|
search: function(event, can, msg, panel, cmds, cb) {
|
||||||
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split("."), function(value) {
|
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split("."), function(value) {
|
||||||
fun && (sub = mod, mod = fun, fun = mod[value], key = value)
|
fun && (sub = mod, mod = fun, fun = mod[value], key = value)
|
||||||
}); if (!sub || !mod || !fun) { can.base.Warn("not found", cmds[1]); return }
|
}); if (!sub || !mod || !fun) { can.base.Warn("not found", cmds[1]); return }
|
||||||
@ -26,12 +26,12 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
|
|||||||
"list": cmds.slice(2), "cb": cb, "target": sub._target,
|
"list": cmds.slice(2), "cb": cb, "target": sub._target,
|
||||||
}, mod)
|
}, mod)
|
||||||
},
|
},
|
||||||
remote: function(event, can, msg, pane, cmds, cb) {
|
remote: function(event, can, msg, panel, cmds, cb) {
|
||||||
delete(msg._handle), delete(msg._toast)
|
delete(msg._handle), delete(msg._toast)
|
||||||
if (pane.onengine.engine(event, can, msg, pane, cmds, cb)) { return }
|
if (panel.onengine.engine(event, can, msg, panel, cmds, cb)) { return }
|
||||||
can.misc.Runs(event, can, {names: pane._name}, cmds, cb)
|
can.misc.Runs(event, can, {names: panel._name}, cmds, cb)
|
||||||
pane.run(event, ["search", "Footer.onimport.ncmd"])
|
panel.run(event, ["search", "Footer.onimport.ncmd"])
|
||||||
}, engine: function(event, can, msg, pane, cmds, cb) { return false },
|
}, engine: function(event, can, msg, panel, cmds, cb) { return false },
|
||||||
listen: shy("事件回调", {}, [], function(can, name, cb) {
|
listen: shy("事件回调", {}, [], function(can, name, cb) {
|
||||||
arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb)
|
arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb)
|
||||||
}),
|
}),
|
||||||
@ -664,7 +664,7 @@ Volcanos("onkeypop", {help: "键盘交互", list: [], _init: function(can, targe
|
|||||||
t: function(event, can, target) { can.run(event, ["search", "River.ondetail.添加工具"]) },
|
t: function(event, can, target) { can.run(event, ["search", "River.ondetail.添加工具"]) },
|
||||||
|
|
||||||
" ": function(event, can, target) {
|
" ": function(event, can, target) {
|
||||||
can.page.Select(can, document.body, "fieldset.pane.Header div.search input", function(target) {
|
can.page.Select(can, document.body, "fieldset.panel.Header div.search input", function(target) {
|
||||||
target.focus()
|
target.focus()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
17
index.html
17
index.html
@ -1,17 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<head>
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=0.8,user-scalable=no">
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>volcanos</title>
|
|
||||||
|
|
||||||
<link rel="shortcut icon" type="image/ico" href="favicon.ico">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/page/cache.css">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/page/index.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script src="/proto.js"></script>
|
|
||||||
<script src="/frame.js"></script>
|
|
||||||
<script src="/page/cache.js"></script>
|
|
||||||
<script src="/page/index.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
@ -63,7 +63,7 @@ legend {
|
|||||||
fieldset {
|
fieldset {
|
||||||
margin:0; border:0; padding:0;
|
margin:0; border:0; padding:0;
|
||||||
}
|
}
|
||||||
fieldset.pane>legend {
|
fieldset.panel>legend {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
fieldset.plugin {
|
fieldset.plugin {
|
||||||
|
@ -1 +0,0 @@
|
|||||||
../index.html
|
|
17
page/index.html
Normal file
17
page/index.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=0.8,user-scalable=no">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>volcanos</title>
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/ico" href="favicon.ico">
|
||||||
|
<link rel="stylesheet" type="text/css" href="/page/cache.css">
|
||||||
|
<link rel="stylesheet" type="text/css" href="/page/index.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script src="/proto.js"></script>
|
||||||
|
<script src="/frame.js"></script>
|
||||||
|
<script src="/page/cache.js"></script>
|
||||||
|
<script src="/page/index.js"></script>
|
||||||
|
</body>
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
Volcanos({name: "chat", iceberg: "/chat/", volcano: "/frame.js",
|
Volcanos({name: "chat", iceberg: "/chat/", volcano: "/frame.js",
|
||||||
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"], panes: [
|
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"], panels: [
|
||||||
{name: "Header", help: "标题栏", pos: "head", state: ["time", "username"]},
|
{name: "Header", help: "标题栏", pos: "head", state: ["time", "username"]},
|
||||||
{name: "Search", help: "搜索框", pos: "auto"},
|
{name: "Search", help: "搜索框", pos: "auto"},
|
||||||
{name: "River", help: "群聊组", pos: "left", action: ["创建", "刷新"]},
|
{name: "River", help: "群聊组", pos: "left", action: ["创建", "刷新"]},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Volcanos({name: "chat", iceberg: "/chat/", volcano: "/frame.js",
|
Volcanos({name: "chat", iceberg: "/chat/", volcano: "/frame.js",
|
||||||
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"], panes: [
|
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"], panels: [
|
||||||
{name: "Action", help: "工作台", pos: "main"},
|
{name: "Action", help: "工作台", pos: "main"},
|
||||||
], main: {name: "Action", engine: "remote", list: ["/publish/order.js"]}, plugin: [
|
], main: {name: "Action", engine: "remote", list: ["/publish/order.js"]}, plugin: [
|
||||||
"/plugin/state.js",
|
"/plugin/state.js",
|
||||||
|
@ -40,13 +40,13 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg)
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onengine", {help: "解析引擎", list: [],
|
Volcanos("onengine", {help: "解析引擎", list: [],
|
||||||
engine: function(event, can, msg, pane, cmds, cb) {
|
engine: function(event, can, msg, panel, cmds, cb) {
|
||||||
var river = can.onengine.river[cmds[0]]
|
var river = can.onengine.river[cmds[0]]
|
||||||
var storm = river && river.storm[cmds[1]]
|
var storm = river && river.storm[cmds[1]]
|
||||||
if (!storm || cmds.length != 2) { return false }
|
if (!storm || cmds.length != 2) { return false }
|
||||||
|
|
||||||
if (storm.index) { cmds = ["action", "command"].concat(storm.index)
|
if (storm.index) { cmds = ["action", "command"].concat(storm.index)
|
||||||
can.misc.Runs(event, can, {names: pane._name}, cmds, cb)
|
can.misc.Runs(event, can, {names: panel._name}, cmds, cb)
|
||||||
} else {
|
} else {
|
||||||
can.core.List(storm.action, function(value) {
|
can.core.List(storm.action, function(value) {
|
||||||
msg.Push("name", value.name||"")
|
msg.Push("name", value.name||"")
|
@ -18,7 +18,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
}), select && select.click(), typeof cb == "function" && cb(msg)
|
}), select && select.click(), typeof cb == "function" && cb(msg)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onengine", {help: "解析引擎", list: [], engine: function(event, can, msg, pane, cmds, cb) {
|
Volcanos("onengine", {help: "解析引擎", list: [], engine: function(event, can, msg, panel, cmds, cb) {
|
||||||
cmds.length == 0 && can.core.Item(can.onengine.river, function(key, value) {
|
cmds.length == 0 && can.core.Item(can.onengine.river, function(key, value) {
|
||||||
msg.Push({hash: key, name: value.name})
|
msg.Push({hash: key, name: value.name})
|
||||||
}); if (cmds.length != 1 && cmds[1] != "tool") { return false }
|
}); if (cmds.length != 1 && cmds[1] != "tool") { return false }
|
6
proto.js
6
proto.js
@ -17,14 +17,14 @@ var Volcanos = shy("火山架", {args: {}, pack: {}, libs: [], cache: {}}, [], f
|
|||||||
meta.libs = Config.libs, meta.volcano = Config.volcano
|
meta.libs = Config.libs, meta.volcano = Config.volcano
|
||||||
|
|
||||||
// 预加载
|
// 预加载
|
||||||
var Preload = [Config.volcano]; for (var i = 0; i < Config.panes.length; i++) { var pane = Config.panes[i]
|
var Preload = [Config.volcano]; for (var i = 0; i < Config.panels.length; i++) { var panel = Config.panels[i]
|
||||||
pane && (Preload = Preload.concat(pane.list = pane.list || ["/pane/"+pane.name+".css", "/pane/"+pane.name+".js"]))
|
panel && (Preload = Preload.concat(panel.list = panel.list || ["/panel/"+panel.name+".css", "/panel/"+panel.name+".js"]))
|
||||||
}; Preload = Preload.concat(Config.plugin)
|
}; Preload = Preload.concat(Config.plugin)
|
||||||
|
|
||||||
// 根模块
|
// 根模块
|
||||||
name = Config.name, can = {_follow: Config.name, _target: document.body}
|
name = Config.name, can = {_follow: Config.name, _target: document.body}
|
||||||
libs = Preload.concat(Config.libs, Config.main.list), cb = function(can) {
|
libs = Preload.concat(Config.libs, Config.main.list), cb = function(can) {
|
||||||
can.onengine._init(can, can.Conf(Config), Config.panes, function(msg) { can.base.Log(can.user.title(), "run", can)
|
can.onengine._init(can, can.Conf(Config), Config.panels, function(msg) { can.base.Log(can.user.title(), "run", can)
|
||||||
document.body.onresize = function() { can.onlayout._init(can, can._target) }
|
document.body.onresize = function() { can.onlayout._init(can, can._target) }
|
||||||
}, can._target)
|
}, can._target)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Volcanos({name: "demo", iceberg: "http://localhost:9020/chat/", volcano: "/frame.js",
|
Volcanos({name: "demo", iceberg: "http://localhost:9020/chat/", volcano: "/frame.js",
|
||||||
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"], panes: [
|
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"], panels: [
|
||||||
{name: "Header", help: "标题栏", pos: "head", state: ["time", "username"]},
|
{name: "Header", help: "标题栏", pos: "head", state: ["time", "username"]},
|
||||||
{name: "Search", help: "搜索框", pos: "auto"},
|
{name: "Search", help: "搜索框", pos: "auto"},
|
||||||
{name: "River", help: "群聊组", pos: "left", action: ["创建", "刷新"]},
|
{name: "River", help: "群聊组", pos: "left", action: ["创建", "刷新"]},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user