diff --git a/frame.js b/frame.js index e4ebdace..715a2bb4 100644 --- a/frame.js +++ b/frame.js @@ -60,7 +60,7 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) { if (can.base.isUndefined(name) || !can.base.isString(name) || name == _name) { return } if (can.base.isUndefined(command)) { return arguments.callee.meta[_name] } var button = false, type = html.TEXT; command.list = can.core.List(command.list, function(item) { - return can.base.isString(item) && (item = can.core.SplitInput(item, can.base.isFunc(command.meta[item])? html.BUTTON: type)), item.type != html.SELECT && (type = item.type), button = button || item.type == html.BUTTON, item + return can.base.isString(item) && (item = can.core.SplitInput(item, can.base.isIn(item, html.FILTER)? html.TEXT: can.base.isFunc(command.meta[item])? html.BUTTON: type)), item.type != html.SELECT && (type = item.type), button = button || item.type == html.BUTTON, item }); if (!button) { command.list.push(can.core.SplitInput(ice.LIST, html.BUTTON)) } command.can = can, command.meta.name = name, arguments.callee.meta[_name] = command }), listen: shy(function(can, name, cb, target) { arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb) @@ -165,7 +165,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { sub.onappend._output(sub, msg, meta.display||msg.Option(ice.MSG_DISPLAY)||meta.feature.display) }), meta.inputs && sub.onappend._option(sub, meta, sub._option, meta.msg) sub._legend && (sub._legend.onclick = 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) { can.misc.Event(event, sub, function(msg) { + can.user.carte(event, sub, sub.onaction, sub.onaction.list.concat([["操作"].concat(can.core.Item(meta.feature._trans))]), function(event, button) { can.misc.Event(event, sub, function(msg) { can.misc.Inputs(sub, msg, [ctx.ACTION, button], null, meta) || msg.RunAction(event, sub.sub, [ctx.ACTION, button]) || msg.RunAction(event, sub, [ctx.ACTION, button]) || sub.runAction(event, button, [], function(msg) { can.onappend._output(sub, msg) }) }) }) }), can.base.isFunc(cb) && cb(sub) @@ -549,6 +549,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { if (key == ctx.ACTION && msg.IsDetail()) { can.onappend.style(can, ctx.ACTION, target.parentNode) } + if (can.base.isIn(key, mdb.TYPE, mdb.STATUS)) { + can.onappend.style(can, value, can.page.parentNode(can, target, html.TABLE)) + } key == ctx.ACTION && can.onappend.mores(can, target, data, msg.IsDetail()? 10: html.TABLE_BUTTON) var list = can.page.Select(can, target, html.INPUT, function(target) { var _icon = can.Conf("_icons."+target.name)||icon[target.name]; if (_icon && typeof _icon == code.STRING || target.name == mdb.DELETE) { return target } diff --git a/index.css b/index.css index cd00f5de..12ecfdb0 100644 --- a/index.css +++ b/index.css @@ -51,15 +51,12 @@ body { --input-padding:5px; --input-margin:var(--input-padding); --table-padding:var(--button-padding); - --header-height:48px; --footer-height:var(--action-height); --action-height:32px; --status-height:var(--action-height); - --river-width:var(--project-width); --project-width:230px; --input-width:140px; --button-width:60px; --form-width:320px; - --url-input-width:320px; --textarea-height:96px; - --qrcode-width:360px; --qrcode-height:364px; - --iframe-height:420px; - --card-height:160px; --card-width:320px; - --story-height:480px; + --header-height:48px; --footer-height:var(--action-height); --action-height:32px; --status-height:var(--action-height); --textarea-height:96px; + --river-width:var(--project-width); --project-width:230px; --input-width:140px; --button-width:60px; --form-width:320px; --url-input-width:480px; + --card-width:320px; --card-height:160px; --qrcode-width:360px; --qrcode-height:364px; + --story-height:480px; --iframe-height:420px; --float-height:var(--story-height); --float-width:1200px; - --plug-height:var(--story-height); --plug-width:var(--float-width); + --plug-height:var(--float-height); --plug-width:var(--float-width); --desktop-height:684px; --desktop-width:var(--float-width); --desktop-icon-size:80px; --action-button:10; --table-button:5; --card-button:5; --order-show-limit:30; --order-show-delay:150; @@ -871,7 +868,7 @@ body:not(.debug) fieldset.plugin.can._notfound { display:none; } fieldset.story.web.chat.wx.agent { position:fixed; left:0; bottom:0; } /* fieldset.story>form.option>div.item.text.path>input { width:var(--input-width); } */ div.output>fieldset.xterm.story>form.option>div.item.hash input { width:var(--form-width); } -div.output>fieldset.iframe.story>form.option>div.item.hash input { width:var(--form-width); } +div.output>fieldset.iframe.story>form.option>div.item.hash input { width:var(--url-input-width); } /* scrollbar */ div.scrollbar { background-color:var(--hover-bg-color); font-size:8px !important; line-height:10px; diff --git a/lib/misc.js b/lib/misc.js index 9f40ebb7..fc11ebf8 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -139,10 +139,9 @@ Volcanos("misc", { xhr.open(msg._method||http.POST, url), xhr.onreadystatechange = function() { if (xhr.readyState != 4) { return } try { var res = JSON.parse(xhr.responseText) } catch (e) { if (xhr.responseText.indexOf("warn: ")) { var res = {result: [xhr.responseText]} } else { var res = {result: [xhr.responseText]} } - } msg.Option("_cost", new Date() - begin) - if (xhr.status == 200) { return msg.detail || (msg.detail = res.detail), can.base.isFunc(cb) && cb(msg.Copy(res)) } - typeof msg._failure == code.FUNCTION && msg._failure() - can.user.toastFailure(msg._can||can, xhr.response), can.misc.Warn(xhr.status, res, url, form), cbs && cbs(xhr) + } msg.Option("_cost", new Date() - begin), msg.detail || (msg.detail = res.detail), msg.Copy(res) + if (xhr.status == 200) { return can.base.isFunc(cb) && cb(msg) } typeof msg._failure == code.FUNCTION && msg._failure() + can.user.toastFailure(msg._can||can, msg.Result(), msg.Option(ice.MSG_TITLE)), can.misc.Warn(xhr.status, res, url, form), cbs && cbs(xhr) }, xhr.setRequestHeader(http.Accept, msg._accept||http.ApplicationJSON) if (msg._upload) { var data = new FormData(); can.core.ItemForm(form, function(v, i, k) { data.append(k, v) }) data.append(ice.MSG_UPLOAD, web.UPLOAD), data.append(web.UPLOAD, msg._upload) diff --git a/lib/page.js b/lib/page.js index 793c8b51..18b2562f 100644 --- a/lib/page.js +++ b/lib/page.js @@ -375,6 +375,7 @@ Volcanos("page", { case html.USERNAME: // no break case html.PASSWORD: // no break case html.TEXT: + case html.FILTER: item.className||can.page.ClassList.add(can, item, ctx.ARGS), item.name = item.name||item.type, item.value = value||item.value||""; item.placeholder = item.placeholder||item.name break diff --git a/panel/action.js b/panel/action.js index 862122fa..b2ca3ad5 100644 --- a/panel/action.js +++ b/panel/action.js @@ -200,7 +200,7 @@ Volcanos(chat.ONKEYMAP, { }) Volcanos(chat.ONPLUGIN, { _plugin: shy("插件", [mdb.NAME, ice.LIST, ice.BACK]), - _filter: shy("表格", [web.FILTER, ice.LIST, ice.BACK]), + _filter: shy("表格", [ice.LIST, html.FILTER]), _notfound: shy("缺失", [ctx.INDEX, web.SPACE, ice.LIST], function(can, msg, arg) { msg.Echo("not found "+arg[0]+" "+arg[1]) }), layout: shy("界面布局", {_init: function(can) { can.Option(chat.LAYOUT, can.getAction(chat.LAYOUT)) }}, ["layout:select=auto,tabs,tabview,horizon,vertical,grid,free,flow,page", ctx.RUN], function(can, msg, arg) { can.onaction.layout(can, arg[0]) }), }) diff --git a/plugin/local/team/plan.js b/plugin/local/team/plan.js index e4aa2a75..2a3b5215 100644 --- a/plugin/local/team/plan.js +++ b/plugin/local/team/plan.js @@ -4,6 +4,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( can.onmotion.hidden(can, can.ui.project) can.onimport[can.Option("scale")||team.WEEK](can, msg), can.Status(mdb.COUNT, msg.Length()), can.ui.filter.placeholder = `search in ${ msg.Length() } items`, can.onimport.layout(can) var item; if (can.isCmdMode() && ls.length > 0) { item = can.list[can.core.Keys(ls)] } else if (can.sup.task) { item = can.list[can.core.Keys(can.sup.task.space, can.sup.task.zone, can.sup.task.id)] } item && item.click() + can.onimport._online(can) }, _content: function(can, msg, head, list, key, get, set) { var begin_time = can.base.Date(can.Option(team.BEGIN_TIME)); can.sup.task && (can.sup.task._target = null) var hash = {}; msg.Table(function(value, index) { var k = key(can.base.Date(value.begin_time)); hash[k] = (hash[k]||[]).concat([value]) }) diff --git a/plugin/story/json.js b/plugin/story/json.js index 18274d79..ad366400 100644 --- a/plugin/story/json.js +++ b/plugin/story/json.js @@ -1,7 +1,14 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(can, target), can.onappend.table(can, msg) - can.onappend.style(can, nfs.JSON, can._output), can.onimport.show(can, can.base.Obj(msg.Result(), {}), target) + can.onappend.style(can, nfs.JSON, can._output), can.onimport.show(can, can.base.Obj(msg.Result(), {}), target, msg) }, - show: function(can, data, target) { var hidden = data.detail && data.option + show: function(can, data, target, msg) { + if (data.append) { + var msg = can.request(); msg.Copy(data), can.onappend.table(can, msg) + msg._xhr = {responseText: msg.Result()} + can.onmotion.delay(can, function() { can.onappend._status(can, msg) }) + return + } + var hidden = data.detail && data.option function show(data, target, index, total) { var list switch (typeof data) { case code.OBJECT: if (data == null) { can.page.Append(can, target, [{text: "null"}]); break }