1
0
forked from x/volcanos
This commit is contained in:
shylinux 2020-04-14 11:30:42 +08:00
parent 62d4e73cc9
commit ebc3654613
29 changed files with 72 additions and 63 deletions

View File

@ -1,6 +1,6 @@
# Volcanos.js # volcanos
volcanos是一个前端框架通过模块化、配置化提升项目的复用性、灵活性 volcanos是一个前端框架通过模块化、共享化、自动化、快速的创建、共享应用程序、数据
## 1 原型 proto.js ## 1 原型 proto.js
### 1.1 ID 生成器 ### 1.1 ID 生成器
@ -20,27 +20,33 @@ volcanos是一个前端框架通过模块化、配置化提升项目的复用
### 2.4 Inputs 控件 ### 2.4 Inputs 控件
### 2.5 Output 组件 ### 2.5 Output 组件
## 3 核心模块 lib/ ## 3 工具模块 lib/
### 3.1 base 模块 ### 3.1 数据类型 base.js
### 3.2 core 模块 ### 3.2 数据结构 core.js
### 3.3 misc 模块 ### 3.3 后端通信 misc.js
### 3.4 page 模块 ### 3.4 网页操作 page.js
### 3.5 user 模块 ### 3.5 用户交互 user.js
## 4 事件模块 pane/ ## 4 网页模块 page/
### 4.1 onimport 模块 ### 4.1 应用页面 index.html
### 4.2 onaction 模块 ### 4.2 共享页面 share.html
### 4.3 onchoice 模块
### 4.4 ondetail 模块
### 4.5 onexport 模块
## 5 配置 order.js ## 4 面板模块 pane/
### 5.1 Header ### 4.1 标题栏 Header.js
### 5.2 Ocean ### 4.2 用户列表 Ocean.js
### 5.3 River ### 4.3 群组列表 River.js
### 5.4 Target ### 4.4 工作台 Action.js
### 5.5 Source ### 4.5 应用列表 Storm.js
### 5.6 Action ### 4.6 设备列表 Steam.js
### 5.7 Storm ### 4.7 状态栏 Footer.js
### 5.8 Steam
### 5.9 Footer ## 5 插件模块 plugin/
### 5.1 插件模块 state.js
### 5.2 输入模块 input.js
### 5.3 输出模块 table.js
### 5.4 输入插件 input/
### 5.5 输出插件 story/
### 5.6 其它模块 local/
## 6 客户端 client/
### 6.1 小程序 mp/

View File

@ -33,7 +33,7 @@ var can = Volcanos("chat", {
}, },
run: function(event, option, cmds, cb) {can.misc.Run(event, page, option, cmds, cb)}, run: function(event, option, cmds, cb) {can.misc.Run(event, page, option, cmds, cb)},
}, Config.libs.concat(["page/"+name, "page/"+topic+".css"]), function(page) { }, Config.libs.concat(["page/"+name, "page/topic/"+topic+".css"]), function(page) {
// 加载配置 // 加载配置
page.onimport._init && page.onimport._init(page, page.Conf(conf), body) page.onimport._init && page.onimport._init(page, page.Conf(conf), body)
@ -128,7 +128,7 @@ var can = Volcanos("chat", {
can.run(event, pane.option.dataset, cmds, cb) can.run(event, pane.option.dataset, cmds, cb)
return msg return msg
}, },
}, Config.libs.concat(["pane/"+name]), function(pane) {can.Dream(document.head, "pane/"+name+".css") }, Config.libs.concat(["pane/"+(meta.path||"")+name]), function(pane) {can.Dream(document.head, "pane/"+(meta.path||"")+name+".css")
pane.onimport._init && pane.onimport._init(pane, pane.Conf(meta), pane.output, pane.action, pane.option, field) pane.onimport._init && pane.onimport._init(pane, pane.Conf(meta), pane.output, pane.action, pane.option, field)
typeof cb == "function" && cb(pane) typeof cb == "function" && cb(pane)
}, meta) }, meta)

View File

