mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt some
This commit is contained in:
parent
feaf44d859
commit
c9ab57067d
9
index.js
9
index.js
@ -10,12 +10,7 @@ Volcanos({name: "demo", volcano: "/frame.js", iceberg: "/chat/", intshell: "plug
|
|||||||
"ncmd",
|
"ncmd",
|
||||||
]},
|
]},
|
||||||
], main: {name: "Header", engine: "remote", list: ["/publish/order.js"]}, plugin: [
|
], main: {name: "Header", engine: "remote", list: ["/publish/order.js"]}, plugin: [
|
||||||
"/plugin/state.js",
|
"/plugin/state.js", "/plugin/input.js", "/plugin/table.js",
|
||||||
"/plugin/input.js",
|
"/plugin/input/key", "/plugin/input/date",
|
||||||
"/plugin/table.js",
|
|
||||||
"/plugin/input/key",
|
|
||||||
"/plugin/input/date",
|
|
||||||
"/plugin/input/upload",
|
|
||||||
"/plugin/input/province",
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
@ -1,34 +1,14 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [],
|
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { can._output.innerHTML = "";
|
||||||
_start: function(can) {
|
|
||||||
var def = {
|
|
||||||
"font-size": "24",
|
|
||||||
"stroke-width": 2,
|
|
||||||
"stroke": "yellow",
|
|
||||||
"fill": "purple",
|
|
||||||
"grid": "10",
|
|
||||||
}
|
|
||||||
// 默认参数
|
|
||||||
can.core.Item(def, function(key, value) {
|
|
||||||
can.svg.Value(key, can.Action(key, can.svg.Value(key)||value))
|
|
||||||
})
|
|
||||||
can.Action("mode", "select")
|
|
||||||
can.Action("mode", "draw")
|
|
||||||
can.Action("shape", "path")
|
|
||||||
},
|
|
||||||
_init: function(can, msg, list, cb, target) { can._output.innerHTML = "";
|
|
||||||
if (msg.Option("_display") == "table") {
|
|
||||||
can.onappend.table(can, target, "table", msg)
|
can.onappend.table(can, target, "table", msg)
|
||||||
return typeof cb == "function" && cb(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 交互数据
|
// 交互数据
|
||||||
can.point = [], can.keys = []
|
can.point = [], can.keys = []
|
||||||
can.current = null, can.temp = null
|
|
||||||
can.group = null, can.svg = null
|
can.group = null, can.svg = null
|
||||||
|
can.current = null, can.temp = null
|
||||||
can.last = null
|
can.last = null
|
||||||
|
|
||||||
// 加载绘图
|
// 加载绘图
|
||||||
var code = can.page.AppendBoard(can, can._output, msg.Result()||can.Export(event, null, "file"))
|
var code = can.page.AppendBoard(can, can._output, msg.Result()||can.onexport.file(event, can))
|
||||||
can.page.Select(can, can._output, "svg", function(svg) {
|
can.page.Select(can, can._output, "svg", function(svg) {
|
||||||
// 画布
|
// 画布
|
||||||
can.onaction.init(event, can, msg, "init", svg);
|
can.onaction.init(event, can, msg, "init", svg);
|
||||||
@ -46,8 +26,25 @@ Volcanos("onimport", {help: "导入数据", list: [],
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
can.Timer(10, function() {
|
||||||
|
var def = {
|
||||||
|
"font-size": "24",
|
||||||
|
"stroke-width": 2,
|
||||||
|
"stroke": "yellow",
|
||||||
|
"fill": "purple",
|
||||||
|
"grid": "10",
|
||||||
|
}
|
||||||
|
// 默认参数
|
||||||
|
can.core.Item(def, function(key, value) {
|
||||||
|
can.svg.Value(key, can.Action(key, can.svg.Value(key)||value))
|
||||||
|
})
|
||||||
|
can.Action("mode", "select")
|
||||||
|
can.Action("mode", "draw")
|
||||||
|
can.Action("shape", "path")
|
||||||
|
})
|
||||||
return typeof cb == "function" && cb(msg);
|
return typeof cb == "function" && cb(msg);
|
||||||
},
|
},
|
||||||
|
|
||||||
draw: function(event, can, value) {
|
draw: function(event, can, value) {
|
||||||
var figure = can.onfigure[value.shape]
|
var figure = can.onfigure[value.shape]
|
||||||
var data = figure.draw(event, can, value.point, value.style)
|
var data = figure.draw(event, can, value.point, value.style)
|
||||||
@ -480,7 +477,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"]))
|
})
|
||||||
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],
|
||||||
@ -896,7 +893,15 @@ Volcanos("ondetail", {help: "组件详情", list: ["标签", "编辑", "复制",
|
|||||||
},
|
},
|
||||||
"删除": function(event, can, value, cmd, target) {can.page.Remove(can, target)},
|
"删除": function(event, can, value, cmd, target) {can.page.Remove(can, target)},
|
||||||
})
|
})
|
||||||
Volcanos("onstatus", {help: "组件状态", list: ["point", "which", "begin", "width", "keys"],
|
|
||||||
|
Volcanos("onexport", {help: "导出数据", list: ["point", "which", "begin", "width", "keys"],
|
||||||
|
file: function(event, can, svg) {
|
||||||
|
return ['<svg vertion="1.1" xmlns="https://www.w3.org/2000/svg" text-anchor="middle" dominant-baseline="middle"'].concat(
|
||||||
|
svg? can.core.List(["count", "width", "height", "font-size", "stroke-width", "stroke", "fill"], function(item) {
|
||||||
|
return svg.Value(item)? ' ' + item + '="' + svg.Value(item) + '"': ""
|
||||||
|
}): []).concat(['>', svg? svg.innerHTML: "", "</svg>"]).join("")
|
||||||
|
},
|
||||||
|
|
||||||
"point": function(event, can, value, cmd, target) {target.innerHTML = value.x+","+value.y},
|
"point": function(event, can, value, cmd, target) {target.innerHTML = value.x+","+value.y},
|
||||||
"which": function(event, can, value, cmd, target) {
|
"which": function(event, can, value, cmd, target) {
|
||||||
var figure = can.onaction._get(can, value);
|
var figure = can.onaction._get(can, value);
|
||||||
@ -907,12 +912,4 @@ Volcanos("onstatus", {help: "组件状态", list: ["point", "which", "begin", "w
|
|||||||
"width": function(event, can, value, cmd, target) {target.innerHTML = value? value.Val("width")+","+value.Val("height"): ""},
|
"width": function(event, can, value, cmd, target) {target.innerHTML = value? value.Val("width")+","+value.Val("height"): ""},
|
||||||
"keys": function(event, can, value, cmd, target) {target.innerHTML = value},
|
"keys": function(event, can, value, cmd, target) {target.innerHTML = value},
|
||||||
})
|
})
|
||||||
Volcanos("onexport", {help: "导出数据", list: [],
|
|
||||||
file: function(event, can, svg, cmd, target) {
|
|
||||||
return ['<svg vertion="1.1" xmlns="https://www.w3.org/2000/svg" text-anchor="middle" dominant-baseline="middle"'].concat(
|
|
||||||
svg? can.core.List(["count", "width", "height", "font-size", "stroke-width", "stroke", "fill"], function(item) {
|
|
||||||
return svg.Value(item)? ' ' + item + '="' + svg.Value(item) + '"': ""
|
|
||||||
}): []).concat(['>', svg? svg.innerHTML: "", "</svg>"]).join("")
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
|
@ -1,29 +1,18 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { can._output.innerHTML = "";
|
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) {
|
||||||
can.onappend.table(can, target, "table", msg)
|
can.onappend.table(can, target, "table", msg)
|
||||||
|
|
||||||
// if (msg.Option("_display") == "table") {
|
|
||||||
// var table = can.page.AppendTable(can, can._output, msg, msg.append, function(event, value, key, index, tr, td) {
|
|
||||||
// can.page.Select(can, can._option, "input.args", function(input) { if (input.name == key) { var data = input.dataset || {}
|
|
||||||
// input.value = value
|
|
||||||
// if (data.action == "auto") {
|
|
||||||
// can.run(event, [], function(msg) {})
|
|
||||||
// }
|
|
||||||
// } })
|
|
||||||
// })
|
|
||||||
// return typeof cb == "function" && cb(msg);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
can._output.innerHTML = msg.Result()
|
can._output.innerHTML = msg.Result()
|
||||||
|
|
||||||
can.page.Select(can, can._output, "fieldset.story", function(item) {var data = item.dataset
|
can.page.Select(can, can._output, ".story", function(item) {var data = item.dataset
|
||||||
var meta = JSON.parse(data.meta||"{}")
|
var cb = can.onimport[data.type]; cb && cb(can, data, item)
|
||||||
can.onappend._init(can, meta, Volcanos.meta.libs.concat(["plugin/state.js"]), function(sub) {
|
|
||||||
sub.run = function(event, cmds, cb, silent) {
|
|
||||||
can.run(event, ["action", "story", data.type, data.name, data.text].concat(cmds), cb, true)
|
|
||||||
}
|
|
||||||
}, can._output, item)
|
|
||||||
})
|
})
|
||||||
return typeof cb == "function" && cb(msg)
|
return typeof cb == "function" && cb(msg)
|
||||||
},
|
},
|
||||||
}, ["plugin/local/wiki/word.css"])
|
field: function(can, item, target) { var meta = can.base.Obj(item.meta)
|
||||||
|
can.onappend._init(can, meta, Volcanos.meta.libs.concat(["/plugin/state.js"]), function(sub) {
|
||||||
|
sub.run = function(event, cmds, cb, silent) {
|
||||||
|
can.run(event, ["action", "story", item.type, item.name, item.text].concat(cmds), cb, true)
|
||||||
|
}
|
||||||
|
}, can._output, target)
|
||||||
|
},
|
||||||
|
}, ["/plugin/local/wiki/word.css"])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user