mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
add Report
This commit is contained in:
parent
9dd111001f
commit
1be0fa8297
68
frame.js
68
frame.js
@ -4,6 +4,8 @@ var can = Volcanos("chat", {
|
|||||||
var action = field.querySelector("div.action");
|
var action = field.querySelector("div.action");
|
||||||
var output = field.querySelector("div.output");
|
var output = field.querySelector("div.output");
|
||||||
|
|
||||||
|
var history = []
|
||||||
|
|
||||||
var name = meta.name, args = meta.args || [];
|
var name = meta.name, args = meta.args || [];
|
||||||
var feature = JSON.parse(meta.feature||'{}');
|
var feature = JSON.parse(meta.feature||'{}');
|
||||||
var plugin = Volcanos(name, {type: "local",
|
var plugin = Volcanos(name, {type: "local",
|
||||||
@ -22,20 +24,35 @@ var can = Volcanos("chat", {
|
|||||||
return key != undefined? option[key] && option[key].value || "":
|
return key != undefined? option[key] && option[key].value || "":
|
||||||
plugin.page.Select(can, option, ".args", function(item) {return item.value})
|
plugin.page.Select(can, option, ".args", function(item) {return item.value})
|
||||||
},
|
},
|
||||||
|
Report: function(event, value, key, index) {
|
||||||
|
plugin[key] && plugin[key].target && plugin[key].Import(event, value, key, index)
|
||||||
|
},
|
||||||
Check: function(event, target, cb) {
|
Check: function(event, target, cb) {
|
||||||
plugin.page.Select(can, option, ".args", function(item, index, list) {
|
plugin.page.Select(can, option, ".args", function(item, index, list) {
|
||||||
if (item == target && index < list.length-1) {can.plugin == field && list[index+1].focus(); return item}
|
if (item == target && index < list.length-1) {can.plugin == field && list[index+1].focus(); return item}
|
||||||
}).length == 0 && plugin.Runs(event, cb)
|
}).length == 0 && plugin.Runs(event, cb)
|
||||||
},
|
},
|
||||||
|
Last: function(event) {
|
||||||
|
can.core.List(history.pop() && history.pop(), function(item, index) {
|
||||||
|
return item.target.value = item.value
|
||||||
|
}).length > 0 && plugin.Runs(event)
|
||||||
|
},
|
||||||
Runs: function(event, cb) {plugin.Run(event, plugin.Option(), cb)},
|
Runs: function(event, cb) {plugin.Run(event, plugin.Option(), cb)},
|
||||||
Run: function(event, args, cb, silent) {var show = !silent;
|
Run: function(event, args, cb, silent) {var show = !silent;
|
||||||
|
history.push(plugin.page.Select(can, option, ".args", function(item, index, list) {
|
||||||
|
return {target: item, value: item.value}
|
||||||
|
}))
|
||||||
|
|
||||||
|
for (var i = args.length-1; i >= 0; i--) {if (args[i] == "") {args = args.slice(0, i)} else {break}}
|
||||||
show && plugin.Timer(1000, function() {show && plugin.user.toast(kit.Format(args||["running..."]), meta.name, -1)});
|
show && plugin.Timer(1000, function() {show && plugin.user.toast(kit.Format(args||["running..."]), meta.name, -1)});
|
||||||
run(event, args, function(msg) {if (silent) {return typeof cb == "function" && cb(msg)}
|
run(event, args, function(msg) {if (silent) {return typeof cb == "function" && cb(msg)}
|
||||||
var display = feature.display || "table";
|
plugin.Show(feature.display || "table", msg, cb)
|
||||||
plugin[display] = can.Output(plugin, display, msg, cb, output, option)
|
|
||||||
show = false, plugin.user.toast();
|
show = false, plugin.user.toast();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
Show: function(type, msg, cb) {msg._plugin_name = name;
|
||||||
|
return plugin[type] = can.Output(plugin, type, msg, cb, output, option)
|
||||||
|
},
|
||||||
}, ["core", "page", "user", "state"], function(plugin) {
|
}, ["core", "page", "user", "state"], function(plugin) {
|
||||||
function next(list, cb) {
|
function next(list, cb) {
|
||||||
list && list.length > 0 && cb(list[0], function() {
|
list && list.length > 0 && cb(list[0], function() {
|
||||||
@ -43,64 +60,35 @@ var can = Volcanos("chat", {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
next(JSON.parse(meta.inputs||"[]"), plugin.Append)
|
next(JSON.parse(meta.inputs||"[]"), plugin.Append)
|
||||||
|
|
||||||
kit.Item(plugin.onaction, function(key, cb) {field[key] = function(event) {
|
|
||||||
cb(event, plugin, field)
|
|
||||||
}})
|
|
||||||
})
|
})
|
||||||
return plugin.target = field, field.Plugin = plugin
|
return plugin.target = field, field.Plugin = plugin
|
||||||
}),
|
}),
|
||||||
Inputs: shy("构造控件", function(can, item, name, value, cb, option) {
|
Inputs: shy("构造控件", function(can, item, name, value, cb, option) {
|
||||||
var input = Volcanos(name, {type: "local",
|
var input = Volcanos(name, {type: "local", item: item,
|
||||||
Select: function(event) {can.Select(event, input.target, true)},
|
Select: function(event) {can.Select(event, input.target, true)},
|
||||||
|
Import: function(event, value, key, index) {input.target.value = value;
|
||||||
|
item.action == "auto"? can.Runs(event): can.Check(event, input.target);
|
||||||
|
},
|
||||||
run: function(event, cmd, cb, silent) {
|
run: function(event, cmd, cb, silent) {
|
||||||
can.Check(event, event.target, cb)
|
(input[item.cb] || can[item.cb] || can.Check)(event, event.target, cb);
|
||||||
},
|
},
|
||||||
|
|
||||||
}, ["core", "page", "user", "input"], function(input) {typeof cb == "function" && cb();
|
}, ["core", "page", "user", "input"], function(input) {typeof cb == "function" && cb();
|
||||||
var target = input.onimport.init(can, item, name, value, option);
|
var target = input.onimport.init(input, item, name, value, option);
|
||||||
input.target = target, target.Input = input;
|
input.target = target, target.Input = input;
|
||||||
|
|
||||||
can.core.Item(input.onaction, function(key, cb) {target[key] = function(event) {
|
|
||||||
cb(event, input, item.type, option);
|
|
||||||
}});
|
|
||||||
|
|
||||||
(item.type == "text" || item.type == "textarea") && !target.placeholder && (target.placeholder = item.name);
|
|
||||||
item.type == "text" && !target.title && (target.title = item.placeholder || item.name || "");
|
|
||||||
})
|
})
|
||||||
return input
|
return input
|
||||||
}),
|
}),
|
||||||
Output: shy("构造组件", function(can, type, msg, cb, target, option) {
|
Output: shy("构造组件", function(can, type, msg, cb, target, option) {
|
||||||
type = "table"
|
|
||||||
var output = Volcanos(type, {type: "local",
|
var output = Volcanos(type, {type: "local",
|
||||||
|
Export: function(event, value, key, index) {can.Report(event, value, key, index)},
|
||||||
run: function(event, cmd, cb, silent) {
|
run: function(event, cmd, cb, silent) {
|
||||||
(output[cmd[1]] || can[cmd[1]] || can.Run)(event, cmd, cb, silent);
|
(output[cmd[1]] || can[cmd[1]] || can.Run)(event, cmd, cb, silent);
|
||||||
},
|
},
|
||||||
size: function(cb) {
|
|
||||||
can.onfigure.meta.size(function(width, height) {
|
|
||||||
cb(width, height);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, ["core", "page", "user", type], function(output) {
|
}, ["core", "page", "user", type], function(output) {
|
||||||
output.onimport.init(output, msg, cb, target, option);
|
output.onimport.init(output, msg, cb, target, option);
|
||||||
|
}, msg)
|
||||||
can.core.Item(output.onaction, function(key, cb) {target[key] = function(event) {
|
|
||||||
cb(event, output, type, msg, target);
|
|
||||||
}})
|
|
||||||
|
|
||||||
target.oncontextmenu = function(event) {
|
|
||||||
can.user.carte(event, shy("", output.onchoice, output.onchoice.list, function(event, value, meta) {
|
|
||||||
typeof meta[value] == "function"? meta[value](event, can, msg, cb, target, option):
|
|
||||||
typeof output[value] == "function"? output[value](event, can, msg, cb, target, option):
|
|
||||||
typeof can[value] == "function"? can[value](event, can, msg, cb, target, option): null
|
|
||||||
return true
|
|
||||||
}))
|
|
||||||
event.stopPropagation()
|
|
||||||
event.preventDefault()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return output.target = target, target.Output = output
|
return output.target = target, target.Output = output
|
||||||
}),
|
}),
|
||||||
}, ["base", "core", "misc", "page", "user"], function(can) {})
|
}, ["base", "core", "misc", "page", "user", "state", "input", "table"], function(can) {})
|
||||||
|
|
||||||
|
64
inner.js
Normal file
64
inner.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
Volcanos("onimport", {help: "导入数据", list: [],
|
||||||
|
init: function(can, msg, cb, output, option) {output.innerHTML = "";
|
||||||
|
output.innerHTML = msg.Result()
|
||||||
|
output.onclick = function(event) {
|
||||||
|
switch (event.target.tagName) {
|
||||||
|
case "text":
|
||||||
|
alert(event.target.innerHTML)
|
||||||
|
break
|
||||||
|
case "rect":
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos("onaction", {help: "组件交互", list: [],
|
||||||
|
})
|
||||||
|
Volcanos("onchoice", {help: "组件菜单", list: ["返回", "清空", "复制", "下载", "表格", "绘图", "媒体"],
|
||||||
|
"返回": function(event, can, msg, value, target) {
|
||||||
|
can.run(event, ["", "Last"])
|
||||||
|
},
|
||||||
|
"清空": function(event, can, msg, value, target) {
|
||||||
|
can.target.innerHTML = "";
|
||||||
|
},
|
||||||
|
"复制": function(event, can, msg, value, target) {
|
||||||
|
var list = can.onexport.Format(can, msg, "data");
|
||||||
|
can.user.toast(can.page.CopyText(can, list[2]), "复制成功")
|
||||||
|
},
|
||||||
|
"下载": function(event, can, msg, value, target) {
|
||||||
|
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: ["选择", "修改", "删除", "复制", "下载"],
|
||||||
|
"选择": "select",
|
||||||
|
"删除": "delete",
|
||||||
|
"修改": function(event, can, msg, value, index, key, td) {
|
||||||
|
var text = td.innerHTML;
|
||||||
|
can.page.Appends(can, td, [{type: "input", style: {width: td.clientWidth+"px"}, data: {onkeydown: function(event) {
|
||||||
|
if (event.key != "Enter") {return}
|
||||||
|
can.run(event, [index, "modify", key == "value" && msg.key? msg[key][index]: key, event.target.value,], function(msg) {
|
||||||
|
td.innerHTML = event.target.value;
|
||||||
|
can.user.toast("修改成功")
|
||||||
|
}, true)
|
||||||
|
}}}])
|
||||||
|
},
|
||||||
|
"复制": function(event, can, msg, value, index, key, target) {
|
||||||
|
can.user.toast(can.page.CopyText(can, target.innerHTML), "复制成功")
|
||||||
|
},
|
||||||
|
"下载": function(event, can, msg, value, index, key, target) {
|
||||||
|
can.page.Download(can, key, target.innerHTML);
|
||||||
|
},
|
||||||
|
})
|
||||||
|
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]
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
49
input.js
49
input.js
@ -1,41 +1,54 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [],
|
Volcanos("onimport", {help: "导入数据", list: [],
|
||||||
init: shy("添加控件", function(can, item, name, value, option) {
|
init: shy("添加控件", function(can, item, name, value, option) {
|
||||||
var input = {type: "input", name: name, data: item}
|
var input = {type: "input", name: name, data: item};
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case "upfile": item.type = "file"; break
|
case "upfile": item.type = "file"; break
|
||||||
case "select":
|
case "select":
|
||||||
item.values = kit.Trans(item.values)
|
item.values = kit.Trans(item.values);
|
||||||
input.type = "select", input.list = item.values.map(function(value) {
|
input.type = "select", input.list = item.values.map(function(value) {
|
||||||
return {type: "option", value: value, inner: value}
|
return {type: "option", value: value, inner: value};
|
||||||
})
|
})
|
||||||
item.value = value || item.value || item.values[0]
|
item.value = value || item.value || item.values[0];
|
||||||
can.page.ClassList.add(can, item, "args")
|
can.page.ClassList.add(can, item, "args");
|
||||||
break
|
break
|
||||||
case "textarea":
|
case "textarea":
|
||||||
var half = parseFloat(item.half||"1")||1
|
var half = parseFloat(item.half||"1")||1;
|
||||||
input.type = "textarea", item.style = "height:"+(item.height||"50px")+";width:"+parseInt(((pane.target.clientWidth-35)/half))+"px"
|
input.type = "textarea", item.style = "height:"+(item.height||"50px")+";width:"+parseInt(((500-35)/half))+"px";
|
||||||
// no break
|
// no break
|
||||||
case "text":
|
case "text":
|
||||||
can.page.ClassList.add(can, item, "args")
|
can.page.ClassList.add(can, item, "args");
|
||||||
item.value = value || item.value || ""
|
item.value = value || item.value || "";
|
||||||
item.autocomplete = "off"
|
item.autocomplete = "off";
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
can.page.ClassList.add(can, item, item.view)
|
can.page.ClassList.add(can, item, item.view);
|
||||||
can.core.List((item.clist||"").split(" "), function(value) {
|
can.core.List((item.clist||"").split(" "), function(value) {
|
||||||
can.page.ClassList.add(can, item, value)
|
can.page.ClassList.add(can, item, value);
|
||||||
})
|
})
|
||||||
return can.Dream(option, "input", input)[input.name]
|
|
||||||
return can.page.Append(can, option, [input])[input.name]
|
var target = can.Dream(option, "input", input)[input.name];
|
||||||
|
(item.type == "text" || item.type == "textarea") && !target.placeholder && (target.placeholder = item.name);
|
||||||
|
item.type == "text" && !target.title && (target.title = item.placeholder || item.name || "");
|
||||||
|
item.type == "button" && item.action == "auto" && can.run && can.run(event);
|
||||||
|
return target;
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
Volcanos("onaction", {help: "控件交互", list: [],
|
Volcanos("onaction", {help: "控件交互", list: [],
|
||||||
onclick: function(event, can, type, option) {can.Select(event); type == "button" && can.run(event)},
|
onclick: function(event, can) {can.Select(event); can.item.type == "button" && can.run(event)},
|
||||||
onkeydown: function(event, can, type, option) {
|
onkeydown: function(event, can) {
|
||||||
if (event.key == "Enter") {return can.run(event, [])}
|
if (event.key == "Enter") {return can.run(event, [])};
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onchoice", {help: "控件菜单", list: [],
|
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("ondetail", {help: "控件详情", list: [],
|
||||||
})
|
})
|
||||||
|
2
page.js
2
page.js
@ -65,7 +65,7 @@ Volcanos("page", {help: "网页模块",
|
|||||||
if (item.view) {var list = can.core.List(item.view);
|
if (item.view) {var list = can.core.List(item.view);
|
||||||
(list.length > 0 && list[0]) && can.page.ClassList.add(can, data, list[0])
|
(list.length > 0 && list[0]) && can.page.ClassList.add(can, data, list[0])
|
||||||
type = list[1] || "div"
|
type = list[1] || "div"
|
||||||
data.innerHTML = list[2] || ""
|
data.innerHTML = list[2] || data.innerHTML || ""
|
||||||
name = name || list[3] || ""
|
name = name || list[3] || ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
proto.js
22
proto.js
@ -13,7 +13,7 @@ function shy(help, meta, list, cb) { // 封装函数
|
|||||||
cb.runs = function() {};
|
cb.runs = function() {};
|
||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
function Volcanos(name, can, libs, cb) { // 封装模块
|
function Volcanos(name, can, libs, cb, msg) { // 封装模块
|
||||||
// 全局属性
|
// 全局属性
|
||||||
var list = arguments.callee.list || [], meta = arguments.callee.meta || {
|
var list = arguments.callee.list || [], meta = arguments.callee.meta || {
|
||||||
create_time: new Date(), path: "/static/volcanos/", index: 1, cache: {},
|
create_time: new Date(), path: "/static/volcanos/", index: 1, cache: {},
|
||||||
@ -86,6 +86,9 @@ function Volcanos(name, can, libs, cb) { // 封装模块
|
|||||||
return typeof cb == "function" && cb(one, index, array)
|
return typeof cb == "function" && cb(one, index, array)
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
|
Result: function() {
|
||||||
|
return msg.result && msg.result.join("") || "";
|
||||||
|
},
|
||||||
};
|
};
|
||||||
msg.event = event
|
msg.event = event
|
||||||
return msg
|
return msg
|
||||||
@ -113,7 +116,22 @@ function Volcanos(name, can, libs, cb) { // 封装模块
|
|||||||
// 加载模块
|
// 加载模块
|
||||||
function next() {
|
function next() {
|
||||||
libs && libs.length > 1? Volcanos(name, can, libs.slice(1), cb):
|
libs && libs.length > 1? Volcanos(name, can, libs.slice(1), cb):
|
||||||
typeof cb == "function" && setTimeout(function() {cb(can)}, 10);
|
typeof cb == "function" && setTimeout(function() {cb(can);
|
||||||
|
if (!can.target) {return}
|
||||||
|
can.core.Item(can.onaction, function(key, cb) {can.target[key] = function(event) {
|
||||||
|
cb(event, can);
|
||||||
|
}});
|
||||||
|
|
||||||
|
can.target.oncontextmenu = function(event) {
|
||||||
|
can.user.carte(event, shy("", can.onchoice, can.onchoice.list, function(event, value, meta) {var cb = meta[value];
|
||||||
|
typeof cb == "function"? cb(event, can, msg, value, event.target):
|
||||||
|
can.run(event, [typeof cb == "string"? cb: value, event.target], null, true)
|
||||||
|
}))
|
||||||
|
event.stopPropagation()
|
||||||
|
event.preventDefault()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
}
|
}
|
||||||
if (libs && libs.length > 0) {
|
if (libs && libs.length > 0) {
|
||||||
if (can[libs[0]]) {
|
if (can[libs[0]]) {
|
||||||
|
35
table.js
35
table.js
@ -1,42 +1,40 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [],
|
Volcanos("onimport", {help: "导入数据", list: [],
|
||||||
init: function(can, msg, cb, target, option) {target.innerHTML = "";
|
init: function(can, msg, cb, output, option) {output.innerHTML = "";
|
||||||
var table = can.page.AppendTable(can, target, msg, msg.append);
|
if (!msg.append || msg.append.length == 0) {
|
||||||
table.onclick = function(event) {
|
var code = can.page.Append(can, output, [{view: ["code", "div", msg.Result()]}]).code;
|
||||||
switch (event.target.tagName) {
|
return typeof cb == "function" && cb(msg), code;
|
||||||
|
}
|
||||||
|
|
||||||
|
var table = can.page.AppendTable(can, output, msg, msg.append);
|
||||||
|
table.onclick = function(event) {switch (event.target.tagName) {
|
||||||
case "TD":
|
case "TD":
|
||||||
can.onimport.which(event, table, msg.append, function(index, key) {
|
can.onimport.which(event, table, msg.append, function(index, key) {
|
||||||
can.ondetail["复制"](event, can, msg, event.target.innerHTML, index, key, event.target);
|
can.ondetail["复制"](event, can, msg, event.target.innerHTML, index, key, event.target);
|
||||||
|
can.Export(event, event.target.innerHTML, key, index)
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case "TH":
|
case "TH":
|
||||||
case "TR":
|
case "TR":
|
||||||
case "TABLE":
|
case "TABLE":
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
table.oncontextmenu = function(event) {var target = event.target;
|
table.oncontextmenu = function(event) {var target = event.target;
|
||||||
switch (event.target.tagName) {
|
switch (event.target.tagName) {
|
||||||
case "TD":
|
case "TD":
|
||||||
can.onimport.which(event, table, msg.append, function(index, key) {
|
can.onimport.which(event, table, msg.append, function(index, key) {
|
||||||
can.user.carte(event, shy("", can.ondetail, can.ondetail.list, function(event, value, meta) {
|
can.user.carte(event, shy("", can.ondetail, can.ondetail.list, function(event, value, meta) {var cb = meta[value];
|
||||||
var cb = meta[value];
|
|
||||||
typeof cb == "function"? cb(event, can, msg, value, index, key, target):
|
typeof cb == "function"? cb(event, can, msg, value, index, key, target):
|
||||||
can.run(event, [index, typeof cb == "string"? cb: value, key, target.innerHTML], null, true)
|
can.run(event, [index, typeof cb == "string"? cb: value, key, target.innerHTML], null, true)
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
event.stopPropagation()
|
||||||
|
event.preventDefault()
|
||||||
break
|
break
|
||||||
case "TH":
|
case "TH":
|
||||||
case "TR":
|
case "TR":
|
||||||
case "TABLE":
|
case "TABLE":
|
||||||
can.user.carte(event, shy("", can.onchoice, can.onchoice.list, function(event, value, meta) {
|
|
||||||
var cb = meta[value];
|
|
||||||
typeof cb == "function"? cb(event, can, msg, value, target):
|
|
||||||
can.run(event, [typeof cb == "string"? cb: value, target], null, true)
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
event.stopPropagation()
|
|
||||||
event.preventDefault()
|
|
||||||
}
|
}
|
||||||
typeof cb == "function" && cb(msg);
|
return typeof cb == "function" && cb(msg), table;
|
||||||
},
|
},
|
||||||
which: function(event, table, list, cb) {if (event.target == table) {return cb(-1, "")}
|
which: function(event, table, list, cb) {if (event.target == table) {return cb(-1, "")}
|
||||||
can.page.Select(can, table, "tr", function(tr, index) {if (event.target == tr) {return cb(index, "")}
|
can.page.Select(can, table, "tr", function(tr, index) {if (event.target == tr) {return cb(index, "")}
|
||||||
@ -49,6 +47,9 @@ Volcanos("onimport", {help: "导入数据", list: [],
|
|||||||
Volcanos("onaction", {help: "组件交互", list: [],
|
Volcanos("onaction", {help: "组件交互", list: [],
|
||||||
})
|
})
|
||||||
Volcanos("onchoice", {help: "组件菜单", list: ["返回", "清空", "复制", "下载", "表格", "绘图", "媒体"],
|
Volcanos("onchoice", {help: "组件菜单", list: ["返回", "清空", "复制", "下载", "表格", "绘图", "媒体"],
|
||||||
|
"返回": function(event, can, msg, value, target) {
|
||||||
|
can.run(event, ["", "Last"])
|
||||||
|
},
|
||||||
"清空": function(event, can, msg, value, target) {
|
"清空": function(event, can, msg, value, target) {
|
||||||
can.target.innerHTML = "";
|
can.target.innerHTML = "";
|
||||||
},
|
},
|
||||||
@ -57,7 +58,7 @@ Volcanos("onchoice", {help: "组件菜单", list: ["返回", "清空", "复制",
|
|||||||
can.user.toast(can.page.CopyText(can, list[2]), "复制成功")
|
can.user.toast(can.page.CopyText(can, list[2]), "复制成功")
|
||||||
},
|
},
|
||||||
"下载": function(event, can, msg, value, target) {
|
"下载": function(event, can, msg, value, target) {
|
||||||
var list = can.onexport.Format(can, msg, "data");
|
var list = can.onexport.Format(can, msg, msg._plugin_name||"data");
|
||||||
can.page.Download(can, list[0]+list[1], list[2]);
|
can.page.Download(can, list[0]+list[1], list[2]);
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
5
user.js
5
user.js
@ -1,11 +1,12 @@
|
|||||||
Volcanos("user", {help: "用户模块",
|
Volcanos("user", {help: "用户模块",
|
||||||
toast: function(text) {},
|
|
||||||
carte: function(event, cb) {},
|
|
||||||
alert: function(text) {alert(JSON.stringify(text))},
|
alert: function(text) {alert(JSON.stringify(text))},
|
||||||
confirm: function(text) {return confirm(JSON.stringify(text))},
|
confirm: function(text) {return confirm(JSON.stringify(text))},
|
||||||
prompt: function(text, cb) {(text = prompt(text)) != undefined && typeof cb == "function" && cb(text); return text},
|
prompt: function(text, cb) {(text = prompt(text)) != undefined && typeof cb == "function" && cb(text); return text},
|
||||||
reload: function() {confirm("重新加载页面?") && location.reload()},
|
reload: function() {confirm("重新加载页面?") && location.reload()},
|
||||||
|
|
||||||
|
toast: function(text) {},
|
||||||
|
carte: function(event, cb) {},
|
||||||
|
|
||||||
isWeiXin: navigator.userAgent.indexOf("MicroMessenger") > -1,
|
isWeiXin: navigator.userAgent.indexOf("MicroMessenger") > -1,
|
||||||
isMobile: navigator.userAgent.indexOf("Mobile") > -1,
|
isMobile: navigator.userAgent.indexOf("Mobile") > -1,
|
||||||
isIPhone: navigator.userAgent.indexOf("iPhone") > -1,
|
isIPhone: navigator.userAgent.indexOf("iPhone") > -1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user