diff --git a/frame.js b/frame.js index e4add85d..71c04386 100644 --- a/frame.js +++ b/frame.js @@ -95,7 +95,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { Status: function(key, value) { if (can.base.isObject(key)) { return can.core.Item(key, sub.Status), key } can.page.Select(can, status, [[[html.DIV, key], html.SPAN]], function(target) { - if (can.base.beginWith(value, ice.HTTP)) { value = can.page.Format(html.A, value) } + if (can.base.beginWith(value, ice.PS, ice.HTTP)) { value = can.page.Format(html.A, value) } return can.base.isUndefined(value)? (value = target.innerHTML): (target.innerHTML = value) }); return value }, @@ -166,7 +166,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { } return can.onengine._plugin(event, can, msg, can, cmds, cb) || can.run(event, cmds, cb||function(msg) { if (silent) { return } if ((msg._can == can || msg._can == can.core.Value(can, chat._OUTPUTS_CURRENT)) && can.core.CallFunc([can, chat.ONIMPORT, ice.MSG_PROCESS], {can: can, msg: msg})) { return } - if (cmds && cmds[0] == ctx.ACTION) { if (cmds[1] == mdb.CREATE || cmds[1] == mdb.INSERT || msg.Length() == 0 && msg.Result() == "") { return can.Update() } } + if (cmds && cmds[0] == ctx.ACTION) { if (can.base.isIn(cmds[1], mdb.CREATE, mdb.INSERT, mdb.IMPORT) || msg.Length() == 0 && msg.Result() == "") { return can.user.toastSuccess(can, cmds[1]), can.Update() } } can.onappend._output(can, msg, meta.display||msg.Option(ice.MSG_DISPLAY)||meta.feature.display) }) }, @@ -180,7 +180,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, can._outputs && can._outputs.push(sub), sub.sup = can sub._index = can._index, sub._msg = msg, sub.Conf(sub._args = can.base.ParseURL(display)) - sub._trans = can.base.Copy(sub._trans||{}, can._trans, can.core.Value(sub, [chat.ONACTION, chat._TRANS])) + sub._trans = can.base.Copy(can.base.Copy(sub._trans||{}, can._trans), can.core.Value(sub, [chat.ONACTION, chat._TRANS])) if (sub.onimport && can.base.isArray(sub.onimport.list) && sub.onimport.list.length > 0) { can.onmotion.clear(can, can._option), can.onappend._option(can, {inputs: can.page.inputs(can, sub.onimport.list) }) } @@ -196,7 +196,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, _status: function(can, list, status) { status = status||can._status, can.onmotion.clear(can, status) can.core.List(can.base.Obj(list, can.core.Value(can, [chat.ONEXPORT, mdb.LIST])), function(item) { item = can.base.isString(item)? {name: item}: item - if (can.base.beginWith(item.value, ice.HTTP)) { item.value = can.page.Format(html.A, item.value) } + if (can.base.beginWith(item.value, ice.PS, ice.HTTP)) { item.value = can.page.Format(html.A, item.value) } can.page.Append(can, status, [{view: can.base.join([html.ITEM, item.name]), title: item.name, list: [ {text: [item.name, html.LABEL]}, {text: [": ", html.LABEL]}, {text: [(item.value||"")+"", html.SPAN, item.name]}, ], onclick: function(event) { can.user.copy(event, can, item.value) }}]) @@ -206,7 +206,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { field: function(can, type, item, target) { type = type||html.PLUGIN, item = item||{} var name = (item.nick||item.name||"").split(ice.SP)[0], title = !item.help || can.user.language(can) == "en"? name: name+"("+item.help.split(ice.SP)[0]+")" return can.page.Append(can, target||can._output, [{view: [can.base.join([type||"", item.name||"", item.pos||""]), html.FIELDSET], list: [ - {text: [name == "word"? item.help.split(ice.SP)[0]: title, html.LEGEND]}, {view: [html.OPTION, html.FORM]}, html.ACTION, html.OUTPUT, html.STATUS, + (name||title)&&{text: [name == "word"? item.help.split(ice.SP)[0]: title, html.LEGEND]}, {view: [html.OPTION, html.FORM]}, html.ACTION, html.OUTPUT, html.STATUS, ]}]) }, input: function(can, item, value, target, style) { @@ -271,7 +271,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { can.core.ItemCB(can.onfigure[input], function(key, on) { var last = target[key]||function(){}; target[key] = function(event) { can.core.CallFunc(on, {event: event, can: can, meta: meta, cb: _cb, target: target, sub: target._can, last: last, cbs: function(cb) { function show() { var sub = target._can - can.onlayout.figure(event, can, target._can._target), can.onmotion.toggle(can, target._can._target, true), can.base.isFunc(cb) && cb(target._can, _cb) + can.base.isFunc(cb) && cb(target._can, _cb), can.onlayout.figure(event, can, target._can._target), can.onmotion.toggle(can, target._can._target, true) can.page.style(can, sub._output, html.MAX_HEIGHT, can.base.Max(can.page.height()-sub._target.offsetTop-2*html.ACTION_HEIGHT, can.page.height()/2)) } if (target._can) { return show() } can.onappend._init(can, {type: html.INPUT, name: input, pos: chat.FLOAT, mode: meta.mode}, [path], function(sub) { sub.Conf(meta) @@ -420,11 +420,13 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) { move: function(can, target, layout, cb) { var begin; layout = layout||{} can.page.style(can, target, layout), target.onmousedown = function(event) { + if (can.page.tagis(event.target, html.BUTTON, html.SELECT)) { return } if (!event.ctrlKey && !can.page.tagis(target, html.FIELDSET)) { return } layout.height = target.offsetHeight, layout.width = target.offsetWidth layout.left = target.offsetLeft, layout.top = target.offsetTop begin = can.base.Copy({x: event.x, y: event.y}, layout) }, target.onmouseup = function(event) { begin = null }, target.onmousemove = function(event) { if (!begin) { return } + if (can.page.tagis(event.target, html.BUTTON, html.SELECT)) { return } if (event.shiftKey) { layout.height = begin.height + event.y - begin.y, layout.width = begin.width + event.x - begin.x can.page.style(can, target, html.HEIGHT, layout.height, html.WIDTH, layout.width) diff --git a/lib/base.js b/lib/base.js index 9ae21d5a..c75d7936 100644 --- a/lib/base.js +++ b/lib/base.js @@ -30,16 +30,10 @@ Volcanos("base", { res += (arguments[i][0]==ice.PS || res=="" || res[res.length-1]==ice.PS? "": ice.PS) + arguments[i].trim() } return res }, - Args: function() { var res = [] - for (var i = 0; i < arguments.length; i += 2) { - if (typeof arguments[i] == lang.OBJECT) { - if (arguments[i].length > 0) { - for (var j = 0; j < arguments[i].length; j += 2) { res[arguments[i][j]] = arguments[i][j] } - } else { - for (var k in arguments[i]) { res[k] = arguments[i][k] } - } i-- - } else if (arguments[i]) { res.push(encodeURIComponent(arguments[i])+ice.EQ+encodeURIComponent(arguments[i+1])) } - } return res.join("&") + Args: function() { var args = arguments, res = []; function encode(k, v) { k && v != undefined && res.push(encodeURIComponent(k)+ice.EQ+encodeURIComponent(v)) } + for (var i = 0; i < args.length; i += 2) { if (typeof args[i] == lang.OBJECT) { + if (args[i].length > 0) { for (var j = 0; j < args[i].length; j += 2) { encode(args[i][j], args[i][j+1]) } } else { for (var k in args[i]) { encode(k, args[i][k]) } } i-- + } else { encode(args[i], args[i+1]) } } return res.join("&") }, _parse: function(url, res) { var list = url.split("?"); res = res||{}, res["_origin"] = list[0] list[1] && list[1].split("&").forEach(function(item) { var ls = item.split(ice.EQ); res[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1]) }) @@ -136,7 +130,7 @@ Volcanos("base", { } }, - beginWith: function(str, begin) { return typeof str == lang.STRING && str.trim().indexOf(begin) == 0 }, + beginWith: function(str) { for (var i = 1; i < arguments.length; i++) { return typeof str == lang.STRING && str.trim().indexOf(arguments[i]) == 0 } }, endWith: function(str, end) { return typeof str == lang.STRING && str.lastIndexOf(end) + end.length == str.length }, trim: function(args) { if (this.isString(args)) { return args.trim() } if (this.isArray(args)) { for (var i = args.length-1; i >= 0; i--) { if (!args[i]) { args.pop() } else { break } } } diff --git a/lib/misc.js b/lib/misc.js index 76cbb830..4dfd7e14 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -172,7 +172,7 @@ Volcanos("misc", {Message: function(event, can) { var msg = {} return can.base.MergeURL(location.origin+path+(clear?"":location.search), objs) }, SearchOrConf: function(can, key, def) { return can.base.getValid(can.misc.Search(can, key), can.Conf(key), def) }, - SearchHash: function(can) { if (can.isCmdMode() && can._index == can.misc.Search(can, ice.CMD)) { return location.hash.slice(1) } }, + SearchHash: function(can) { return can.isCmdMode() && can._index == can.misc.Search(can, ice.CMD)? can.core.Split(decodeURIComponent(location.hash.slice(1)))||[]: [] }, Search: function(can, key, value) { var args = {} if (value == undefined && can.base.isString(key)) { var ls = location.pathname.split(ice.PS); if (ls[1] == chat.SHARE) { args[chat.SHARE] = ls[2] } for (var i = 2; i < ls.length; i += 2) { if (kit.Dict(ice.POD, true, ice.CMD, true, web.WEBSITE, true)[ls[i]]) { args[ls[i]] = ls[i+1] } } diff --git a/lib/user.js b/lib/user.js index 902af58c..2d519ecc 100644 --- a/lib/user.js +++ b/lib/user.js @@ -141,11 +141,11 @@ Volcanos("user", {info: {}, agent: { item.run = item.run||function(event, cmds, cb) { var _msg = can.request(event, {_handle: ice.TRUE, action: msg.Option(html.ACTION)}, msg, can.Option()) can.page.Select(can, ui.table, html.OPTION_ARGS, function(item) { item.name && item.value && _msg.Option(item.name, item.value) }) can.run(event, cmds, cb, true) - }, item._enter = function(event) { action.submit(event, can, html.SUBMIT) } + }, item._enter = function(event) { return action.submit(event, can, html.SUBMIT), true } item.mode = chat.SIMPLE, can.onappend.figure(can, item, target) }; return {type: html.TR, list: [{type: html.TD, list: [{text: item.name||""}, {text: item.need == "must"? "*": "", style: {color: cli.RED}}]}, {type: html.TD, list: [can.page.input(can, item)]}]} })}]}, html.ACTION, - ]}]); can.onlayout.figure(event, can, ui._target), can.onmotion.delay(can, function() { action.focus() }) + ]}]); can.onmotion.delay(can, function() { can.onlayout.figure(event, can, ui._target), action.focus() }) var action = can.onappend._action(can, button||[html.SUBMIT, html.CANCEL], ui.action, { focus: function() { can.onmotion.focus(can, can.page.Select(can, ui.first, html.INPUT_ARGS)[0]) }, cancel: function() { can.page.Remove(can, ui._target) }, diff --git a/page/index.css b/page/index.css index e23c434d..badf2b5d 100644 --- a/page/index.css +++ b/page/index.css @@ -60,7 +60,7 @@ fieldset.Action>div.output>fieldset.plugin:not(.float):not(.full)>legend { float fieldset.Action.cmd>div.output>fieldset.plugin:not(.float):not(.full)>legend { float:left; } fieldset.Action>div.output>fieldset.plugin>legend { box-shadow:4px 4px 20px 4px #626bd0; } -fieldset>form.option input[type=button][name=close]{ display:none; } +fieldset.plugin>form.option input[type=button][name=close]{ display:none; } fieldset.float>form.option input[type=button][name=close]{ display:block; } fieldset.full>form.option input[type=button][name=close]{ display:block; } fieldset.plug>form.option input[type=button][name=close]{ display:block; } @@ -323,8 +323,7 @@ body.simple fieldset.Action>div.output>fieldset.plugin.inner>legend { display:no body.simple fieldset.Action>div.output>fieldset.plugin.inner>form.option { display:none; } body.simple fieldset.Action>div.output>fieldset.plugin.inner>div.action { display:none; } -body.simple div.output.card div.item { min-width:240px; border-radius:5px; box-shadow:2px 2px 6px 1px gray; } -body.simple div.output.card div.item:hover { background-color:white; box-shadow:5px 5px 10px 5px gray; } +body.simple div.output.card div.item { border-radius:5px; box-shadow:2px 2px 6px 1px gray; } body.simple div.output.card div.item>div.title { border-bottom:solid 1px #e7e7e7; } body.simple fieldset.feel.float { top:0; } @@ -341,6 +340,7 @@ body.white.simple div.carte div.item:hover { background-color:#e3e6f1; } body.white.simple fieldset.plugin div.output.json div.item span { color:black; } body.white.simple fieldset.plugin div.output.json div.item span.key { color:blue; } body.white.simple fieldset.plugin div.output.json div.item span.nonce { color:lightgray; } +body.white.simple div.output.card div.item:hover { background-color:white; box-shadow:5px 5px 10px 5px gray; } body.white.simple div.output.card input[type=button] { background-color:#0152d9; color:black; font-size:0.8rem; padding:5px 10px; box-shadow:2px 2px 6px 1px gray; } body.white.simple div.output.card input[type=button]:hover { box-shadow:2px 2px 8px 2px gray; } body.white.simple div.output div.project div.zone>div.action>div.item input[type=text] { color:black; } diff --git a/plugin/input/date.js b/plugin/input/date.js index f2067f65..65d2aea5 100644 --- a/plugin/input/date.js +++ b/plugin/input/date.js @@ -1,7 +1,7 @@ Volcanos(chat.ONFIGURE, {date: { onclick: function(event, can, meta, target, cbs) { cbs(function(can, cb) { const TODAY = "today", YEAR = "year", MONTH = "month", HOUR = "hour", MINUTE = "minute", SECOND = "second" - var today = new Date(), now = can.base.Date(target.value); function _cb(_now) { cb(can, can.user.time(can, now = _now), target.value) } + var today = new Date(), now = can.base.Date((target.value||"").trim()); function _cb(_now) { cb(can, can.user.time(can, now = _now), target.value) } can.onappend._action(can, [cli.CLOSE, [HOUR].concat(can.core.List(24)), [MINUTE].concat(can.core.List(0, 60, 5)), [SECOND].concat(can.core.List(0, 60, 5)), TODAY, "", mdb.PREV, [YEAR].concat(can.core.List(now.getFullYear() - 10, now.getFullYear() + 10)), [MONTH].concat(can.core.List(1, 13)), mdb.NEXT, ], can.onmotion.clear(can, can._action), kit.Dict(cli.CLOSE, function() { can.close() }, @@ -20,6 +20,7 @@ Volcanos(chat.ONFIGURE, {date: { "come", function() { now.setFullYear(now.getFullYear()+1), show(now) }, chat._TRANS, kit.Dict(TODAY, "今天", mdb.NEXT, "下一月", mdb.PREV, "上一月", "over", "去年", "come", "今年"), )), can._table = can.page.Appends(can, can._output, [{view: [chat.CONTENT, html.TABLE]}]).first + target.value == "" && (now.setMinutes(now.getMinutes()>30? 30: 0), now.setSeconds(0)) function show(now) { can.Action(YEAR, now.getFullYear()) can.Action(MONTH, now.getMonth()+1) @@ -29,13 +30,16 @@ Volcanos(chat.ONFIGURE, {date: { can.page.Appends(can, can._table, [{th: ["日", "一", "二", "三", "四", "五", "六"]}]) var tr; function add(day, type) { if (day.getDay() == 0) { tr = can.page.Append(can, can._table, [{type: html.TR}]).last } + var _day = new Date(day) can.page.Append(can, tr, [{text: [day.getDate(), html.TD, can.base.isIn(can.base.Time(day, "%y-%m-%d"), can.base.Time(now, "%y-%m-%d"), can.base.Time(today, "%y-%m-%d"))? html.SELECT: type], - onclick: function(event) { _cb(day) }, + onclick: function(event) { + _day.setHours(now.getHours()), _day.setMinutes(now.getMinutes()), _day.getSeconds(now.getSeconds()) + _cb(_day), can.close() }, }]) } var one = new Date(now); one.setDate(1) - var end = new Date(now); end.setMonth(now.getMonth()+1), end.setDate(1) + var end = new Date(now); end.setMonth(end.getMonth()+1), end.setDate(1) var head = new Date(one); head.setDate(one.getDate()-one.getDay()) var tail = new Date(end); tail.setDate(end.getDate()+7-end.getDay()) diff --git a/plugin/input/key.js b/plugin/input/key.js index fa7a9dd5..0b793401 100644 --- a/plugin/input/key.js +++ b/plugin/input/key.js @@ -1,5 +1,6 @@ Volcanos(chat.ONFIGURE, {key: { _show: function(can, msg, cb, target, name) { if (msg.Length() == 0 || msg.Length() == 1 && msg.Append(name) == target.value) { return can.onmotion.hidden(can) } + if (msg.append[msg.append.length-1] == ctx.ACTION) { msg.append = msg.append.slice(0, -1) } can.onmotion.clear(can), can.onappend.table(can, msg, function(value, key, index, line) { value = line[key] return {text: [value, html.TD], style: msg.append && msg.append.length == 1? kit.Dict(html.MIN_WIDTH, target.offsetWidth-16): {}, onclick: function(event) { can._delay_hidden = false, cb(can, value, target.value), msg.Option(ice.MSG_PROCESS) == ice.PROCESS_AGAIN && can.onmotion.delay(can, function() { can._load(event, can, cb, target, name, value) }) diff --git a/plugin/local/code/inner.css b/plugin/local/code/inner.css index 63298a0e..d74c9594 100644 --- a/plugin/local/code/inner.css +++ b/plugin/local/code/inner.css @@ -11,9 +11,9 @@ fieldset.inner>div.action>div.tabs.select { background-color:steelblue; } fieldset.inner>div.output td.content { position:relative; } fieldset.inner>div.output div.content { color:white; font-size:16px; font-family:monospace; position:relative; } fieldset.inner>div.output div.content td.line { position:sticky; left:0; text-align:right; padding:0 6px; border-right:solid 2px red; } -fieldset.inner>div.output div.content tr:hover { background-color:#4682b46b; } -fieldset.inner>div.output div.content tr.select { background-color:#4682b46b; } -fieldset.inner>div.output div.content tr.select td.line { background-color:#6495ed63; border:solid 1px red; border-right:solid 2px red; } +fieldset.inner>div.output div.content>tr:hover { background-color:#4682b46b; } +fieldset.inner>div.output div.content>tr.select { background-color:#4682b46b; } +fieldset.inner>div.output div.content>tr.select td.line { background-color:#6495ed63; border:solid 1px red; border-right:solid 2px red; } fieldset.inner>div.output div.content td.text { white-space:pre; padding-left:10px; cursor:text; } fieldset.inner>div.output div.content td.text span.comment { background-color:blue; color:cyan; } fieldset.inner>div.output div.content td.text span.keyword { color:blue; font-weight:bold; } diff --git a/plugin/local/code/vimer.js b/plugin/local/code/vimer.js index 3a4a8a11..61e5a820 100644 --- a/plugin/local/code/vimer.js +++ b/plugin/local/code/vimer.js @@ -361,7 +361,7 @@ Volcanos(chat.ONACTION, {help: "控件交互", } return true }, run: function(event, cmds, cb) { - var msg = can.request(event); can.core.List(can.core.Split(can.current.text(), "\t \n{[:,]}", {detail: true}), function(value) { + var msg = can.request(event); can.core.List(can.core.Split(can.current.text(), "\t \n{[(:=,)]}", {detail: true}), function(value) { if (can.base.isObject(value)) { if (value.type == html.SPACE) { return } value.type == lang.STRING && msg.Push(mdb.VALUE, value.left+value.text+value.right) msg.Push(mdb.VALUE, value.text) diff --git a/plugin/local/team/plan.css b/plugin/local/team/plan.css index 0421cce3..21c6d3c6 100644 --- a/plugin/local/team/plan.css +++ b/plugin/local/team/plan.css @@ -9,4 +9,4 @@ fieldset.plan>div.output div.finish { background-color:gray; color:white; } fieldset.plan>div.output div.content table { height:-webkit-fill-available; width:-webkit-fill-available; } fieldset.plan>div.output div.content th:first-child { width:40px; position:sticky; left:2px; } -fieldset.plan>div.output div.content tr:first-child { height:30px; position:sticky; top:2px; } \ No newline at end of file +fieldset.plan>div.output div.content table.content>tr:first-child { height:30px; position:sticky; top:2px; } \ No newline at end of file diff --git a/plugin/local/team/plan.js b/plugin/local/team/plan.js index b9bf85fe..f943c731 100644 --- a/plugin/local/team/plan.js +++ b/plugin/local/team/plan.js @@ -1,8 +1,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(can, target), can._display_heights = {} can.ui = can.onlayout.profile(can), can.onmotion.hidden(can, can.ui.project), can.onmotion.hidden(can, can.ui.profile) - can.onimport.layout(can), can.onimport[can.Option("scale")||"week"](can, msg) + can.onimport[can.Option("scale")||"week"](can, msg), can.onimport.layout(can) }, - _content: function(can, msg, head, list, key, get, set) { var begin_time = can.base.Date(can.Option("begin_time")) + _content: function(can, msg, head, list, key, get, set) { var begin_time = can.base.Date(can.Option(team.BEGIN_TIME)) var hash = {}; msg.Table(function(value, index) { var k = key(can.base.Date(value.begin_time)); hash[k] = (hash[k]||[]).concat([value]) }) can.sup.task && (can.sup.task._target = null) can.page.Append(can, can.ui.content, [{view: [chat.CONTENT, html.TABLE], list: can.core.List(list, function(hour, row) { @@ -21,20 +21,19 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( list: can.core.List(list, function(task) { return can.base.isString(task)? {text: [task, html.DIV, "date"]}: {text: [can.onexport[can.Action(ice.VIEW)||mdb.TEXT](can, task), 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, "begin_time", time+task.begin_time.slice(time.length), task.begin_time) + 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) { var item = can.onimport.item(can, {nick: task.name+ice.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.Status(mdb.COUNT, msg.Length()) }) }, null, can.ui.project); task._target = target, target.onclick = function(event) { item.click() } can.sup.task && can.sup.task.zone == task.zone && can.sup.task.id == task.id && (can.sup.task._target = target) - var ls = can.core.Split(decodeURIComponent(location.hash.slice(1)))||[]; if (ls[0] == task.zone && ls[1] == task.id) { can.sup.task = task } + var ls = can.misc.SearchHash(can); if (ls[0] == task.zone && ls[1] == task.id) { can.sup.task = task } }, } }), } }, - _profile: function(can, task) { can.onexport.hash(can, task) + _profile: function(can, task) { can.onexport.hash(can, task), can.onmotion.toggle(can, can.ui.profile, true) if (can.onmotion.cache(can, function() { return can.sup.task = task, can.Status(task), [task.pod, task.zone, task.id].join(ice.PT) }, can.ui.profile, can.ui.display)) { return can.onimport.layout(can) } - 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: [mdb.KEY, mdb.VALUE]}]}]).first can.core.Item(task, function(key, value) { key != "_target" && can.page.Append(can, table, [{ @@ -45,18 +44,23 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( ondblclick: function(event) { if ([ice.POD, 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", mode: chat.SIMPLE}) + }, {name: key, action: key.indexOf(mdb.TIME) > 0? "date": "key"}) }, - }]) }), can.onimport.layout(can), task["extra.index"] && can.onimport._display(can, task) + }]) }), task["extra.index"]? can.onimport._display(can, task): can.onimport.layout(can) + can.onmotion.story.auto(can, can.ui.profile) }, _display: function(can, task) { can.onmotion.toggle(can, can.ui.display, true) - can.onappend.plugin(can, {type: "plug", index: task["extra.index"], args: task["extra.args"], height: can.ConfHeight()/2-2*html.ACTION_HEIGHT}, function(sub, meta) { + can.onappend.plugin(can, {type: chat.STORY, index: task["extra.index"], args: task["extra.args"], height: can.ConfHeight()/2-2*html.ACTION_HEIGHT}, function(sub, meta) { sub.run = function(event, cmds, cb) { can.request(event, kit.Dict("task.pod", task.pod, "task.zone", task.zone, "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) }, can._plugins_display = (can._plugins_display||[]).concat([sub]) sub.onaction._output = function() { - can._display_heights[[task.zone, task.id].join(ice.FS)] = can.base.Max(sub._output.offsetHeight+html.ACTION_HEIGHT+sub.onexport.statusHeight(sub), can.ConfHeight()/2), can.onimport.layout(can) + can.onmotion.delay(can, function() { + can._display_heights[[task.zone, task.id].join(ice.FS)] = can.base.Max(sub._target.offsetHeight, can.ConfHeight()/2), can.onimport.layout(can) + }) }, sub.onaction.close = function() { can.onmotion.toggle(can, can.ui.display), can.onimport.layout(can) } + can.onimport.layout(can) }, can.ui.display) }, @@ -99,7 +103,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( can.onimport._content(can, msg, head, list, key, get, set) }, long: function(can, msg) { - var begin_time = can.base.Date(can.base.Time(can.Option("begin_time"), "%y-%m-%d %H:%M:%S")) + var begin_time = can.base.Date(can.base.Time(can.Option(team.BEGIN_TIME), "%y-%m-%d %H:%M:%S")) var begin = begin_time.getFullYear() - 5 var head = ["month"]; for (var i = 0; i < 10; i++) { head.push(begin+i) } @@ -113,8 +117,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( can.onmotion.toggle(can, can._action, !can.isFloatMode() && !(can.user.isMobile && can.page.height() < can.page.width())) can.onmotion.toggle(can, can._status, !can.isFloatMode() && !(can.user.isMobile && can.page.height() < can.page.width())) can.page.styleWidth(can, can.ui.content, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth) - if (!can.isAutoMode() || can.isStoryType()) { can.page.styleHeight(can, can._output, can.ConfHeight()) - var height = can._display_heights[can.sup.task? [can.sup.task.zone, can.sup.task.id].join(ice.FS): ""]||200 + if (true || !can.isAutoMode() || can.isStoryType()) { can.page.styleHeight(can, can._output, can.ConfHeight()) + var height = can._display_heights[can.sup.task? [can.sup.task.zone, can.sup.task.id].join(ice.FS): ""]||html.ACTION_HEIGHT if (can.ui.display.innerHTML && can.ui.display.style.display != html.NONE) { can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight()-height) } else { @@ -126,7 +130,6 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( } can.page.style(can, can.ui.profile, html.MAX_HEIGHT, can.ui.content.offsetHeight) can.page.style(can, can.ui.project, html.MAX_HEIGHT, can.ui.content.offsetHeight+can.ui.display.offsetHeight) - can.onmotion.clear(can, can.ui.content), can.onimport[can.Option("scale")||"week"](can, can._msg) } }, [""]) Volcanos(chat.ONACTION, {list: [mdb.PREV, mdb.NEXT, mdb.INSERT, mdb.EXPORT, mdb.IMPORT, @@ -135,15 +138,15 @@ Volcanos(chat.ONACTION, {list: [mdb.PREV, mdb.NEXT, mdb.INSERT, mdb.EXPORT, mdb. ["score", "all", "s1", "s2", "s3", "s4", "s5"], ["view", "", "name", "text", "level", "score"], ], _trans: {"task": "任务", "hour": "时间", "month": "月份", "order": "周序"}, - prev: function(event, can) { var begin = can.base.Date(can.Option("begin_time")||can.base.Time()) - can.Option("begin_time", can.base.Time(new Date(begin-can.onexport.span(can)))), can.Update() + prev: function(event, can) { var begin = can.base.Date(can.Option(team.BEGIN_TIME)||can.base.Time()) + can.Option(team.BEGIN_TIME, can.base.Time(new Date(begin-can.onexport.span(can)))), can.Update() }, - next: function(event, can) { var begin = can.base.Date(can.Option("begin_time")||can.base.Time()) - can.Option("begin_time", can.base.Time(new Date(begin-(-can.onexport.span(can))))), can.Update() + next: function(event, can) { var begin = can.base.Date(can.Option(team.BEGIN_TIME)||can.base.Time()) + can.Option(team.BEGIN_TIME, can.base.Time(new Date(begin-(-can.onexport.span(can))))), can.Update() }, insertTask: function(event, can, time) { var msg = can.sup.request(event, {begin_time: time}) can.user.input(event, can, can.Conf([ctx.FEATURE, mdb.INSERT]), function(args) { - can.runAction(event, mdb.INSERT, [mdb.ZONE, args[1], "begin_time", time].concat(args)) + can.runAction(event, mdb.INSERT, [mdb.ZONE, args[1], team.BEGIN_TIME, time].concat(args)) }) }, modifyTask: function(event, can, task, key, value) { @@ -163,7 +166,7 @@ Volcanos(chat.ONACTION, {list: [mdb.PREV, mdb.NEXT, mdb.INSERT, mdb.EXPORT, mdb. score: function(event, can, key, value) { 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.onimport[can.Option("scale")](can, can._msg) }, }) -Volcanos(chat.ONEXPORT, {list: [mdb.COUNT, "begin_time", mdb.ZONE, mdb.ID, mdb.TYPE, mdb.NAME, mdb.TEXT], +Volcanos(chat.ONEXPORT, {list: [mdb.COUNT, team.BEGIN_TIME, mdb.ZONE, mdb.ID, mdb.TYPE, mdb.NAME, mdb.TEXT], span: function(can) { return {"day": 24*3600*1000, "week": 7*24*3600*1000, "month": 30*24*3600*1000, "year": 365*24*3600*1000, "long": 365*24*3600*1000}[can.Option("scale")]||0 }, hash: function(can, task) { if (!can.isCmdMode()) { return } location.hash = [task.zone, task.id].join(ice.FS) }, head: function(can, scale) { if (["year", "long"].indexOf(scale) > -1) { return } return [scale].concat(can.user.time(can, "", "%W")) }, diff --git a/plugin/state.js b/plugin/state.js index 19437420..983378e8 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -73,7 +73,7 @@ Volcanos(chat.ONIMPORT, {_process: function(can, msg) { size: function(can, height, width, auto, mode) { if (auto) { - can.page.style(can, can._output, html.HEIGHT, "", html.WIDTH, "", html.MAX_HEIGHT, can.ConfHeight(height), html.MAX_WIDTH, can.ConfWidth(width)) + can.page.style(can, can._output, html.HEIGHT, "", html.WIDTH, "", html.MAX_HEIGHT, height? can.ConfHeight(height): "", html.MAX_WIDTH, can.ConfWidth(width)) } else { can.page.style(can, can._output, html.HEIGHT, can.ConfHeight(height), html.WIDTH, can.ConfWidth(width), html.MAX_HEIGHT, "", html.MAX_WIDTH, "") } diff --git a/plugin/story/json.js b/plugin/story/json.js index ace7990b..ddc59fef 100644 --- a/plugin/story/json.js +++ b/plugin/story/json.js @@ -1,7 +1,8 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, target) { can.page.ClassList.add(can, target, "json") - can.onmotion.clear(can, target), can.base.isFunc(cb) && cb(msg) + can.onmotion.clear(can, target) can.onappend.table(can, msg), can.onimport.show(can, can.base.Obj(msg.Result(), {}), target) + can.base.isFunc(cb) && cb(msg) }, show: function(can, data, target) { function show(data, target, index, total) { var list diff --git a/proto.js b/proto.js index 397a94cb..83d1697b 100644 --- a/proto.js +++ b/proto.js @@ -176,6 +176,7 @@ var chat = { } var team = { TASK: "task", PLAN: "plan", + BEGIN_TIME: "begin_time", } var mall = { COUNT: "count", PRICE: "price",