1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-26 17:24:06 +08:00

opt search

This commit is contained in:
shaoying 2021-01-12 20:15:38 +08:00
parent 58d1f99d03
commit 51c558fd56
3 changed files with 18 additions and 2 deletions

View File

@ -372,6 +372,8 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
break break
case "textarea": case "textarea":
input.type = "textarea" input.type = "textarea"
item.style.width = can.Conf(["feature", "textarea", item.name, "width"].join(".")) || can.Conf(["feature", "textarea", "width"].join(".")) || item.style.width
item.style.height = can.Conf(["feature", "textarea", item.name, "height"].join(".")) || can.Conf(["feature", "textarea", "height"].join(".")) || item.style.height
item.value = can.Conf("content") || item.value item.value = can.Conf("content") || item.value
// no break // no break
case "password": case "password":

View File

@ -16,6 +16,20 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
var table = can.onappend.table(can, msg, can.ui.content, "table", function(value, key, index, line) { var table = can.onappend.table(can, msg, can.ui.content, "table", function(value, key, index, line) {
can.Status("count", index+1) 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) { var msg = can.request(event, line)
can.onappend.plugin(can, {index: line.ctx+"."+line.cmd}, function(story, meta) {
story.run = function(event, cmds, cb, silent) {
can.run(event, ["command", "run", meta.index].concat(cmds), function(msg) {
typeof cb == "function" && cb(msg)
})
}
}, can.ui.display)
return
}
if (line.ctx == "web.chat" && line.cmd == "/search") {
can.onimport.select(can, msg, [line.type, line.name, line.text], can.cb)
return
}
if (typeof line.text == "function") { if (typeof line.text == "function") {
return can.onmotion.hide(can), line.text(event) return can.onmotion.hide(can), line.text(event)
} }
@ -71,7 +85,7 @@ Volcanos("onaction", {help: "交互操作", list: ["关闭", "清空", "完成"]
can.onimport._init(can, msg, list, cb, can._output) can.onimport._init(can, msg, list, cb, can._output)
}, },
"关闭": function(event, can) { can.onmotion.hide(can) }, "关闭": function(event, can) { can.onmotion.hide(can) },
"清空": function(event, can) { can.onmotion.clear(can, can.ui.table) }, "清空": function(event, can) { can.onmotion.clear(can, can.ui.table), can.onmotion.clear(can, can.ui.display) },
"完成": function(event, can) { typeof can.cb == "function" && can.cb() }, "完成": function(event, can) { typeof can.cb == "function" && can.cb() },
choice: function(event, can, index) { choice: function(event, can, index) {

View File

@ -9,7 +9,7 @@ Volcanos("onaction", {help: "控件交互", list: [], _init: function(can, meta,
}) , typeof cb == "function" && cb() }) , typeof cb == "function" && cb()
switch (meta.type) { switch (meta.type) {
case "textarea": !target.placeholder && (target.placeholder = meta.name || ""); break case "textarea":
case "text": case "text":
!target.placeholder && (target.placeholder = meta.name || "") !target.placeholder && (target.placeholder = meta.name || "")
!target.title && (target.title = target.placeholder) !target.title && (target.title = target.placeholder)