1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 08:48:06 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-05-21 07:39:21 +08:00
parent fa4e9d6178
commit 0fd53c1e23
5 changed files with 26 additions and 32 deletions

View File

@ -155,8 +155,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
}); return value }); return value
} catch {} }, } catch {} },
Action: function(key, value) { Action: function(key, value) {
// key && value && can.misc.sessionStorage(can, [sub.ConfIndex(), ctx.ACTION, key], value) // value && (value = can.user.trans(sub, value, null, html.INPUT))
value && (value = can.user.trans(sub, value, null, html.INPUT))
return can.page.SelectArgs(can, action, key, value)[0] return can.page.SelectArgs(can, action, key, value)[0]
}, },
Option: function(key, value) { Option: function(key, value) {
@ -214,9 +213,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
}}]) }}])
}) })
while (args.length > 0) { if (args[args.length-1] != "") { break } args.pop() } while (args.length > 0) { if (args[args.length-1] != "") { break } args.pop() }
if (args.slice) { args.slice && can.core.List(args.slice(can.core.List(meta.inputs, function(item) { if (can.base.isIn(item.type, html.TEXTAREA, html.TEXT, html.SELECT)) { return item } }).length), function(item, index) { meta.inputs.push({type: mdb.TEXT, name: "args"+index, value: item}) })
can.core.List(args.slice(can.core.List(meta.inputs, function(item) { if (can.base.isIn(item.type, html.TEXTAREA, html.TEXT, html.SELECT)) { return item } }).length), function(item, index) { meta.inputs.push({type: mdb.TEXT, name: "args"+index, value: item}) })
}
function add(item, next) { item = can.base.isString(item)? {type: html.TEXT, name: item}: item, item.type != html.BUTTON && index++ function add(item, next) { item = can.base.isString(item)? {type: html.TEXT, name: item}: item, item.type != html.BUTTON && index++
return Volcanos(item.name, {_root: can._root, _follow: can.core.Keys(can._follow, item.name), return Volcanos(item.name, {_root: can._root, _follow: can.core.Keys(can._follow, item.name),
_target: can.onappend.input(can, item, args[index]||(typeof args[item.name] == code.STRING? args[item.name]: "")||opts[item.name], option||can._option), _option: option||can._option, _action: can._action, _output: can._output, _status: can._status, _target: can.onappend.input(can, item, args[index]||(typeof args[item.name] == code.STRING? args[item.name]: "")||opts[item.name], option||can._option), _option: option||can._option, _action: can._action, _output: can._output, _status: can._status,
@ -236,8 +233,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
can.core.ItemCB(item, function(key, cb) { sub._target[key] = function(event) { can.misc.Event(event, can, function(msg) { cb(event, sub, sub._target) })} }) can.core.ItemCB(item, function(key, cb) { sub._target[key] = function(event) { can.misc.Event(event, can, function(msg) { cb(event, sub, sub._target) })} })
item.action && can.onappend.figure(sub, item, sub._target, function(_sub, value) { can.Update() }); if (skip === true) { return } item.action && can.onappend.figure(sub, item, sub._target, function(_sub, value) { can.Update() }); if (skip === true) { return }
item.type == html.BUTTON && item.action == ice.AUTO && can.base.isUndefined(can._delay_init) && (auto = sub._target), next() item.type == html.BUTTON && item.action == ice.AUTO && can.base.isUndefined(can._delay_init) && (auto = sub._target), next()
can.Conf(ice.AUTO) == item.name && (auto = sub._target) can.Conf(ice.AUTO) == item.name && (auto = sub._target), can._auto = auto
can._auto = auto
}) })
}; };
var auto; can.core.Next(can.core.Value(can, [chat.ONIMPORT, mdb.LIST])||meta.inputs, add, function() { var auto; can.core.Next(can.core.Value(can, [chat.ONIMPORT, mdb.LIST])||meta.inputs, add, function() {
@ -268,16 +264,12 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
can.base.isString(item)? /* 2.按键 */ {type: html.BUTTON, name: item, value: can.user.trans(can, item, meta._trans), onclick: function(event) { can.base.isString(item)? /* 2.按键 */ {type: html.BUTTON, name: item, value: can.user.trans(can, item, meta._trans), onclick: function(event) {
run(event, item) run(event, item)
}}: item.length > 0? /* 3.列表 */ {type: html.SELECT, name: item[0], values: item.slice(1), onchange: function(event) { can.misc.Event(event, can, function(msg) { }}: item.length > 0? /* 3.列表 */ {type: html.SELECT, name: item[0], values: item.slice(1), onchange: function(event) { can.misc.Event(event, can, function(msg) {
var button = event.target.value; var button = event.target.value; can.onexport.session && can.onexport.session(can, "action:"+item[0], button)
can.onaction._select && can.onaction._select(event, can, item[0], button) can.onaction._select && can.onaction._select(event, can, item[0], button)
can.onexport.session && can.onexport.session(can, "action:"+item[0], button)
meta[item[0]]? can.core.CallFunc(meta[item[0]], [event, can, item[0], button]): meta[item[0]]? can.core.CallFunc(meta[item[0]], [event, can, item[0], button]):
meta[button]? can.core.CallFunc(meta[button], [event, can, button]): can.Action(item[0], button) meta[button]? can.core.CallFunc(meta[button], [event, can, button]): can.Action(item[0], button)
})}, _init: function() { })}, _init: function() {
if (can.onexport.session) { if (can.onexport.session) { var value = can.onexport.session(can, "action:"+item[0]); value && can.Action(item[0], value) }
var value = can.onexport.session(can, "action:"+item[0])
value && can.Action(item[0], value)
}
}}: /* 4.其它 */(item.type == html.BUTTON && (item.value = item.value||can.user.trans(can, item.name, meta._trans), item.onclick = item.onclick||function(event) { }}: /* 4.其它 */(item.type == html.BUTTON && (item.value = item.value||can.user.trans(can, item.name, meta._trans), item.onclick = item.onclick||function(event) {
run(event, item.name||item.value) run(event, item.name||item.value)
}, item._init = item._init||function(target) { item.action && can.onappend.figure(sub, item, target, function(_sub, value) { can.Update() }) }, item._init = item._init||function(target) { item.action && can.onappend.figure(sub, item, target, function(_sub, value) { can.Update() })
@ -347,7 +339,6 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
var list = can.base.Obj(msg.Option(ice.MSG_ACTION)||can.Conf(ice.MSG_ACTION), [])||[] var list = can.base.Obj(msg.Option(ice.MSG_ACTION)||can.Conf(ice.MSG_ACTION), [])||[]
can.onmotion.clear(can, can._action), sub.onappend._action(sub, list, action||can._action) can.onmotion.clear(can, can._action), sub.onappend._action(sub, list, action||can._action)
sub.onappend._status(sub, sub.onexport&&sub.onexport.list||msg.Option(ice.MSG_STATUS), null, msg), can.user.isMobile || sub.onappend.tools(sub, msg) sub.onappend._status(sub, sub.onexport&&sub.onexport.list||msg.Option(ice.MSG_STATUS), null, msg), can.user.isMobile || sub.onappend.tools(sub, msg)
can.core.Item(can.Action(), function(key) { var value = can.misc.sessionStorage(can, [can.ConfIndex(), ctx.ACTION, key]); value && can.Action(key, msg.Option(key)||value[0]) })
if (msg.Option("sess.online") == ice.TRUE) { can.ondaemon._online(can) } if (msg.Option("sess.online") == ice.TRUE) { can.ondaemon._online(can) }
if (msg.Length() > 9 && !sub.ui.project && !can.user.isMobile) { can.onmotion.delay(can, function() { can.onappend._filter(can) }, 300) } if (msg.Length() > 9 && !sub.ui.project && !can.user.isMobile) { can.onmotion.delay(can, function() { can.onappend._filter(can) }, 300) }
} can.onappend.style(sub, sub.Conf(ctx.STYLE)), can.onmotion.story.auto(can, can._output) } can.onappend.style(sub, sub.Conf(ctx.STYLE)), can.onmotion.story.auto(can, can._output)

View File

@ -894,7 +894,7 @@ fieldset.draw>div.output>div.layout>div.layout>div.profile table { width:100%; }
fieldset.draw>div.output>div.layout>div.layout>div.profile { width:var(--project-width); flex:0 0 var(--project-width); } fieldset.draw>div.output>div.layout>div.layout>div.profile { width:var(--project-width); flex:0 0 var(--project-width); }
fieldset.draw div.output svg { margin-bottom:-5px; } fieldset.draw div.output svg { margin-bottom:-5px; }
fieldset.draw div.output svg { min-height:100%; } fieldset.draw div.output svg { min-height:100%; }
fieldset.draw div.output { display:flex; flex-direction:row; } // fieldset.draw div.output { display:flex; flex-direction:row; }
fieldset.draw.spides div.output svg text { cursor:pointer; } fieldset.draw.spides div.output svg text { cursor:pointer; }
fieldset.draw.spides div.output svg path { stroke-width:1; } fieldset.draw.spides div.output svg path { stroke-width:1; }
fieldset.draw.trends div.output { overflow:hidden; } fieldset.draw.trends div.output { overflow:hidden; }

View File

@ -314,31 +314,32 @@ Volcanos(chat.ONACTION, {list: ["刷新数据",
recorder.onstop = function() { cb(blobs, nfs.WEBM) }, recorder.start(1) recorder.onstop = function() { cb(blobs, nfs.WEBM) }, recorder.start(1)
}) }, }) },
}) })
Volcanos(chat.ONEXPORT, {_output: function(can, msg) {}, Volcanos(chat.ONEXPORT, {
_output: function(can, msg) {},
output: function(can, msg) {}, action: function(can, button, data) {}, record: function(can, value, key, data) {}, output: function(can, msg) {}, action: function(can, button, data) {}, record: function(can, value, key, data) {},
title: function(can, title) { marginTop: function() { return 0 }, marginBottom: function() { return 0 }, outputMargin: function(can) { return 0 },
if (can.base.isIn(title, web.DESKTOP)) { return }
var pod = can.misc.Search(can, ice.POD)
can.isCmdMode() && can.user.title(title+(pod && title != pod? " "+pod: "")) },
marginTop: function() { return 0 }, marginBottom: function() { return 0 },
actionHeight: function(can) { return can.page.ClassList.has(can, can._target, html.OUTPUT)? 0: html.ACTION_HEIGHT }, actionHeight: function(can) { return can.page.ClassList.has(can, can._target, html.OUTPUT)? 0: html.ACTION_HEIGHT },
outputHeight: function(can) { var height = can.ConfHeight() - can.onexport.actionHeight(can) - can.onexport.statusHeight(can) outputHeight: function(can) { var height = can.ConfHeight() - can.onexport.actionHeight(can) - can.onexport.statusHeight(can)
if (can.user.isMobile) { return height } height -= can.onexport.outputMargin(can) if (can.user.isMobile) { return height } height -= can.onexport.outputMargin(can)
can.page.SelectChild(can, can._output, html.TABLE, function(target) { height -= target.offsetHeight }) can.page.SelectChild(can, can._output, html.TABLE, function(target) { height -= target.offsetHeight })
return can.base.Max(can.base.Min(height, can.ConfHeight()/2), can.ConfHeight()-2*html.ACTION_HEIGHT, 320) return can.base.Max(can.base.Min(height, can.ConfHeight()/2), can.ConfHeight()-2*html.ACTION_HEIGHT, 320)
}, },
outputMargin: function(can) { return 0 },
statusHeight: function(can) { statusHeight: function(can) {
return can.page.ClassList.has(can, can._target, html.OUTPUT) || !can.page.isDisplay(can._status) || (can._target.offsetHeight > 0 && can._status.offsetHeight == 0) || return can.page.ClassList.has(can, can._target, html.OUTPUT) || !can.page.isDisplay(can._status) || (can._target.offsetHeight > 0 && can._status.offsetHeight == 0) ||
can._status.innerHTML == "" && !can.page.ClassList.has(can, can._target, html.PLUG)? 0: html.STATUS_HEIGHT }, can._status.innerHTML == "" && !can.page.ClassList.has(can, can._target, html.PLUG)? 0: html.STATUS_HEIGHT
},
session: function(can, key, value) { if (value) { value = JSON.stringify(value) }
return can.misc.sessionStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), key, location.pathname], value)
},
title: function(can, title) { if (can.base.isIn(title, web.DESKTOP)) { return }
var pod = can.misc.Search(can, ice.POD); can.isCmdMode() && can.user.title(title+(pod && title != pod? " "+pod: ""))
},
args: function(can) { return can.Option() },
link: function(can) { link: function(can) {
if (can.sub && can.sub.onexport.link) { if (can.sub && can.sub.onexport.link) { return can.sub.onexport.link(can.sub) }
return can.sub.onexport.link(can.sub)
}
var args = can.Option(); args.pod = can.ConfSpace()||can.misc.Search(can, ice.POD), args.cmd = can.ConfIndex() var args = can.Option(); args.pod = can.ConfSpace()||can.misc.Search(can, ice.POD), args.cmd = can.ConfIndex()
can.core.Item(args, function(key, value) { key != ice.POD && !value && delete(args[key]) }) can.core.Item(args, function(key, value) { key != ice.POD && !value && delete(args[key]) })
return can.misc.MergePodCmd(can, args, true) return can.misc.MergePodCmd(can, args, true)
}, },
args: function(can) { return can.Option() },
close: function(can, msg) {}, close: function(can, msg) {},
}) })

