1
0
forked from x/volcanos
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-03-04 02:36:21 +08:00
parent 0850d12bec
commit acca353827
7 changed files with 26 additions and 18 deletions

View File

@ -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(name) || !can.base.isString(name) || name == _name) { return }
if (can.base.isUndefined(command)) { return arguments.callee.meta[_name] } 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) { 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 }); 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) 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) 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) }), meta.inputs && sub.onappend._option(sub, meta, sub._option, meta.msg)
sub._legend && (sub._legend.onclick = function(event) { 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.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) }), 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()) { if (key == ctx.ACTION && msg.IsDetail()) {
can.onappend.style(can, ctx.ACTION, target.parentNode) 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) 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 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 } var _icon = can.Conf("_icons."+target.name)||icon[target.name]; if (_icon && typeof _icon == code.STRING || target.name == mdb.DELETE) { return target }

View File

@ -51,15 +51,12 @@ body {
--input-padding:5px; --input-margin:var(--input-padding); --input-padding:5px; --input-margin:var(--input-padding);
--table-padding:var(--button-padding); --table-padding:var(--button-padding);
--header-height:48px; --footer-height:var(--action-height); --action-height:32px; --status-height:var(--action-height); --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; --river-width:var(--project-width); --project-width:230px; --input-width:140px; --button-width:60px; --form-width:320px; --url-input-width:480px;
--url-input-width:320px; --textarea-height:96px; --card-width:320px; --card-height:160px; --qrcode-width:360px; --qrcode-height:364px;
--qrcode-width:360px; --qrcode-height:364px; --story-height:480px; --iframe-height:420px;
--iframe-height:420px;
--card-height:160px; --card-width:320px;
--story-height:480px;
--float-height:var(--story-height); --float-width:1200px; --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; --desktop-height:684px; --desktop-width:var(--float-width); --desktop-icon-size:80px;
--action-button:10; --table-button:5; --card-button:5; --action-button:10; --table-button:5; --card-button:5;
--order-show-limit:30; --order-show-delay:150; --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.web.chat.wx.agent { position:fixed; left:0; bottom:0; }
/* fieldset.story>form.option>div.item.text.path>input { width:var(--input-width); } */ /* 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.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 */ /* scrollbar */
div.scrollbar { div.scrollbar {
background-color:var(--hover-bg-color); font-size:8px !important; line-height:10px; background-color:var(--hover-bg-color); font-size:8px !important; line-height:10px;

View File

@ -139,10 +139,9 @@ Volcanos("misc", {
xhr.open(msg._method||http.POST, url), xhr.onreadystatechange = function() { if (xhr.readyState != 4) { return } xhr.open(msg._method||http.POST, url), xhr.onreadystatechange = function() { if (xhr.readyState != 4) { return }
try { var res = JSON.parse(xhr.responseText) } catch (e) { 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]} } if (xhr.responseText.indexOf("warn: ")) { var res = {result: [xhr.responseText]} } else { var res = {result: [xhr.responseText]} }
} msg.Option("_cost", new Date() - begin) } msg.Option("_cost", new Date() - begin), msg.detail || (msg.detail = res.detail), msg.Copy(res)
if (xhr.status == 200) { return msg.detail || (msg.detail = res.detail), can.base.isFunc(cb) && cb(msg.Copy(res)) } if (xhr.status == 200) { return can.base.isFunc(cb) && cb(msg) } typeof msg._failure == code.FUNCTION && msg._failure()
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)
can.user.toastFailure(msg._can||can, xhr.response), can.misc.Warn(xhr.status, res, url, form), cbs && cbs(xhr)
}, xhr.setRequestHeader(http.Accept, msg._accept||http.ApplicationJSON) }, 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) }) 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) data.append(ice.MSG_UPLOAD, web.UPLOAD), data.append(web.UPLOAD, msg._upload)

View File

@ -375,6 +375,7 @@ Volcanos("page", {
case html.USERNAME: // no break case html.USERNAME: // no break
case html.PASSWORD: // no break case html.PASSWORD: // no break
case html.TEXT: 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.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 item.placeholder = item.placeholder||item.name
break break

View File

@ -200,7 +200,7 @@ Volcanos(chat.ONKEYMAP, {
}) })
Volcanos(chat.ONPLUGIN, { Volcanos(chat.ONPLUGIN, {
_plugin: shy("插件", [mdb.NAME, ice.LIST, ice.BACK]), _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]) }), _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]) }), 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]) }),
}) })

View File

@ -4,6 +4,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
can.onmotion.hidden(can, can.ui.project) 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) 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() 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) _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]) }) var hash = {}; msg.Table(function(value, index) { var k = key(can.base.Date(value.begin_time)); hash[k] = (hash[k]||[]).concat([value]) })

View File

@ -1,7 +1,14 @@
Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(can, target), can.onappend.table(can, msg) 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 function show(data, target, index, total) { var list
switch (typeof data) { switch (typeof data) {
case code.OBJECT: if (data == null) { can.page.Append(can, target, [{text: "null"}]); break } case code.OBJECT: if (data == null) { can.page.Append(can, target, [{text: "null"}]); break }