From 7597f8654a7bd640c085187c2a5f5499b8e08f36 Mon Sep 17 00:00:00 2001 From: shylinux Date: Thu, 14 Oct 2021 04:14:48 +0800 Subject: [PATCH] opt some --- frame.js | 4 +++- lib/page.js | 3 +++ lib/user.js | 3 ++- page/index.css | 19 +++++++++++-------- panel/river.js | 6 +++--- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/frame.js b/frame.js index 52b42981..a6188fa3 100644 --- a/frame.js +++ b/frame.js @@ -377,7 +377,9 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta, }) }, - figure: function(can, meta, target, cb) { if (target.type == html.BUTTON) { return } + figure: function(can, meta, target, cb) { + if (meta.type == html.BUTTON) { return } + if (meta.type == html.SELECT) { return } var input = meta.action||"key"; can.require(["/plugin/input/"+input+".js"], function(can) { can.core.Item(can.onfigure[input], function(key, on) { if (key.indexOf("on") != 0) { return } target[key] = function(event) { diff --git a/lib/page.js b/lib/page.js index 7230cece..879a813a 100644 --- a/lib/page.js +++ b/lib/page.js @@ -311,6 +311,8 @@ Volcanos("page", {help: "用户界面", ClassList: { case "password": // no break case html.TEXT: + if (item.username) { item.type = "text"; return item } + if (item.password) { return item } item.autocomplete = "off" item.value = value||item.value||"" item.className || can.page.ClassList.add(can, item, "args") @@ -326,6 +328,7 @@ Volcanos("page", {help: "用户界面", ClassList: { case html.BUTTON: item.value = item.value||item.name||"list"; break case "upfile": item.type = html.FILE; break case "upload": item.type = html.FILE, input.name = "upload"; break + default: } return input }, diff --git a/lib/user.js b/lib/user.js index 2cf0b982..31eb19aa 100644 --- a/lib/user.js +++ b/lib/user.js @@ -193,6 +193,7 @@ Volcanos("user", {help: "用户操作", agent: { var ui = can.page.Append(can, document.body, [{view: ["input"], style: {left: 0, top: 0}, list: [ {view: ["option", "table"], list: can.core.List(form, function(item) { item = typeof item == "string"? {type: html.TEXT, name: item}: item.length > 0? {type: html.SELECT, name: item[0], values: item.slice(1)}: item + item.type = item.type||(item.values? html.SELECT: html.TEXT) item._init = function(target) { item.run = function(event, cmds, cb) { @@ -203,7 +204,7 @@ Volcanos("user", {help: "用户操作", agent: { }, msg, can.Option()); can.run(event, cmds, cb, true) } - target.value = target.value||can.Option(item.name)||"" + target.value = target.value||(item.name&&can.Option(item.name))||"" can.onappend.figure(can, item, target) } diff --git a/page/index.css b/page/index.css index 88f70362..f1a2ad56 100644 --- a/page/index.css +++ b/page/index.css @@ -68,12 +68,12 @@ body.en input[type=button] { input[type=button]:hover { background-color:gray; color:cyan; } -input[type=password] { - width:82px; height:21px; font-size:16px; - box-shadow: 4px 4px 10px 1px #626bd0; - background-color:cyan; color:black; - padding: 0 4px; -} +/* input[type=password] { */ +/* width:82px; height:21px; font-size:16px; */ +/* box-shadow: 4px 4px 10px 1px #626bd0; */ +/* background-color:cyan; color:black; */ +/* padding: 0 4px; */ +/* } */ input[type=text] { width:82px; height:21px; font-size:16px; box-shadow:4px 4px 10px 1px #626bd0; @@ -383,7 +383,10 @@ body>div.input { body>div.input input[type=text] { width:171px; } -body>div.input input[type=password] { +body>div.input input[name=username] { + width:171px; +} +body>div.input input[name=password] { width:171px; } body>div.input textarea { @@ -400,7 +403,7 @@ body>div.input.login { padding:10px; } body>div.input.login input { - font-size:18px + font-size:18px; } body>div.upload { diff --git a/panel/river.js b/panel/river.js index 87ad1a6a..50a8bbbd 100644 --- a/panel/river.js +++ b/panel/river.js @@ -277,9 +277,9 @@ Volcanos("ondetail", {help: "菜单交互", list: ["共享群组", "添加应用 var msg = can.request(event, {action: cli.START}) can.run(event, cmds, cb, silent) }}, [ - {name: "name", value: "@key=hi"}, - {name: "repos", value: "@key"}, - {name: "template", value: "@key"}, + {name: "name", value: "hi", action: "key"}, + {name: "repos", action: "key"}, + {name: "template", action: "key"}, ], function(event, button, data, list, args) { can.run(event, [ctx.ACTION, cli.START].concat(args, chat.RIVER, river), function(msg) { var link = can.user.MergeURL(can, {_path: "/chat/pod/"+can.core.Keys(can.user.Search(can, cli.POD), msg.Option(kit.MDB_NAME))})