1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
shaoying 2020-07-15 10:45:36 +08:00
parent 31772af647
commit 05bf9ad7e3
7 changed files with 121 additions and 63 deletions

View File

@ -95,7 +95,6 @@ Volcanos("onengine", { _init: function(can, meta, list, cb, target) {
]}, ]},
}}, }},
}, },
search: function(event, can, msg, pane, cmds, cb) { var chain = cmds[1] search: function(event, can, msg, pane, cmds, cb) { var chain = cmds[1]
var sub, mod = can, key, fun = can; can.core.List(chain.split("."), function(value, index, array) { var sub, mod = can, key, fun = can; can.core.List(chain.split("."), function(value, index, array) {
fun && (sub = mod, mod = fun, key = value, fun = mod[value]) fun && (sub = mod, mod = fun, key = value, fun = mod[value])
@ -112,7 +111,7 @@ Volcanos("onengine", { _init: function(can, meta, list, cb, target) {
msg.Push("name", value.name) msg.Push("name", value.name)
}) })
} }
if (cmds.length != 1) { if (cmds.length != 1 && cmds[1] != "storm") {
break break
} }
case "Storm": case "Storm":
@ -377,6 +376,19 @@ Volcanos("onappend", { _init: function(can, meta, list, cb, target, field) { met
}]) }])
return ui.item.Meta = item, ui.item return ui.item.Meta = item, ui.item
}, },
tree: function(can, target, msg, cb) {
var list = {}; msg.Table(function(value) {
can.core.List(value.path.split("/"), function(item, index, array) {
var last = array.slice(0, index).join("/")
var name = array.slice(0, index+1).join("/")
list[name] || (list[name] = can.page.Append(can, list[last]||target, [{text: [item, "div", "item"], style: {"margin-left": "10px"}, onclick: function(event) {
var hide = list[name].style.display=="none"
can.page.Modify(can, list[name], {style: {display: hide? "": "none"}})
!hide && typeof cb == "function" && cb(event, value)
}}, {view: "list", style: {"margin-left": "10px", display: "none"}}]).last)
})
})
},
menu: function(can, msg, value) { menu: function(can, msg, value) {
can.ondetail && can.ondetail.list && can.ondetail.list.length > 0 && (can._target.oncontextmenu = function(event) { can.ondetail && can.ondetail.list && can.ondetail.list.length > 0 && (can._target.oncontextmenu = function(event) {
can.user.carte(can, can.ondetail||{}, msg["_detail"] || can.Conf("detail"), function(ev, item, meta) { can.user.carte(can, can.ondetail||{}, msg["_detail"] || can.Conf("detail"), function(ev, item, meta) {

View File

@ -254,80 +254,69 @@ fieldset.input.key {
body.white { body.white {
padding:0; margin:0; padding:0;
margin:0;
background:gray;
background-color:#0dabda; background-color:#0dabda;
} }
body.white fieldset.plugin { body.white fieldset.plugin {
margin:0; margin:0; border:0;
border:0;
border-top:solid 2px #CCCCFF; border-top:solid 2px #CCCCFF;
background-color:white; background-color:white;
color:black; color:black;
} }
body.white fieldset.plugin.Header {
body.white fieldset.Header {
border:solid 2px #1f2224;
background-color:#2f3638; background-color:#2f3638;
border:solid 2px #1f2224;
color:white; color:white;
} }
body.white fieldset.plugin.Footer { body.white fieldset.Header input {
margin:0;
border:0;
border:solid 2px #1f2224;
background-color:#1f2224;
color:white;
}
body.white fieldset.plugin.Header input {
color:white;
background:white;
border:2px solid #c4c7ce; border:2px solid #c4c7ce;
border-radius:10px 10px 10px 10px; border-radius:10px 10px 10px 10px;
background-color:white;
color:white;
} }
body.white fieldset.plugin.River { body.white fieldset.Footer {
border:solid 2px #1f2224; border:solid 2px #1f2224;
background-color:#1f2224; background-color:#1f2224;
color:white; color:white;
} }
body.white fieldset.plugin.River>div.output div.item.select { body.white fieldset.River {
background-color:black; border:solid 2px #1f2224;
border:solid 2px black; background-color:#1f2224;
color:white; color:white;
} }
body.white fieldset.plugin.River>div.output div.item:hover { body.white fieldset.River>div.output div.item:hover {
background-color:black; background-color:black;
border:solid 2px black; border:solid 2px black;
color:white;
} }
body.white fieldset.plugin.River>div.output div.subitem.select { body.white fieldset.River>div.output div.item.select {
background-color:black; background-color:black;
border:solid 2px black; border:solid 2px black;
color:white;
} }
body.white fieldset.plugin.River>div.output div.subitem:hover { body.white fieldset.River>div.output div.subitem:hover {
background-color:black; background-color:black;
border:solid 2px black; border:solid 2px black;
color:white;
} }
body.white fieldset.plugin.Storm { body.white fieldset.River>div.output div.subitem.select {
background-color:black;
border:solid 2px black;
}
body.white fieldset.Storm {
border:solid 10px #1f2224; border:solid 10px #1f2224;
background-color:#1f2224; background-color:#1f2224;
color:white; color:white;
} }
body.white fieldset.plugin.Storm>div.output>div.item.select { body.white fieldset.Storm>div.output>div.item:hover {
background-color:black; background-color:black;
border:solid 2px black; border:solid 2px black;
color:white;
} }
body.white fieldset.plugin.Storm>div.output>div.item:hover { body.white fieldset.Storm>div.output>div.item.select {
background-color:black; background-color:black;
border:solid 2px black; border:solid 2px black;
color:white;
} }
body.white fieldset.Action { body.white fieldset.Action {
/* background-color:black; */
background-color:#0dabda; background-color:#0dabda;
border-top:0;
} }
body.white fieldset.Action fieldset.plugin { body.white fieldset.Action fieldset.plugin {
border:0; border:0;
@ -339,69 +328,71 @@ body.white fieldset.Action fieldset.plugin:hover {
border-top:solid 2px #6666FF; border-top:solid 2px #6666FF;
} }
body.white fieldset.Action fieldset.plugin legend { body.white fieldset.Action fieldset.plugin legend {
border-top:solid black 2px; padding:2px 20px;
border-radius:10px 10px 10px 10px; border-radius:10px 10px 10px 10px;
border:2px solid #99CCFF; border:2px solid #99CCFF;
background-color:#99CCFF;
background-color:#339999; background-color:#339999;
padding:0 20px;
color:white; color:white;
} }
body.white fieldset.Action fieldset.plugin legend:hover { body.white fieldset.Action fieldset.plugin legend:hover {
background-color:#6ee4e4; background-color:#6ee4e4;
} }
body.white fieldset.Action fieldset.plugin div.output { body.white fieldset.Action fieldset.plugin div.output{
color:black; color:black;
} }
body.white fieldset.Action fieldset.plugin div.item input[type=button] {
letter-spacing:4px;
}
body.white fieldset.plugin div.item input[type=text] { body.white fieldset.plugin div.item input[type=text] {
color:white;
background:0;
border:2px solid #c4c7ce; border:2px solid #c4c7ce;
border-radius:8px 8px 8px 8px; border-radius:8px 8px 8px 8px;
background-color:white;
color:black; color:black;
} }
body.white fieldset.plugin div.item input[type=button] { body.white fieldset.plugin div.item input[type=text]:hover {
background-color:cyan; background-color:cyan;
color:white; }
background-color:#FF9900; body.white fieldset.plugin div.item input[type=button] {
border:2px solid #FF9900;
padding:0 20px; padding:0 20px;
border-radius:10px 10px 10px 10px; border-radius:10px 10px 10px 10px;
border:2px solid #FF9900;
background-color:#FF9900;
color:white;
} }
body.white fieldset.plugin div.item input[type=button]:hover { body.white fieldset.plugin div.item input[type=button]:hover {
background-color:#FFCC33; border-radius:10px 10px 10px 10px;
border:2px solid #FFCC33; border:2px solid #FFCC33;
background-color:#FFCC33;
} }
body.white fieldset.plugin div.item select { body.white fieldset.plugin div.item select {
margin-top:2px;
background-color:cyan;
color:white;
background-color:#99CC66;
border:2px solid #99CC66;
padding:0 20px; padding:0 20px;
margin-top:2px;
border-radius:10px 10px 10px 10px; border-radius:10px 10px 10px 10px;
border:2px solid #99CC66;
background-color:#99CC66;
color:white;
} }
body.white fieldset.plugin div.item select:hover { body.white fieldset.plugin div.item select:hover {
} }
body.white fieldset.plugin table { body.white fieldset.plugin table {
background:gray; background:#9fb5bb;
border:0; border:0;
} }
body.white fieldset.plugin table tr { body.white fieldset.plugin table tr {
background-color:gray; background-color:gray;
} }
body.white fieldset.plugin table tr:hover { body.white fieldset.plugin table tr:hover {
background:gray; background-color:gray;
} }
body.white fieldset.plugin table th { body.white fieldset.plugin table th {
padding:4px;
background-color:#99CCFF; background-color:#99CCFF;
color:black; color:black;
} }
body.white fieldset.plugin table td { body.white fieldset.plugin table td {
padding:4px;
background-color:white; background-color:white;
color:black; color:black;
border:0;
} }
body.white fieldset.plugin table td:hover { body.white fieldset.plugin table td:hover {
background-color:lightgray; background-color:lightgray;

View File

@ -81,9 +81,17 @@ Volcanos("onexport", {help: "导出数据", list: [], _init: function(can, msg,
}, }], }]).input) }, }], }]).input)
var height = document.body.offsetHeight var height = document.body.offsetHeight
var ui = can.page.Append(can, can._output, can.core.List(["Search", "River", "Storm", "Footer"], function(item) { var ui = can.page.Append(can, can._output, can.core.List(["Search", "River", "Storm", "Footer", "black", "white"], function(item) {
return {view: "item", list: [{type: "input", data: {name: item, type: "button", value: item.toLowerCase()}, return {view: "item", list: [{type: "input", data: {name: item, type: "button", value: item.toLowerCase()},
onclick: function(event) { onclick: function(event) {
if (item == "white") {
can.page.Modify(can, document.body, {className: item})
return
}
if (item == "black") {
can.page.Modify(can, document.body, {className: item})
return
}
if (item == "Footer") { can.page.Select(can, document.body, "fieldset.Action", function(item) { if (item == "Footer") { can.page.Select(can, document.body, "fieldset.Action", function(item) {
if (item.style.height) { if (item.style.height) {
height = document.body.offsetHeight height = document.body.offsetHeight

View File

@ -6,9 +6,9 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, meta,
return can.page.Modify(can, list, {style: {display: hide? "": "none"}}) return can.page.Modify(can, list, {style: {display: hide? "": "none"}})
} }
can.run(event, [river], function(msg) { var which = 0 can.run({}, [river, "storm"], function(msg) { var which = 0
list = can.page.Append(can, can._output, [{view: "sublist", list: msg.Table(function(value, index) { list = can.page.Append(can, can._output, [{view: "sublist", list: msg.Table(function(value, index) {
river == can.user.Search(can, "river") && value.name == can.user.Search(can, "storm") && (which = index) river == can.user.Search(can, "river") && value.key == can.user.Search(can, "storm") && (which = index)
return {text: [value.name, "div", "subitem"], onclick: function(event) { return {text: [value.name, "div", "subitem"], onclick: function(event) {
var msg = can.request(event) var msg = can.request(event)
msg.Option("river", can.Conf("river", river)) msg.Option("river", can.Conf("river", river))
@ -19,9 +19,15 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, meta,
can.page.ClassList.del(can, item, "select") can.page.ClassList.del(can, item, "select")
}) })
can.page.ClassList.add(can, event.target, "select") can.page.ClassList.add(can, event.target, "select")
}, oncontextmenu: function(event) {
can.user.carte(can, {}, ["添加工具", "删除"], function(ev, item, meta) {
item == "删除" && can.run(event, [can.Conf("river"), value.key, "storm", "action", "remove"], function(msg) {
can.user.Search(can, {"river": can.Conf("river")})
}) || can.ondetail[item](event, can, value)
})
}} }}
})}]).sublist })}]).sublist
list.children[which].click() which < list.children.length && list.children[which].click()
event.target.nextSibling && can._output.insertBefore(list, event.target.nextSibling) event.target.nextSibling && can._output.insertBefore(list, event.target.nextSibling)
can.sublist[river] = list can.sublist[river] = list
}) })
@ -45,9 +51,27 @@ Volcanos("onaction", {help: "控件交互", list: ["创建", "刷新"], _init: f
can.user.Search(can, {"river": can.Conf("river")}) can.user.Search(can, {"river": can.Conf("river")})
}, },
}) })
Volcanos("ondetail", {help: "菜单交互", list: ["添加用户", "重命名", "共享", "删除"], _init: function(can, msg, list, cb, target) { Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加用户", "重命名", "共享", "删除"], _init: function(can, msg, list, cb, target) {
can.onexport._init(can, msg, list, cb, target) can.onexport._init(can, msg, list, cb, target)
}, },
"添加工具": function(event, can, value) {
can.run(event, ["search", "Search.onimport.select", "command", "", ""], function(list) {
var args = []; can.core.List(list, function(item) {
args = args.concat([item[0], item[5], item[4], ""])
})
can.run(event, [can.Conf("river"), can.Conf("storm"), "storm", "action", "tool"].concat(args), function(msg) {
can.user.Search(can, {"river": can.Conf("river"), "storm": can.Conf("storm")})
})
})
},
"添加应用": function(event, can, river, button) {
can.user.input(event, can, [["type", "public", "protected", "private"], "name", "text"], function(event, button, meta, list) {
can.run(event, [can.Conf("river"), "storm", "action", "create"].concat(list), function(msg) {
can.user.Search(can, {"river": can.Conf("river"), "storm": msg.Result()})
})
return true
})
},
"添加用户": function(event, can, river, button) { "添加用户": function(event, can, river, button) {
can.run(event, ["search", "Search.onimport.select", "user", "", ""], function(list) { can.run(event, ["search", "Search.onimport.select", "user", "", ""], function(list) {
var args = []; can.core.List(list, function(item) { var args = []; can.core.List(list, function(item) {

View File

@ -20,6 +20,16 @@ Volcanos("onaction", {help: "交互操作", list: ["创建", "刷新"], _init: f
}, },
}) })
Volcanos("ondetail", {help: "交互菜单", list: ["添加工具", "重命名", "共享", "删除"], Volcanos("ondetail", {help: "交互菜单", list: ["添加工具", "重命名", "共享", "删除"],
insert: function(can) {
can.run(event, ["search", "Search.onimport.select", "command", "", ""], function(list) {
var args = []; can.core.List(list, function(item) {
args = args.concat([item[0], item[5], item[4], ""])
})
can.run(event, [can.Conf("river"), can.Conf("storm"), "action", "tool"].concat(args), function(msg) {
can.user.Search(can, {"river": can.Conf("river"), "storm": can.Conf("storm")})
})
})
},
"添加工具": function(event, can, value) { "添加工具": function(event, can, value) {
can.run(event, ["search", "Search.onimport.select", "command", "", ""], function(list) { can.run(event, ["search", "Search.onimport.select", "command", "", ""], function(list) {
var args = []; can.core.List(list, function(item) { var args = []; can.core.List(list, function(item) {

View File

@ -25,6 +25,10 @@ fieldset.editor>div.output>div.project {
max-width:120px; max-width:120px;
color:white; color:white;
} }
fieldset.editor>div.output>div.project div.item0 {
}
fieldset.editor>div.output>div.project div.list0 {
}
fieldset.editor>div.output>div.project div.item { fieldset.editor>div.output>div.project div.item {
cursor:pointer; cursor:pointer;
} }

View File

@ -91,6 +91,14 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
}, true) }, true)
}, },
project: function(can, path) { can.Option({path: path}), can.ui.project.innerHTML = "" project: function(can, path) { can.Option({path: path}), can.ui.project.innerHTML = ""
can.run({}, ["action", "project", path+"/"], function(res) {
can.onappend.tree(can, can.ui.project, res, function(event, value) {
value.path.indexOf(can.Option("path")) == 0 && (value.path = value.path.slice(can.Option("path").length+1))
value.path.endsWith("/")? can.onimport.project(can, can.base.Path(can.Option("path"), value.path)):
can.onimport.tabview(can, can.Option("path"), value.path)
})
}, true)
return
can.run({}, ["action", "project", path+"/"], function(res) { res.Table(function(value) { can.run({}, ["action", "project", path+"/"], function(res) { res.Table(function(value) {
value.path = value.path.slice(can.Option("path").length+1) value.path = value.path.slice(can.Option("path").length+1)
@ -777,7 +785,7 @@ Volcanos("onaction", {help: "控件交互", list: [
} }
}], onfocus: function(event) { }], onfocus: function(event) {
event.target.setSelectionRange(0, -1) event.target.setSelectionRange(0, -1)
}, value: value}, }, value: value||"main"},
{button: ["搜索", function(event) { {button: ["搜索", function(event) {
can.onaction.searchLine(event, can, ui.word.value) can.onaction.searchLine(event, can, ui.word.value)
}]}, }]},
@ -794,6 +802,7 @@ Volcanos("onaction", {help: "控件交互", list: [
var msg = can.request(event); msg.Option("_path", can.Option("path")) var msg = can.request(event); msg.Option("_path", can.Option("path"))
value && can.run(event, ["action", "search", can.parse, value, ""], function(msg) { value && can.run(event, ["action", "search", can.parse, value, ""], function(msg) {
can.onappend.table(can, can.ui.search, "table", msg, function(value, key, index, line) { can.onappend.table(can, can.ui.search, "table", msg, function(value, key, index, line) {
can.Status("npos", index+1)
value = value.replace("<", "&lt;").replace(">", "&gt;") value = value.replace("<", "&lt;").replace(">", "&gt;")
value = value.replace("./", "") value = value.replace("./", "")
return {text: [value, "td"], onclick: function(event) { return {text: [value, "td"], onclick: function(event) {
@ -866,7 +875,7 @@ Volcanos("ondetail", {help: "菜单交互", list: [
can.onaction.appendLine(can) can.onaction.appendLine(can)
}, },
}) })
Volcanos("onexport", {help: "导出数据", list: ["输入法", "输入值", "文件名", "解析器", "当前行", "ncmd"], Volcanos("onexport", {help: "导出数据", list: ["输入法", "输入值", "文件名", "解析器", "当前行", "ncmd", "npos"],
content: function(can) { content: function(can) {
return can.page.Select(can, can._output, "div.content>pre.item", function(item) { return can.page.Select(can, can._output, "div.content>pre.item", function(item) {
return can.current == item? can.editor.value: item.innerText return can.current == item? can.editor.value: item.innerText