From 20318a125cdfb6a35fbbc6711dbea48d2014d17c Mon Sep 17 00:00:00 2001 From: harveyshao Date: Wed, 2 Nov 2022 19:35:59 +0800 Subject: [PATCH] opt some --- frame.js | 2 +- lib/user.js | 8 ++++---- page/index.css | 2 ++ panel/action.js | 1 + plugin/local/team/plan.js | 2 -- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/frame.js b/frame.js index 5aea8159..b2d3073c 100644 --- a/frame.js +++ b/frame.js @@ -119,7 +119,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { sub._trans = can.base.Copy(sub._trans||{}, can.core.Value(sub, [chat.ONACTION, chat._TRANS])), meta.inputs && sub.onappend._option(sub, meta, sub._option, meta.msg) if (meta.msg) { var msg = sub.request(); msg.Copy(can.base.Obj(meta.msg)), sub.onappend._output(sub, msg, meta.display||msg.Option(ice.MSG_DISPLAY)||meta.feature.display) } - can.core.Value(can, sub._legend, chat.ONMOUSEENTER, function(event) { + can.core.Value(sub._legend, chat.ONMOUSEENTER, function(event) { can.user.carte(event, sub, sub.onaction, sub.onaction.list.concat([[ctx.ACTION].concat(can.core.Item(meta.feature._trans))]), function(event, button, meta) { var _sub = can.core.Value(sub, chat._OUTPUTS_CURRENT) var cb = can.core.Value(_sub, [chat.ONACTION, button]); if (can.base.isFunc(cb)) { return cb(event, _sub, button) } diff --git a/lib/user.js b/lib/user.js index 2d519ecc..d522bcad 100644 --- a/lib/user.js +++ b/lib/user.js @@ -95,9 +95,8 @@ Volcanos("user", {info: {}, agent: { }); can.onmotion.story.auto(can, ui._target) return can._toast && (can._toast.close(), delete(can._toast)), can._toast = action }, - share: function(can, msg, cmd) { can.run(msg, cmd||[ctx.ACTION, chat.SHARE], function(msg) { + share: function(can, msg, cmd) { can.run(msg, cmd||[ctx.ACTION, chat.SHARE], function(msg) { can.user.copy(msg._event, can, msg.Append(mdb.NAME)) can.user.toast(can, {title: msg.Append(mdb.NAME), duration: -1, content: msg.Append(mdb.TEXT), action: [cli.CLOSE, cli.OPEN]}) - can.user.copy(msg._event, can, msg.Append(mdb.NAME)) }) }, copy: function(event, can, text) { if (!text) { return } if (navigator.clipboard) { var ok = false; navigator.clipboard.writeText(text).then(function() { ok = true }) @@ -145,7 +144,7 @@ Volcanos("user", {info: {}, agent: { item.mode = chat.SIMPLE, can.onappend.figure(can, item, target) }; return {type: html.TR, list: [{type: html.TD, list: [{text: item.name||""}, {text: item.need == "must"? "*": "", style: {color: cli.RED}}]}, {type: html.TD, list: [can.page.input(can, item)]}]} })}]}, html.ACTION, - ]}]); can.onmotion.delay(can, function() { can.onlayout.figure(event, can, ui._target), action.focus() }) + ]}]) var action = can.onappend._action(can, button||[html.SUBMIT, html.CANCEL], ui.action, { focus: function() { can.onmotion.focus(can, can.page.Select(can, ui.first, html.INPUT_ARGS)[0]) }, cancel: function() { can.page.Remove(can, ui._target) }, @@ -156,7 +155,8 @@ Volcanos("user", {info: {}, agent: { }); if (err) { return } can.onkeymap.prevent(event) can.core.CallFunc(cb, {event: can.request(event, {_handle: ice.TRUE})._event, button: button, data: data, list: list, args: args}) || action.cancel() }, _target: ui._target, _engine: function(event, can, button) { action.submit(event, can, button) }, - }); return button === true && action.submit(event, can, html.SUBMIT), action + }); can.onlayout.figure(event, can, ui._target), can.onmotion.delay(can, function() { action.focus() }) + return button === true && action.submit(event, can, html.SUBMIT), action }, select: function(event, can, type, fields, cb, cbs) { can.search(can.request(event, {fields: fields||"type,name,text"}), ["Search.onimport.select", type, "", ""], function(list) { diff --git a/page/index.css b/page/index.css index badf2b5d..e948c5bb 100644 --- a/page/index.css +++ b/page/index.css @@ -125,6 +125,8 @@ select { font-size:1.1rem; height:31px; } input { font-size:1.1rem; height:31px; } table.content th, table.content td, div.zone>div.name, div.item, div.code, code.story, div.story[data-type=spark] { font-size:1.1rem; font-family:monospace; } div.status>div.item>label { font-size:0.6rem; font-family:monospace; } +fieldset.plugin>form.option>div.item { height:31px; } +fieldset.plugin>div.action>div.item { height:31px; } div.status>div.item { padding:4px; height:22px; } div.action>div.tabs { padding:5px 10px; height:21px; } svg { font-family:monospace; } diff --git a/panel/action.js b/panel/action.js index 764817f7..9abaad75 100644 --- a/panel/action.js +++ b/panel/action.js @@ -143,6 +143,7 @@ Volcanos(chat.ONACTION, {_init: function(can, target) { can.page.ClassList.add(can, can._target, can.Conf(chat.LAYOUT, button)) can._header_tabs && can.onmotion.hidden(can, can._header_tabs) can.user.isMobile || can.isCmdMode() || (can.onmotion.toggle(can, can._root.River._target, true), can.onmotion.toggle(can, can._root.Footer._target, true)) + can.user.isMobile && can.isCmdMode() && can.page.style(can, can._target, html.WIDTH, "", html.HEIGHT, "") can.onlayout._init(can); var cb = can.onlayout[button]; if (can.base.isFunc(cb) && cb(can, silent)) { return } can.onlayout._plugin(can, button) }, help: function(can, button) { can.user.open("/help/"+button+".shy") }, diff --git a/plugin/local/team/plan.js b/plugin/local/team/plan.js index f943c731..66f3932c 100644 --- a/plugin/local/team/plan.js +++ b/plugin/local/team/plan.js @@ -114,8 +114,6 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( can.onimport._content(can, msg, head, list, key, get, set) }, layout: function(can) { - can.onmotion.toggle(can, can._action, !can.isFloatMode() && !(can.user.isMobile && can.page.height() < can.page.width())) - can.onmotion.toggle(can, can._status, !can.isFloatMode() && !(can.user.isMobile && can.page.height() < can.page.width())) can.page.styleWidth(can, can.ui.content, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth) if (true || !can.isAutoMode() || can.isStoryType()) { can.page.styleHeight(can, can._output, can.ConfHeight()) var height = can._display_heights[can.sup.task? [can.sup.task.zone, can.sup.task.id].join(ice.FS): ""]||html.ACTION_HEIGHT