mirror of
https://shylinux.com/x/volcanos
synced 2025-04-26 01:04:06 +08:00
opt figure
This commit is contained in:
parent
79c0b50d39
commit
a8f5216791
49
frame.js
49
frame.js
@ -11,7 +11,7 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
|
|||||||
}, target)
|
}, target)
|
||||||
}, function() {
|
}, function() {
|
||||||
var pane = can[meta.main.name], msg = can.request({})
|
var pane = can[meta.main.name], msg = can.request({})
|
||||||
pane.onkeypop._init(pane, target), pane.onmotion._init(pane)
|
pane.onmotion._init(pane, target), pane.onkeypop._init(pane, target)
|
||||||
pane.onaction._init(pane, msg, [], cb, pane._target)
|
pane.onaction._init(pane, msg, [], cb, pane._target)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -23,15 +23,6 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
listen: shy("", {}, [], function(can, name, cb) {
|
|
||||||
arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb)
|
|
||||||
}),
|
|
||||||
trigger: function(can, msg, name) {
|
|
||||||
can.core.List(can.onengine.listen.meta[name], function(cb) {
|
|
||||||
can.core.CallFunc(cb, {"msg": msg})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
search: function(event, can, msg, pane, cmds, cb) {
|
search: function(event, can, msg, pane, cmds, cb) {
|
||||||
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split("."), function(value) {
|
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split("."), function(value) {
|
||||||
fun && (sub = mod, mod = fun, fun = mod[value], key = value)
|
fun && (sub = mod, mod = fun, fun = mod[value], key = value)
|
||||||
@ -39,7 +30,7 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
|
|||||||
|
|
||||||
return can.core.CallFunc(fun, {
|
return can.core.CallFunc(fun, {
|
||||||
"event": event, "can": sub, "msg": msg,
|
"event": event, "can": sub, "msg": msg,
|
||||||
"cmd": key, "button": key, "cmds": cmds.slice(2),
|
"button": key, "cmd": key, "cmds": cmds.slice(2),
|
||||||
"list": cmds.slice(2), "cb": cb, "target": sub._target,
|
"list": cmds.slice(2), "cb": cb, "target": sub._target,
|
||||||
}, mod)
|
}, mod)
|
||||||
},
|
},
|
||||||
@ -49,6 +40,15 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
|
|||||||
// pane.run(event, ["search", "Footer.onimport.ncmd"])
|
// pane.run(event, ["search", "Footer.onimport.ncmd"])
|
||||||
}, engine: function(event, can, msg, pane, cmds, cb) { return false },
|
}, engine: function(event, can, msg, pane, cmds, cb) { return false },
|
||||||
|
|
||||||
|
listen: shy("", {}, [], function(can, name, cb) {
|
||||||
|
arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb)
|
||||||
|
}),
|
||||||
|
trigger: function(can, name, msg) {
|
||||||
|
can.core.List(can.onengine.listen.meta[name], function(cb) {
|
||||||
|
can.core.CallFunc(cb, {msg: msg})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
river: {
|
river: {
|
||||||
"serivce": {name: "运营群", storm: {
|
"serivce": {name: "运营群", storm: {
|
||||||
"wx": {name: "公众号 wx", action: [
|
"wx": {name: "公众号 wx", action: [
|
||||||
@ -396,6 +396,19 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
|||||||
return text && can.page.Append(can, target, [{view: ["code", "div", text]}]).code
|
return text && can.page.Append(can, target, [{view: ["code", "div", text]}]).code
|
||||||
},
|
},
|
||||||
|
|
||||||
|
figure: function(can, meta, key, target) {
|
||||||
|
if (key.indexOf("@") != 0) { return }
|
||||||
|
var list = can.core.Split(key, "@=", "@=", {simple: true})
|
||||||
|
var pkey = list[0], pval = list[1]||""
|
||||||
|
|
||||||
|
can.page.Modify(can, target, {autocomplete: "off"})
|
||||||
|
target.type != "button" && target.value.startsWith("@") && (target.value = pval||"")
|
||||||
|
pkey && can.require(["/plugin/input/"+pkey+".js"], function(can) {
|
||||||
|
can.onfigure && can.core.Item(can.onfigure[pkey], function(key, cb) { if (key.startsWith("on")) {
|
||||||
|
target[key] = function(event) { cb(event, can, meta, target) }
|
||||||
|
} })
|
||||||
|
})
|
||||||
|
},
|
||||||
plugin: function(can, meta, cb, target) { meta = meta || {}
|
plugin: function(can, meta, cb, target) { meta = meta || {}
|
||||||
can.run({}, ["action", "command", meta.index], function(msg) {
|
can.run({}, ["action", "command", meta.index], function(msg) {
|
||||||
meta.feature = can.base.Obj(msg.meta&&msg.meta[0] || "{}", {})
|
meta.feature = can.base.Obj(msg.meta&&msg.meta[0] || "{}", {})
|
||||||
@ -429,7 +442,7 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (can.user.isMobile) { return }
|
if (can.user.isMobile) { return }
|
||||||
can.onengine.trigger(can, can.request(event, {width: width, height: height}), "resize")
|
can.onengine.trigger(can, "resize", can.request(event, {width: width, height: height}))
|
||||||
|
|
||||||
can.page.Select(can, target, ["fieldset.main"], function(field, index) {
|
can.page.Select(can, target, ["fieldset.main"], function(field, index) {
|
||||||
can.page.Modify(can, field, {style: {height: height}})
|
can.page.Modify(can, field, {style: {height: height}})
|
||||||
@ -442,6 +455,12 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
|
|||||||
topic: function(can, topic) { topic && (can._topic = topic)
|
topic: function(can, topic) { topic && (can._topic = topic)
|
||||||
can.user.topic(can, can._topic || can.user.Search(can, "topic") || ((can.user.Search(can, "pod")||can.base.isNight())? "black": "white"))
|
can.user.topic(can, can._topic || can.user.Search(can, "topic") || ((can.user.Search(can, "pod")||can.base.isNight())? "black": "white"))
|
||||||
},
|
},
|
||||||
|
figure: function(can, ui, event) {
|
||||||
|
var layout = {top: event.clientY+10, left: event.clientX}
|
||||||
|
can.page.Modify(can, ui.fieldset, {style: layout})
|
||||||
|
can.onmotion.move(can, ui.fieldset, layout)
|
||||||
|
can.page.Remove(can, ui.legend)
|
||||||
|
},
|
||||||
|
|
||||||
profile: function(can, target) {
|
profile: function(can, target) {
|
||||||
return can.page.Append(can, target, [{view: ["void", "table"], list: [{type: "tr", list: [
|
return can.page.Append(can, target, [{view: ["void", "table"], list: [{type: "tr", list: [
|
||||||
@ -621,18 +640,18 @@ Volcanos("onkeypop", {help: "键盘交互", list: [], _init: function(can, targe
|
|||||||
if (target._keys.length == 0) { event.stopPropagation(), event.preventDefault() }
|
if (target._keys.length == 0) { event.stopPropagation(), event.preventDefault() }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onmotion", {help: "动态交互", list: [], _init: function(can) {
|
Volcanos("onmotion", {help: "动态交互", list: [], _init: function(can, target) {
|
||||||
if ((can.user.Search(can, "topic")||"").indexOf("print") > -1) { return }
|
if ((can.user.Search(can, "topic")||"").indexOf("print") > -1) { return }
|
||||||
|
|
||||||
var count = 0, add = true
|
var count = 0, add = true
|
||||||
can.user.isMobile || can.user.Search(can, "share") || can.core.Timer({interval: 100}, function() {
|
can.user.isMobile || can.user.Search(can, "share") || can.core.Timer({interval: 100}, function() {
|
||||||
if (document.body.className.indexOf("print") > -1) { return }
|
if (target.className.indexOf("print") > -1) { return }
|
||||||
|
|
||||||
add? count++: count--
|
add? count++: count--
|
||||||
count < 0 && (add = true)
|
count < 0 && (add = true)
|
||||||
count > 100 && (add = false)
|
count > 100 && (add = false)
|
||||||
|
|
||||||
can.page.Select(can, document.body, "fieldset.story", function(item) {
|
can.page.Select(can, target, "fieldset.story", function(item) {
|
||||||
can.page.Modify(can, item, {style: {
|
can.page.Modify(can, item, {style: {
|
||||||
"box-shadow": "40px 10px 10px "+(count/10+1)+"px #626bd0",
|
"box-shadow": "40px 10px 10px "+(count/10+1)+"px #626bd0",
|
||||||
}})
|
}})
|
||||||
|
22
lib/user.js
22
lib/user.js
@ -40,10 +40,11 @@ Volcanos("user", {help: "用户模块", agent: {
|
|||||||
return value
|
return value
|
||||||
},
|
},
|
||||||
copy: function(event, can, text) {
|
copy: function(event, can, text) {
|
||||||
var input = can.page.Append(can, event.target.parentNode, [{type: "input", value: text}]).first
|
var input = can.page.Append(can, event.target, [{type: "input", value: text}]).first
|
||||||
input.setSelectionRange(0,-1), input.focus()
|
input.setSelectionRange(0,-1), input.focus()
|
||||||
document.execCommand("Copy"), can.page.Remove(can, input)
|
document.execCommand("Copy"), can.page.Remove(can, input)
|
||||||
can.user.toast(can, text, "复制成功")
|
can.user.toast(can, text, "复制成功")
|
||||||
|
event.stopPropagation(), event.preventDefault()
|
||||||
},
|
},
|
||||||
|
|
||||||
camera: function(can, msg, cb) {
|
camera: function(can, msg, cb) {
|
||||||
@ -161,25 +162,8 @@ Volcanos("user", {help: "用户模块", agent: {
|
|||||||
return {button: typeof item == "object"? item: [item, function(event) { cbs(event, item) }]}
|
return {button: typeof item == "object"? item: [item, function(event) { cbs(event, item) }]}
|
||||||
}); return }
|
}); return }
|
||||||
|
|
||||||
function _init(target) { var pval = ""
|
function _init(target) { can.onappend.figure(can, item, item.value, target) }
|
||||||
if (item.value && item.value.indexOf("@") == 0) {
|
|
||||||
var pkey = item.value.slice(1).split("=")[0]
|
|
||||||
if (item.value.indexOf("=") > 0) {
|
|
||||||
var pval = item.value.slice(1).split("=")[1]
|
|
||||||
}
|
|
||||||
item._action = msg.Option("action")
|
|
||||||
|
|
||||||
target.type != "button" && (target.value = pval || msg.Option(item.name))
|
|
||||||
can.page.Modify(can, target, {autocomplete: "off"})
|
|
||||||
can.require(["/plugin/input/"+pkey], function(can) {
|
|
||||||
can.onfigure._init(can, item, target, function(event) {
|
|
||||||
var msg = can.request(event); can.page.Select(can, ui.table, "select,input,textarea", function(item) {
|
|
||||||
item.name && msg.Option(item.name, item.value||"")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {type: ["tr"], list: [
|
return {type: ["tr"], list: [
|
||||||
{type: "td", list: [{text: typeof item == "string"? item: item.length > 0? item[0]: item.name || ""}]},
|
{type: "td", list: [{text: typeof item == "string"? item: item.length > 0? item[0]: item.name || ""}]},
|
||||||
{type: "td", list: [typeof item == "string"? /* input */ {input: item, data: {autofocus: true}, _init: _init}:
|
{type: "td", list: [typeof item == "string"? /* input */ {input: item, data: {autofocus: true}, _init: _init}:
|
||||||
|
@ -100,10 +100,10 @@ Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg,
|
|||||||
can.core.CallFunc(can.onaction[key], {event: event, can: can, key: key})
|
can.core.CallFunc(can.onaction[key], {event: event, can: can, key: key})
|
||||||
})
|
})
|
||||||
|
|
||||||
can._target.ontouchstart = function(event) { can.onengine.trigger(can, {}, "action.touch") }
|
can._target.ontouchstart = function(event) { can.onengine.trigger(can, "action.touch", {}) }
|
||||||
can.Conf({width: can._output.offsetWidth-33, height: window.innerHeight})
|
can.Conf({width: can._output.offsetWidth-33, height: window.innerHeight})
|
||||||
can.onengine.listen(can, "resize", function(width, height) { can.Conf({width: width, height: height})
|
can.onengine.listen(can, "resize", function(width, height) { can.Conf({width: width, height: height})
|
||||||
can.onengine.trigger(can, can.request({}, {width: width, height: height}), "action.resize")
|
can.onengine.trigger(can, "action.resize", can.request({}, {width: width, height: height}))
|
||||||
})
|
})
|
||||||
|
|
||||||
can.onengine.listen(can, "search", function(msg, word) {
|
can.onengine.listen(can, "search", function(msg, word) {
|
||||||
|
@ -106,7 +106,7 @@ Volcanos("onaction", {help: "控件交互", list: [], _init: function(can, msg,
|
|||||||
},
|
},
|
||||||
action: function(event, can, river, storm) {
|
action: function(event, can, river, storm) {
|
||||||
var msg = can.request(event, {river: can.Conf(RIVER, river), storm: can.Conf(STORM, storm)})
|
var msg = can.request(event, {river: can.Conf(RIVER, river), storm: can.Conf(STORM, storm)})
|
||||||
can.onengine.trigger(can, msg, "storm.select")
|
can.onengine.trigger(can, "storm.select", msg)
|
||||||
|
|
||||||
can.page.Select(can, can._output, "div.item.select", function(item) {
|
can.page.Select(can, can._output, "div.item.select", function(item) {
|
||||||
can.page.ClassList.del(can, item, "select")
|
can.page.ClassList.del(can, item, "select")
|
||||||
|
@ -1,34 +1,33 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) {
|
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) {
|
||||||
can.ui = can.onlayout.profile(can, can._output)
|
can.ui = can.page.Append(can, can._output, [
|
||||||
can.ui.table = can.page.Append(can, can.ui.display, [{type: "table"}]).first
|
{input: ["word", function(event) { can.onkeypop.input(event, can)
|
||||||
|
if (event.key == "Escape") { can.onmotion.hide(can) }
|
||||||
can.ui.word = can.page.Append(can, can._action, [{input: ["word", function(event) { can.onkeypop.input(event, can)
|
|
||||||
if (event.key == "Escape") { can.onmotion.hide(can) }
|
|
||||||
|
|
||||||
if (event.key == "Enter") { event.stopPropagation(), event.preventDefault()
|
|
||||||
if (event.ctrlKey && can.onaction.choice(event, can, 0)) { return }
|
|
||||||
can.input(event, event.target.value)
|
|
||||||
}
|
|
||||||
}]}]).first
|
|
||||||
|
|
||||||
|
if (event.key == "Enter") { event.stopPropagation(), event.preventDefault()
|
||||||
|
if (event.ctrlKey && can.onaction.choice(event, can, 0)) { return }
|
||||||
|
can.input(event, event.target.value)
|
||||||
|
}
|
||||||
|
}]},
|
||||||
|
{view: "content"}, {view: "display", list: [{type: "table"}]},
|
||||||
|
])
|
||||||
typeof cb == "function" && cb(msg)
|
typeof cb == "function" && cb(msg)
|
||||||
},
|
},
|
||||||
_table: function(can, msg, fields) { can.onmotion.clear(can, can.ui.content)
|
_table: function(can, msg, fields) { can.onmotion.clear(can, can.ui.content)
|
||||||
var table = can.onappend.table(can, msg, can.ui.content, "table", function(value, key, index, line) { can.Status("count", index+1)
|
var table = can.onappend.table(can, msg, can.ui.content, "table", function(value, key, index, line) {
|
||||||
|
can.Status("count", index+1)
|
||||||
return {text: [key == "text" && typeof line.text == "function" && line.text.help || value, "td"], onclick: function(event) {
|
return {text: [key == "text" && typeof line.text == "function" && line.text.help || value, "td"], onclick: function(event) {
|
||||||
// if (event.shiftKey) {
|
if (event.shiftKey) { var msg = can.request(event, line)
|
||||||
can.onappend.plugin(can, {index: msg.Option("index")||line.ctx+"."+line.cmd, arg: [line.type, line.name]}, function(story, meta) {
|
can.onappend.plugin(can, {index: line.ctx+"."+line.cmd}, function(story, meta) {
|
||||||
story.run = function(event, cmds, cb, silent) {
|
story.run = function(event, cmds, cb, silent) {
|
||||||
can.run(event, ["action", "command", "run", meta.index].concat(cmds), function(msg) {
|
can.run(event, ["command", "run", meta.index].concat(cmds), function(msg) {
|
||||||
typeof cb == "function" && cb(msg)
|
typeof cb == "function" && cb(msg)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, can.ui.profile)
|
}, can.ui.display)
|
||||||
can.onmotion.clear(can, can.ui.profile)
|
return
|
||||||
// return
|
}
|
||||||
// }
|
|
||||||
if (line.ctx == "web.chat" && line.cmd == "/search") {
|
if (line.ctx == "web.chat" && line.cmd == "/search") {
|
||||||
can.onimport.select(can, can.request(), [line.type, line.name, line.text], can.cb)
|
can.onimport.select(can, msg, [line.type, line.name, line.text], can.cb)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (typeof line.text == "function") {
|
if (typeof line.text == "function") {
|
||||||
@ -51,11 +50,10 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
can.page.Modify(can, can.ui.table, {style: {width: table.offsetWidth}})
|
can.page.Modify(can, can.ui.table, {style: {width: table.offsetWidth}})
|
||||||
},
|
},
|
||||||
_word: function(can, msg, cmds, fields) {
|
_word: function(can, msg, cmds, fields) {
|
||||||
can.request(msg._event, {fields: fields.join(","), word: cmds})
|
var msg = can.request({}, {fields: fields.join(","), word: cmds})
|
||||||
can.onengine.trigger(can, msg, "search")
|
can.onengine.trigger(can, "search", msg)
|
||||||
|
|
||||||
can.onmotion.clear(can, can.ui.content)
|
can.onmotion.clear(can, can.ui.content)
|
||||||
can.onmotion.clear(can, can.ui.profile)
|
|
||||||
can.run(msg._event, cmds, function(msg) { can.list = msg.Table()
|
can.run(msg._event, cmds, function(msg) { can.list = msg.Table()
|
||||||
can.onimport._table(can, msg, fields)
|
can.onimport._table(can, msg, fields)
|
||||||
})
|
})
|
||||||
@ -79,7 +77,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
can.page.Modify(can, can._target, {style: {left: item.offsetWidth}})
|
can.page.Modify(can, can._target, {style: {left: item.offsetWidth}})
|
||||||
})
|
})
|
||||||
|
|
||||||
can.onmotion.show(can), can.ui.word.focus()
|
can.onmotion.show(can), can.ui.input.focus()
|
||||||
can.onimport._word(can, msg, cmds, fields)
|
can.onimport._word(can, msg, cmds, fields)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -18,17 +18,7 @@ Volcanos("onaction", {help: "控件交互", list: [], _init: function(can, meta,
|
|||||||
case "select": meta.value && (target.value = meta.value); break
|
case "select": meta.value && (target.value = meta.value); break
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meta.figure.indexOf("@") == 0) {
|
can.onappend.figure(can, meta, meta.figure, target)
|
||||||
var ls = meta.figure.slice(1).split("=")
|
|
||||||
var pkey = ls[0], pval = ls[1]||""
|
|
||||||
|
|
||||||
target.type != "button" && target.value.startsWith("@") && (target.value = pval)
|
|
||||||
can.require(["/plugin/input/"+pkey+".js"], function(can) {
|
|
||||||
can.onfigure && can.core.Item(can.onfigure[pkey], function(key, value) { if (key.startsWith("on")) {
|
|
||||||
target[key] = function(event) { value(event, can, meta, target) }
|
|
||||||
} })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"upload": function(event, can) { can.user.upload(event, can) },
|
"upload": function(event, can) { can.user.upload(event, can) },
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Volcanos("onfigure", {help: "控件详情", list: [], date: {onclick: function(event, can, item, target) { target = target || event.target
|
Volcanos("onfigure", {help: "控件详情", list: [], date: {onclick: function(event, can, item, target) {
|
||||||
|
|
||||||
// 设置输入
|
// 设置输入
|
||||||
function set(now) {
|
function set(now) {
|
||||||
@ -7,10 +7,10 @@ Volcanos("onfigure", {help: "控件详情", list: [], date: {onclick: function(e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 添加插件
|
// 添加插件
|
||||||
|
can._figure && can.page.Remove(can, can._figure.fieldset)
|
||||||
var figure = can.onappend.field(can, document.body, "input date", {})
|
var figure = can.onappend.field(can, document.body, "input date", {})
|
||||||
|
can._figure = figure; can.onlayout.figure(can, figure, event)
|
||||||
figure.table = can.page.Append(can, figure.output, [{type: "table"}]).first
|
figure.table = can.page.Append(can, figure.output, [{type: "table"}]).first
|
||||||
can.page.Modify(can, figure.fieldset, {style: {top: event.clientY+10, left: event.clientX}})
|
|
||||||
can.page.Remove(can, figure.legend)
|
|
||||||
|
|
||||||
// 添加控件
|
// 添加控件
|
||||||
var now = target.value? new Date(target.value): new Date()
|
var now = target.value? new Date(target.value): new Date()
|
||||||
@ -19,7 +19,7 @@ Volcanos("onfigure", {help: "控件详情", list: [], date: {onclick: function(e
|
|||||||
"关闭", {type: "hr", style: {margin: 0}},
|
"关闭", {type: "hr", style: {margin: 0}},
|
||||||
"上一月", ["year"].concat(can.core.List(now.getFullYear() - 20, now.getFullYear() + 20)),
|
"上一月", ["year"].concat(can.core.List(now.getFullYear() - 20, now.getFullYear() + 20)),
|
||||||
["month"].concat(can.core.List(1, 13)), "下一月", {view: ["", "br"]},
|
["month"].concat(can.core.List(1, 13)), "下一月", {view: ["", "br"]},
|
||||||
], function(event, value, cmd) {can.stick = true
|
], function(event, value, cmd) { can.stick = true
|
||||||
// 设置时间
|
// 设置时间
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case "year": now.setFullYear(parseInt(value)), show(now); return
|
case "year": now.setFullYear(parseInt(value)), show(now); return
|
||||||
@ -73,6 +73,5 @@ Volcanos("onfigure", {help: "控件详情", list: [], date: {onclick: function(e
|
|||||||
for (var day = new Date(end); end.getDay() != 0 && day < tail; day.setDate(day.getDate()+1)) {add(day, "next")}
|
for (var day = new Date(end); end.getDay() != 0 && day < tail; day.setDate(day.getDate()+1)) {add(day, "next")}
|
||||||
return now
|
return now
|
||||||
}; show(now)
|
}; show(now)
|
||||||
return figure
|
|
||||||
}} }, ["/plugin/input/date.css"])
|
}} }, ["/plugin/input/date.css"])
|
||||||
|
|
||||||
|
@ -1,38 +1,23 @@
|
|||||||
Volcanos("onfigure", {help: "控件详情", list: [], _init: function(can, item, target, cb) {
|
Volcanos("onfigure", {help: "控件详情", list: [], key: {onclick: function(event, can, item, target) { function run() {
|
||||||
can.core.Item(can.onfigure.key, function(key, value) { if (key.startsWith("on")) {
|
var msg = can.request(event, can.Option()); msg.Option("action", item._action)
|
||||||
target[key] = function(event) {
|
can.run(event, ["action", "inputs", item.name, target.value], function(msg) {
|
||||||
cb(event), value(event, can, item, target)
|
if (!msg.append) { return }
|
||||||
}
|
|
||||||
} })
|
|
||||||
},
|
|
||||||
key: {onclick: function(event, can, item, target) {
|
|
||||||
function run() { var msg = can.request(event); msg.Option(can.Option())
|
|
||||||
msg.Option("action", item._action)
|
|
||||||
can.run(event, ["action", "inputs", item.name, target.value], function(msg) {
|
|
||||||
if (!msg.append) { return }
|
|
||||||
|
|
||||||
can._figure && can.page.Remove(can, can._figure.fieldset)
|
can._figure && can.page.Remove(can, can._figure.fieldset)
|
||||||
can._figure = can.onappend.field(can, document.body, "input key", {})
|
var figure = can.onappend.field(can, document.body, "input key", {})
|
||||||
|
can._figure = figure; can.onlayout.figure(can, figure, event)
|
||||||
|
|
||||||
var layout = {top: event.clientY+10, left: event.clientX}
|
can.onappend._action(can, [
|
||||||
can.onmotion.move(can, can._figure.fieldset, layout)
|
{button: ["清空", function(event) { target.value = "" }]},
|
||||||
can.page.Modify(can, can._figure.fieldset, {style: layout})
|
{button: ["关闭", function(event) { can.page.Remove(can, can._figure.fieldset) }]},
|
||||||
can.page.Remove(can, can._figure.legend)
|
], can._figure.action)
|
||||||
|
|
||||||
can.page.Append(can, can._figure.action, [
|
can.onappend.table(can, msg, can._figure.output, "table", function(value, key, index, line) {
|
||||||
{button: ["清空", function(event) { target.value = "" }]},
|
return {type: "td", inner: value, onclick: function() {
|
||||||
{button: ["关闭", function(event) { can.page.Remove(can, can._figure.fieldset) }]},
|
target.value = value; msg.Option("_refresh") && run()
|
||||||
])
|
can.page.Remove(can, can._figure.fieldset)
|
||||||
|
}}
|
||||||
can.page.AppendTable(can, msg, can._figure.output, msg.append, function(value, key, index, line) {
|
})
|
||||||
return {type: "td", inner: value, onclick: function() {
|
}, true)
|
||||||
target.value = value; msg.Option("_refresh") && run()
|
}; run() }}, }, ["/plugin/input/key.css"])
|
||||||
can.page.Remove(can, can._figure.fieldset)
|
|
||||||
}}
|
|
||||||
})
|
|
||||||
}, true)
|
|
||||||
}
|
|
||||||
run()
|
|
||||||
}},
|
|
||||||
}, ["/plugin/input/key.css"])
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user