From 19ea4275a4114957a091a007fc0040f2f2767c09 Mon Sep 17 00:00:00 2001 From: shaoying Date: Tue, 10 Dec 2019 20:18:17 +0800 Subject: [PATCH] add can_order --- src/examples/chat/chat.go | 2 +- src/examples/wiki/chart.go | 2 +- src/examples/wiki/wiki.go | 2 +- src/plugin/story/index.shy | 2 +- usr/librarys/can_order.js | 1 + usr/librarys/chat.js | 8 ++--- usr/librarys/example.css | 6 ++++ usr/librarys/example.js | 16 +-------- usr/local/wiki/volcano.md | 73 ++++++++++++++++++++++++++------------ 9 files changed, 66 insertions(+), 46 deletions(-) create mode 120000 usr/librarys/can_order.js diff --git a/src/examples/chat/chat.go b/src/examples/chat/chat.go index 15f7ebd4..21426faa 100644 --- a/src/examples/chat/chat.go +++ b/src/examples/chat/chat.go @@ -98,7 +98,7 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心", map[string]interface{}{"name": "tail", "tmpl": "tail", "scripts": []interface{}{ "toolkit.js", "context.js", "example.js", "chat.js", - "can_proto.js", "can_frame.js", + "can_proto.js", "can_order.js", "can_frame.js", }, }, }, diff --git a/src/examples/wiki/chart.go b/src/examples/wiki/chart.go index 7fe02110..f8f33855 100644 --- a/src/examples/wiki/chart.go +++ b/src/examples/wiki/chart.go @@ -88,7 +88,7 @@ type Chain struct { } func (b *Chain) Init(m *ctx.Message, arg ...string) Chart { - // 解析数据 + // 解数据 b.data = mis.Parse(nil, "", b.show(m, arg[0])...).(map[string]interface{}) b.FontColor = kit.Select("white", arg, 1) b.BackGround = kit.Select("red", arg, 2) diff --git a/src/examples/wiki/wiki.go b/src/examples/wiki/wiki.go index a95334e3..6713bfd0 100644 --- a/src/examples/wiki/wiki.go +++ b/src/examples/wiki/wiki.go @@ -171,7 +171,7 @@ var Index = &ctx.Context{Name: "wiki", Help: "文档中心", Commands: map[string]*ctx.Command{ "tree": {Name: "tree", Help: "目录", Form: map[string]int{"level": 1, "class": 1}, Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { m.Cmdy("nfs.dir", path.Join(m.Confx("level"), m.Confx("class", arg, 0)), - "time", "size", "line", "file", "dir_sort", "time", "time_r") + "time", "size", "line", "file", "dir_sort", "time", "time_r").Set("result") return }}, "text": {Name: "text", Help: "文章", Form: map[string]int{"level": 1, "class": 1, "favor": 1}, Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { diff --git a/src/plugin/story/index.shy b/src/plugin/story/index.shy index 29af974f..7177886c 100644 --- a/src/plugin/story/index.shy +++ b/src/plugin/story/index.shy @@ -4,7 +4,7 @@ kit share "共享" public "web.chat.share" \ button "共享" kit note "记事本" public "_:web.wiki.note" "@you" \ - text "miss.md" name story imports plugin_story view long action auto \ + text "volcano.md" name story imports plugin_story view long action auto \ button "查看" action auto \ button "返回" cb Last \ exports story file \ diff --git a/usr/librarys/can_order.js b/usr/librarys/can_order.js new file mode 120000 index 00000000..2943b727 --- /dev/null +++ b/usr/librarys/can_order.js @@ -0,0 +1 @@ +../volcanos/order.js \ No newline at end of file diff --git a/usr/librarys/chat.js b/usr/librarys/chat.js index 04623711..f1edc655 100644 --- a/usr/librarys/chat.js +++ b/usr/librarys/chat.js @@ -220,6 +220,10 @@ var page = Page({ initRiver: function(page, field, option, output) { return { Show: function(which) {var pane = field.Pane + if (ctx.Search("feature") != "") { + return + } + pane.Event(event, {}, {name: pane.Zone("show", page.who.get())}) output.innerHTML = "", pane.Appends([], "text", ["nick", "count"], "key", which||ctx.Search("river")||true, function(event, line) { page.title(line.nick) @@ -340,10 +344,6 @@ var page = Page({ Show: function() {var pane = field.Pane if (river && storm && field.Pane.Load(river+"."+storm, output)) {return} - return can.Page(can, "chat", ["Action"], function(page) { - page.Action.Show(river, storm) - }, document.body) - var msg = pane.Event(event, {}, {name: pane.Zone("show", river, storm)}) msg.Option("you", you) output.innerHTML = "", pane.Appends([river, storm], "plugin", ["name", "help"], "name", true, null, function() { diff --git a/usr/librarys/example.css b/usr/librarys/example.css index e6be3148..2bce9f41 100644 --- a/usr/librarys/example.css +++ b/usr/librarys/example.css @@ -178,11 +178,16 @@ fieldset.dialog.Toast { display:none; z-index:100; } +fieldset.dialog.Toast>div.action { + padding:0 0px; +} fieldset.dialog.Toast>div.output { padding:0 10px; } fieldset.dialog.Toast>div.output>div.title { font-size:12px; + text-align:center; + color:gray; } fieldset.dialog.Toast>div.output>div.content { word-break:break-word; @@ -194,6 +199,7 @@ fieldset.dialog.Toast>div.output>div.content { } fieldset.dialog.Toast>div.output>div.tick { font-size:12px; + color:gray; } fieldset.dialog.Carte { padding:0; diff --git a/usr/librarys/example.js b/usr/librarys/example.js index 7b015ebd..a128ea21 100644 --- a/usr/librarys/example.js +++ b/usr/librarys/example.js @@ -634,7 +634,7 @@ function Pane(page, field) { var pane = Meta(page.Zone(name), field, (page[field.dataset.init] || function() {})(page, field, option, output) || {}, { Appends: shy("添加列表", function(cmds, type, key, which, first, cb, cbs) { var list = [] - pane.Runs(event, cmds, function(line, index, msg) { + pane.Runs(event||{}, cmds, function(line, index, msg) { var ui = pane.Append(type, line, key, which, cb) list.push(ui) if (typeof first == "string") { @@ -684,20 +684,6 @@ function Pane(page, field) { if (type == "plugin" && line.name || type == "field") { page.Require(line.init? line.group+"/"+line.init: "", function(init) { page.Require(line.view? line.group+"/"+line.view: "", function(view) { - can.user.carte = page.carte.Pane.Show; - can.user.toast = page.toast.Pane.Show; - ( - line.group == "docker" || - line.group == "story" || - line.group == "favor" - ) && can.Plugin(can.action||can, ui.item.Meta, "state", function(event, cmds, cbs) { - var msg = ctx.Event(event) - kit.Selector(action, "input", function(item, index) { - item.value && msg.Option(item.name, item.value) - }) - - ctx.Run(event, option.dataset, [line.river, line.storm, line.action].concat(cmds), cbs) - }, ui.item) || pane.Plugin(page, pane, ui.item, init, function(event, cmds, cbs) { kit._call(cb||pane.Core, [event, line, cmds, cbs]) }) diff --git a/usr/local/wiki/volcano.md b/usr/local/wiki/volcano.md index 4c71134d..e58761ae 100644 --- a/usr/local/wiki/volcano.md +++ b/usr/local/wiki/volcano.md @@ -1,13 +1,10 @@ # {{title "Volcanos.js"}} -volcanos是一个前端框架。 -通过组件化方式设计功能模块,每个模块都是一个独立完整的运行单元。 -通过插件化方式加载功能模块,每个模块都有框架与输入与输出。 -通过模块化方式管理模块依赖,可以动态按需加载各种模块。 +volcanos是一个前端框架,通过模块化、配置化提升项目的复用性、灵活性。 {{chart "chain" ` -chat - proto +volcanos + proto.js "ID 生成器" "Log 日志器" "Conf 配置器" @@ -17,23 +14,34 @@ chat "Dream 构造器" "Cache 缓存器" "Story 存储器" + frame.js bg blue + Page bg blue + Pane bg blue + "base 基础模块" + "core 核心模块" + "misc 工具模块" + "page 网页模块" + "user 用户模块" + Plugin bg blue + Inputs bg blue + "onimport 导入数据" + "onaction 控件交互" + "onchoice 控件菜单" + "ondetail 控件详情" + "onexport 导出数据" + Output bg blue + order.js + Header + Ocean + River + Target + Source + Action + Storm + Steam + Footer - Plugin - Inputs - "onimport 导入数据" - "onaction 控件交互" - "onchoice 控件菜单" - "ondetail 控件详情" - "onexport 导出数据" - Output - - "base 基础模块" - "core 核心模块" - "misc 工具模块" - "page 网页模块" - "user 用户模块" - -`}} +` "" "" 16}} ## {{chapter "原型"}} ### {{section "ID 生成器"}} @@ -47,14 +55,33 @@ chat ### {{section "Story 存储器"}} ## {{chapter "框架"}} +### {{section "Page 页面"}} +### {{section "Pane 面板"}} ### {{section "Plugin 插件"}} ### {{section "Inputs 控件"}} ### {{section "Output 组件"}} -## {{chapter "模块"}} +## {{chapter "核心模块"}} ### {{section "base 模块"}} ### {{section "core 模块"}} ### {{section "misc 模块"}} ### {{section "page 模块"}} ### {{section "user 模块"}} +## {{chapter "事件模块"}} +### {{section "onimport 模块"}} +### {{section "onaction 模块"}} +### {{section "onchoice 模块"}} +### {{section "ondetail 模块"}} +### {{section "onexport 模块"}} + +## {{chapter "配置"}} +### {{section "Header"}} +### {{section "Ocean"}} +### {{section "River"}} +### {{section "Target"}} +### {{section "Source"}} +### {{section "Action"}} +### {{section "Storm"}} +### {{section "Steam"}} +### {{section "Footer"}}