diff --git a/const.js b/const.js index 69d71c76..f271528b 100644 --- a/const.js +++ b/const.js @@ -55,9 +55,8 @@ var ctx = { var mdb = {FOREACH: "*", RANDOMS: "%", DICT: "dict", META: "meta", HASH: "hash", LIST: "list", ID: "id", KEY: "key", TIME: "time", ZONE: "zone", TYPE: "type", NAME: "name", TEXT: "text", DATA: "data", VIEW: "view", - STATUS: "status", LINK: "link", SCAN: "scan", HELP: "help", ICON: "icon", ICONS: "icons", - INDEX: "index", VALUE: "value", EXTRA: "extra", ALIAS: "alias", EXPIRE: "expire", + STATUS: "status", INDEX: "index", VALUE: "value", EXTRA: "extra", ALIAS: "alias", EXPIRE: "expire", SHORT: "short", FIELD: "field", TOTAL: "total", COUNT: "count", LIMIT: "limit", INPUTS: "inputs", CREATE: "create", REMOVE: "remove", INSERT: "insert", DELETE: "delete", MODIFY: "modify", SELECT: "select", @@ -69,9 +68,8 @@ var mdb = {FOREACH: "*", RANDOMS: "%", QS: ice.QS, AT: ice.AT, EQ: ice.EQ, FS: ice.FS, } -var web = {CHAT: "chat", PORTAL: "portal", STUDIO: "studio", SERVICE: "service", +var web = {CHAT: "chat", PORTAL: "portal", STUDIO: "studio", SERVICE: "service", DOMAIN: "domain", SPIDE: "spide", SPACE: "space", ROUTE: "route", DREAM: "dream", - DOMAIN: "domain", SHARE: "share", COUNT: "count", WORKER: "worker", SERVER: "server", GATEWAY: "gateway", OPEN: "open", LINK: "link", HTTP: "http", URL: "url", SHARE_CACHE: "/share/cache/", SHARE_LOCAL: "/share/local/", @@ -101,8 +99,7 @@ var web = {CHAT: "chat", PORTAL: "portal", STUDIO: "studio", SERVICE: "service", var aaa = { LOGIN: "login", LOGOUT: "logout", USER: "user", AUTH: "auth", SESS: "sess", ROLE: "role", - USERNICK: "usernick", USERNAME: "username", PASSWORD: "password", USERROLE: "userrole", - USERZONE: "userzone", + USERNICK: "usernick", USERNAME: "username", PASSWORD: "password", USERROLE: "userrole", USERZONE: "userzone", EMAIL: "email", AVATAR: "avatar", BACKGROUND: "background", LANGUAGE: "language", ENGLISH: "english", CHINESE: "chinese", VOID: "void", TECH: "tech", ROOT: "root", @@ -235,9 +232,9 @@ var team = { TASK_POD: "task.pod", TASK_ZONE: "task.zone", TASK_ID: "task.id", } var mall = { - COUNT: "count", PRICE: "price", - ASSET: "asset", SALARY: "salary", + PRICE: "price", COUNT: "count", UNITS: "units", AMOUNT: "amount", GOODS: "goods", + ASSET: "asset", SALARY: "salary", } var http = { diff --git a/frame.js b/frame.js index d9142445..eb40e7d9 100644 --- a/frame.js +++ b/frame.js @@ -358,7 +358,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, _init: function(target) { key == ctx.ACTION && can.onappend.mores(can, target, data, can.user.isMobile && !can.user.isLandscape()? 2: can.isCmdMode()? 5: 3) }} - }); table && can.onappend.style(can, chat.CONTENT, table), msg.append && msg.append[msg.append.length-1] == ctx.ACTION && can.onappend.style(can, ctx.ACTION, table) + }); table && can.onappend.style(can, chat.CONTENT, table), table && msg.IsDetail() && can.onappend.style(can, mdb.DETAIL, table) + msg.append && msg.append[msg.append.length-1] == ctx.ACTION && can.onappend.style(can, ctx.ACTION, 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 }, @@ -547,7 +548,9 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro can.page.SelectChild(can, target, html.DIV_ITEM, function(target) { can.page.styleWidth(can, target, width) }) }, background: function(can, url, target) { can.page.style(can, target||can._root._target, "background-image", url == "" || url == "void"? "": 'url("'+url+'")') }, - _figure: function(event, can, target, right, min) { if (!event || !event.target) { return {} } target = target||can._fields||can._target + _figure: function(event, can, target, right, min) { + if (!can.user.isMobile) { return can.onlayout.figure(event, can, target, right, min) } + if (!event || !event.target) { return {} } target = target||can._fields||can._target var rect = event.target == document.body? {left: can.page.width()/2, top: can.page.height()/2, right: can.page.width()/2, bottom: can.page.height()/2}: (event.currentTarget||event.target).getBoundingClientRect() var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom} can.getActionSize(function(left, top, width, height) { left = left||0, top = top||0, height = can.base.Max(height, can.page.height()-top) @@ -564,8 +567,6 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro if (can.user.isMobile) { if (target.offsetHeight > height/2) { layout.top = top+32 } if (target.offsetWidth > width/2) { layout.left = left, can.page.style(can, target, html.WIDTH, width) } - can.page.style(can, target, html.MAX_HEIGHT, top+height-layout.top) - return } if (layout.top+target.offsetHeight > top+height) { if (min && top+height-layout.top > min) { @@ -615,15 +616,15 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) { }, }, scrollHold: function(can, cb, target) { target = target || can._output; var left = target.scrollLeft; cb(), target.scrollLeft = left }, - scrollIntoView: function(can, target) { if (can._scroll) { return } can._scroll = true - var offset = target.offsetTop - target.parentNode.scrollTop, step = offset < 0? -20: 20 + scrollIntoView: function(can, target, margin) { if (can._scroll) { return } can._scroll = true, margin = margin||0 + var offset = (target.offsetTop-margin) - target.parentNode.scrollTop, step = offset < 0? -20: 20 if (Math.abs(offset) > 1000) { - return target.parentNode.scrollTop = target.offsetTop, delete(can._scroll) + return target.parentNode.scrollTop = (target.offsetTop-margin), delete(can._scroll) } can.core.Timer({interval: 10, length: offset/step}, function() { target.parentNode.scrollTop += step }, function() { - target.parentNode.scrollTop = target.offsetTop, delete(can._scroll) + target.parentNode.scrollTop = (target.offsetTop-margin), delete(can._scroll) }) }, clearFloat: function(can) { diff --git a/index.css b/index.css index 21dbedb4..5eb459c6 100644 --- a/index.css +++ b/index.css @@ -37,6 +37,7 @@ body { --code-datatype:lavender; --code-function:lightgreen; --code-constant:gray; --code-string:orange; --code-object:silver; --svg-stroke-width:1; --desktop-icon-size:80px; + --project-width:230px; } body.windows { --code-font-family:"Courier New"; } /* element */ @@ -58,6 +59,7 @@ table.content tr.offline { color:var(--disable-fg-color); } table.content tr.offline a { color:var(--disable-fg-color); } table.content th { padding:5px; box-shadow: var(--box-shadow); } table.content td { padding:5px; } +table.content.detail td:first-child { width:80px; } table.content.action th:last-child { position:sticky; right:2px; } table.content.action td:last-child { position:sticky; right:2px; text-align:center; } table.content input:not(:last-child) { margin-right:10px; } @@ -169,6 +171,7 @@ div.story[data-type=spark] { padding:0 5px; border-left:var(--notice-bg-color) s fieldset>div.action>div.tabs { font-style:italic; padding:5px 10px; box-shadow:var(--box-shadow); margin-left:5px; } fieldset>div.action>div.cmds { font-style:italic; padding:5px 10px; box-shadow:var(--box-shadow); margin-left:5px; } fieldset>div.output>div.code { font-size:14px; } +body.mobile fieldset>div.output>div.code>img { max-width:390px; } fieldset>div.status { font-style:italic; line-height:20px; max-height:32px; } fieldset>div.status>div.item { padding:5px; height:31px; } fieldset>div.status>div.item>label { font-size:0.6rem; } @@ -289,7 +292,7 @@ div.content>div.toggle.project { top:20%; left:0; height:80px; width:unset; padd div.content>div.toggle.profile { top:20%; right:0; height:80px; padding-top:25px; transform:scale(1, 3); border:none; } div.content>div.toggle.display { left:20%; bottom:0; width:80px; text-align:center; transform:scale(3, 1); border:none; } body.mobile div.project:not(.toggle) { border-right:var(--box-border); width:120px; flex:0 0 120px; } -div.output>div.project:not(.toggle) { border-right:var(--box-border); width:230px; flex:0 0 230px; } +div.output>div.project:not(.toggle) { border-right:var(--box-border); width:var(--project-width); flex:0 0 var(--project-width); } div.profile:not(.toggle) { border-left:var(--box-border); width:50%; } div.display:not(.toggle) { border-top:var(--box-border); } /* table card */ diff --git a/panel/footer.css b/panel/footer.css index 5601efb9..fce1b25c 100644 --- a/panel/footer.css +++ b/panel/footer.css @@ -1,6 +1,6 @@ fieldset.Footer>div.output { font-style:italic; height:32px; overflow:hidden; } fieldset.Footer>div.output div.item { padding:7px; float:left; } -fieldset.Footer>div.output div.title:first-child { font-weight:bold; text-align:center; width:230px; overflow:auto; } +fieldset.Footer>div.output div.title:first-child { font-weight:bold; text-align:center; width:var(--project-width); overflow:auto; } fieldset.Footer>div.output div.state { float:right; } fieldset.Footer>div.output div.state label { font-size:12px; } fieldset.Footer>div.output div.toast { float:right; line-height:18px; } diff --git a/panel/header.css b/panel/header.css index 40a8fff4..e4d1fc2e 100644 --- a/panel/header.css +++ b/panel/header.css @@ -1,6 +1,6 @@ fieldset.Header>div.output { font-size:1.1rem; line-height:21px; height:48px; overflow:hidden; } fieldset.Header>div.output div.item { background-color:var(--panel-output-bg-color); padding:13.5px; float:left; } -fieldset.Header>div.output div.title:first-child { font-style:italic; font-weight:bold; text-align:center; width:230px; overflow:auto; } +fieldset.Header>div.output div.title:first-child { font-style:italic; font-weight:bold; text-align:center; width:var(--project-width); overflow:auto; } fieldset.Header>div.output div.state { float:right; } fieldset.Header>div.output div.state.avatar { padding:0; } fieldset.Header>div.output div.state.avatar>img { height:48px; } diff --git a/panel/river.css b/panel/river.css index 4de41d1f..8da63a2f 100644 --- a/panel/river.css +++ b/panel/river.css @@ -1,5 +1,6 @@ -fieldset.River { width:230px; float:left; } +fieldset.River { width:var(--project-width); float:left; } fieldset.River>div.action { width:100%; display:flex; justify-content:center; } -fieldset.River>div.output div.item { padding:10px 20px; border-left:#00ffae solid 3px; } +fieldset.River>div.output { padding:40px 10px; } +fieldset.River>div.output div.item { padding:20px 20px; border-left:#00ffae solid 3px; } fieldset.River>div.output div.list div.item { border-left:#ccdc4c solid 3px; } fieldset.River>div.output div.list { margin-left:20px; } diff --git a/panel/search.css b/panel/search.css index 77eb795d..a93cb9b2 100644 --- a/panel/search.css +++ b/panel/search.css @@ -1,3 +1,3 @@ -fieldset.Search { padding:10px; box-shadow:unset; position:fixed; left:230px; top:48px; } +fieldset.Search { padding:10px; box-shadow:unset; position:fixed; left:var(--project-width); top:48px; } fieldset.Search>div.output>div.profile { max-width:unset; } fieldset.Search>div.output table.content { width:100%; } diff --git a/plugin/local/code/inner.css b/plugin/local/code/inner.css index 08862491..a4e7669a 100644 --- a/plugin/local/code/inner.css +++ b/plugin/local/code/inner.css @@ -77,7 +77,7 @@ body.light tr.line.insert { background-color:#ffeef0; } body.white tr.line.delete { background-color:#e6ffed; } body.white tr.line.insert { background-color:#ffeef0; } -fieldset.inner:not(.monaco)>div.output>div.layout>div.layout>div.content * { font-family:var(--code-font-family); font-size:var(--code-font-size); } +fieldset.inner:not(.monaco)>div.output div.content>tr.line * { font-family:var(--code-font-family); font-size:var(--code-font-size); } body:not(.windows) fieldset.inner>div.output>div.project * { font-family:var(--code-font-family); font-size:var(--code-font-size); } body:not(.windows) fieldset.inner>div.output>div.layout>div.tabs { font-family:var(--code-font-family); font-size:var(--code-font-size); } body:not(.windows) fieldset.inner>div.output>div.layout>div.path { font-family:var(--code-font-family); font-size:var(--code-font-size); } diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index 40b7158a..c0721bcc 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -81,12 +81,12 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { var paths = can.core.Sp var carte = can.user[parent? "carteRight": "carte"](event, can, {_style: key}, (msg.Length() > 10? [web.FILTER]: []).concat(msg.Table(function(value) { var p = can.core.Split(value[key], ps).pop()+(can.base.endWith(value[key], ps)? ps: ""); return _trans[p] = value[key], p })), function(event, button) { - if (can.base.endWith(button, ps)) { - can.onimport.tabPath(event, can, ps, key, pre+button, cb, carte) - return true - } else { cb(_trans[button], pre) } + if (can.base.endWith(button, ps)) { can.onimport.tabPath(event, can, ps, key, pre+button, cb, carte); return true } else { cb(_trans[button], pre) } }, parent)._target, file = can.core.Split(event.target.innerHTML.trim(), nfs.PT)[0] - can.page.Select(can, carte, html.DIV_ITEM, function(target) { target.innerHTML.trim() != event.target.innerHTML.trim() && can.base.beginWith(target.innerHTML, file+nfs.PT) && carte.insertBefore(target, carte.firstChild) }) + can.page.Select(can, carte, html.DIV_ITEM, function(target) { + target.innerHTML.trim() != event.target.innerHTML.trim() && can.base.beginWith(target.innerHTML, file+nfs.PT) && carte.insertBefore(target, carte.firstChild) + target.innerHTML.trim() == event.target.innerHTML.trim() && can.onappend.style(can, html.SELECT, target) + }) }) }, _tabFunc: function(can, target, cache) { if (cache) { var func = can.db._func||{list: []} } else { var func = can.onexport.func(can); can.db._func = func } @@ -312,7 +312,9 @@ Volcanos(chat.ONLAYOUT, { var style = type == html.FLOW? {height: target.offsetHeight/2, width: target.offsetWidth}: {height: target.offsetHeight, width: parseInt(target.offsetWidth/2)} var layout = can.page.insertBefore(can, [{view: [[html.LAYOUT, type]]}], target); layout.appendChild(target), can.page.style(can, target, style) var right = can.page.Append(can, layout, [{view: html.CONTENT, style: style}])._target; can.onmotion.cache(can, function() { return can.onexport.keys(can) }, right) - can.ui.content = right, right._max = 0, can.page.SelectChild(can, target, "tr.line", function(target) { can.onaction.appendLine(can, can.page.SelectOne(can, target, "td.text").innerText, right) }) + can.ui.content = right, right._max = 0 + can.page.Appends(can, right, [{view: ["tips", "", msg.Option(nfs.FILE)]}]) + can.page.SelectChild(can, target, "tr.line", function(target) { can.onaction.appendLine(can, can.page.SelectOne(can, target, "td.text").innerText, right) }) right.scrollTop = target.scrollTop = scroll, right._msg = msg, msg._content = layout._root = right._root = target._root = target._root||layout }, split: function(can) { can.onlayout._split(can, html.FLOW) }, diff --git a/plugin/local/code/vimer.css b/plugin/local/code/vimer.css index cd2c98d4..ff6af9a3 100644 --- a/plugin/local/code/vimer.css +++ b/plugin/local/code/vimer.css @@ -1,5 +1,5 @@ fieldset.vimer>div.output>div.layout>div.layout>div.layout div.content { border-left:var(--box-border); border-top:var(--box-border); } -fieldset.inner>div.output>div.layout>div.layout>div.content div.tips { display:none; } +/* fieldset.inner>div.output>div.layout>div.layout>div.content div.tips { display:none; } */ fieldset.vimer>div.output>div.layout>div.layout div.content div.tips { color:var(--disable-fg-color); font-style:italic; position:absolute; top:0; right:0; } fieldset.vimer>div.output>div.layout>div.layout div.content input.current { background-color:transparent; color:transparent; padding-left:10px; height:20px; position:absolute; } fieldset.vimer>div.output>div.layout>div.layout div.content div.complete { background-color:unset; padding-top:0; display:none; position:absolute; height:1px; overflow:visible; } diff --git a/plugin/local/code/vimer.js b/plugin/local/code/vimer.js index 9880d532..c727f9d6 100644 --- a/plugin/local/code/vimer.js +++ b/plugin/local/code/vimer.js @@ -1,4 +1,4 @@ -Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { +Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { if (can.user.mod.isPod) { delete(can.onfigure.space), delete(can.onfigure.repos) } can.require(["/plugin/local/code/inner.js"], function(can) { can.onimport._last_init(can, msg, function() { can.onengine.listen(can, "tabview.line.select", function(msg) { can.onaction._selectLine(can) }) can.db.undo = [], can.db.redo = [], can.onimport._input(can), cb && cb(msg) diff --git a/plugin/local/mall/goods.css b/plugin/local/mall/goods.css index acb39bd5..02a743a8 100644 --- a/plugin/local/mall/goods.css +++ b/plugin/local/mall/goods.css @@ -1,11 +1,12 @@ fieldset.goods>div.output>div.project { flex:0 0 80px; } +fieldset.goods>div.output>div.project>div.item { text-align:center; padding:20px 10px; border-right:var(--plugin-bg-color) solid 4px; } fieldset.goods>div.output>div.layout>div.layout>div.content>div.item:not(.hide) { - background-color:var(--plugin-bg-color); border-radius:10px; box-shadow:var(--box-shadow); margin:10px; float:left; - display:flex; height:150px; + background-color:var(--plugin-bg-color); border-radius:10px; box-shadow:var(--box-shadow); + margin:10px; float:left; display:flex; height:150px; } fieldset.goods>div.output>div.layout>div.layout>div.content>div.item>div { padding:10px; float:left; clear:none; } fieldset.goods>div.output>div.layout>div.layout>div.content>div.item>div.image { flex-grow:0; } -fieldset.goods>div.output>div.layout>div.layout>div.content>div.item>div.image>img { height:100px; width:100px; } +fieldset.goods>div.output>div.layout>div.layout>div.content>div.item>div.image>img { height:120px; width:120px; } fieldset.goods>div.output>div.layout>div.layout>div.content>div.item>div.content { flex-grow:1; } fieldset.goods>div.output>div.layout>div.layout>div.content>div.item>div.content div.title { font-weight:bold; white-space:break-spaces; overflow:hidden; height:32px; } fieldset.goods>div.output>div.layout>div.layout>div.content>div.item>div.content div.content { height:24px; } diff --git a/plugin/local/mall/goods.js b/plugin/local/mall/goods.js index d2b35d3a..9e4b008f 100644 --- a/plugin/local/mall/goods.js +++ b/plugin/local/mall/goods.js @@ -1,25 +1,34 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) } var list = {}; can.ui = can.onappend.layout(can), can.onmotion.clear(can, can.ui.project) - can.page.Appends(can, can.ui.content, msg.Table(function(item) { - if (!list[item.zone]) { list[item.zone] = item, can.onimport.item(can, {name: item.zone}, function() {}) } - return {view: html.ITEM, list: [ + can.page.Appends(can, can.ui.content, msg.Table(function(item, index) { var style = {} + if (!list[item.zone]) { if (can.user.isMobile && index > 0) { style["margin-top"] = "40px" } + list[item.zone] = item, item._zone = can.onimport.item(can, {name: item.zone}, function() { + can.onmotion.scrollIntoView(can, item._target, 10) + }) + } + return {view: html.ITEM, style: style, list: [ {view: wiki.IMAGE, list: [{img: can.misc.MergeCache(can, can.core.Split(item.image)[0], item.space)}]}, {view: wiki.CONTENT, list: [ {view: [html.TITLE, html.DIV, item.name]}, {view: [html.CONTENT, html.DIV, item.text]}, {view: html.DISPLAY, list: [ - {view: [mall.PRICE, html.DIV, "¥ "+(item.price||0)]}, - {view: [mall.COUNT, html.DIV, "剩 "+(item.count||0)+" "+item.type]}, + item.area? {view: [mall.PRICE, html.DIV, "¥ "+(item.price||0)+" 万"]}: {view: [mall.PRICE, html.DIV, "¥ "+(item.price||0)]}, + item.area? {view: [mall.COUNT, html.DIV, "面积 "+(item.area||0)+" 平"]}: {view: [mall.COUNT, html.DIV, "剩 "+(item.count||0)+" "+item.units]}, ]}, {view: html.ACTION, inner: item.action}, ]}, - ], onclick: function(event) { + ], _init: function(target) { item._target = target }, onclick: function(event) { if (can.page.tagis(event.target, html.INPUT) && event.target.type == html.BUTTON) { can.run(can.request(event, item), [ctx.ACTION, event.target.name]) } }} - })) + })), can.onmotion.select(can, can.ui.project, html.DIV_ITEM, 0) + can.ui.content.onscroll = function(event) { can.core.Item(list, function(zone, item) { + if (item._target.offsetTop > can.ui.content.scrollTop && item._target.offsetTop < can.ui.content.scrollTop+can.ui.content.offsetHeight/4) { + can.onmotion.select(can, can.ui.project, html.DIV_ITEM, item._zone) + } + }) } }, layout: function(can) { can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight()) diff --git a/plugin/table.js b/plugin/table.js index 9514495d..302971d4 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -86,9 +86,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( can.base.isFunc(button)? button(event, button): can.onaction[button](event, can, button), can.onkeymap.prevent(event) }}]) }, icon: function(can, msg, target, cb) { return msg.Table(function(value) { - var space = can.core.Keys(can.misc.Search(can, ice.POD), value.space||can.ConfSpace()) - // var space = value.space||can.ConfSpace()||can.misc.Search(can, ice.POD) - ; value.icon && (value.icon = can.base.MergeURL(value.icon, ice.POD, space)) + value.icon && (value.icon = can.base.MergeURL(value.icon, ice.POD, value.space||can.ConfSpace(), log.DEBUG, can.misc.Search(can, log.DEBUG))) 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) { cb && cb(target, value)