mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
add old
This commit is contained in:
parent
c2444a21d4
commit
b3857d213f
@ -1,25 +0,0 @@
|
||||
var Config = {name: "demo", volcano: "frame.js", iceberg: "/chat/", intshell: "plug.sh",
|
||||
libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"], panes: [
|
||||
{type: "pane", name: "Header", help: "标题栏", pos: "head", list: ["pane/Header.js", "pane/Header.css"], state: ["time"]},
|
||||
{type: "pane", name: "River", help: "群聊组", pos: "left", list: ["pane/River.js", "pane/River.css"]},
|
||||
{type: "pane", name: "Storm", help: "应用流", pos: "right", list: ["pane/Storm.js", "pane/Storm.css"]},
|
||||
{type: "pane", name: "Action", help: "工作台", pos: "middle", list: ["pane/Action.js", "pane/Action.css"]},
|
||||
{type: "pane", name: "Footer", help: "状态条", pos: "foot", list: ["pane/Footer.js", "pane/Footer.css"]},
|
||||
], main: {name: "Header", engine: "remote", list: []},
|
||||
list: ["plugin/state.js", "plugin/input.js", "plugin/table.js"],
|
||||
}
|
||||
|
||||
var Preload = Config.libs; Config.panes.forEach(function(pane) {
|
||||
Preload = Preload.concat(pane.list);
|
||||
}); Preload = Preload.concat(Config.list)
|
||||
|
||||
Volcanos(Config.name, { _target: document.body,
|
||||
_head: document.head, _body: document.body,
|
||||
_width: window.innerWidth, _height: window.innerHeight,
|
||||
}, Preload.concat(Config.volcano), function(can) { // 程序入口
|
||||
can.onimport._init(can, can.Conf(Config), [], function(msg) {
|
||||
console.log(can._root, can._name, "start", can, msg);
|
||||
can.Footer.onaction._init(can.Footer, msg);
|
||||
}, can._target)
|
||||
})
|
||||
|
@ -1,10 +0,0 @@
|
||||
fieldset.Action {
|
||||
min-width:160px;
|
||||
min-height:160px;
|
||||
padding-left:10px;
|
||||
padding-right:10px;
|
||||
}
|
||||
fieldset.Action>div.output>div.item:hover {
|
||||
background-color:lightblue;
|
||||
}
|
||||
|
@ -1,40 +0,0 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, target) {
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "交互操作", list: [],
|
||||
_init: function(can, msg, list, cb, target) {
|
||||
can.onexport._init(can, msg, list, cb, target)
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) { var key = "action";
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
can.run(msg._event, ["search", "Storm.onaction._init"], function(msg) {
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
can.Cache(can.Conf("river")+can.Conf("storm"), can._output, can.Conf(key));
|
||||
var river = can.Conf("river", msg.Option("river"));
|
||||
var storm = can.Conf("storm", msg.Option("storm"));
|
||||
console.log(can._root, can._name, "show", river, storm);
|
||||
if (can.Conf(key, msg.Option(key, can.Cache(river+"."+storm, can._output)))) {
|
||||
typeof cb == "function" && cb(msg); return
|
||||
}
|
||||
|
||||
can.run(msg._event, [river, storm], function(msg) { can._output.innerHTML = "";
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
msg.Table(function(value, index, array) {
|
||||
// 添加列表
|
||||
can.onappend._init(can, value, Config.libs.concat([value.display||"plugin/state.js"]), function(sub) {
|
||||
sub.run = function(event, cmds, cb, silent) {
|
||||
can.run(event, [river, storm, index].concat(cmds), cb, silent)
|
||||
}
|
||||
}, can._output)
|
||||
can.Conf(key, "which")
|
||||
});
|
||||
msg.Option(key, can.Conf(key))
|
||||
typeof cb == "function" && cb(msg)
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
|
@ -1,19 +0,0 @@
|
||||
fieldset.Footer {
|
||||
height:32px;
|
||||
clear:both;
|
||||
}
|
||||
fieldset.Footer>div {
|
||||
margin:7px 0;
|
||||
}
|
||||
fieldset.Footer>div.output div.title {
|
||||
margin-left:5px;
|
||||
float:left;
|
||||
}
|
||||
fieldset.Footer>div.output div.state {
|
||||
float:right;
|
||||
}
|
||||
fieldset.Footer>div.output div.state>div {
|
||||
margin-right:5px;
|
||||
float:right;
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, target) {
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "交互数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) {
|
||||
can.onexport._init(can, msg, list, cb, target)
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) { can._output.innerHTML = "";
|
||||
can.run(msg._event, [], function(msg) {
|
||||
console.log(can._root, can._name, "show", msg.result)
|
||||
can.core.List(msg.result, function(title) {
|
||||
can.page.Append(can, can._output, [{view: ["title", "div", title]}])
|
||||
})
|
||||
|
||||
console.log(can._root, can._name, "show", can.Conf("state"))
|
||||
can.ui = can.page.Append(can, can._output, [{view: "state", list: can.core.List(can.Conf("state"), function(item) {
|
||||
return {text: can.Conf(item)||"", className: item, click: function(event) {can.onaction[item](event, can, item)}};
|
||||
})}])
|
||||
})
|
||||
},
|
||||
})
|
||||
|
@ -1,39 +0,0 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, target) {
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "交互数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) {
|
||||
can.onexport._init(can, msg, list, cb, target)
|
||||
can.run(msg._event, ["search", "Footer.onaction._init"], function(msg) {
|
||||
})
|
||||
can.run(msg._event, ["search", "Action.onaction._init"], function(msg) {
|
||||
})
|
||||
},
|
||||
title: function(event, can, key) {
|
||||
},
|
||||
time: function(event, can, key) {
|
||||
can.ui[key].innerHTML = can.base.Time().split(" ")[1]
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) { can._output.innerHTML = "";
|
||||
can.run(msg._event, [], function(msg) {
|
||||
console.log(can._root, can._name, "show", msg.result)
|
||||
can.core.List(msg.result, function(title) {
|
||||
can.page.Append(can, can._output, [{view: ["title", "div", title],
|
||||
click: function(event) {can.onaction["title"](event, can, "title")},
|
||||
}])
|
||||
})
|
||||
|
||||
console.log(can._root, can._name, "show", can.Conf("state"))
|
||||
can.ui = can.page.Append(can, can._output, [{view: "state", list: can.core.List(can.Conf("state"), function(item) {
|
||||
return {text: can.Conf(item)||"", className: item, click: function(event) {can.onaction[item](event, can, item)}};
|
||||
})}])
|
||||
|
||||
can.timer = can.Timer({interval: 1000, length: -1}, function(event) {
|
||||
can.onaction.time(event, can, "time")
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
@ -1,37 +0,0 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, target) {
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "交互数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) {
|
||||
can.onexport._init(can, msg, list, cb, target)
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) { var key = "river";
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
if (msg.Option(key, can.Conf(key))) {
|
||||
typeof cb == "function" && cb (msg); return
|
||||
}
|
||||
|
||||
can.run(msg._event, [], function(msg) { can._output.innerHTML = "";
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
var select; msg.Table(function(value, index, array) {
|
||||
// 添加列表
|
||||
var view = can.onappend.item(can, can._output, "item", value, function(event, item) {
|
||||
// 左键点击
|
||||
can.Conf(key, value.key); can.run(event, ["search", "Storm.onaction._init"], function(action) {
|
||||
// 切换群组
|
||||
});
|
||||
}, function(event) {
|
||||
// 右键点击
|
||||
});
|
||||
if (index == 0 || [value.key, value.name].indexOf(can.user.Search(can, key)) > -1) {
|
||||
select = view
|
||||
}
|
||||
}); select.click();
|
||||
typeof cb == "function" && cb(msg)
|
||||
})
|
||||
},
|
||||
})
|
||||
|
@ -1,21 +0,0 @@
|
||||
fieldset.Storm {
|
||||
min-width:80px;
|
||||
min-height:160px;
|
||||
float:right;
|
||||
}
|
||||
fieldset.Storm>div.output {
|
||||
padding:0;
|
||||
}
|
||||
fieldset.Storm>div.output>div.item {
|
||||
padding-left:6px;
|
||||
}
|
||||
fieldset.Storm>div.output>div.item:hover {
|
||||
cursor:pointer;
|
||||
background-color:red;
|
||||
border:ridge 2px yellow;
|
||||
}
|
||||
fieldset.Storm>div.output>div.item.select {
|
||||
background-color:red;
|
||||
border:ridge 2px yellow;
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, target) {
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "交互数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) {
|
||||
can.onexport._init(can, msg, list, cb, target)
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) { var key = "storm";
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
can.run(msg._event, ["search", "River.onaction._init"], function(msg) {
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
can.Cache(can.Conf("river"), can._output, can.Conf(key));
|
||||
var river = can.Conf("river", msg.Option("river"));
|
||||
console.log(can._root, can._name, "show", river);
|
||||
if (can.Conf(key, msg.Option(key, can.Cache(river, can._output)))) {
|
||||
typeof cb == "function" && cb (msg); return
|
||||
}
|
||||
|
||||
can.run(msg._event, [river], function(msg) { can._output.innerHTML = "";
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
var select; msg.Table(function(value, index, array) {
|
||||
// 添加列表
|
||||
var view = can.onappend.item(can, can._output, "item", value, function(event, item) {
|
||||
// 左键点击
|
||||
can.Conf(key, value.key); can.run(event, ["search", "Action.onaction._init"], function(msg) {
|
||||
})
|
||||
}, function(event, item) {
|
||||
// 右键点击
|
||||
});
|
||||
if (index == 0 || [value.key, value.name].indexOf(can.user.Search(can, key)) > -1) {
|
||||
select = view
|
||||
}
|
||||
}); select.click();
|
||||
typeof cb == "function" && cb(msg)
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
@ -1,27 +0,0 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, output, action, option, field) { output.innerHTML = "";
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "控件交互", list: [],
|
||||
onclick: function(event, can) {
|
||||
switch (can.Conf("type")) {
|
||||
case "button":
|
||||
can.run(event, [], function() {})
|
||||
break
|
||||
}
|
||||
},
|
||||
onkeydown: function(event, can) {
|
||||
switch (event.key) {
|
||||
case "Enter":
|
||||
can.run(event, [], function() {})
|
||||
break
|
||||
}
|
||||
},
|
||||
onkeyup: function(event, can) {
|
||||
switch (event.key) {
|
||||
case "Enter":
|
||||
can.run(event, [], function() {})
|
||||
break
|
||||
}
|
||||
},
|
||||
})
|
@ -1,5 +0,0 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, target) {
|
||||
},
|
||||
})
|
||||
|
@ -1,19 +0,0 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, msg, list, cb, output, action, option, field) { output.innerHTML = "";
|
||||
var table = can.page.AppendTable(can, output, msg, msg.append, function(event, value, key, index, tr, td) {
|
||||
can.page.Select(can, option, "input.args", function(input) { if (input.name == key) {
|
||||
input.value = value
|
||||
} })
|
||||
}, function(event, value, key, index, tr, td) {
|
||||
});
|
||||
msg.result && can.page.AppendBoard(can, output, msg.result.join(""))
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "控件交互", list: [],
|
||||
onclick: function(event, can) {
|
||||
can.run(event, [], function() {})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
156
demo/style.css
156
demo/style.css
@ -1,156 +0,0 @@
|
||||
* {
|
||||
background:black;
|
||||
}
|
||||
body {
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
fieldset {
|
||||
color:cyan;
|
||||
padding:2px;
|
||||
margin:0px;
|
||||
}
|
||||
legend {
|
||||
margin-left:10px;
|
||||
}
|
||||
|
||||
fieldset>form.option {
|
||||
padding:0 5px;
|
||||
}
|
||||
fieldset>form.option>br {
|
||||
clear:both;
|
||||
}
|
||||
fieldset>form.option>div.item {
|
||||
margin-right:3px;
|
||||
float:left;
|
||||
}
|
||||
fieldset>form.option>div.item label {
|
||||
margin-right:3px;
|
||||
}
|
||||
fieldset>form.option>div.item input.args.char {
|
||||
width:20px;
|
||||
}
|
||||
fieldset>form.option>div.item input.args.tiny {
|
||||
width:40px;
|
||||
}
|
||||
fieldset>form.option>div.item input.args {
|
||||
width:80px;
|
||||
}
|
||||
fieldset>form.option>div.item input.args.cmd {
|
||||
background-color:black;
|
||||
color:white;
|
||||
width:160px;
|
||||
}
|
||||
fieldset>form.option>div.item input.args.long {
|
||||
width:240px;
|
||||
}
|
||||
fieldset>form.option>div.item input.args.full {
|
||||
width:480px;
|
||||
}
|
||||
fieldset>form.option>div.item input.opts {
|
||||
width:80px;
|
||||
}
|
||||
fieldset>form.option>div.item textarea.args {
|
||||
width:300px;
|
||||
height:50px;
|
||||
background-color:cyan;
|
||||
}
|
||||
|
||||
fieldset>form.option>div.item.text>input {
|
||||
background-color:cyan;
|
||||
}
|
||||
fieldset>form.option>div.item.button>input {
|
||||
color:cyan;
|
||||
}
|
||||
fieldset>form.option>div.item.select>select {
|
||||
color:cyan;
|
||||
}
|
||||
fieldset>form.option>div.item.textarea {
|
||||
margin-top:4px;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
fieldset.Action>div.output {
|
||||
overflow:auto;
|
||||
}
|
||||
fieldset>div.output {
|
||||
margin-top:4px;
|
||||
clear:both;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
fieldset table {
|
||||
font-size:14px;
|
||||
overflow: auto;
|
||||
}
|
||||
fieldset table caption {
|
||||
font-size:18px;
|
||||
font-style:italic;
|
||||
border:solid 1px green;
|
||||
}
|
||||
fieldset table tbody {
|
||||
overflow:auto;
|
||||
}
|
||||
fieldset table td sup.more {
|
||||
color:red;
|
||||
}
|
||||
|
||||
fieldset table {
|
||||
border:solid 1px green;
|
||||
cursor:pointer;
|
||||
}
|
||||
fieldset table tr:hover {
|
||||
background-color:#0fbd45;
|
||||
}
|
||||
fieldset table tr.over {
|
||||
background:red;
|
||||
}
|
||||
fieldset table tr.select {
|
||||
background-color:#0fbd45;
|
||||
}
|
||||
fieldset table th {
|
||||
font-family:monospace;
|
||||
background-color:#0fbd45;
|
||||
cursor:pointer;
|
||||
padding: 0 6px;
|
||||
}
|
||||
fieldset table td {
|
||||
max-width:1200px;
|
||||
font-family:monospace;
|
||||
padding: 0 6px;
|
||||
white-space: pre;
|
||||
}
|
||||
fieldset table td:hover {
|
||||
background-color:red;
|
||||
}
|
||||
fieldset table td.select {
|
||||
background-color:red;
|
||||
}
|
||||
|
||||
fieldset div.code {
|
||||
color:white;
|
||||
font-size:14px;
|
||||
font-family:monospace;
|
||||
background-color:#343a34f2;
|
||||
white-space:pre;
|
||||
padding:10px;
|
||||
overflow:auto;
|
||||
border:solid 3px green;
|
||||
max-height:640px;
|
||||
}
|
||||
fieldset div.hidden {
|
||||
display:none;
|
||||
}
|
||||
|
||||
fieldset div.code {
|
||||
color:white;
|
||||
font-size:14px;
|
||||
font-family:monospace;
|
||||
background-color:#343a34f2;
|
||||
white-space:pre;
|
||||
padding:10px;
|
||||
overflow:auto;
|
||||
border:solid 3px green;
|
||||
max-height:640px;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ Volcanos("onappend", {
|
||||
var option = can.page.Select(can, field, "form.option")[0];
|
||||
var action = can.page.Select(can, field, "div.action")[0];
|
||||
var output = can.page.Select(can, field, "div.output")[0];
|
||||
var feature = JSON.parse(meta.feature||"{}")||{}
|
||||
|
||||
// 添加插件
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
@ -85,10 +86,10 @@ Volcanos("onappend", {
|
||||
if (silent) { typeof cb == "function" && cb(msg); return }
|
||||
|
||||
// 添加组件
|
||||
var display = msg.Option("display")||meta.display||"table"
|
||||
var display = msg.Option("display")||feature.display||"plugin/table"
|
||||
sub[display] = Volcanos(display, { _target: output,
|
||||
_option: option, _action: action, _output: output,
|
||||
}, Config.libs.concat(["plugin/"+display]), function(table) {
|
||||
}, Config.libs.concat([display]), function(table) {
|
||||
table.onimport._init(table, msg, msg.append||[], function() {
|
||||
}, output)
|
||||
})
|
1
old/page/frame_old.js
Symbolic link
1
old/page/frame_old.js
Symbolic link
@ -0,0 +1 @@
|
||||
../frame_old.js
|
@ -5,11 +5,12 @@
|
||||
<title>volcanos</title>
|
||||
|
||||
<link rel="shortcut icon" type="image/ico" href="favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<link rel="stylesheet" type="text/css" href="style_old.css">
|
||||
</head>
|
||||
<body>
|
||||
<script src="proto.js"></script>
|
||||
<script src="order.js"></script>
|
||||
<script src="page/index.js"></script>
|
||||
<script src="proto_old.js"></script>
|
||||
<script src="frame_old.js"></script>
|
||||
</body>
|
||||
|
||||
|
46
old/page/index.js
Normal file
46
old/page/index.js
Normal file
@ -0,0 +1,46 @@
|
||||
var Config = {iceberg: "/chat/", volcano: "",
|
||||
libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"],
|
||||
main: "chat", list: [
|
||||
"page/chat",
|
||||
"pane/float/Toast", "pane/float/Carte",
|
||||
"pane/float/Tutor", "pane/float/Debug",
|
||||
"pane/float/Login", "pane/float/Favor",
|
||||
|
||||
"pane/Header",
|
||||
"pane/River", "pane/Storm",
|
||||
"pane/Target", "pane/Source", "pane/Action",
|
||||
"pane/Ocean", "pane/Steam",
|
||||
"pane/Footer",
|
||||
|
||||
"plugin/state", "plugin/table", "plugin/input",
|
||||
"plugin/input/date", "plugin/input/key",
|
||||
], pane: [
|
||||
{group: "index", name: "Toast", path: "float/", pos: "dialog", duration: 3000},
|
||||
{group: "index", name: "Carte", path: "float/", pos: "dialog"},
|
||||
{group: "index", name: "Tutor", path: "float/", pos: "dialog"},
|
||||
{group: "index", name: "Debug", path: "float/", pos: "dialog"},
|
||||
{group: "index", name: "Login", path: "float/", pos: "dialog"},
|
||||
{group: "index", name: "Favor", path: "float/", pos: "dialog"},
|
||||
|
||||
{group: "index", name: "Header", pos: "head", state: ["time", "user", "link"]},
|
||||
{group: "index", name: "River", pos: "left"},
|
||||
{group: "index", name: "Storm", pos: "right"},
|
||||
|
||||
{group: "index", name: "Target", pos: "top"},
|
||||
{group: "index", name: "Source", pos: "center"},
|
||||
{group: "index", name: "Action", pos: "bottom"},
|
||||
|
||||
{group: "index", name: "Ocean", pos: "dialog", def_name: "meet"},
|
||||
{group: "index", name: "Steam", pos: "dialog", def_name: "miss"},
|
||||
{group: "index", name: "Footer", pos: "foot", state: ["ntxt", "ncmd"]},
|
||||
|
||||
], title: "volcanos", topic: "black", layout: {def: "工作", list: ["工作", "办公", "聊天"], size: {
|
||||
"最大": {head: 0, foot: 0, left: 0, right: 0, bottom: -1, center: 0, top: 0},
|
||||
"工作": {head: 30, foot: 30, left: 0, right: 100, bottom: -1, center: 0, top: 0},
|
||||
"办公": {head: 30, foot: 30, left: 100, right: 100, bottom: -1, center: 0, top: 0},
|
||||
"聊天": {head: 30, foot: 30, left: 100, right: 100, bottom: 300, center: 40, top: -2},
|
||||
"最长": {head: 30, foot: 30, left: 0, right: 0, bottom: -2, center: 0, top: 0},
|
||||
"全屏": {head: 0, foot: 0, left: 0, right: 0, bottom: -1, center: 0, top: 0},
|
||||
}, border: 4,
|
||||
}, scroll: {line: 100},
|
||||
}
|
1
old/page/lib
Symbolic link
1
old/page/lib
Symbolic link
@ -0,0 +1 @@
|
||||
../../lib
|
1
old/page/pane
Symbolic link
1
old/page/pane
Symbolic link
@ -0,0 +1 @@
|
||||
../pane
|
1
old/page/proto_old.js
Symbolic link
1
old/page/proto_old.js
Symbolic link
@ -0,0 +1 @@
|
||||
../proto_old.js
|
1
old/page/style_old.css
Symbolic link
1
old/page/style_old.css
Symbolic link
@ -0,0 +1 @@
|
||||
../style_old.css
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
4
old/pane/Action.css
Normal file
4
old/pane/Action.css
Normal file
@ -0,0 +1,4 @@
|
||||
fieldset.Action div.output div.item:hover {
|
||||
background-color:lightblue;
|
||||
}
|
||||
|
218
old/pane/Action.js
Normal file
218
old/pane/Action.js
Normal file
@ -0,0 +1,218 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_begin: function(can) {},
|
||||
_start: function(can) {
|
||||
can.page.Select(can, can.action, "input,select", function(input) {
|
||||
input.value = can.user.Search(can, input.name) || input.value || ""
|
||||
})
|
||||
},
|
||||
|
||||
init: function(event, can, msg, cmd, field) {can.output.innerHTML = "";
|
||||
can._local[msg.cmds[0]] = can._local[msg.cmds[0]] || {}
|
||||
can._local[msg.cmds[0]][msg.cmds[1]] = msg.Table(function(item, index) {if (!item.name) {return}
|
||||
// 添加插件
|
||||
var plugin = can[item.name] = can.Plugin(can, item.name, item, function(event, cmds, cbs) {
|
||||
can.run(event, [item.river, item.storm, item.action].concat(cmds), cbs)
|
||||
}, can.page.AppendField(can, can.output, "item "+item.name, item))
|
||||
return can._plugins.push(plugin), plugin
|
||||
})
|
||||
},
|
||||
river: function(event, can, value, cmd, field) {if (value == "update") {return}
|
||||
can.Conf("temp_river", value)
|
||||
},
|
||||
storm: function(event, can, value, cmd, field) {if (value == "update") {return}
|
||||
// 保存界面
|
||||
can.Cache(can.Conf("river")+"."+can.Conf("storm"), can.output, "some");
|
||||
if (can.Cache(can.Conf("river", can.Conf("temp_river"))+"."+can.Conf("storm", value), can.output)) {
|
||||
// 恢复界面
|
||||
return
|
||||
}
|
||||
// 刷新界面
|
||||
can.run(event, [can.Conf("river"), can.Conf("storm")], function(msg) {
|
||||
can.onimport.init(event, can, msg, cmd, can.output)
|
||||
})
|
||||
},
|
||||
pod: function(event, can, value, cmd, field) {
|
||||
can.user.title(value)
|
||||
},
|
||||
you: function(event, can, value, cmd, field) {
|
||||
can.user.title(value)
|
||||
},
|
||||
|
||||
layout: function(event, can, value, cmd, field) {value},
|
||||
scroll: function(event, can, value, cmd, field) {can.layout = value;
|
||||
can.output.parentElement.scrollBy(value.x, value.y)
|
||||
},
|
||||
favor: function(event, can, msg, cmd, field) {if (msg._hand) {return}
|
||||
var cmds = msg.detail, key = cmds[0];
|
||||
if (key == can.Name()) {key = cmds[1], cmds = cmds.slice(1)}
|
||||
|
||||
// 下发数据
|
||||
can.core.Item(can._local, function(river, list) {
|
||||
can.core.Item(list, function(storm, list) {
|
||||
can.core.List(list, function(sub) {
|
||||
if (sub._name == key) {
|
||||
sub.Select(event), msg._hand = true;
|
||||
msg.Echo(can._name, " ", key)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "组件交互", list: [
|
||||
["layout"].concat(Config.layout.list), "清屏", "刷新", "并行","串行",
|
||||
["action", "正常", "竖排", "编排", "定位", "定形"],
|
||||
{input: "pod"}, {input: "you"},
|
||||
{input: "hot"}, {input: "top"},
|
||||
{input: "grp"}, {input: "lab"},
|
||||
],
|
||||
layout: function(event, can, value, cmd, field) {can.Export(event, cmd, value)},
|
||||
|
||||
"清屏": function(event, can, msg, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item>div.output", function(item) {
|
||||
item.innerHTML = "";
|
||||
})
|
||||
},
|
||||
"刷新": function(event, can, msg, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item>div.output", function(item) {
|
||||
item.innerHTML = "";
|
||||
})
|
||||
can.run(event, [can.Conf("river"), can.Conf("storm")], function(msg) {
|
||||
can.onimport.init(event, can, msg, cmd, can.output)
|
||||
})
|
||||
},
|
||||
"并行": function(event, can, msg, cmd, field) {
|
||||
can.page.Select(can, field, "fieldset.item", function(field) {
|
||||
can.page.Select(can, field, "input[type=button]", function(input, index) {
|
||||
index == 0 && input.click()
|
||||
})
|
||||
})
|
||||
},
|
||||
"串行": function(event, can, msg, cmd, field) {
|
||||
can.core.Next(can.page.Select(can, field, "fieldset.item", function(field) {
|
||||
return field
|
||||
}), function(field, cb) {
|
||||
can.page.Select(can, field, "input[type=button]", function(input, index) {
|
||||
index == 0 && field.Check(event, input, cb)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
"正常": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.setAttribute("draggable", false)
|
||||
item.style.position = ""
|
||||
item.style.cursor = ""
|
||||
item.style.clear = ""
|
||||
item.style.left = ""
|
||||
item.style.top = ""
|
||||
})
|
||||
},
|
||||
"竖排": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.clear = "both"
|
||||
})
|
||||
},
|
||||
"编排": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.target, "fieldset.item", function(item) {
|
||||
item.setAttribute("draggable", true)
|
||||
item.ondragstart = function(event) {can.drag = event.target}
|
||||
item.ondragover = function(event) {event.preventDefault()}
|
||||
item.ondrop = function(event) {event.preventDefault()
|
||||
item.parentNode.insertBefore(can.drag, item)
|
||||
}
|
||||
})
|
||||
},
|
||||
"定位": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.left = item.offsetLeft + "px"
|
||||
item.style.top = item.offsetTop + "px"
|
||||
})
|
||||
|
||||
var max, current, begin;
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.position = "absolute"
|
||||
|
||||
item.onmousedown = function(event) {if (can.Action("action") != "定位") {return}
|
||||
if (current) {
|
||||
// 更新位置
|
||||
current.style.left = begin.left + event.clientX - begin.x + "px"
|
||||
current.style.top = begin.top + event.clientY - begin.y + "px"
|
||||
current = null;
|
||||
return
|
||||
}
|
||||
// 记录位置
|
||||
current = item;
|
||||
current.style["z-index"] = max = max + 1
|
||||
begin = {x: event.clientX, y: event.clientY, left: item.offsetLeft, top: item.offsetTop}
|
||||
};
|
||||
|
||||
can.output.onmousemove = item.onmousemove = function(event) {if (!current) {return}
|
||||
// 移动位置
|
||||
current.style.left = begin.left + event.clientX - begin.x + "px"
|
||||
current.style.top = begin.top + event.clientY - begin.y + "px"
|
||||
}
|
||||
})
|
||||
},
|
||||
"定形": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.top = item.offsetTop + "px"
|
||||
item.style.left = item.offsetLeft + "px"
|
||||
item.style.width = item.offsetWidth + "px"
|
||||
item.style.height = item.offsetHeight + "px"
|
||||
})
|
||||
|
||||
var max, pos, current, begin;
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.position = "absolute"
|
||||
|
||||
item.onmousedown = function(event) {
|
||||
if (can.Action("action") != "定形") {return}
|
||||
if (current) {current = null; return}
|
||||
|
||||
// 记录位置
|
||||
current = item;
|
||||
current.style["z-index"] = max = max + 1
|
||||
begin = {
|
||||
x: event.clientX, y: event.clientY,
|
||||
left: item.offsetLeft, top: item.offsetTop,
|
||||
width: item.offsetWidth, height: item.offsetHeight,
|
||||
}
|
||||
};
|
||||
|
||||
item.onmousemove = function(event) {
|
||||
if (can.Action("action") != "定形") {return}
|
||||
var pos = can.page.Prepos(event, item)
|
||||
if (!current) {return}
|
||||
can.page.Resize(event, current, begin, pos)
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onchoice", {help: "组件菜单", list: ["共享", "保存", "刷新"],
|
||||
"共享": function(event, can, msg, cmd, field) {
|
||||
can.user.input(event, can, ["name", "text"], function(event, cmd, meta, list) {
|
||||
var msg = can.Event(event);
|
||||
msg.Option("name", meta.name)
|
||||
msg.Option("text", meta.key)
|
||||
cmd == "提交" && can.Export(event, can.Name(), "share")
|
||||
return true
|
||||
})
|
||||
},
|
||||
"保存": function(event, can, msg, cmd, field) {
|
||||
var list = []
|
||||
can.page.Select(can, field, "fieldset.item", function(item) {var meta = item.Meta
|
||||
can.page.Select(can, item, "form.option", function(option) {
|
||||
if (option.parentNode != item) {return}
|
||||
meta.args = can.page.Select(can, option, ".args", function(item) {return item.value})
|
||||
})
|
||||
list.push(meta.node||"", meta.group, meta.index, meta.help, JSON.stringify(meta.args||[]))
|
||||
})
|
||||
can.run(event, [can.Conf("river"), can.Conf("storm"), "save"].concat(list), function(msg) {
|
||||
can.user.toast("保存成功")
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("ondetail", {help: "组件详情", list: []})
|
||||
Volcanos("onexport", {help: "导出数据", list: []})
|
||||
|
29
old/pane/Footer.css
Normal file
29
old/pane/Footer.css
Normal file
@ -0,0 +1,29 @@
|
||||
fieldset.Footer {
|
||||
clear:both;
|
||||
overflow:hidden;
|
||||
height:32px;
|
||||
}
|
||||
fieldset.Footer>div.action {
|
||||
padding:0;
|
||||
}
|
||||
fieldset.Footer>div.output div.title {
|
||||
float:left;
|
||||
}
|
||||
fieldset.Footer>div.output div.magic {
|
||||
float:right;
|
||||
margin-top:-6px;
|
||||
}
|
||||
fieldset.Footer>div.output div.magic>label {
|
||||
margin-right:2px;
|
||||
}
|
||||
fieldset.Footer>div.output div.magic>input {
|
||||
background-color:black;
|
||||
color:lightgreen;;
|
||||
}
|
||||
fieldset.Footer>div.output div.state {
|
||||
float:right;
|
||||
}
|
||||
fieldset.Footer>div.output div.state div {
|
||||
float:right;
|
||||
}
|
||||
|
31
old/pane/Footer.js
Normal file
31
old/pane/Footer.js
Normal file
@ -0,0 +1,31 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, output, action, option, field) {output.innerHTML = "";
|
||||
can._init = function() {
|
||||
can.run({}, [], function(msg) {
|
||||
can.core.List(msg.result, function(title) {
|
||||
can.page.Append(can, output, [{view: "title", list: [{text: title, className: "title"}]}])
|
||||
})
|
||||
|
||||
can.ui = can.page.Append(can, output, [{view: "state", list: can.core.List(meta.state, function(item) {
|
||||
return {text: meta[item]||"", className: item, click: function(event) {can.Export(event, meta[item], item)}};
|
||||
})}])
|
||||
})
|
||||
}
|
||||
},
|
||||
username: function(event, can, value, cmd, field) {can._init()},
|
||||
|
||||
email: function(event, can, value, cmd, field) {
|
||||
can.ui[cmd].innerHTML = value
|
||||
},
|
||||
ntxt: function(event, can, value, cmd, field) {var state = can.Conf(cmd);
|
||||
can.ui[cmd].innerHTML = cmd+":"+ can.Conf(cmd, can.base.Int(value)+can.base.Int(state))
|
||||
},
|
||||
ncmd: function(event, can, value, cmd, field) {var state = can.Conf(cmd);
|
||||
can.ui && (can.ui[cmd].innerHTML = cmd+":"+ can.Conf(cmd, can.base.Int(value)+can.base.Int(state)))
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "组件交互", list: []})
|
||||
Volcanos("onchoice", {help: "组件菜单", list: []})
|
||||
Volcanos("ondetail", {help: "组件详情", list: []})
|
||||
Volcanos("onexport", {help: "导出数据", list: []})
|
||||
|
@ -1,27 +1,29 @@
|
||||
fieldset.Header {
|
||||
height:32px;
|
||||
min-width:640px;
|
||||
clear:both;
|
||||
}
|
||||
fieldset.Header>div {
|
||||
margin:7px 0;
|
||||
fieldset.Header>div.action {
|
||||
padding:0;
|
||||
}
|
||||
fieldset.Header>div.output>div.title {
|
||||
margin-left:5px;
|
||||
cursor:pointer;
|
||||
float:left;
|
||||
}
|
||||
fieldset.Header>div.output>div.title:hover {
|
||||
cursor:pointer;
|
||||
background-color:red;
|
||||
border:ridge 2px yellow;
|
||||
}
|
||||
|
||||
fieldset.Header>div.output>div.state {
|
||||
margin-right:5px;
|
||||
float:right;
|
||||
}
|
||||
fieldset.Header>div.output>div.state div.item {
|
||||
padding:0;
|
||||
}
|
||||
fieldset.Header>div.output>div.state>div {
|
||||
cursor:pointer;
|
||||
margin-right:5px;
|
||||
margin-left:5px;
|
||||
float:right;
|
||||
}
|
||||
fieldset.Header>div.output>div.state>div:hover {
|
59
old/pane/Header.js
Normal file
59
old/pane/Header.js
Normal file
@ -0,0 +1,59 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, output, action, option, field) {output.innerHTML = "";
|
||||
can._init = function() {
|
||||
can.run({}, [], function(msg) {
|
||||
can.core.List(msg.result, function(title) {
|
||||
can.page.Append(can, output, [{view: "title", list: [{text: title, className: "title"}],
|
||||
click: function(event) {can.Export(event, meta.title, "title")},
|
||||
}])
|
||||
})
|
||||
|
||||
can.ui = can.page.Append(can, output, [{view: "state", list: can.core.List(meta.state, function(item) {
|
||||
return {text: meta[item]||"", className: item, click: function(event) {can.Export(event, meta[item], item)}};
|
||||
})}])
|
||||
|
||||
can.timer = can.Timer({interval: 1000, length: -1}, function(event) {
|
||||
can.onimport.time(event, can, can.base.Time().split(" ")[1], "time")
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
username: function(event, can, value, cmd, field) {can.Conf("user", value), can._init()},
|
||||
|
||||
title: function(event, can, value, cmd, field) {
|
||||
can.ui[cmd].innerHTML = value
|
||||
},
|
||||
time: function(event, can, value, cmd, field) {
|
||||
can.ui[cmd].innerHTML = value
|
||||
},
|
||||
|
||||
river: function(event, can, value, cmd, field) {if (value == "update") {return}
|
||||
can.Conf("river", value)
|
||||
},
|
||||
storm: function(event, can, value, cmd, field) {if (value == "update") {return}
|
||||
can.Conf("storm", value)
|
||||
},
|
||||
layout: function(event, can, value, cmd, field) {if (value == "update") {return}
|
||||
can.Conf("layout", value)
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "组件交互", list: []})
|
||||
Volcanos("onchoice", {help: "组件菜单", list: []})
|
||||
Volcanos("ondetail", {help: "组件详情", list: []})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
title: function(event, can, value, cmd, field) {
|
||||
var args = {river: can.Conf("river"), storm: can.Conf("storm"), layout: can.Conf("layout")}
|
||||
|
||||
can.page.Select(can, document.body, "fieldset.Action>div.action input", function(input) {
|
||||
input.name && input.value && (args[input.name] = input.value)
|
||||
})
|
||||
can.user.Search(can, args)
|
||||
},
|
||||
user: function(event, can, value, cmd, field) {
|
||||
if (can.user.confirm("logout?")) {
|
||||
can.user.Cookie(can, "sessid", "")
|
||||
can.user.reload()
|
||||
}
|
||||
},
|
||||
})
|
||||
|
@ -1,6 +1,4 @@
|
||||
fieldset.River {
|
||||
min-width:80px;
|
||||
min-height:160px;
|
||||
float:left;
|
||||
}
|
||||
fieldset.River>div.output {
|
||||
@ -9,10 +7,6 @@ fieldset.River>div.output {
|
||||
fieldset.River>div.output>div.item {
|
||||
padding-left:6px;
|
||||
}
|
||||
fieldset.River>div.output>div.item:hover {
|
||||
background-color:red;
|
||||
border:ridge 2px yellow;
|
||||
}
|
||||
fieldset.River>div.output>div.item.select {
|
||||
background-color:red;
|
||||
border:ridge 2px yellow;
|
79
old/pane/River.js
Normal file
79
old/pane/River.js
Normal file
@ -0,0 +1,79 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
init: function(event, can, msg, cmd, field) {can.output.innerHTML = "";
|
||||
can.page.AppendItem(can, can.output, msg.Table(), can.user.Search(can, can.Name()), function(event, line, item) {
|
||||
can.Export(event, line.key, can.Name())
|
||||
})
|
||||
},
|
||||
river: function(event, can, value, cmd, field) {if (value == "update") {
|
||||
can.run(event, [], function(msg) {
|
||||
can.onimport.init(event, can, msg, cmd, field)
|
||||
})
|
||||
}},
|
||||
favor: function(event, can, msg, cmd, field) {if (msg._hand) {return}
|
||||
var cmds = msg.detail, key = cmds[0];
|
||||
if (key == can.Name()) {key = cmds[1], cmds = cmds.slice(1)}
|
||||
|
||||
can.page.Select(can, field, "div.item>span", function(item) {
|
||||
if (item.innerText == key) {
|
||||
item.click(), msg._hand = true;
|
||||
msg.Echo(can._name, " ", key)
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "组件交互", list: ["创建", "刷新"],
|
||||
"创建": function(event, can, meta, cmd, field) {
|
||||
can.Export(event, "create", "ocean")
|
||||
},
|
||||
"刷新": function(event, can, meta, cmd, field) {
|
||||
can.Import(event, "update", can.Name())
|
||||
},
|
||||
})
|
||||
Volcanos("onchoice", {help: "组件菜单", list: ["创建", "刷新", "宽度"],
|
||||
"宽度": function(event, can, meta, cmd, field) {
|
||||
var begin;
|
||||
function end() {
|
||||
field.onmousedown = null;
|
||||
field.onmousemove = null;
|
||||
field.style.cursor = "";
|
||||
begin = null;
|
||||
}
|
||||
|
||||
field.style.cursor = "e-resize"
|
||||
field.onmousedown = function(event) {if (begin) {return end()}
|
||||
begin = {x: event.clientX, width: field.offsetWidth}
|
||||
}
|
||||
field.onmousemove = function(event) {if (!begin) {return}
|
||||
field.dataset.width = field.style.width = begin.width + event.clientX - begin.x + "px";
|
||||
can.Export(event, "", "layout");
|
||||
}
|
||||
|
||||
can.user.prompt("输入宽度", function(width) {
|
||||
field.dataset.width = field.style.width = width + "px"
|
||||
can.Export(event, "", "layout")
|
||||
end()
|
||||
}, field.offsetWidth)
|
||||
},
|
||||
})
|
||||
Volcanos("ondetail", {help: "组件详情", list: ["共享", "重命名", "删除"],
|
||||
"共享": function(event, can, line, value, cmd, item) {
|
||||
var msg = can.Event(event);
|
||||
msg.Option("name", line.name)
|
||||
msg.Option("text", line.key)
|
||||
can.Export(event, can.Name(), "share")
|
||||
},
|
||||
"重命名": function(event, can, line, value, cmd, item) {
|
||||
can.user.prompt("输入新名:", function(name) {
|
||||
can.run(event, [value, "rename", name], function(msg) {
|
||||
can.Import(event, "update", can.Name())
|
||||
})
|
||||
}, line.name)
|
||||
},
|
||||
"删除": function(event, can, line, value, cmd, item) {
|
||||
can.run(event, [value, "remove"], function(msg) {
|
||||
can.Import(event, "update", can.Name())
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: []})
|
||||
|
10
old/pane/Storm.css
Normal file
10
old/pane/Storm.css
Normal file
@ -0,0 +1,10 @@
|
||||
fieldset.Storm {
|
||||
float:right;
|
||||
}
|
||||
fieldset.Storm>div.output {
|
||||
padding:0;
|
||||
}
|
||||
fieldset.Storm>div.output>div.item {
|
||||
padding-left:6px;
|
||||
}
|
||||
|
89
old/pane/Storm.js
Normal file
89
old/pane/Storm.js
Normal file
@ -0,0 +1,89 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
init: function(event, can, msg, cmd, field) {can.output.innerHTML = "";
|
||||
can.page.AppendItem(can, can.output, msg.Table(), can.user.Search(can, can.Name()), function(event, line, item) {
|
||||
can.Export(event, line.key, can.Name())
|
||||
})
|
||||
},
|
||||
river: function(event, can, value, cmd, field) {if (value == "update") {return}
|
||||
can.run(event, [can.Conf("river", value)], function(msg) {
|
||||
can.onimport.init(event, can, msg, cmd, field)
|
||||
})
|
||||
},
|
||||
storm: function(event, can, value, cmd, field) {
|
||||
if (value == "update") {
|
||||
can.run(event, [can.Conf("river")], function(msg) {
|
||||
can.onimport.init(event, can, msg, cmd, field)
|
||||
})
|
||||
} else {
|
||||
can.Conf(can.Name(), value)
|
||||
}
|
||||
},
|
||||
favor: function(event, can, msg, cmd, field) {if (msg._hand) {return}
|
||||
var cmds = msg.detail, key = cmds[0];
|
||||
if (key == "river") {key = cmds[1], cmds = cmds.slice(1)}
|
||||
|
||||
can.page.Select(can, field, "div.item>span", function(item) {
|
||||
if (item.innerText == key) {
|
||||
item.click(), msg._hand = true;
|
||||
msg.Echo(can._name, " ", key)
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "组件交互", list: ["创建", "刷新"],
|
||||
"创建": function(event, can, meta, cmd, field) {
|
||||
can.Export(event, "create", "steam")
|
||||
},
|
||||
"刷新": function(event, can, meta, cmd, field) {
|
||||
can.Import(event, "update", can.Name())
|
||||
},
|
||||
})
|
||||
Volcanos("onchoice", {help: "组件菜单", list: ["创建", "刷新", "宽度"],
|
||||
"宽度": function(event, can, meta, cmd, field) {
|
||||
var begin;
|
||||
function end() {
|
||||
field.onmousedown = null;
|
||||
field.onmousemove = null;
|
||||
field.style.cursor = "";
|
||||
begin = null;
|
||||
}
|
||||
|
||||
field.style.cursor = "w-resize"
|
||||
field.onmousedown = function(event) {if (begin) {return end()}
|
||||
begin = {x: event.clientX, width: field.offsetWidth}
|
||||
}
|
||||
field.onmousemove = function(event) {if (!begin) {return}
|
||||
field.dataset.width = field.style.width = begin.width - event.clientX + begin.x + "px";
|
||||
can.Export(event, "", "layout");
|
||||
}
|
||||
|
||||
can.user.prompt("输入宽度", function(width) {
|
||||
field.dataset.width = field.style.width = width + "px"
|
||||
can.Export(event, "", "layout")
|
||||
end()
|
||||
}, field.offsetWidth)
|
||||
},
|
||||
})
|
||||
Volcanos("ondetail", {help: "组件详情", list: ["共享", "重命名", "删除"],
|
||||
"共享": function(event, can, line, value, cmd, item) {can.share || (can.share = {});
|
||||
var msg = can.Event(event);
|
||||
msg.Option("name", line.name)
|
||||
msg.Option("text", line.key)
|
||||
can.Export(event, can.Name(), "share")
|
||||
},
|
||||
"重命名": function(event, can, line, value, cmd, item) {
|
||||
can.user.prompt("输入新名:", function(name) {
|
||||
can.run(event, [can.Conf("river"), value, "rename", name], function(msg) {
|
||||
can.Import(event, "update", can.Name())
|
||||
})
|
||||
}, line.name)
|
||||
},
|
||||
"删除": function(event, can, line, value, cmd, item) {
|
||||
can.run(event, [can.Conf("river"), value, "remove"], function(msg) {
|
||||
can.Import(event, "update", can.Name())
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
})
|
||||
|
1
old/plugin/github.com/shylinux/echarts
Submodule
1
old/plugin/github.com/shylinux/echarts
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 7a6928917468fdc44c879de55baeaf933c052fc5
|
117
old/plugin/input.js
Normal file
117
old/plugin/input.js
Normal file
@ -0,0 +1,117 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
init: shy("添加控件", function(can, item, name, value, option) {
|
||||
var input = {type: "input", name: name, data: item};
|
||||
item.action = item.action || item.value || "";
|
||||
item.figure = item.figure || item.value || "";
|
||||
item.cb = item.cb || item.value || "";
|
||||
item.name && item.name.indexOf("@") == 0 && (item.name = item.name.slice(1)) && (item.position = item.position || "opts")
|
||||
|
||||
switch (item.type = item.type || item._type || item._input || "text") {
|
||||
case "upfile": item.type = "file"; break
|
||||
case "button":
|
||||
item.value = item.name || item.value;
|
||||
break
|
||||
case "select":
|
||||
item.values = typeof item.values == "string"? item.values.split(" "): item.values;
|
||||
if (!item.values && item.value) {
|
||||
item.values = item.value.split("|")
|
||||
item.value = item.values[0]
|
||||
}
|
||||
input.type = "select", input.list = item.values.map(function(value) {
|
||||
return {type: "option", value: value, inner: value};
|
||||
})
|
||||
item.className || can.page.ClassList.add(can, item, item.position||"args");
|
||||
break
|
||||
case "textarea":
|
||||
input.type = "textarea"
|
||||
// no break
|
||||
case "password":
|
||||
// no break
|
||||
case "text":
|
||||
item.className || can.page.ClassList.add(can, item, item.position||"args");
|
||||
item.value = value || item.value || "";
|
||||
item.autocomplete = "off";
|
||||
break
|
||||
}
|
||||
|
||||
if (item.value == "auto") {item.value = ""}
|
||||
item.figure && item.figure.indexOf("@") == 0 && (item.figure = item.figure.slice(1)) && can.require(["plugin/input/"+item.figure], function() {
|
||||
target.type != "button" && (target.value = "")
|
||||
})
|
||||
|
||||
var target = can.Dream(option, "input", input)[input.name];
|
||||
item.type == "text" && !target.placeholder && (target.placeholder = item.name || "");
|
||||
item.type != "button" && !target.title && (target.title = item.placeholder || item.name || "");
|
||||
item.type == "textarea" && can.page.Append(can, option, [{type: "br"}])
|
||||
item.type == "select" && (target.value = value || item.value || item.values[item.index||0])
|
||||
item.type == "button" && item.action == "auto" && can.run && can.run({});
|
||||
return target;
|
||||
}),
|
||||
path: function(event, can, value, cmd, target) {
|
||||
return target.value + (target.value == "" || target.value.endsWith("/")? "": "/") + value
|
||||
},
|
||||
})
|
||||
Volcanos("onfigure", {help: "控件交互", list: []})
|
||||
Volcanos("onaction", {help: "控件交互", list: [],
|
||||
onclick: function(event, can) {can.Select(event);
|
||||
var figure = can.onfigure[can.item.cb] || can.onfigure[can.item.figure]
|
||||
figure? can.page.AppendFigure(event, can, can.item.figure, can._name) && figure.click(event, can, can.item, can.item.name, event.target, can.figure):
|
||||
can.item.type == "button" && can.run(event)
|
||||
},
|
||||
onchange: function(event, can) {
|
||||
can.item.type == "select" && can.item.action == "auto" && can.Runs(event)
|
||||
},
|
||||
onkeydown: function(event, can) {
|
||||
if (event.target.tagName == "TEXTAREA") {return}
|
||||
|
||||
can.page.oninput(event, can, function(event) {
|
||||
switch (event.key) {
|
||||
case "b":
|
||||
can.Append(event)
|
||||
return true
|
||||
case "m":
|
||||
can.Clone(event)
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
switch (event.key) {
|
||||
case "Enter": can.run(event, []); break
|
||||
case "Escape": event.target.blur(); break
|
||||
default:
|
||||
if (event.target.value.endsWith("j") && event.key == "k") {
|
||||
can.page.DelText(event.target, event.target.selectionStart-1, 2);
|
||||
event.target.blur();
|
||||
break
|
||||
}
|
||||
return false
|
||||
}
|
||||
event.stopPropagation()
|
||||
event.preventDefault()
|
||||
return true
|
||||
},
|
||||
onkeyup: function(event, can) {
|
||||
if (event.target.tagName == "TEXTAREA") {return}
|
||||
|
||||
switch (event.key) {
|
||||
default: return false
|
||||
}
|
||||
event.stopPropagation()
|
||||
event.preventDefault()
|
||||
return true
|
||||
},
|
||||
})
|
||||
Volcanos("onchoice", {help: "控件菜单", list: ["全选", "复制", "清空"],
|
||||
"全选": function(event, can, msg, value, target) {
|
||||
can.target.focus(), can.target.setSelectionRange(0, can.target.value.length);
|
||||
},
|
||||
"复制": function(event, can, msg, value, target) {
|
||||
can.user.toast(can.page.CopyText(can, can.target.value), "复制成功")
|
||||
},
|
||||
"清空": function(event, can, msg, value, target) {
|
||||
can.target.value = "";
|
||||
},
|
||||
})
|
||||
Volcanos("ondetail", {help: "控件详情", list: []})
|
||||
Volcanos("onexport", {help: "导出数据", list: []})
|
||||
|
41
old/plugin/state.js
Normal file
41
old/plugin/state.js
Normal file
@ -0,0 +1,41 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: []})
|
||||
Volcanos("onaction", {help: "组件交互", list: []})
|
||||
Volcanos("onchoice", {help: "组件菜单", list: ["执行", "返回", "共享", "重命名", "选项", "加参", "减参", "克隆", "删除"],
|
||||
"执行": function(event, can, msg, cmd, field) {can.Runs(event)},
|
||||
"返回": function(event, can, msg, cmd, field) {can.Last(event)},
|
||||
"共享": function(event, can, msg, cmd, field) {
|
||||
can.user.input(event, can, ["name", "text"], function(event, cmd, meta, list) {
|
||||
var msg = can.Event(event);
|
||||
msg.Option("name", meta.name)
|
||||
msg.Option("text", meta.text)
|
||||
can.Conf("args", JSON.stringify(can.Option()))
|
||||
can.core.List(["node", "group", "index", "args"], function(key) {
|
||||
msg.Option(key, can.Conf(key))
|
||||
})
|
||||
can.Export(event, "action", "share")
|
||||
return true
|
||||
})
|
||||
},
|
||||
"重命名": function(event, can, msg, cmd, field) {var meta = field.Meta;
|
||||
meta.help = can.user.prompt("", function(help) {
|
||||
meta.help = help
|
||||
}, meta.help)
|
||||
},
|
||||
"选项": function(event, can, msg, cmd, field) {
|
||||
can.user.input(event, can, ["name", "value"], function(event, cmd, meta, list) {
|
||||
var data = {type: "text", value: meta.value||""}
|
||||
can.page.ClassList.add(can, data, "opts");
|
||||
|
||||
var input = {type: "input", name: meta.name, data: data};
|
||||
var target = can.Dream(can.option, "option", input)[input.name];
|
||||
return true
|
||||
})
|
||||
},
|
||||
"加参": function(event, can, msg, cmd, field) {can.Append()},
|
||||
"减参": function(event, can, msg, cmd, field) {can.Remove(event)},
|
||||
"克隆": function(event, can, msg, cmd, field) {can.Clone(event)},
|
||||
"删除": function(event, can, msg, cmd, field) {can.Delete(event)},
|
||||
})
|
||||
Volcanos("ondetail", {help: "组件详情", list: []})
|
||||
Volcanos("onexport", {help: "导出数据", list: []})
|
||||
|
143
old/plugin/table.js
Normal file
143
old/plugin/table.js
Normal file
@ -0,0 +1,143 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
init: function(can, msg, cb, output, action, option) {output.innerHTML = "";
|
||||
var table = can.page.AppendTable(can, output, msg, msg.append, function(event, value, key, index, tr, td) {
|
||||
can.ondetail["复制"](event, can, msg, value, index, key, td);
|
||||
can.Export(event, value.trim(), key, index)
|
||||
}, function(event, value, key, index, tr, td) {
|
||||
can.user.carte(event, shy("上下文菜单", can.ondetail, msg["field.detail"] || can.feature.detail || can.ondetail.list, function(event, cmd, meta) {var cb = meta[cmd];
|
||||
var sub = can.Event(event);
|
||||
msg.append.forEach(function(key) {sub.Option(key, msg[key][index].trim())})
|
||||
|
||||
typeof cb == "function"? cb(event, can, msg, index, key, cmd, td):
|
||||
can.run(event, ["action", typeof cb == "string"? cb: cmd, key, value.trim(), msg.Ids(index)], function(msg) {
|
||||
can.user.toast(msg.Result())
|
||||
if (msg.Option("field.reload") == "true") {
|
||||
can.run(event)
|
||||
}
|
||||
}, true)
|
||||
}))
|
||||
});
|
||||
|
||||
if (msg.Option("render") != "" && msg.result) {
|
||||
var story = can.page.Append(can, output, [{view: [msg.Option("render"), "div", msg.Result()]}]).first;
|
||||
can.page.Select(can, story, ".story", function(item) {var data = item.dataset;
|
||||
switch (item.tagName) {
|
||||
case "FIELDSET":
|
||||
can.Plugin(can, data.name, JSON.parse(data.meta||"{}"), function(event, cmds, cb, silent) {
|
||||
can.run(event, ["action", "story", data.type, data.name, data.text].concat(cmds), cb, true)
|
||||
}, item, function(sub) {
|
||||
|
||||
})
|
||||
break
|
||||
}
|
||||
})
|
||||
} else {
|
||||
switch (msg._xhr.getResponseHeader("content-type")) {
|
||||
case "image/png":
|
||||
if (msg._xhr.responseType != "blob") {
|
||||
break
|
||||
}
|
||||
var str = URL.createObjectURL(new Blob([msg._xhr.response], {type: "image/png"}));
|
||||
can.page.Append(can, output, [{img: [str]}])
|
||||
break
|
||||
|
||||
default:
|
||||
msg.result && can.page.Append(can, output, [{view: ["code", "div"], list: [
|
||||
{view: ["code", "pre", can.page.Display(msg.Result())]},
|
||||
]}]).code;
|
||||
}
|
||||
}
|
||||
return typeof cb == "function" && cb(msg);
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "组件交互", list: []})
|
||||
Volcanos("onchoice", {help: "组件菜单", list: ["返回", "清空", "复制", "下载"],
|
||||
"返回": function(event, can, msg, cmd, target) {
|
||||
can.run(event, ["", "Last"])
|
||||
},
|
||||
"清空": function(event, can, msg, cmd, target) {
|
||||
can.target.innerHTML = "";
|
||||
},
|
||||
"复制": function(event, can, msg, cmd, target) {
|
||||
var list = can.onexport.Format(can, msg, "data");
|
||||
can.user.toast(can.page.CopyText(can, list[2]), "复制成功")
|
||||
},
|
||||
"下载": function(event, can, msg, cmd, target) {msg = msg || can.msg;
|
||||
var list = can.onexport.Format(can, msg, msg._plugin_name||"data");
|
||||
can.page.Download(can, list[0]+list[1], list[2]);
|
||||
},
|
||||
})
|
||||
Volcanos("ondetail", {help: "组件详情", list: ["渲染", "选择", "编辑", "删除", "复制", "下载", "收藏"],
|
||||
"渲染": function(event, can, msg, index, key, cmd, td) {
|
||||
can._story = can._story || can.Plugin(can, msg.name[index], {inputs: [
|
||||
{_input: "button", name: "喜欢"},
|
||||
{_input: "button", name: "讨厌"},
|
||||
{_input: "button", name: "查看"},
|
||||
{_input: "button", name: "关闭"},
|
||||
]}, function(event, cmds, cb, silent) {
|
||||
var req = can.Event(event)
|
||||
switch (req.Option("_action")) {
|
||||
case "关闭":
|
||||
can.page.Remove(can, can._story.target)
|
||||
delete(can._story)
|
||||
break
|
||||
default:
|
||||
req.Option("pod", "");
|
||||
can.run(event, ["set", msg.pod[index], msg.engine[index], msg.favor[index], msg.id[index],
|
||||
msg.type[index], msg.name[index], msg.text[index]], function(res) {
|
||||
can._story.Show(res.Option("display")||"table", res, cb)
|
||||
}, true)
|
||||
}
|
||||
}, can.page.AppendField(can, document.body, "story", {name: msg.type[index], help: msg.name[index]}), function(plugin) {
|
||||
can.page.Modify(can, plugin.target, {style: {position: "absolute", left: "10px", top: "100px"}})
|
||||
})
|
||||
can._story.Runs(event)
|
||||
},
|
||||
"选择": "select",
|
||||
"删除": "delete",
|
||||
"编辑": function(event, can, msg, index, key, cmd, td) {
|
||||
var text = td.innerHTML;
|
||||
var input = can.page.Appends(can, td, [{type: "input", value: text, style: {width: td.clientWidth+"px"}, data: {onkeydown: function(event) {
|
||||
if (event.key != "Enter") {return}
|
||||
if (key == "value" && msg.key) {key = msg.key[index]}
|
||||
|
||||
var sub = can.Event(event);
|
||||
can.core.List(msg.append, function(key) {sub.Option(key, msg[key][index])})
|
||||
can.run(event, ["action", "modify", key, event.target.value, text, can.Option("id")||msg.Ids(index)], function(msg) {
|
||||
td.innerHTML = event.target.value;
|
||||
can.user.toast(msg.Result()||"修改成功")
|
||||
}, true)
|
||||
}}}]).first;
|
||||
input.focus();
|
||||
input.setSelectionRange(0, input.value.length);
|
||||
},
|
||||
"复制": function(event, can, msg, index, key, cmd, target) {
|
||||
can.user.toast(can.page.CopyText(can, target.innerHTML), "复制成功")
|
||||
},
|
||||
"下载": function(event, can, msg, index, key, cmd, target) {
|
||||
can.page.Download(can, key, target.innerHTML);
|
||||
},
|
||||
"收藏": function(event, can, msg, index, key, cmd, target) {
|
||||
can.user.input(event, can, [
|
||||
{_input: "text", name: "favor", value: can._last_favor||""},
|
||||
{_input: "text", name: "type", value: msg.type && msg.type[index] || ""},
|
||||
{_input: "text", name: "name", value: msg.name && msg.name[index] || ""},
|
||||
{_input: "text", name: "text", value: msg.text && msg.text[index] || ""},
|
||||
], function(event, cmd, meta, list) {can._last_favor = meta.favor;
|
||||
can.run(event, ["action", "favor", meta.favor, meta.type, meta.name, meta.text], function(msg) {
|
||||
can.user.toast(msg.Result()||"收藏成功");
|
||||
}, true)
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
Format: function(can, msg, name) {
|
||||
var ext = ".csv", txt = can.page.Select(can, can.target, "tr", function(tr) {
|
||||
return can.page.Select(can, tr, "td,th", function(td) {return td.innerText}).join(",")
|
||||
}).join("\n");
|
||||
|
||||
!txt && (ext = ".txt", txt = msg.result && msg.result.join("") || "");
|
||||
return [name, ext, txt]
|
||||
},
|
||||
})
|
||||
|
@ -5,12 +5,11 @@
|
||||
<title>volcanos</title>
|
||||
|
||||
<link rel="shortcut icon" type="image/ico" href="favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="style_old.css">
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<script src="proto.js"></script>
|
||||
<script src="page/index.js"></script>
|
||||
<script src="proto_old.js"></script>
|
||||
<script src="frame_old.js"></script>
|
||||
</body>
|
||||
|
||||
|
||||
|
@ -1,46 +1,25 @@
|
||||
var Config = {iceberg: "/chat/", volcano: "",
|
||||
libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"],
|
||||
main: "chat", list: [
|
||||
"page/chat",
|
||||
"pane/float/Toast", "pane/float/Carte",
|
||||
"pane/float/Tutor", "pane/float/Debug",
|
||||
"pane/float/Login", "pane/float/Favor",
|
||||
|
||||
"pane/Header",
|
||||
"pane/River", "pane/Storm",
|
||||
"pane/Target", "pane/Source", "pane/Action",
|
||||
"pane/Ocean", "pane/Steam",
|
||||
"pane/Footer",
|
||||
|
||||
"plugin/state", "plugin/table", "plugin/input",
|
||||
"plugin/input/date", "plugin/input/key",
|
||||
], pane: [
|
||||
{group: "index", name: "Toast", path: "float/", pos: "dialog", duration: 3000},
|
||||
{group: "index", name: "Carte", path: "float/", pos: "dialog"},
|
||||
{group: "index", name: "Tutor", path: "float/", pos: "dialog"},
|
||||
{group: "index", name: "Debug", path: "float/", pos: "dialog"},
|
||||
{group: "index", name: "Login", path: "float/", pos: "dialog"},
|
||||
{group: "index", name: "Favor", path: "float/", pos: "dialog"},
|
||||
|
||||
{group: "index", name: "Header", pos: "head", state: ["time", "user", "link"]},
|
||||
{group: "index", name: "River", pos: "left"},
|
||||
{group: "index", name: "Storm", pos: "right"},
|
||||
|
||||
{group: "index", name: "Target", pos: "top"},
|
||||
{group: "index", name: "Source", pos: "center"},
|
||||
{group: "index", name: "Action", pos: "bottom"},
|
||||
|
||||
{group: "index", name: "Ocean", pos: "dialog", def_name: "meet"},
|
||||
{group: "index", name: "Steam", pos: "dialog", def_name: "miss"},
|
||||
{group: "index", name: "Footer", pos: "foot", state: ["ntxt", "ncmd"]},
|
||||
|
||||
], title: "volcanos", topic: "black", layout: {def: "工作", list: ["工作", "办公", "聊天"], size: {
|
||||
"最大": {head: 0, foot: 0, left: 0, right: 0, bottom: -1, center: 0, top: 0},
|
||||
"工作": {head: 30, foot: 30, left: 0, right: 100, bottom: -1, center: 0, top: 0},
|
||||
"办公": {head: 30, foot: 30, left: 100, right: 100, bottom: -1, center: 0, top: 0},
|
||||
"聊天": {head: 30, foot: 30, left: 100, right: 100, bottom: 300, center: 40, top: -2},
|
||||
"最长": {head: 30, foot: 30, left: 0, right: 0, bottom: -2, center: 0, top: 0},
|
||||
"全屏": {head: 0, foot: 0, left: 0, right: 0, bottom: -1, center: 0, top: 0},
|
||||
}, border: 4,
|
||||
}, scroll: {line: 100},
|
||||
var Config = {name: "demo", volcano: "frame.js", iceberg: "/chat/", intshell: "plug.sh",
|
||||
libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"], panes: [
|
||||
{type: "pane", name: "Header", help: "标题栏", pos: "head", list: ["pane/Header.js", "pane/Header.css"], state: ["time"]},
|
||||
{type: "pane", name: "River", help: "群聊组", pos: "left", list: ["pane/River.js", "pane/River.css"]},
|
||||
{type: "pane", name: "Storm", help: "应用流", pos: "right", list: ["pane/Storm.js", "pane/Storm.css"]},
|
||||
{type: "pane", name: "Action", help: "工作台", pos: "middle", list: ["pane/Action.js", "pane/Action.css"]},
|
||||
{type: "pane", name: "Footer", help: "状态条", pos: "foot", list: ["pane/Footer.js", "pane/Footer.css"]},
|
||||
], main: {name: "Header", engine: "remote", list: []},
|
||||
list: ["plugin/state.js", "plugin/input.js", "plugin/table.js"],
|
||||
}
|
||||
|
||||
var Preload = Config.libs; Config.panes.forEach(function(pane) {
|
||||
Preload = Preload.concat(pane.list);
|
||||
}); Preload = Preload.concat(Config.list)
|
||||
|
||||
Volcanos(Config.name, { _target: document.body,
|
||||
_head: document.head, _body: document.body,
|
||||
_width: window.innerWidth, _height: window.innerHeight,
|
||||
}, Preload.concat(Config.volcano), function(can) { // 程序入口
|
||||
can.onimport._init(can, can.Conf(Config), [], function(msg) {
|
||||
console.log(can._root, can._name, "start", can, msg);
|
||||
can.Footer.onaction._init(can.Footer, msg);
|
||||
}, can._target)
|
||||
})
|
||||
|
||||
|
@ -1,4 +1,10 @@
|
||||
fieldset.Action div.output div.item:hover {
|
||||
fieldset.Action {
|
||||
min-width:160px;
|
||||
min-height:160px;
|
||||
padding-left:10px;
|
||||
padding-right:10px;
|
||||
}
|
||||
fieldset.Action>div.output>div.item:hover {
|
||||
background-color:lightblue;
|
||||
}
|
||||
|
||||
|
237
pane/Action.js
237
pane/Action.js
@ -1,218 +1,41 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_begin: function(can) {},
|
||||
_start: function(can) {
|
||||
can.page.Select(can, can.action, "input,select", function(input) {
|
||||
input.value = can.user.Search(can, input.name) || input.value || ""
|
||||
})
|
||||
_init: function(can, meta, list, cb, target) {
|
||||
},
|
||||
|
||||
init: function(event, can, msg, cmd, field) {can.output.innerHTML = "";
|
||||
can._local[msg.cmds[0]] = can._local[msg.cmds[0]] || {}
|
||||
can._local[msg.cmds[0]][msg.cmds[1]] = msg.Table(function(item, index) {if (!item.name) {return}
|
||||
// 添加插件
|
||||
var plugin = can[item.name] = can.Plugin(can, item.name, item, function(event, cmds, cbs) {
|
||||
can.run(event, [item.river, item.storm, item.action].concat(cmds), cbs)
|
||||
}, can.page.AppendField(can, can.output, "item "+item.name, item))
|
||||
return can._plugins.push(plugin), plugin
|
||||
})
|
||||
})
|
||||
Volcanos("onaction", {help: "交互操作", list: [],
|
||||
_init: function(can, msg, list, cb, target) {
|
||||
can.onexport._init(can, msg, list, cb, target)
|
||||
},
|
||||
river: function(event, can, value, cmd, field) {if (value == "update") {return}
|
||||
can.Conf("temp_river", value)
|
||||
},
|
||||
storm: function(event, can, value, cmd, field) {if (value == "update") {return}
|
||||
// 保存界面
|
||||
can.Cache(can.Conf("river")+"."+can.Conf("storm"), can.output, "some");
|
||||
if (can.Cache(can.Conf("river", can.Conf("temp_river"))+"."+can.Conf("storm", value), can.output)) {
|
||||
// 恢复界面
|
||||
return
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) { var key = "action";
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
can.run(msg._event, ["search", "Storm.onaction._init"], function(msg) {
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
can.Cache(can.Conf("river")+can.Conf("storm"), can._output, can.Conf(key));
|
||||
var river = can.Conf("river", msg.Option("river"));
|
||||
var storm = can.Conf("storm", msg.Option("storm"));
|
||||
console.log(can._root, can._name, "show", river, storm);
|
||||
if (can.Conf(key, msg.Option(key, can.Cache(river+"."+storm, can._output)))) {
|
||||
typeof cb == "function" && cb(msg); return
|
||||
}
|
||||
// 刷新界面
|
||||
can.run(event, [can.Conf("river"), can.Conf("storm")], function(msg) {
|
||||
can.onimport.init(event, can, msg, cmd, can.output)
|
||||
})
|
||||
},
|
||||
pod: function(event, can, value, cmd, field) {
|
||||
can.user.title(value)
|
||||
},
|
||||
you: function(event, can, value, cmd, field) {
|
||||
can.user.title(value)
|
||||
},
|
||||
|
||||
layout: function(event, can, value, cmd, field) {value},
|
||||
scroll: function(event, can, value, cmd, field) {can.layout = value;
|
||||
can.output.parentElement.scrollBy(value.x, value.y)
|
||||
},
|
||||
favor: function(event, can, msg, cmd, field) {if (msg._hand) {return}
|
||||
var cmds = msg.detail, key = cmds[0];
|
||||
if (key == can.Name()) {key = cmds[1], cmds = cmds.slice(1)}
|
||||
|
||||
// 下发数据
|
||||
can.core.Item(can._local, function(river, list) {
|
||||
can.core.Item(list, function(storm, list) {
|
||||
can.core.List(list, function(sub) {
|
||||
if (sub._name == key) {
|
||||
sub.Select(event), msg._hand = true;
|
||||
msg.Echo(can._name, " ", key)
|
||||
can.run(msg._event, [river, storm], function(msg) { can._output.innerHTML = "";
|
||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||
msg.Table(function(value, index, array) {
|
||||
// 添加列表
|
||||
//
|
||||
can.onappend._init(can, value, Config.libs.concat(["plugin/state.js"]), function(sub) {
|
||||
sub.run = function(event, cmds, cb, silent) {
|
||||
can.run(event, [river, storm, index].concat(cmds), cb, silent)
|
||||
}
|
||||
})
|
||||
}, can._output)
|
||||
can.Conf(key, "which")
|
||||
});
|
||||
msg.Option(key, can.Conf(key))
|
||||
typeof cb == "function" && cb(msg)
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "组件交互", list: [
|
||||
["layout"].concat(Config.layout.list), "清屏", "刷新", "并行","串行",
|
||||
["action", "正常", "竖排", "编排", "定位", "定形"],
|
||||
{input: "pod"}, {input: "you"},
|
||||
{input: "hot"}, {input: "top"},
|
||||
{input: "grp"}, {input: "lab"},
|
||||
],
|
||||
layout: function(event, can, value, cmd, field) {can.Export(event, cmd, value)},
|
||||
|
||||
"清屏": function(event, can, msg, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item>div.output", function(item) {
|
||||
item.innerHTML = "";
|
||||
})
|
||||
},
|
||||
"刷新": function(event, can, msg, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item>div.output", function(item) {
|
||||
item.innerHTML = "";
|
||||
})
|
||||
can.run(event, [can.Conf("river"), can.Conf("storm")], function(msg) {
|
||||
can.onimport.init(event, can, msg, cmd, can.output)
|
||||
})
|
||||
},
|
||||
"并行": function(event, can, msg, cmd, field) {
|
||||
can.page.Select(can, field, "fieldset.item", function(field) {
|
||||
can.page.Select(can, field, "input[type=button]", function(input, index) {
|
||||
index == 0 && input.click()
|
||||
})
|
||||
})
|
||||
},
|
||||
"串行": function(event, can, msg, cmd, field) {
|
||||
can.core.Next(can.page.Select(can, field, "fieldset.item", function(field) {
|
||||
return field
|
||||
}), function(field, cb) {
|
||||
can.page.Select(can, field, "input[type=button]", function(input, index) {
|
||||
index == 0 && field.Check(event, input, cb)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
"正常": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.setAttribute("draggable", false)
|
||||
item.style.position = ""
|
||||
item.style.cursor = ""
|
||||
item.style.clear = ""
|
||||
item.style.left = ""
|
||||
item.style.top = ""
|
||||
})
|
||||
},
|
||||
"竖排": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.clear = "both"
|
||||
})
|
||||
},
|
||||
"编排": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.target, "fieldset.item", function(item) {
|
||||
item.setAttribute("draggable", true)
|
||||
item.ondragstart = function(event) {can.drag = event.target}
|
||||
item.ondragover = function(event) {event.preventDefault()}
|
||||
item.ondrop = function(event) {event.preventDefault()
|
||||
item.parentNode.insertBefore(can.drag, item)
|
||||
}
|
||||
})
|
||||
},
|
||||
"定位": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.left = item.offsetLeft + "px"
|
||||
item.style.top = item.offsetTop + "px"
|
||||
})
|
||||
|
||||
var max, current, begin;
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.position = "absolute"
|
||||
|
||||
item.onmousedown = function(event) {if (can.Action("action") != "定位") {return}
|
||||
if (current) {
|
||||
// 更新位置
|
||||
current.style.left = begin.left + event.clientX - begin.x + "px"
|
||||
current.style.top = begin.top + event.clientY - begin.y + "px"
|
||||
current = null;
|
||||
return
|
||||
}
|
||||
// 记录位置
|
||||
current = item;
|
||||
current.style["z-index"] = max = max + 1
|
||||
begin = {x: event.clientX, y: event.clientY, left: item.offsetLeft, top: item.offsetTop}
|
||||
};
|
||||
|
||||
can.output.onmousemove = item.onmousemove = function(event) {if (!current) {return}
|
||||
// 移动位置
|
||||
current.style.left = begin.left + event.clientX - begin.x + "px"
|
||||
current.style.top = begin.top + event.clientY - begin.y + "px"
|
||||
}
|
||||
})
|
||||
},
|
||||
"定形": function(event, can, value, cmd, field) {
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.top = item.offsetTop + "px"
|
||||
item.style.left = item.offsetLeft + "px"
|
||||
item.style.width = item.offsetWidth + "px"
|
||||
item.style.height = item.offsetHeight + "px"
|
||||
})
|
||||
|
||||
var max, pos, current, begin;
|
||||
can.page.Select(can, can.output, "fieldset.item", function(item) {
|
||||
item.style.position = "absolute"
|
||||
|
||||
item.onmousedown = function(event) {
|
||||
if (can.Action("action") != "定形") {return}
|
||||
if (current) {current = null; return}
|
||||
|
||||
// 记录位置
|
||||
current = item;
|
||||
current.style["z-index"] = max = max + 1
|
||||
begin = {
|
||||
x: event.clientX, y: event.clientY,
|
||||
left: item.offsetLeft, top: item.offsetTop,
|
||||
width: item.offsetWidth, height: item.offsetHeight,
|
||||
}
|
||||
};
|
||||
|
||||
item.onmousemove = function(event) {
|
||||
if (can.Action("action") != "定形") {return}
|
||||
var pos = can.page.Prepos(event, item)
|
||||
if (!current) {return}
|
||||
can.page.Resize(event, current, begin, pos)
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onchoice", {help: "组件菜单", list: ["共享", "保存", "刷新"],
|
||||
"共享": function(event, can, msg, cmd, field) {
|
||||
can.user.input(event, can, ["name", "text"], function(event, cmd, meta, list) {
|
||||
var msg = can.Event(event);
|
||||
msg.Option("name", meta.name)
|
||||
msg.Option("text", meta.key)
|
||||
cmd == "提交" && can.Export(event, can.Name(), "share")
|
||||
return true
|
||||
})
|
||||
},
|
||||
"保存": function(event, can, msg, cmd, field) {
|
||||
var list = []
|
||||
can.page.Select(can, field, "fieldset.item", function(item) {var meta = item.Meta
|
||||
can.page.Select(can, item, "form.option", function(option) {
|
||||
if (option.parentNode != item) {return}
|
||||
meta.args = can.page.Select(can, option, ".args", function(item) {return item.value})
|
||||
})
|
||||
list.push(meta.node||"", meta.group, meta.index, meta.help, JSON.stringify(meta.args||[]))
|
||||
})
|
||||
can.run(event, [can.Conf("river"), can.Conf("storm"), "save"].concat(list), function(msg) {
|
||||
can.user.toast("保存成功")
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("ondetail", {help: "组件详情", list: []})
|
||||
Volcanos("onexport", {help: "导出数据", list: []})
|
||||
|
||||
|
@ -1,29 +1,19 @@
|
||||
fieldset.Footer {
|
||||
clear:both;
|
||||
overflow:hidden;
|
||||
height:32px;
|
||||
clear:both;
|
||||
}
|
||||
fieldset.Footer>div.action {
|
||||
padding:0;
|
||||
fieldset.Footer>div {
|
||||
margin:7px 0;
|
||||
}
|
||||
fieldset.Footer>div.output div.title {
|
||||
margin-left:5px;
|
||||
float:left;
|
||||
}
|
||||
fieldset.Footer>div.output div.magic {
|
||||
float:right;
|
||||
margin-top:-6px;
|
||||
}
|
||||
fieldset.Footer>div.output div.magic>label {
|
||||
margin-right:2px;
|
||||
}
|
||||
fieldset.Footer>div.output div.magic>input {
|
||||
background-color:black;
|
||||
color:lightgreen;;
|
||||
}
|
||||
fieldset.Footer>div.output div.state {
|
||||
float:right;
|
||||
}
|
||||
fieldset.Footer>div.output div.state div {
|
||||
fieldset.Footer>div.output div.state>div {
|
||||
margin-right:5px;
|
||||
float:right;
|
||||
}
|
||||
|
||||
|
@ -1,31 +1,25 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [],
|
||||
_init: function(can, meta, list, cb, output, action, option, field) {output.innerHTML = "";
|
||||
can._init = function() {
|
||||
can.run({}, [], function(msg) {
|
||||
can.core.List(msg.result, function(title) {
|
||||
can.page.Append(can, output, [{view: "title", list: [{text: title, className: "title"}]}])
|
||||
})
|
||||
|
||||
can.ui = can.page.Append(can, output, [{view: "state", list: can.core.List(meta.state, function(item) {
|
||||
return {text: meta[item]||"", className: item, click: function(event) {can.Export(event, meta[item], item)}};
|
||||
})}])
|
||||
})
|
||||
}
|
||||
},
|
||||
username: function(event, can, value, cmd, field) {can._init()},
|
||||
|
||||
email: function(event, can, value, cmd, field) {
|
||||
can.ui[cmd].innerHTML = value
|
||||
},
|
||||
ntxt: function(event, can, value, cmd, field) {var state = can.Conf(cmd);
|
||||
can.ui[cmd].innerHTML = cmd+":"+ can.Conf(cmd, can.base.Int(value)+can.base.Int(state))
|
||||
},
|
||||
ncmd: function(event, can, value, cmd, field) {var state = can.Conf(cmd);
|
||||
can.ui && (can.ui[cmd].innerHTML = cmd+":"+ can.Conf(cmd, can.base.Int(value)+can.base.Int(state)))
|
||||
_init: function(can, meta, list, cb, target) {
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "交互数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) {
|
||||
can.onexport._init(can, msg, list, cb, target)
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: [],
|
||||
_init: function(can, msg, list, cb, target) { can._output.innerHTML = "";
|
||||
can.run(msg._event, [], function(msg) {
|
||||
console.log(can._root, can._name, "show", msg.result)
|
||||
can.core.List(msg.result, function(title) {
|
||||
can.page.Append(can, can._output, [{view: ["title", "div", title]}])
|
||||
})
|
||||
|
||||
console.log(can._root, can._name, "show", can.Conf("state"))
|
||||
can.ui = can.page.Append(can, can._output, [{view: "state", list: can.core.List(can.Conf("state"), function(item) {
|
||||
return {text: can.Conf(item)||"", className: item, click: function(event) {can.onaction[item](event, can, item)}};
|
||||
})}])
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "组件交互", list: []})
|
||||
Volcanos("onchoice", {help: "组件菜单", list: []})
|
||||
Volcanos("ondetail", {help: "组件详情", list: []})
|
||||
Volcanos("onexport", {help: "导出数据", list: []})
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user