From 6fb00ba9e8cb730f735ab5ac8d1b957a71bd0e7f Mon Sep 17 00:00:00 2001 From: shylinux Date: Wed, 26 Jul 2023 17:57:09 +0800 Subject: [PATCH] add some --- plugin/local/code/inner.js | 10 +++++----- plugin/local/team/plan.js | 20 ++++++++++---------- plugin/local/wiki/word.css | 2 +- plugin/table.js | 4 ++-- proto.js | 3 ++- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index 0036fc8a..dd753ec1 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -4,17 +4,17 @@ const CURRENT_FILE = "web.code.inner:currentFile", SELECT_LINE = "web.code.inner const VIEW_CREATE = "tabview.view.create", VIEW_REMOVE = "tabview.view.remove", LINE_SELECT = "tabview.line.select" Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { var paths = can.core.Split(can.Option(nfs.PATH), mdb.FS); can.Option(nfs.PATH, paths[0]) switch (can.Mode()) { - case "result": msg.result = msg.result||[can._output.innerHTML], can.Mode(chat.SIMPLE) + case ice.MSG_RESULT: msg.result = msg.result||[can._output.innerHTML], can.Mode(chat.SIMPLE) } - can.core.List(paths.concat(can.core.Split(msg.Option(nfs.REPOS))), function(p) { if (can.base.endWith(p, "-story/", "-dict/")) { return } + can.core.List(paths.concat(can.core.Split(msg.Option(nfs.REPOS))), function(p) { if (can.base.beginWith(p, nfs.USR_LOCAL_WORK) || can.base.endWith(p, "-dict/")) { return } if (p && paths.indexOf(p) == -1 && p[0] != nfs.PS) { paths.push(p) } }), can.onmotion.clear(can), can.onappend.style(can, code.INNER), can.sup.onimport._process = function() {} can.db = {paths: paths, tabview: {}, history: [], _history: [], toolkit: {}}, can.db.tabview[can.onexport.keys(can)] = msg can.ui = can.onappend.layout(can, [html.PROJECT, [html.TABS, nfs.PATH, [html.CONTENT, html.PROFILE], html.DISPLAY, html.PLUG]]) can.ui._content = can.ui.content, can.ui._profile = can.ui.profile, can.ui._display = can.ui.display, can.onmotion.hidden(can, can.ui.plug) can.onmotion.hidden(can, can.ui.profile), can.onmotion.hidden(can, can.ui.display) - can.Conf("style") == "output" && can.onmotion.hidden(can, can.ui.project) - can.Conf("style") == "output" && can.page.style(can, can.ui.content, html.HEIGHT, "") + can.Conf(ctx.STYLE) == html.OUTPUT && can.onmotion.hidden(can, can.ui.project) + can.Conf(ctx.STYLE) == html.OUTPUT && can.page.style(can, can.ui.content, html.HEIGHT, "") switch (can.Mode()) { case chat.SIMPLE: // no break case chat.FLOAT: can.onmotion.hidden(can, can.ui.project); break @@ -218,7 +218,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { var paths = can.core.Sp can.onimport.tabview(can, item.path, can.base.trimPrefix(item.file, nfs.PWD), parseInt(item.line)); return true }, can.base.isFunc(cb) && cb(sub) }, can.ui.plug.parentNode, can.ui.plug), can.page.isDisplay(can.ui.plug) || can.onmotion.toggle(can, can.ui.plug, true) && can.onimport.layout(can) }, - layout: function(can) { if (can.isSimpleMode() || can.Conf("style") == "output") { return can.page.style(can, can.ui.content, html.WIDTH, can.ConfWidth()) } if (can.isCmdMode()) { can.ConfHeight(can.page.height()) } + layout: function(can) { if (can.isSimpleMode() || can.Conf(ctx.STYLE) == html.OUTPUT) { return can.page.style(can, can.ui.content, html.WIDTH, can.ConfWidth()) } if (can.isCmdMode()) { can.ConfHeight(can.page.height()) } var content = can.ui.content; if (content._root) { can.ui.content = content._root } can.ui.size = {profile: can._msg.Option(html.WIDTH), display: can._msg.Option(html.HEIGHT)} can.ui.layout(can.ConfHeight(), can.ConfWidth(), 0, function(height, width) { can.ui.content = content, can.onlayout.layout(can, height, width) var sub = can.ui.profile._plugin; sub && can.page.isDisplay(can.ui.profile) && sub.onimport && sub.onimport.size(sub, can.ui.profile.offsetHeight, can.ui.profileWidth, true) diff --git a/plugin/local/team/plan.js b/plugin/local/team/plan.js index 25c94b82..e8429930 100644 --- a/plugin/local/team/plan.js +++ b/plugin/local/team/plan.js @@ -1,7 +1,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(can, target), can._display_heights = {}, can.list = {}; var ls = can.misc.SearchHash(can) can.ui = can.onappend.layout(can), can.onmotion.hidden(can, can.ui.profile), can.onmotion.hidden(can, can.ui.display), can.isCmdMode() || 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.pod, 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() }, _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]) }) @@ -23,26 +23,26 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( } }, draggable: time != undefined, title: can.onexport.title(can, task), _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) - }) }, null, can.ui.project); task._target = target, target.onclick = function(event) { item.click() }, can.list[can.core.Keys(task.pod, task.zone, task.id)] = target + }) }, null, can.ui.project); 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) - if (can.onmotion.cache(can, function() { return can.sup.task = task, can.Status(task), [task.pod, task.zone, task.id].join(nfs.PT) }, can.ui.profile)) { return } + 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["extra."+key] = value }), delete(task.extra) var table = can.page.Appends(can, can.ui.profile, [{view: [chat.CONTENT, html.TABLE], list: [{th: [can.user.trans(can, mdb.KEY, "字段"), can.user.trans(can, mdb.VALUE, "属性")]}]}])._target can.core.Item(task, function(key, value) { key != "_target" && can.page.Append(can, table, [{ - td: [key, key == ice.POD && value != ""? can.page.Format(html.A, can.misc.MergeURL(can, {pod: value}), value): value], + td: [key, key == web.SPACE && value != ""? can.page.Format(html.A, can.misc.MergeURL(can, {pod: value}), value): value], onclick: function(event) { can.page.tagis(event.target, html.INPUT) && event.target.type == html.BUTTON && can.run(can.request(event, task), [ctx.ACTION, event.target.name]) }, - ondblclick: function(event) { if ([ice.POD, mdb.ZONE, mdb.ID].indexOf(key) > -1) { return } + ondblclick: function(event) { if ([web.SPACE, mdb.ZONE, mdb.ID].indexOf(key) > -1) { return } can.onmotion.modify(can, event.target, function(sub, value) { can.onaction.modifyTask(event, can, task, key, value) }, {name: key, action: key.indexOf(mdb.TIME) > 0? "date": "key"}) }, }]) }), can.onmotion.story.auto(can, can.ui.profile) }, _display: function(can, task) { can.onmotion.toggle(can, can.ui.display, true) - if (can.onmotion.cache(can, function() { return can.sup.task = task, can.Status(task), [task.pod, task.zone, task.id].join(nfs.PT) }, can.ui.display)) { return } - task[ctx.EXTRA_INDEX] && can.onappend.plugin(can, {space: task.pod, index: task[ctx.EXTRA_INDEX], args: task[ctx.EXTRA_ARGS], height: can.ConfHeight()/2-2*html.ACTION_HEIGHT}, function(sub, meta) { - sub.run = function(event, cmds, cb) { can.request(event, kit.Dict(team.TASK_POD, task.pod, team.TASK_ZONE, task.zone, team.TASK_ID, task.id)) + 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.display)) { return } + task[ctx.EXTRA_INDEX] && can.onappend.plugin(can, {space: task.space, index: task[ctx.EXTRA_INDEX], args: task[ctx.EXTRA_ARGS], height: can.ConfHeight()/2-2*html.ACTION_HEIGHT}, function(sub, meta) { + sub.run = function(event, cmds, cb) { can.request(event, kit.Dict(team.TASK_POD, task.space, team.TASK_ZONE, task.zone, team.TASK_ID, task.id)) can.page.style(can, sub._output, html.MAX_HEIGHT, ""), can.runAction(event, ice.RUN, [task[mdb.ZONE], task[mdb.ID]].concat(cmds), cb) } sub.onexport.output = function() { can.onmotion.delay(can, function() { @@ -144,9 +144,9 @@ Volcanos(chat.ONACTION, {list: [ score: function(event, can, key, value) { can.onaction._filter(event, can, key, value) }, view: function(event, can, key, value) { can.Action(key, value), can.onmotion.clear(can, can.ui.project), can.onmotion.clear(can, can.ui.content), can.core.CallFunc([can.onimport, can.Option("scale")], [can, can._msg]) }, }) -Volcanos(chat.ONEXPORT, {list: [mdb.COUNT, ice.POD, team.BEGIN_TIME, mdb.ZONE, mdb.ID, mdb.TYPE, mdb.NAME, mdb.TEXT], +Volcanos(chat.ONEXPORT, {list: [mdb.COUNT, web.SPACE, team.BEGIN_TIME, mdb.ZONE, mdb.ID, mdb.TYPE, mdb.NAME, mdb.TEXT], span: function(can) { return kit.Dict(team.DAY, 24*3600*1000, team.WEEK, 7*24*3600*1000, team.MONTH, 30*24*3600*1000, team.YEAR, 365*24*3600*1000, team.LONG, 365*24*3600*1000)[can.Option("scale")]||0 }, - hash: function(can, task) { if (!can.isCmdMode()) { return } location.hash = [task.pod, task.zone, task.id].join(nfs.DF) }, + hash: function(can, task) { if (!can.isCmdMode()) { return } location.hash = [task.space, task.zone, task.id].join(nfs.DF) }, head: function(can, scale) { if ([team.YEAR, team.LONG].indexOf(scale) > -1) { return } return [scale].concat(can.user.time(can, "", "%W")) }, name: function(can, task) { return task.name }, text: function(can, task) { return task.name+": "+(task.text||"") }, diff --git a/plugin/local/wiki/word.css b/plugin/local/wiki/word.css index eea070c0..acb63127 100644 --- a/plugin/local/wiki/word.css +++ b/plugin/local/wiki/word.css @@ -7,7 +7,7 @@ fieldset.word>div.output>p { margin:20px auto; } fieldset.word>div.output div.story.flex { display:flex; justify-content:center; } fieldset.word>div.output div.story.flex>* { padding:20px; } fieldset.word>div.output h2.story[data-type=spark][data-name=title] { text-align:center; } -fieldset.word>div.output h2 { margin-top:40px; } +// fieldset.word>div.output h2 { margin-top:40px; } fieldset.word>div.output h3 { margin-top:20px; } fieldset.word>div.output table { width:100%; } fieldset.word>div.output img { max-height:100%; max-width:100%; } diff --git a/plugin/table.js b/plugin/table.js index 592d6253..880458c0 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -28,7 +28,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( ]} })), can.onlayout.expand(can, can._output, 320) }, icon: function(can, msg, target, cb) { return msg.Table(function(value) { value.icon = can.misc.PathJoin(value.icon||can.page.drawText(can, value.name, 80)) - return can.page.Append(can, target, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: value.icon}]}, {view: [mdb.NAME, "", value.name]}], _init: function(target) { + return can.page.Append(can, target, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: value.icon+(value.space? "?pod="+value.space: "")}]}, {view: [mdb.NAME, "", value.name]}], _init: function(target) { cb && cb(target, value) }, onclick: function(event) { can.sup.onexport.record(can.sup, value.name, mdb.NAME, value) }}])._target }) }, @@ -109,7 +109,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( return {view: [[html.ZONE, zone.name]], list: [ {view: html.ITEM, inner: can.user.trans(can, zone.name), _init: function(target) { zone._legend = target }, onclick: function() { if (zone._delay_init) { zone._delay_init(zone._target, zone), delete(zone._delay_init) } - can.onmotion.toggle(can, zone._action), can.onmotion.toggle(can, zone._action.nextSibling), zone._toggle && zone._toggle() + can.onmotion.toggle(can, zone._action), can.onmotion.toggle(can, zone._action.nextSibling||zone._target), zone._toggle && zone._toggle() }, oncontextmenu: function(event) { var menu = zone._menu menu? can.user.carteRight(event, can, menu.meta, menu.list||can.core.Item(menu.meta), can.base.isFunc(menu)? menu: function(event, button, meta, carte) { can.runAction(event, button), carte.close() diff --git a/proto.js b/proto.js index cbfb687a..0c9b12e9 100644 --- a/proto.js +++ b/proto.js @@ -133,8 +133,9 @@ var nfs = { _CSS: ".css", _JS: ".js", DF: ice.DF, PS: ice.PS, PT: ice.PT, PWD: "./", SRC: "src/", USR: "usr/", - PACK: "pack", + USR_LOCAL_WORK: "usr/local/work/", SRC_DOCUMENT: "src/document/", + PACK: "pack", IMAGE_PNG: "image/png", IMAGE_JPEG: "image/jpeg",