forked from x/volcanos
add process
This commit is contained in:
parent
b37c87c28e
commit
1e1889b618
33
frame.js
33
frame.js
@ -124,10 +124,14 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
},
|
||||
Option: function(key, value) { value && (value = can.user.trans(sub, value, null, html.INPUT)); return can.page.SelectArgs(can, option, key, value)[0] },
|
||||
Update: function(event, cmds, cb, silent) { event = event||{}
|
||||
event.metaKey && sub.request(event, {metaKey: ice.TRUE})
|
||||
sub.request(event, can.core.Value(sub, "sub.db._checkbox"))._caller()
|
||||
if (event.isTrusted && cmds && cmds.length > 0 && cmds[0] == ctx.ACTION) {
|
||||
can.onengine.signal(can, "onrecord", can.request({}, {cmds: [sub.ConfSpace(), sub.ConfIndex()].concat(cmds||[])})) }
|
||||
sub.request(event, can.core.Value(sub, "sub.db._checkbox"))._caller(),
|
||||
sub.onappend._output0(sub, sub.Conf(), event||{}, cmds||sub.Input([], !silent), cb, silent); return true },
|
||||
can.onengine.signal(can, "onrecord", can.request({}, {cmds: [sub.ConfSpace(), sub.ConfIndex()].concat(cmds||[])}))
|
||||
}
|
||||
sub.onappend._output0(sub, sub.Conf(), event||{}, cmds||sub.Input([], !silent), cb, silent)
|
||||
return true
|
||||
},
|
||||
Focus: function() { can.page.SelectOne(can, option, html.INPUT_ARGS, function(target) { target.focus() }) },
|
||||
Input: function(cmds, save, opts) { cmds = cmds && cmds.length > 0? cmds: can.page.SelectArgs(sub), cmds && cmds[0] != ctx.ACTION && (cmds = can.base.trim(cmds)), cmds._opts = opts
|
||||
return !save || cmds[0] == ctx.ACTION || can.base.Eq(sub._history[sub._history.length-1], cmds) || sub._history.push(cmds), cmds
|
||||
@ -297,7 +301,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
}, target: output})
|
||||
})
|
||||
},
|
||||
_status: function(can, list, status, msg) { status = status||can._status, can.onmotion.clear(can, status); var keys = {}
|
||||
_status: function(can, list, status, msg) { list && list.Option && (list = list.Option(ice.MSG_STATUS)||list)
|
||||
status = status||can._status, can.onmotion.clear(can, status); var keys = {}
|
||||
var fileline = can.base.trimPrefix((can.Conf("_fileline")||"").split("?")[0], "/require/")
|
||||
can.core.List((can.base.Obj(list, can.core.Value(can, [chat.ONEXPORT, mdb.LIST]))||[]).concat([
|
||||
can.ConfSpace() && {name: web.SPACE, value: can.ConfSpace()},
|
||||
@ -388,7 +393,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
can.user.trans(can, kit.Dict(target.name, target.value))
|
||||
return {type: html.BUTTON, name: target.name, value: target.value, style: _style}
|
||||
})
|
||||
function run(event, button) { can.run(can.request(event, value, can.Option()), [ctx.ACTION, button]), can.onkeymap.prevent(event) }
|
||||
function run(event, button) { can.run(can.request(event, value, can.Option())._event, [ctx.ACTION, button]), can.onkeymap.prevent(event) }
|
||||
if (list.length <= limit) {
|
||||
target.onclick = function(event) { run(event, event.target.name) }
|
||||
} else {
|
||||
@ -501,7 +506,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
if (msg.Option(ice.TABLE_CHECKBOX) == ice.TRUE && !msg.IsDetail()) { can.onappend.checkbox(can, table, msg), can.onappend.style(can, html.CHECKBOX, table) }
|
||||
// (can.isCmdMode() || table.offsetWidth > can.ConfWidth() / 2) &&
|
||||
can.onappend.style(can, "full", table)
|
||||
return keys && can.page.RangeTable(can, table, can.core.List(keys, function(key) { return can.page.Select(can, table, html.TH, function(th, index) { if (th.innerHTML == key) { return index } })[0] })), table
|
||||
keys && can.page.RangeTable(can, table, can.core.List(keys, function(key) { return can.page.Select(can, table, html.TH, function(th, index) { if (th.innerHTML == key) { return index } })[0] }))
|
||||
can.onmotion.orderShow(can, can.page.SelectOne(can, table, html.TBODY), html.TR)
|
||||
return table
|
||||
},
|
||||
board: function(can, text, target) { text && text.Result && (text = text.Result()); if (!text) { return }
|
||||
var code = can.page.Append(can, target||can._output, [{text: [can.page.Color(text), html.DIV, html.CODE]}]).code
|
||||
@ -614,7 +621,11 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
ui.profile && can.onmotion.hidden(can, ui.profile), ui.display && can.onmotion.hidden(can, ui.display)
|
||||
if (can.onimport.filter) { ui.filter = can.onimport.filter(can, ui.project) }
|
||||
ui.project && can.user.isMobile && can.onmotion.hidden(can, ui.project)
|
||||
ui.layout = function(height, width, delay, cb) { can.onmotion.delay(can, function() { defer = [], layout(type, ui.list, height, width), defer.forEach(function(cb) { cb() }), cb && cb(content_height, content_width) }, delay||0) }; return ui
|
||||
ui.layout = function(height, width, delay, cb) { can.onmotion.delay(can, function() { defer = [], layout(type, ui.list, height, width), defer.forEach(function(cb) { cb() }), cb && cb(content_height, content_width) }, delay||0) }
|
||||
can.onimport.layout = can.onimport.layout||function(can) { ui.layout(can.ConfHeight(), can.ConfWidth()), can.onimport._layout && can.onimport._layout(can)
|
||||
can.Action(html.FILTER) && can.onmotion.filter(can, can.Action(html.FILTER))
|
||||
}
|
||||
return ui
|
||||
},
|
||||
tabview: function(can, meta, list, target) { var ui = can.page.Append(can, target, [html.ACTION, html.OUTPUT])
|
||||
can.onappend.style(can, html.FLEX, ui.action)
|
||||
@ -626,7 +637,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
}); return ui._target = target, ui
|
||||
},
|
||||
|
||||
plugin: function(can, meta, cb, target, field) { meta = meta||{}, meta.index = meta.index||can.core.Keys(meta.ctx, meta.cmd)||ice.CAN_PLUGIN, meta._space = can.Conf("_space")
|
||||
plugin: function(can, meta, cb, target, field) { meta = meta||{}, meta.index = meta.index||can.core.Keys(meta.ctx, meta.cmd)||ice.CAN_PLUGIN, meta._space = meta._space||can.Conf("_space")
|
||||
var res = {}; function _cb(sub, meta, skip) { kit.proto(res, sub), cb && cb(sub, meta, skip) }
|
||||
if (meta.inputs && meta.inputs.length > 0 || meta.meta) { can.onappend._plugin(can, {meta: meta.meta, list: meta.list}, meta, _cb, target, field); return res }
|
||||
function _plugin(_meta) { var value = can.onengine.plugin(can, _meta.index)
|
||||
@ -644,7 +655,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
meta.type = meta.type||chat.STORY, meta.name = meta.name||value.meta&&value.meta.name||"", meta.help = meta.help||value.help||"", meta.height = meta.height||can.ConfHeight(), meta.width = meta.width||can.ConfWidth()
|
||||
meta.inputs = can.base.getValid(meta.inputs, can.base.Obj(value.list))||[], meta.feature = can.base.getValid(meta.feature, can.base.Obj(value.meta))||{}
|
||||
meta.index = value.index||meta.index, meta.args = can.base.getValid(can.base.Obj(meta.args), can.base.Obj(meta.arg), can.base.Obj(value.args), can.base.Obj(value.arg))||[]
|
||||
meta.space = value.space||meta.space
|
||||
meta.space = value.space||meta.space, meta._space = value._space||meta._space
|
||||
can.onappend._init(can, meta, [chat.PLUGIN_STATE_JS], function(sub, skip) {
|
||||
sub.run = function(event, cmds, cb) {
|
||||
if (can.base.isFunc(value)) {
|
||||
@ -941,6 +952,10 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
||||
}
|
||||
}
|
||||
},
|
||||
orderShow: function(can, target, key) {
|
||||
var list = can.page.SelectChild(can, target, key||html.DIV_ITEM, function(target) { can.page.style(can, target, html.VISIBILITY, html.HIDDEN); return target })
|
||||
can.core.Next(list, function(target, next) { can.page.style(can, target, html.VISIBILITY, ""), can.onmotion.delay(can, next, list.length > 3? 80: 0) })
|
||||
},
|
||||
slideGrow: function(can, target) {
|
||||
if (can.page.tagis(target, html.DIV) && can.page.ClassList.has(can, target, html.INPUT)) { return }
|
||||
var height = target.offsetHeight, begin = 0; if (height < 50) { return } can.page.style(can, target, html.HEIGHT, 0)
|
||||
|
@ -91,6 +91,7 @@ body.width5 { /* 1600-1920 */
|
||||
}
|
||||
body.width6 { /* 1920-2240 显示器 */
|
||||
--river-width:280px; --input-width:180px;
|
||||
--card-height:160px;
|
||||
}
|
||||
/* element */
|
||||
* { tab-size:4; box-sizing:border-box; padding:0; border:0; margin:0; }
|
||||
@ -411,7 +412,7 @@ div.project:not(.toggle) { border-right:var(--box-border); width:var(--project-w
|
||||
div.profile:not(.toggle) { border-left:var(--box-border); width:50%; flex:0 0 50%; }
|
||||
div.display:not(.toggle) { border-top:var(--box-border); }
|
||||
/* output style */
|
||||
div.title>div.status { margin-top:var(--input-margin); }
|
||||
div.title>div.status { line-height:20px; }
|
||||
div.title>div.status>div.item { color:var(--disable-fg-color); font-size:var(--status-font-size); font-weight:normal; float:left; margin-right:var(--button-margin); }
|
||||
div.title>div.status>div.item>i { margin-right:var(--input-margin); }
|
||||
body.mobile div.output.card { overflow-x:hidden; }
|
||||
@ -567,6 +568,7 @@ body.mobile fieldset.River { position:fixed; top:var(--header-height); z-index:1
|
||||
body.mobile fieldset.River>div.output { font-size:1.4rem; min-width:var(--project-width); }
|
||||
html:not(.login) body.mobile:not(.cmd) fieldset.Action { margin-top:var(--header-height); }
|
||||
body.mobile fieldset.Action.cmd { margin-top:0; }
|
||||
body.mobile fieldset.Action { overflow:hidden; }
|
||||
body.mobile fieldset.Action>div.output { overflow-x:hidden; }
|
||||
body.mobile fieldset.word>div.output { overflow-x:hidden; }
|
||||
body.mobile fieldset.word>div.output div.story.flex { display:block; }
|
||||
@ -607,6 +609,8 @@ 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); }
|
||||
fieldset.xterm.float>form.option>div.item.hash input { width:var(--form-width); }
|
||||
fieldset.iframe.float>form.option>div.item.hash input { width:var(--form-width); }
|
||||
fieldset.Action:not(.horizon):not(.grid)>fieldset.plugin>form.option>div.item.text.path>input { width:var(--project-width); }
|
||||
body:not(.debug) fieldset.plugin.can._notfound { display:none; }
|
||||
fieldset.inner.float>div.status { display:none; }
|
||||
|
@ -25,3 +25,4 @@ fieldset.Action.grid>div.project.toggle { display:none; }
|
||||
fieldset.Action>div.toggle.project { padding-top:50px; height:150px; top:30%; }
|
||||
body:not(.mobile) fieldset.Action>div.project.toggle { display:none; }
|
||||
body.mobile fieldset.Action>div.project.toggle { top:60%; }
|
||||
body.mobile fieldset.Action>div.action div.item { display:none; }
|
||||
|
@ -127,7 +127,7 @@ Volcanos(chat.ONLAYOUT, {
|
||||
sub.onimport.size(sub, can.ConfHeight()-can.Conf(html.MARGIN_Y)-(can._plugins.length == 1 || button && button != ALL || sub.isCmdMode()? 0: html.ACTION_MARGIN),
|
||||
can.ConfWidth()-can.Conf(html.MARGIN_X), can._plugins.length > 1 && can.onexport.isauto(can)) && can.page.style(can, sub._output, html.HEIGHT, "", html.MAX_HEIGHT, "")
|
||||
}) },
|
||||
_storage: function(can, value) { return can.user.isMobile? "": (can.misc.sessionStorage(can, can.core.Keys(CAN_LAYOUT, location.pathname), value)||[])[0] },
|
||||
_storage: function(can, value) { return can.user.isMobile? "all": (can.misc.sessionStorage(can, can.core.Keys(CAN_LAYOUT, location.pathname), value)||[])[0] },
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {
|
||||
size: function(can, msg) {
|
||||
|
@ -14,10 +14,10 @@ Volcanos(chat.ONIMPORT, {
|
||||
_field: function(can, msg, cb) { var height = can.base.Max(html.STORY_HEIGHT, can.ConfHeight()-2*html.ACTION_HEIGHT), width = can.ConfWidth()
|
||||
msg.Table(function(item) { can.onappend._plugin(can, item, {space: can.ConfSpace(), index: item.index, args: can.base.Obj(item.args||item.arg, []), height: height, width: width}, function(sub) {
|
||||
sub.run = function(event, cmds, cb) { var index = msg.Option(ice.MSG_INDEX); can.run(can.request(event, {pod: item.space}), (msg[ice.MSG_PREFIX]? msg[ice.MSG_PREFIX]: index? [ctx.RUN, index]: []).concat(cmds), cb, true) }
|
||||
if (can.base.isIn(sub.ConfIndex(), wiki.PORTAL, chat.IFRAME, chat.DESKTOP, wiki.WORD, code.VIMER,)) { height = can.base.Max(can.onexport.outputHeight(can), can.ConfHeight(), 480) }
|
||||
if (item.style != html.FLOAT && can.base.isIn(sub.ConfIndex(), wiki.PORTAL, chat.IFRAME, chat.DESKTOP, wiki.WORD, code.VIMER,)) { height = can.base.Max(can.onexport.outputHeight(can), can.ConfHeight(), 480) }
|
||||
can.page.ClassList.has(can, sub._target, html.FLOAT)? can.onmotion.float(sub): sub.onimport.size(sub, height, width, true), cb && cb(sub)
|
||||
if (item.style == html.FLOAT) { return } can.onmotion.delay(can, function() { can.onmotion.scrollIntoView(can, sub._target) }, 300)
|
||||
if (can.base.isIn(sub.ConfIndex(), wiki.WORD)) { sub.onexport.output = function() { can.page.style(can, sub._output, html.HEIGHT, "", html.MAX_HEIGHT, "") } }
|
||||
can.onmotion.delay(can, function() { can.onmotion.scrollIntoView(can, sub._target) }, 300)
|
||||
}) })
|
||||
},
|
||||
_float: function(can, msg) { can.onimport._field(can, msg, function(sub) { can.onmotion.float(sub) }) },
|
||||
|
@ -8,8 +8,19 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) {
|
||||
can.onappend.table(can, msg, null, target), can.onappend.board(can, msg, target), can.onmotion.story.auto(can, target)
|
||||
}
|
||||
},
|
||||
card: function(can, msg, target) {
|
||||
can.page.Appends(can, target||can.ui.content||can._output, msg.Table(function(value) { value.icon = value.icon||value.image
|
||||
__project: function(can, msg) { var select, current = can.sup.db._zone||can.db.hash[0]||ice.DEV
|
||||
msg.Table(function(value) {
|
||||
var _target = can.onimport.item(can, value, function(event) { can.isCmdMode()? can.misc.SearchHash(can, value.name): can.sup.db._zone = value.name
|
||||
if (can.onmotion.cache(can, function() { return value.name }, can.ui.content, can._status)) { return can.onimport.layout(can) }
|
||||
can.run(can.request(event, {_toast: ice.PROCESS}), [value.name], function(msg) {
|
||||
can.onimport.__content(can, msg), can.onappend._status(can, msg), can.onimport.layout(can)
|
||||
})
|
||||
}, function() {}, can.ui.project); select = (value.name == current? _target: select)||_target
|
||||
}), select && select.click(), can.onmotion.orderShow(can, can.ui.project)
|
||||
can.onappend.style(can, "output card", can.ui.content), can.onmotion.delay(can, function() { can.onimport.layout(can) })
|
||||
}, __content: function(can, msg) { can.onimport.card(can, msg) },
|
||||
card: function(can, msg, target) { target = target||can.ui.content||can._output
|
||||
var list = msg.Table(function(value) { value.icon = value.icon||value.image
|
||||
var img = can.misc.Resource(can, value.icon, value.type == web.MASTER? "": value.name)
|
||||
if (img.indexOf("/require/") == 0 && value.origin) { img = value.origin + img }
|
||||
return {view: [[html.ITEM, value.type, value.status]], list: [
|
||||
@ -18,9 +29,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) {
|
||||
]}, {view: [wiki.CONTENT, html.DIV, value.text]},
|
||||
{view: html.ACTION, inner: value.action, _init: function(target) { can.onappend.mores(can, target, value, 5) }},
|
||||
]}
|
||||
})), can.onimport.layout = can.onimport.layout||function() {
|
||||
var height = can.onlayout.expand(can, can._output); can.sup.onexport.outputMargin = function() { return height }
|
||||
}, can.onappend.scroll(can, can._output)
|
||||
})
|
||||
can.onimport.layout = can.onimport.layout||function() { var height = can.onlayout.expand(can, target); can.sup.onexport.outputMargin = function() { return height } }
|
||||
can.page.Append(can, target, list), can.onmotion.orderShow(can, target)
|
||||
},
|
||||
_vimer_zone: function(can, msg, target) { msg.Table(function(value) { var action = can.page.parseAction(can, value)
|
||||
can.onimport.item(can, {icon: can.misc.Resource(can, value.icon||value.avatar_url), name: can.page.Color(value[can.Conf(mdb.FIELD)||mdb.VIEW]||value[mdb.NAME]||value[mdb.TEXT]||value[mdb.TYPE]), title: value[mdb.TEXT]||value.description}, function(event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user