@ -59,7 +59,7 @@ Volcanos("misc", {help: "工具模块",
return msg[key] = value, key return msg[key] = value, key
}) })
msg._hand = true, can.misc.POST(can, msg, can.Conf("iceberg")+(msg.names||dataset.names||event.names||"").toLowerCase(), option, function(msg) { msg._hand = true, can.misc.POST(can, msg, can.Conf("iceberg")+(msg.name||dataset.name||event.name||"").toLowerCase(), option, function(msg) {
typeof cb == "function" && cb(msg) typeof cb == "function" && cb(msg)
}), delete(event.msg) }), delete(event.msg)
}), }),

View File

@ -145,7 +145,7 @@ Volcanos("page", {help: "网页模块",
// 创建节点 // 创建节点
name = name || data.className || type || ""; name = name || data.className || type || "";
name && (data.name = data.name || item.name); !data.name && item.name && (data.name = item.name)
var node = can.page.Create(can, type, data); var node = can.page.Create(can, type, data);
value.last = node, value.first || (value.first = node), name && (value[name] = value[data.className||""] = value[type] = node); value.last = node, value.first || (value.first = node), name && (value[name] = value[data.className||""] = value[type] = node);
item.list && can.page.Append(can, node, item.list, value); item.list && can.page.Append(can, node, item.list, value);
@ -196,7 +196,7 @@ Volcanos("page", {help: "网页模块",
AppendField: shy("添加插件", function(can, target, type, item) { AppendField: shy("添加插件", function(can, target, type, item) {
typeof item.help == "string" && item.help.startsWith("[") && (item.help = JSON.parse(item.help)) typeof item.help == "string" && item.help.startsWith("[") && (item.help = JSON.parse(item.help))
var dataset = {}; item && item.name && (dataset.names = item.name); var dataset = {}; item && item.name && (dataset.name = item.name);
var field = can.page.Append(can, target, [{view: [type, "fieldset"], list: [ var field = can.page.Append(can, target, [{view: [type, "fieldset"], list: [
item.pos? undefined: {text: [(item.nick||item.name||"")+"("+((typeof item.help == "string"? item.help: item.help.length > 0 && item.help[0])||"")+")", "legend"]}, item.pos? undefined: {text: [(item.nick||item.name||"")+"("+((typeof item.help == "string"? item.help: item.help.length > 0 && item.help[0])||"")+")", "legend"]},
{view: ["option", "form"], dataset: dataset, list: []}, {view: ["option", "form"], dataset: dataset, list: []},

View File

@ -2,16 +2,15 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=0.7,user-scalable=no"> <meta name="viewport" content="width=device-width,initial-scale=0.7,user-scalable=no">
<meta name="viewport" content="width=device-width,initial-scale=0.7,user-scalable=no">
<title>volcanos</title> <title>volcanos</title>
<link rel="shortcut icon" type="image/ico" href="/static/volcanos/favicon.ico"> <link rel="shortcut icon" type="image/ico" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="/static/volcanos/style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<script src="/static/volcanos/page/index.js"></script> <script src="page/index.js"></script>
<script src="/static/volcanos/proto.js"></script> <script src="proto.js"></script>
<script src="/static/volcanos/frame.js"></script> <script src="frame.js"></script>
</body> </body>

View File

@ -1,37 +1,38 @@
var Config = {iceberg: "/chat/", volcano: "/static/volcanos/", var Config = {iceberg: "/chat/", volcano: "",
libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"], libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"],
main: "chat", list: ["page/chat", main: "chat", list: [
"pane/Toast", "pane/Carte", "page/chat",
"pane/Debug", "pane/Tutor", "pane/Favor", "pane/Login", "pane/float/Toast", "pane/float/Carte",
"pane/float/Tutor", "pane/float/Debug",
"pane/float/Login", "pane/float/Favor",
"pane/Header", "pane/Header",
"pane/Ocean", "pane/River", "pane/Storm", "pane/Steam", "pane/River", "pane/Storm",
"pane/Target", "pane/Source", "pane/Action", "pane/Target", "pane/Source", "pane/Action",
"pane/Ocean", "pane/Steam",
"pane/Footer", "pane/Footer",
"plugin/state", "plugin/table", "plugin/input", "plugin/state", "plugin/table", "plugin/input",
"plugin/input/date", "plugin/input/key", "plugin/input/date", "plugin/input/key",
], pane: [ ], pane: [
{group: "index", name: "Toast", pos: "dialog", duration: 3000}, {group: "index", name: "Toast", path: "float/", pos: "dialog", duration: 3000},
{group: "index", name: "Carte", pos: "dialog"}, {group: "index", name: "Carte", path: "float/", pos: "dialog"},
{group: "index", name: "Debug", pos: "dialog"}, {group: "index", name: "Tutor", path: "float/", pos: "dialog"},
{group: "index", name: "Tutor", pos: "dialog"}, {group: "index", name: "Debug", path: "float/", pos: "dialog"},
{group: "index", name: "Favor", pos: "dialog"}, {group: "index", name: "Login", path: "float/", pos: "dialog"},
{group: "index", name: "Login", pos: "dialog"}, {group: "index", name: "Favor", path: "float/", pos: "dialog"},
{group: "index", name: "Header", pos: "head", {group: "index", name: "Header", pos: "head", state: ["time", "user", "link"]},
title: "github.com/shylinux/context",
state: ["time", "user", "link"],
},
{group: "index", name: "Ocean", pos: "dialog", def_name: "meet"},
{group: "index", name: "River", pos: "left"}, {group: "index", name: "River", pos: "left"},
{group: "index", name: "Storm", pos: "right"}, {group: "index", name: "Storm", pos: "right"},
{group: "index", name: "Steam", pos: "dialog", def_name: "miss"},
{group: "index", name: "Target", pos: "top"}, {group: "index", name: "Target", pos: "top"},
{group: "index", name: "Source", pos: "center"}, {group: "index", name: "Source", pos: "center"},
{group: "index", name: "Action", pos: "bottom"}, {group: "index", name: "Action", pos: "bottom"},
{group: "index", name: "Footer", pos: "foot", state: ["ntxt", "ncmd"], title: '<a href="mailto:shylinux@163.com">shylinux@163.com</a>'},
{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: { ], title: "volcanos", topic: "black", layout: {def: "工作", list: ["工作", "办公", "聊天"], size: {
"最大": {head: 0, foot: 0, left: 0, right: 0, bottom: -1, center: 0, top: 0}, "最大": {head: 0, foot: 0, left: 0, right: 0, bottom: -1, center: 0, top: 0},

View File

@ -1,6 +1,8 @@
var Config = {iceberg: "", volcano: "/static/volcanos/", var Config = {iceberg: "", volcano: "/static/volcanos/",
libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"], libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"],
main: "chat", list: [ main: "chat", list: [
"pane/float/Toast", "pane/float/Carte",
"pane/Header", "pane/Header",
"pane/River", "pane/Storm", "pane/River", "pane/Storm",
"pane/Target", "pane/Source", "pane/Action", "pane/Target", "pane/Source", "pane/Action",

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -13,6 +13,6 @@ Volcanos("onfigure", {help: "控件详情", list: [],
}); });
}}, }},
}, [ }, [
"/plugin/github.com/shylinux/echarts/echarts.js", "plugin/github.com/shylinux/echarts/echarts.js",
"/plugin/github.com/shylinux/echarts/china.js", "plugin/github.com/shylinux/echarts/china.js",
]) ])

View File

@ -126,7 +126,7 @@ Volcanos("onimport", {help: "导入数据", list: [],
call(prefix.concat(list.list)) call(prefix.concat(list.list))
return can.keys = [], can.Status(event, can.keys, "keys") return can.keys = [], can.Status(event, can.keys, "keys")
}, },
}, ["/plugin/local/wiki/draw.css"]) }, ["plugin/local/wiki/draw.css"])
Volcanos("onfigure", {help: "图形绘制", list: [], Volcanos("onfigure", {help: "图形绘制", list: [],
_spawn: function(sup, can) {can.sup = sup}, _spawn: function(sup, can) {can.sup = sup},
_swell: function(can, sub) { _swell: function(can, sub) {
@ -483,7 +483,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
return value.tagName + ": (" + value.points.baseVal.value + ")" return value.tagName + ": (" + value.points.baseVal.value + ")"
}, },
}, },
}, Config.libs.concat(["/plugin/local/wiki/draw/heart"])) }, Config.libs.concat(["plugin/local/wiki/draw/heart"]))
Volcanos("onaction", {help: "组件菜单", list: ["保存", "清空", "删除", "添加", Volcanos("onaction", {help: "组件菜单", list: ["保存", "清空", "删除", "添加",
["group", "svg"], ["group", "svg"],
["font-size", 12, 16, 18, 24, 32], ["font-size", 12, 16, 18, 24, 32],

View File

@ -18,8 +18,8 @@ Volcanos("onimport", {help: "导入数据", list: [],
} }
// can.page.Append(can, action, [{type: "script", src: "https://cdn.bootcss.com/echarts/4.2.0-rc.2/echarts.js"}]); // can.page.Append(can, action, [{type: "script", src: "https://cdn.bootcss.com/echarts/4.2.0-rc.2/echarts.js"}]);
can.page.Append(can, output, [{include: ["/plugin/github.com/shylinux/echarts/echarts.js", function(event) { can.page.Append(can, output, [{include: ["plugin/github.com/shylinux/echarts/echarts.js", function(event) {
can.page.Append(can, output, [{include: ["/plugin/github.com/shylinux/echarts/china.js", function(event) { can.page.Append(can, output, [{include: ["plugin/github.com/shylinux/echarts/china.js", function(event) {
var china_chart = echarts.init(can.page.Append(can, output, [{type: "div", style: {width: "600px", height: "400px"}}]).last); var china_chart = echarts.init(can.page.Append(can, output, [{type: "div", style: {width: "600px", height: "400px"}}]).last);
var data = msg.Table() var data = msg.Table()

View File

@ -34,7 +34,7 @@ Volcanos("onimport", {help: "导入数据", list: [],
}) })
return typeof cb == "function" && cb(msg) return typeof cb == "function" && cb(msg)
}, },
}, ["/plugin/local/wiki/word.css"]) }, ["plugin/local/wiki/word.css"])
Volcanos("onfigure", {help: "图形绘制", list: [], Volcanos("onfigure", {help: "图形绘制", list: [],
_spawn: function(sup, can) {can.sup = sup}, _spawn: function(sup, can) {can.sup = sup},
_swell: function(can, sub) {}, _swell: function(can, sub) {},

View File

@ -16,7 +16,7 @@ Volcanos("onimport", {help: "导入数据", list: [],
can.data = can.msg.Table() can.data = can.msg.Table()
can.page.ClassList.add(can, can.ui.total, "status") can.page.ClassList.add(can, can.ui.total, "status")
can.sub = can.Output(can, {}, "/plugin/wiki/draw", can.Event({}), function() { can.sub = can.Output(can, {}, "/plugin/local/wiki/draw", can.Event({}), function() {
can.Action("width", 600) can.Action("width", 600)
can.onaction["编辑"]({}, can) can.onaction["编辑"]({}, can)
can.onaction["股价图"]({}, can) can.onaction["股价图"]({}, can)

View File

@ -76,7 +76,8 @@ function Volcanos(name, can, libs, cb, msg) { // 封装模块
} }
// 加载脚本 // 加载脚本
can.Dream(document.body, !libs[0].endsWith("/") && libs[0].indexOf(".") == -1? libs[0]+".js": libs[0], function() { can.Dream(libs[0].endsWith(".css")? document.head: document.body,
!libs[0].endsWith("/") && libs[0].indexOf(".") == -1? libs[0]+".js": libs[0], function() {
can._load(libs[0]), can.require(libs.slice(1), cb); can._load(libs[0]), can.require(libs.slice(1), cb);
}) })
}, },