From 4efab3b3ceec69d73c8d028c8cefc70f299d4bc9 Mon Sep 17 00:00:00 2001 From: harveyshao Date: Mon, 23 May 2022 08:31:21 +0800 Subject: [PATCH] opt some --- lib/user.js | 7 +++++-- page/index.css | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/user.js b/lib/user.js index 0f341a6b..ad295f42 100644 --- a/lib/user.js +++ b/lib/user.js @@ -244,7 +244,7 @@ Volcanos("user", {help: "用户操作", info: {}, agent: { input: function(event, can, form, cb, button) { if (!form || form.length == 0) { return cb() } var msg = can.request(event) var ui = can.page.Append(can, document.body, [{view: [html.INPUT], style: {left: 0, top: 0}, list: [ - {view: [chat.OPTION, html.TABLE], list: can.core.List(form, function(item) { + {view: "content", list: [{view: [chat.OPTION, html.TABLE], list: can.core.List(form, function(item) { item = can.base.isString(item)? {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: item.name == html.TEXT? html.TEXTAREA: html.TEXT) @@ -265,7 +265,7 @@ Volcanos("user", {help: "用户操作", info: {}, agent: { // return {type: html.TR, list: [{type: html.TD, list: [{text: item._trans||can.user.trans(can, item.name)||""}]}, {type: html.TD, list: [can.page.input(can, item)]} ]} return {type: html.TR, list: [{type: html.TD, list: [{text: item.name||""}]}, {type: html.TD, list: [can.page.input(can, item)]} ]} - })}, {view: chat.ACTION}, + })}]}, {view: chat.ACTION}, ]}]) var layout = can.onlayout.figure(event, can, ui._target) @@ -274,6 +274,9 @@ Volcanos("user", {help: "用户操作", info: {}, agent: { can.page.style(can, ui._target, layout) } can.page.ClassList.add(can, ui._target, chat.FLOAT) + if (layout.top) { + can.page.style(can, ui.content, html.MAX_HEIGHT, window.innerHeight - layout.top - 200) + } var action = can.onappend._action(can, button||[html.SUBMIT, html.CANCEL], ui.action, { focus: function(event) { can.page.Select(can, ui.first, html.INPUT_ARGS)[0].focus() }, diff --git a/page/index.css b/page/index.css index 86b2246f..5d27bbe6 100644 --- a/page/index.css +++ b/page/index.css @@ -107,6 +107,7 @@ body>div.carte div.item { padding:3px 12px; } body>div.input { background-color:#0d4142a6; padding:5px; } body>div.input div.item { float:left; } body>div.input tr td:first-child { text-align:center; } +body>div.input div.content { overflow:auto; max-height:200px; } body>div.input select { width:183px; margin:5px; } body>div.input input[type=text] { width:171px; margin:5px; } body>div.input input[name=username] { width:171px; }