diff --git a/const.js b/const.js index 49593df1..1cad81dd 100644 --- a/const.js +++ b/const.js @@ -443,7 +443,9 @@ var icon = { tools: "bi bi-grid", key: "bi bi-hash", hash: "bi bi-hash", zone: "bi bi-diagram-3", id: "bi bi-sort-numeric-down", - modify: "bi bi-pencil-square", rename: "bi bi-pencil-square", remove: "bi bi-trash", + modify: "bi bi-pencil-square", + rename: "bi bi-pencil-square", + remove: "bi bi-trash", enable: "bi bi-toggle-off", disable: "bi bi-toggle-on", expire: "bi bi-clock-history", @@ -502,6 +504,10 @@ var icon = { localCreate: "bi bi-cloud-download", notifications: "bi bi-chat-right-text", play: "bi bi-play-circle", app: "bi bi-box-arrow-down-left", + + "Close": "bi bi-x-lg", + "Close Other": "bi bi-x-lg", + "Rename Tabs": "bi bi-pencil-square", } var svg = { GROUP: "group", PID: "pid", GRID: "grid", diff --git a/frame.js b/frame.js index 33b9f785..6cefbfbd 100644 --- a/frame.js +++ b/frame.js @@ -1,6 +1,5 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) { can.Option = function() {}, can.run = function(event, cmds, cb) { var msg = can.request(event); cmds = cmds||[]; return (can.onengine[cmds[0]]||can.onengine._remote)(event, can, msg, can, cmds, cb) } - can.user.title(can.misc.SearchOrConf(can, chat.TITLE)||can.misc.Search(can, ice.POD)||location.host) can.core.Next(list, function(item, next) { item.type = chat.PANEL can.onappend._init(can, item, item.list, function(sub) { can[item.name] = sub, sub.db = {}, sub.ui = {}, sub.db._boot = can.misc._time() sub.run = function(event, cmds, cb) { var msg = sub.request(event); cmds = cmds||[]; return (can.onengine[cmds[0]]||can.onengine._remote)(event, can, msg, sub, cmds, cb) } @@ -335,7 +334,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { sub._output.className = html.OUTPUT // can.onappend.style(can, sub._args.style, can._output) // can.isCmdMode() && can.onappend.style(can, html.OUTPUT) - sub.isCmdMode() && sub.onexport.title(sub, sub.ConfIndex()) + // sub.isCmdMode() && sub.onexport.title(sub, sub.ConfIndex()) can.onmotion.toggle(can, can._action, true) can.onexport._output(sub, msg), sub.Mode() != ice.MSG_RESULT && can.onmotion.clear(can, output) can.core.CallFunc([sub, chat.ONIMPORT, chat._INIT], {can: sub, msg: msg, cb: function(msg) { @@ -490,9 +489,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { } }, _filter: function(can) { - can.page.insertBefore(can, [ - {view:[[html.ITEM, html.TEXT, html.FILTER, "state"]], _init: function(target) { can.onappend.filter(can, target, can.ui.content||can._output) }} - ], (can.page.SelectOne(can, can._action, "div.item._space")||{}).nextSibling, can._action) + can.page.insertBefore(can, can.onappend.filter(can, can._action, can.ui.content||can._output).parentNode, + (can.page.SelectOne(can, can._action, "div.item._space")||{}).nextSibling, can._action) }, filter: function(can, target, output) { output = output||can.ui.content||target return can.onappend.input(can, {type: html.TEXT, name: web.FILTER, icon: icon.SEARCH, placeholder: "search in n items", onkeydown: function() {}, onkeyup: function(event) { @@ -839,7 +837,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, plugin: function(can, meta, cb, target, field) { - meta = meta||{}, meta.index = meta.index||can.core.Keys(meta.ctx, meta.cmd)||"can._notfound", meta._space = meta._space||can.ConfSpace() + meta = meta||{}, meta.index = meta.index||can.core.Keys(meta.ctx, meta.cmd)||"can._output", meta._space = meta._space||can.ConfSpace() 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) @@ -872,7 +870,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, sub._index = value.index||meta.index, can.base.isFunc(cb) && cb(sub, meta, skip) meta._init && (meta._init(sub)) if (meta.style == html.FLOAT || value.style == html.FLOAT) { can.onmotion.float(sub) } - }, target||can._output, field) + }, target||can.ui.content||can._output, field) }, _float: function(can, index, args, cb) { can.onappend.plugin(can, typeof index == code.OBJECT? (index.style = chat.FLOAT, index.args = args, index): {index: index, args: args, style: chat.FLOAT}, function(sub) { diff --git a/index.css b/index.css index e155dc1f..d714e910 100644 --- a/index.css +++ b/index.css @@ -22,6 +22,7 @@ body.light { --code-package:blue; --code-datatype:cornflowerblue; --code-object:purple; } body.dark { + --shadow-color:gray; --plugin-bg-color:black; --plugin-fg-color:silver; --code-keyword:dodgerblue; --code-comment:green; --code-function:lightgreen; --code-constant:gray; --code-string:orange; @@ -57,6 +58,7 @@ body { --box-shadow:var(--shadow-color) 0px 0px 10px; --notice-box-shadow:var(--notice-bg-color) 0px 0px 10px; --plugin-box-shadow:var(--box-shadow); --legend-box-shadow:var(--box-shadow); --input-box-shadow:var(--box-shadow); --th-box-shadow:var(--box-shadow); --keyword-box-shadow:var(--box-shadow); + --float-box-shadow:var(--box-shadow); --box-border:var(--border-color) solid 1px; --box-notice:var(--notice-bg-color) solid 1px; --box-danger:var(--danger-bg-color) solid 1px; --box-border3:var(--border-color) solid 3px; --box-notice3:var(--notice-bg-color) solid 3px; --box-danger3:var(--danger-bg-color) solid 3px; --plugin-border:var(--box-border); --input-border:var(--box-border); --status-border:var(--box-border); @@ -554,13 +556,13 @@ body>div.toast.float { z-index:12; } fieldset.Action>div.toast { z-index:12; } fieldset.desktop.cmd>div.output>fieldset.macos.dock { z-index:10; } /* box-shadow */ -div.float { box-shadow:var(--plugin-box-shadow); border:var(--plugin-border); } +div.float { box-shadow:var(--float-box-shadow); border:var(--plugin-border); } div.float:hover { box-shadow:var(--notice-box-shadow); } fieldset.plugin { box-shadow:var(--plugin-box-shadow); border-radius:var(--plugin-radius); } fieldset.story { box-shadow:var(--plugin-box-shadow); border-radius:var(--plugin-radius); } -fieldset.studio fieldset.story { border-radius:0; } -fieldset.studio fieldset.story>legend { border-top-left-radius:0; } -fieldset.float { box-shadow:var(--plugin-box-shadow); border:var(--plugin-border); border-radius:var(--plugin-radius); } +// fieldset.studio fieldset.story { border-radius:0; } +// fieldset.studio fieldset.story>legend { border-top-left-radius:0; } +fieldset.float { box-shadow:var(--float-box-shadow); border:var(--plugin-border); border-radius:var(--plugin-radius); } fieldset:not(.panel):hover { box-shadow:var(--notice-box-shadow); } body.light fieldset.plugin>legend { box-shadow:var(--legend-box-shadow); margin-right:var(--legend-margin); } body.light fieldset.story>legend { box-shadow:var(--legend-box-shadow); margin-right:var(--legend-margin); } @@ -638,6 +640,7 @@ fieldset>div.action div.item.state.filter input { width:120px; transition:all 0. fieldset>div.action div.item.state.filter input:focus { width:240px; transition:all 0.5s; } fieldset>div.action div.item { height:var(--action-height); } fieldset>div.action>div.tabs { font-style:italic; padding:var(--input-padding) var(--button-padding); padding-right:0; height:var(--action-height); } +fieldset>div.action>div.tabs img { margin-right:var(--input-margin); height:24px; } fieldset>div.action>div.cmds { font-style:italic; padding:var(--input-padding) var(--button-padding); height:var(--action-height); min-width:60px; text-align:center; justify-content:center; align-items:center; } fieldset>div.output>div.code { font-size:var(--code-font-size); } fieldset>div.output { width:100%; } fieldset>div.status { width:100%; } diff --git a/panel/action.js b/panel/action.js index 80ae6ea3..6be2d4b5 100644 --- a/panel/action.js +++ b/panel/action.js @@ -191,6 +191,8 @@ Volcanos(chat.ONPLUGIN, { _filter: shy("表格", [ice.LIST, html.FILTER]), _plugin: shy("插件", [mdb.NAME, ice.LIST, ice.BACK]), _action: shy("操作", [ice.LIST]), + _display: shy("操作", [ice.LIST]), + _output: shy("操作", [ice.LIST], function(can, sub) { can.onappend.style(sub, html.OUTPUT) }), _notfound: shy("缺失", [ctx.INDEX, web.SPACE, ice.LIST], function(can, msg, arg, sub) { msg.Echo("not found "+(arg[0]||sub.ConfIndex())+" "+(arg[1]||can.ConfSpace())) }), 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/code/xterm.js b/plugin/local/code/xterm.js index fabe7ac2..a1d8acd6 100644 --- a/plugin/local/code/xterm.js +++ b/plugin/local/code/xterm.js @@ -1,15 +1,15 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg, cb) { can.page.requireModules(can, ["xterm/css/xterm.css", "xterm", "xterm-addon-fit", "xterm-addon-web-links"], function() { if (can.Option(mdb.HASH) || can.Option("args0") || can.ConfIndex() == "can._filter") { var item = can.base.Obj(msg.TableDetail()); item.hash = item.hash||can.Option(mdb.HASH)||can.Option("args0")||"current" - can.onimport._connect(can, item, can._output) + cb && cb(msg), can.onimport._connect(can, item, can._output) } else { - can.ui = can.onappend.layout(can), can.onimport._project(can, msg, can.db.hash) - } cb && cb(msg) + can.ui = can.onappend.layout(can), cb && cb(msg); can.onimport._project(can, msg, can.db.hash) + } }) }, _project: function(can, msg, hash) { msg.Table(function(value) { value.nick = `${value.hash}(${value.name||value.type||"ish"})`, value._select = value.hash == hash[0] can.onimport.item(can, value, function(event, item, show, target) { - can.onimport.tabsCache(can, can.request(), value.hash, value, target, function() { can.onappend._status(can) + can.onimport.tabsCache(can, value, target, function() { can.onappend._status(can) value._term = can.onimport._connect(can, value, can.ui.content) }) }) diff --git a/plugin/local/team/plan.js b/plugin/local/team/plan.js index 3b6d4242..5a719e21 100644 --- a/plugin/local/team/plan.js +++ b/plugin/local/team/plan.js @@ -1,4 +1,5 @@ -Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { +Volcanos(chat.ONIMPORT, { + _init: function(can, msg, target) { can._display_heights = {}, can.list = {}; var ls = can.misc.SearchHash(can) can.ui = can.onappend.layout(can), can.ui.toggle = can.onappend.toggle(can) can.onmotion.hidden(can, can.ui.project), can.isCmdMode() || can.onmotion.hidden(can, can._action) @@ -24,14 +25,14 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { {text: [can.core.CallFunc([can.onexport, can.Action(html.VIEW)||mdb.TEXT], [can, task])||task.name, html.DIV, can.onexport.style(can, task)], ondragstart: function(event) { var target = event.target; can.drop = function(event, td, time) { td.append(target) can.onaction.modifyTask(event, can, task, team.BEGIN_TIME, time+task.begin_time.slice(time.length), task.begin_time) - } }, draggable: time != undefined, title: can.onexport.title(can, task), _init: function(target) { + } }, draggable: time != undefined, title: can.onexport.title(can, task.name), _init: function(target) { var item = can.onimport.item(can, {nick: task.name+nfs.DF+task.text}, function() { can.onmotion.delay(can, function() { can.onmotion.select(can, can.ui.content, html.TD, target.parentNode), can.onimport._profile(can, task), can.onimport._display(can, task), can.onimport.layout(can) }) }); task._target = target, target.onclick = function(event) { item.click() }, can.list[can.core.Keys(task.space, task.zone, task.id)] = target }} }), } }, - _profile: function(can, task) { can.onmotion.toggle(can, can.ui.profile, true), can.onexport.hash(can, task) + _profile: function(can, task) { can.onmotion.toggle(can, can.ui.profile, true), can.onexport.hash(can, task), can.onexport.title(can, task.name, task.text) if (can.onmotion.cache(can, function() { return can.sup.task = task, can.Status(task), [task.space, task.zone, task.id].join(nfs.PT) }, can.ui.profile)) { return } task.extra && can.core.Item(can.base.Obj(task.extra), function(key, value) { task[key] = value }), delete(task.extra) var table = can.page.Appends(can, can.ui.profile, [{view: [[chat.CONTENT, mdb.DETAIL], html.TABLE], list: [{th: [can.user.trans(can, mdb.KEY, "字段"), can.user.trans(can, mdb.VALUE, "属性")]}]}])._target @@ -151,6 +152,5 @@ Volcanos(chat.ONEXPORT, {list: [mdb.COUNT, team.BEGIN_TIME, mdb.ZONE, mdb.ID, md text: function(can, task) { return task.name+": "+(task.text||"") }, level: function(can, task) { return "l-"+(task.level||3)+": "+(task.name||"") }, score: function(can, task) { return "s-"+(task.level||3)+": "+(task.name||"") }, - title: function(can, task) { return task.zone+": "+(task.type||"") }, style: function(can, task) { return [html.ITEM, task.status, mdb.ID+task.id, "l"+(task.level||""), "s"+(task.score||"")].join(lex.SP) }, }) diff --git a/plugin/local/wiki/feel.css b/plugin/local/wiki/feel.css index 328b5874..7b1273f4 100644 --- a/plugin/local/wiki/feel.css +++ b/plugin/local/wiki/feel.css @@ -1,6 +1,6 @@ fieldset.feel>div.output>div.layout>div.display { position:relative; overflow-y:hidden; } fieldset.feel>div.output>div.layout>div.display>img:hover { background-color:var(--hover-bg-color); cursor:pointer; } -fieldset.feel>div.output>div.layout>div.display:not(.hide) { height:100px; align-items:normal; gap:10px; } +fieldset.feel>div.output>div.layout>div.display:not(.hide) { height:100px; display:flex; justify-content:center; align-items:normal; gap:10px; } fieldset.feel>div.output>div.layout>div.display:not(.hide) img { height:100px; } fieldset.feel>div.output>div.layout>div.display:not(:hover)>div.toggle { display:none; } fieldset.feel>div.output>div.layout>div.display>div.toggle { font-size:48px; padding:5px; position:absolute; height:100px; padding-top:20px; } diff --git a/plugin/local/wiki/feel.js b/plugin/local/wiki/feel.js index bd718899..3a0bc5d7 100644 --- a/plugin/local/wiki/feel.js +++ b/plugin/local/wiki/feel.js @@ -1,19 +1,18 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg, cb) { - can.onmotion.hidden(can, can._action) - can.ui = can.onappend.layout(can), cb && cb(msg) - can.onappend.style(can, html.FLEX, can.ui.display), can.onmotion.toggle(can, can.ui.display, true), can.onimport.layout(can) - can.onimport._project(can, msg), can.onimport.page(can, can.db.list, can.db.begin = parseInt(msg.Option(cli.BEGIN)||"0")) + _init: function(can, msg) { can.onappend.style(can, html.FLEX, can.ui.display) + can.ui = can.onappend.layout(can), can.onmotion.toggle(can, can.ui.display, true), can.onimport._project(can, msg) + can.onimport.page(can, can.db.list, can.db.begin = parseInt(msg.Option(cli.BEGIN)||"0")) + can.onmotion.hidden(can, can._action), can.onimport.layout(can) }, _project: function(can, msg) { can.db.list = [], can.db.dir_root = msg.Option(nfs.DIR_ROOT) msg.Table(function(item) { item.name = can.base.trimPrefix(item.path, can.Option(nfs.PATH)) can.base.endWith(item.path, nfs.PS)? can.onimport.item(can, item, function(event) { can.Option(nfs.PATH, item.path) && can.Update(event) }): can.db.list.push(item) }) var rate = can.misc.localStorage(can, [can.ConfIndex(), "rate"]); rate && can.Action(html.SPEED, rate) - var _target; can.core.List(can.db.list, function(item, index) { - var last = can.misc.localStorage(can, [can.ConfIndex(), "p", can.onimport._file(can, item.path)]) + can.core.List(can.db.list, function(item, index) { item._select = item.path == (can.db.hash[0]||"usr/icons/background.jpg") item.nick = (last? last+lex.SP: "")+item.name - var target = can.onimport.item(can, item, function(_event) { var target = _event.target + var last = can.misc.localStorage(can, [can.ConfIndex(), "p", can.onimport._file(can, item.path)]) + var target = can.onimport.item(can, item, function(_event, item, show, target) { can.onexport.hash(can, item.path), can.onexport.title(can, item.path.split("/").pop()) can.ui.cb = function(event) { var next = _event.target.nextSibling target.innerHTML = parseInt(event.target.currentTime*100/event.target.duration)+"% "+item.name can.ui.video = event.target, can.Status(item), can.misc.localStorage(can, [can.ConfIndex(), "last"], item.path) @@ -24,7 +23,7 @@ Volcanos(chat.ONIMPORT, { can.onimport.layout(can), can.onmotion.scrollIntoView(can, target), can.onmotion.clear(can, can.ui.content) var _target = can.onimport.file(can, item.path, item, index, can.ui.content, can.ui.content.offsetHeight, true) _target.focus(), _target.onclick = function() { can.ondetail._init(can, index) } - can.onimport.layout(can), can.isCmdMode() && can.misc.SearchHash(can, item.path) + can.onimport.layout(can) can.onappend._toggle(can, can.ui.content, function() { index == 0? can.user.toast(can, "已经是第一页了"): _event.target.previousSibling.click() }, function() { @@ -34,12 +33,12 @@ Volcanos(chat.ONIMPORT, { if (index < can.db.begin || index >= can.db.begin+limit) { can.onimport.page(can, can.db.list, can.db.begin = index-index%limit) } - }); item._target = target, _target = can.base.isIn(item.path, can.db.hash[0]||can.Option(nfs.PATH)+can.Option(nfs.FILE))? target: _target||target + }); item._target = target if (can.isCmdMode() && item.path == can.misc.localStorage(can, [can.ConfIndex, "last"])) { can.Action(html.HEIGHT, html.HIDE), can.onmotion.hidden(can, can.ui.display) _target = target, can.onmotion.delay(can, function() { can.onaction.full({}, can) }) } - }), can.onmotion.delay(can, function() { _target && _target.click() }), can.onmotion.orderShow(can, can.ui.project) + }) }, _file: function(can, path) { var p = location.href.indexOf(ice.HTTP) == 0? "": "http://localhost:9020" return path.indexOf(ice.HTTP) == 0? path: p+can.base.Path(web.SHARE_LOCAL, can.db.dir_root||"", path) diff --git a/plugin/local/wiki/word.css b/plugin/local/wiki/word.css index 178fcdf6..8dd6422e 100644 --- a/plugin/local/wiki/word.css +++ b/plugin/local/wiki/word.css @@ -22,7 +22,7 @@ fieldset.word>div.navmenu>div.item { font-size:1.6em; } div.story[data-type=spark] label { -webkit-user-select:none; } div.story[data-type=spark_tabs] { margin-top:var(--title-margin); } div.story[data-type=spark_tabs]>div.tabs>div.item { font-style:italic; padding:var(--input-padding) var(--button-padding); height:var(--action-height); float:left; } -div.story[data-type=spark_tabs]>div.tabs>div.item.select { border-bottom:var(--box-notice3); } +div.story[data-type=spark_tabs]>div.tabs>div.item.select { border-top:var(--box-notice3); background-color:var(--code-bg-color); } div.story[data-type=spark_tabs]>div.story:not(.select) { display:none; } fieldset.word.play.float { top:0; } diff --git a/plugin/state.js b/plugin/state.js index 6dfce7f8..6268cb0f 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -16,6 +16,8 @@ Volcanos(chat.ONIMPORT, { _cookie: function(can, msg) { can.misc.Cookie(can, msg._arg[0], msg._arg[1]), can.Update() }, _session: function(can, msg) { can.misc.sessionStorage(can, msg._arg[0], msg._arg[1]), can.Update() }, _field: function(can, msg, cb) { + can.page.style(can, can._target, "visibility", "") + can.page.style(can, can._output, "visibility", "") var height = can.ConfHeight()-can.onexport.actionHeight(can)-(can.onexport.statusHeight(can)||1), width = can.ConfWidth() var tabs = false, tabHash = msg.Option("field.tabs"); if (tabHash) { can.sub && can.sub.onimport.tabs(can.sub, [{name: tabHash.slice(0, 6)}], function() { can.onmotion.cache(can, function() { return tabHash }) }), tabs = true @@ -332,17 +334,20 @@ Volcanos(chat.ONEXPORT, { 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 list = [title] - function push(p) { p && list.indexOf(p) == -1 && list.push(p) } - push(can.ConfIndex()), push(can.ConfSpace()||can.misc.Search(can, ice.POD)) + var list = []; function push(p) { p && list.indexOf(p) == -1 && list.push(p) } + push(can.user.trans(can, can.ConfIndex(), can.Conf("help"))) + // push(can.ConfIndex()) + can.core.List(arguments, function(title, index) { index > 0 && push(title) }), push(can.ConfSpace()||can.misc.Search(can, ice.POD)) can.isCmdMode() && can.user.title(list.join(" ")) }, args: function(can) { return can.Option() }, link: function(can) { - if (can.sub && can.sub.onexport.link) { return can.sub.onexport.link(can.sub) } + // if (can.sub && can.sub.onexport.link) { 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() can.core.Item(args, function(key, value) { key != ice.POD && !value && delete(args[key]) }) - return can.misc.MergePodCmd(can, args, true) + var hash = can.misc.localStorage(can, [args.pod, args.cmd, "hash"])||"" + hash && (hash = "#"+hash) + return can.misc.MergePodCmd(can, args, true)+hash }, close: function(can, msg) {}, }) diff --git a/plugin/story/studio.js b/plugin/story/studio.js index 982a8749..f204a4fc 100644 --- a/plugin/story/studio.js +++ b/plugin/story/studio.js @@ -1,12 +1,11 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg, cb) { - // can.isCmdMode() && can.sup.onimport.size(can.sup, can.page.height(), can.page.width()) can.onmotion.hidden(can, can._status), cb && cb(msg), can.onimport._tabs(can, msg) }, _tabs: function(can, msg) { can.onappend.style(can, web.STUDIO), can.onmotion.clear(can, can._action) var margin = html.PLUGIN_MARGIN*2 msg.Table(function(value, index) { value.nick = can.user.trans(can, value.index.split(nfs.PT).pop(), value.help) - value._select == index == 0 + value._select = index == 0 var target = can.onimport.item(can, value, function() { if (value._plugin) { return can.onmotion.select(can, can._output, html.FIELDSET, value._plugin._target) } can.onappend.plugin(can, value, function(sub) { value._plugin = sub @@ -15,18 +14,6 @@ Volcanos(chat.ONIMPORT, { target.oncontextmenu = function(event) { sub._legend.onclick(event) }, can.onmotion.hidden(can, sub._legend) }, can._output) }, null, can._action); can.onappend.style(can, "cmds", target) - }), can.onappend._action(can, null, null, null, true) - }, - _full: function(can, msg) { - can.ui = can.onappend.layout(can), can.page.style(can, can.ui.content, html.PADDING, 10) - msg.Table(function(value, index) { - value.nick = can.user.trans(can, value.index.split(nfs.PT).pop(), value.help) - var target = can.onimport.item(can, value, function(event) { - if (can.onmotion.cache(can, function() { return value.index }, can.ui.content)) { return } - can.onappend.plugin(can, value, function(sub) { - sub.onexport.output = function() { sub.onimport.size(sub, can.ConfHeight(), can.ConfWidth()-can.ui.project.offsetWidth) } - }, can.ui.content) - }); index == 0 && target.click() }) }, }) diff --git a/plugin/story/studiolayout.js b/plugin/story/studiolayout.js index 3c2d6e83..2d781b89 100644 --- a/plugin/story/studiolayout.js +++ b/plugin/story/studiolayout.js @@ -6,13 +6,13 @@ Volcanos(chat.ONIMPORT, { content: {index: "web.code.redis.keys", args: sess}, } }) }, - project: function(can, msg, key, cb) { can.ui = can.onappend.layout(can), can.onappend.style(can, "studiolayout", can._fields) - msg.Table(function(value) { var hash = value[key]; value._select = can.db.hash[0] == hash + project: function(can, msg, key, cb) { can.ui = can.onappend.layout(can), can.onappend.style(can, "studiolayout") + msg.Table(function(value) { var hash = value[key]; value._hash = hash, value._title = hash can.onimport.item(can, value, function(event, value, show, target) { if (value._tabs) { return value._tabs.click() } var msg = can.request(event), list = cb(event, hash, value) can.core.List("content,display,profile".split(","), function(field) { list[field] && can.core.List("index,args,style,_init".split(","), function(key) { msg.Push(key, list[field][key]||"") }) - }), can.onimport.tabsCache(can, msg, hash, value, target) + }), can.onimport.tabsCache(can, value, target, msg) }) }) }, diff --git a/plugin/table.js b/plugin/table.js index 541a5b8d..4c610c56 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -119,14 +119,17 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target, cb) { can.user.carteItem(event, can, item) }, _item: function(can, item, cb, cbs) { + item._hash = item._hash||item.hash||item.zone||item.path||item.name + item._title = item._title||item.name||item.path||item.path||item.hash + item._select == undefined && can.db.hash[0] && (item._select = can.db.hash[0] == item._hash) return {view: [[html.ITEM, item.type, item.role, item.status]], title: item.title||item.nick, list: [ can.onimport._icons(can, item), can.onimport._nick(can, item), ].concat(item._label||[], [ item.action && {icon: "bi bi-three-dots", onclick: function(event) { can.onimport._menu(event, can, item, cbs) }}, - ]), _init: function(target) { - target._item = item, item._item = target, can.ui[item.path] = target + ]), _init: function(target) { target._item = item, item._item = target, can.ui[item.path] = target item._select && can.onmotion.delay(can, function() { target.click() }) }, onclick: function(event) { + can.db.value = item, can.onexport.hash(can, item._hash), can.onexport.title(can, item._title) cb(event) }, oncontextmenu: function(event) { can.onimport._menu(event, can, item, cbs) @@ -159,13 +162,16 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target, cb) { var last = array.slice(0, index).join(split), name = array.slice(0, index+1).join(split); if (node[name]) { return } last && node[last] && can.page.Select(can, node[last].previousSibling, "div.expand", function(target) { target.innerHTML == "" && (target.innerHTML = can.page.unicode.closes) }) item.expand = item.expand||item._select||(can.db.hash && (can.db.hash[0] == key)) + item._hash = item._hash||item.hash||item.zone||item.path||item.name + item._title = item._title||item.name||item.path||item.path||item.hash var ui = can.page.Append(can, node[last], [{view: html.ITEM, list: [ {view: [[html.EXPAND], html.DIV, (index==array.length-1? "": can.page.unicode.closes)]}, {view: [mdb.NAME], list: [{text: [value, "", html.NAME]}].concat(item._label||[])}, item.action && {view: [mdb.ICON], list: [{icon: "bi bi-three-dots", onclick: function(event) { can.onimport._menu(event, can, item, cbs) }}]}, ], onclick: function(event) { var target = event.currentTarget if (index < array.length-1 && !can.page.ClassList.set(can, ui[html.EXPAND], cli.OPEN, !can.page.ClassList.neg(can, node[name], html.HIDE))) { return } - can.onexport.hash(can, [key]), can.onimport._itemselect(can, target), can.base.isFunc(cb) && cb(event, item, ui.item) + can.db.value = item, can.onexport.hash(can, item._hash), can.onexport.title(can, item._title) + can.onimport._itemselect(can, target), can.base.isFunc(cb) && cb(event, item, ui.item) node[key] && can.page.ClassList.add(can, node[key].previousSibling, html.SELECT) if (node[name].childElementCount == 2) { can.onmotion.delay(can, function() { node[name].firstChild.click() }) } }, oncontextmenu: function(event) { @@ -206,20 +212,24 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target, cb) { }) }} }))._target }, - tabsCache: function(can, msg, key, value, target, cb) { if (value._tabs) { return value._tabs.click() } - value._tabs = can.onimport.tabs(can, [value], function() { can.onexport.hash(can, key), can.Status(value), can.db.value = value - can.page.isSelect(target) || can.onmotion.delay(can, function() { target.click() }) - if (can.onmotion.cache(can, function() { return key }, can.ui.content, can.ui.profile, can.ui.display, can._status)) { return can.onimport.layout(can) } - if (cb && cb()) { return } + tabsCache: function(can, value, target, cb) { if (value._tabs) { return value._tabs.click() } + value._tabs = can.onimport.tabs(can, [value], function() { can.page.isSelect(target) || can.onmotion.delay(can, function() { target.click() }) + can.page.SelectOne(can, can._status, html.LEGEND) || can.onmotion.cache(can, function() { return value._hash }, can._status) + if (can.onmotion.cache(can, function() { return value._hash }, can.ui.content, can.ui.profile, can.ui.display)) { return can.onimport.layout(can) } + can.Status(value); if (can.base.isFunc(cb)) { return cb() } var msg = cb if (msg.Append(ctx.INDEX)) { msg.Table(function(value, index) { index == 0 && can.onappend.plugin(can, value, function(sub) { can.db.value._content_plugin = sub, can.onimport.layout(can) }, can.ui.content) - index == 1 && can.onappend.plugin(can, value, function(sub) { can.db.value._display_plugin = sub, can.onimport.layout(can) }, can.ui.display) - index == 2 && can.onappend.plugin(can, value, function(sub) { can.db.value._profile_plugin = sub, can.onimport.layout(can) }, can.ui.profile) + index == 1 && can.onappend.plugin(can, value, function(sub) { + can.onmotion.toggle(can, can.ui.display, true) + can.db.value._display_plugin = sub, can.onimport.layout(can) }, can.ui.display) + index == 2 && can.onappend.plugin(can, value, function(sub) { + can.onmotion.toggle(can, can.ui.profile, true) + can.db.value._profile_plugin = sub, can.onimport.layout(can) }, can.ui.profile) can.onmotion.delay(can, function() { can.onimport.layout(can) }) can.onmotion.delay(can, function() { can.onimport.layout(can) }, 100) can.onmotion.delay(can, function() { can.onimport.layout(can) }, 300) }) } else { can.onappend.table(can, msg), can.onappend.board(can, msg) } - }, function() { delete(value._tabs), can.onmotion.cacheClear(can, key, can.ui.content, can.ui.profile, can.ui.display) }) + }, function() { delete(value._tabs), can.onmotion.cacheClear(can, value._hash, can.ui.content, can.ui.profile, can.ui.display) }) }, tool: function(can, list, cb, target, status) { target = target||can._output, status = status||can._status var height = can.base.Max(html.PLUG_HEIGHT, can.ConfHeight()-3*html.ACTION_HEIGHT, 240), width = can.base.Max(html.PLUG_WIDTH, can.ConfWidth()-(can.user.isMobile? 0: html.PROJECT_WIDTH)) @@ -266,7 +276,7 @@ Volcanos(chat.ONLAYOUT, { cmd: function(can, height, width) { can.onlayout._init(can, height, width) }, }) Volcanos(chat.ONEXPORT, { - title: function(can, title) { can.sup.onexport.title(can, title) }, + title: function(can, title) { can.sup.onexport.title.apply(can.sup.onexport, [can.sup].concat(can.core.List(arguments).slice(1))) }, action_value: function(can, key, def) { var value = can.Action(key); return can.base.isIn(value, ice.AUTO, key, undefined)? def: value }, tabs: function(can) {}, tool: function(can) { can.misc.sessionStorage(can, [can.ConfIndex(), "tool"], JSON.stringify(can.page.Select(can, can._status, html.LEGEND, function(target) { return target._meta }))) },