View File

@ -273,9 +273,7 @@ Volcanos(chat.ONEXPORT, {
hash: function(can, hash) { hash = typeof hash == code.STRING? hash.split(":").concat(can.core.List(arguments).slice(2)||[]): hash || can.core.Item(can.Option(), function(key, value) { return value||"" }) hash: function(can, hash) { hash = typeof hash == code.STRING? hash.split(":").concat(can.core.List(arguments).slice(2)||[]): hash || can.core.Item(can.Option(), function(key, value) { return value||"" })
can.misc.SearchHash(can, hash), can.misc.localStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), "hash"], hash) can.misc.SearchHash(can, hash), can.misc.localStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), "hash"], hash)
}, },
session: function(can, key, value) { if (value) { value = JSON.stringify(value) } session: function(can, key, value) { return can.sup.onexport.session(can.sup, key, value) },
return can.misc.sessionStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), key, location.pathname].join(":"), value)
},
table: function(can) { var msg = can._msg; if (msg.Length() == 0) { return } var res = [msg.append && msg.append.join(mdb.FS)] table: function(can) { var msg = can._msg; if (msg.Length() == 0) { return } var res = [msg.append && msg.append.join(mdb.FS)]
msg.Table(function(line, index, array) { res.push(can.core.Item(line, function(key, value) { return value }).join(ice.FS)) }) msg.Table(function(line, index, array) { res.push(can.core.Item(line, function(key, value) { return value }).join(ice.FS)) })
return res.join(lex.NL) return res.join(lex.NL)

View File

@ -113,8 +113,12 @@ var Volcanos = shy({iceberg: "", volcano: "", frame: chat.FRAME_JS, _cache: {},
isAutoMode: function() { return can.Mode() == "" }, isAutoMode: function() { return can.Mode() == "" },
Mode: function(value) { return can.Conf(ice.MODE, value) }, Mode: function(value) { return can.Conf(ice.MODE, value) },
ConfDefault: function(value) { can.core.Item(value, function(k, v) { can.Conf(k) || can.Conf(k, v) }) }, ConfDefault: function(value) { can.core.Item(value, function(k, v) { can.Conf(k) || can.Conf(k, v) }) },
ConfSpace: function() { return can.Conf("_space")||can.Conf(web.SPACE)||"" }, ConfSpace: function(space) {
ConfIndex: function() { return can.Conf("_command")||can.Conf(ctx.INDEX)||can.Conf("_index") }, if (space) { can.Conf(web.SPACE, space) }
return can.Conf("_space")||can.Conf(web.SPACE)||"" },
ConfIndex: function(index) {
if (index) { can.Conf(ctx.INDEX, index) }
return can.Conf("_command")||can.Conf(ctx.INDEX)||can.Conf("_index") },
ConfHeight: function(value) { return can.Conf(html.HEIGHT, value) }, ConfHeight: function(value) { return can.Conf(html.HEIGHT, value) },
ConfWidth: function(value) { return can.Conf(html.WIDTH, value)||can._output.offsetWidth }, ConfWidth: function(value) { return can.Conf(html.WIDTH, value)||can._output.offsetWidth },
Conf: function(key, value) { var res = can._conf Conf: function(key, value) { var res = can._conf