diff --git a/frame.js b/frame.js index 90c35d16..19cd01ec 100644 --- a/frame.js +++ b/frame.js @@ -670,7 +670,7 @@ Volcanos("onkeypop", {help: "键盘交互", list: [], _init: function(can, targe }) }, _parse: function(event, can, mode, list, target) { list = list||[], list.push(event.key) - can.Status("按键", list.join("")) + // can.Status("按键", list.join("")) for (var pre = 0; pre < list.length; pre++) { if ("0" <= list[pre] && list[pre] <= "9") { continue } break }; var count = parseInt(list.slice(0, pre).join(""))||1 @@ -678,7 +678,7 @@ Volcanos("onkeypop", {help: "键盘交互", list: [], _init: function(can, targe function repeat(cb, count) { list = [] for (var i = 1; i <= count; i++) { if (cb(event, can, target, count)) { break } } event.stopPropagation(), event.preventDefault() - can.Status("按键", list.join("")) + // can.Status("按键", list.join("")) } var map = can.onkeypop._mode[mode] diff --git a/page/index.css b/page/index.css index 5cafbd40..9c03a588 100644 --- a/page/index.css +++ b/page/index.css @@ -238,7 +238,7 @@ div.carte { background:#295b61; color:white; padding:4px; - z-index:10; + z-index:30; min-width:80px; } div.carte div.item { diff --git a/panel/Search.js b/panel/Search.js index 3b6374c3..f7211e9d 100644 --- a/panel/Search.js +++ b/panel/Search.js @@ -1,46 +1,22 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { - can.ui = can.page.Append(can, can._output, [ - {input: ["word", function(event) { can.onkeypop.input(event, can) - if (event.key == "Escape") { can.onmotion.hide(can) } - - if (event.key == "Enter") { event.stopPropagation(), event.preventDefault() - if (event.ctrlKey) { - can.type == "*"? can.onimport._plugin(can, can.list[0]): can.onaction.select(event, can, 0) - return - } - if (event.shiftKey) { return can.onaction["完成"](event, can) } - can.input(event, event.target.value) - } - }]}, - {view: "content"}, {view: ["display", "table"]}, {view: "preview"}, - ]), can.base.isFunc(cb) && cb(msg) - can.page.ClassList.add(can, can.ui.display, "content") - }, - _plugin: function(can, line) { - can.onappend.plugin(can, {index: line.ctx&&line.cmd!="command"? line.ctx+"."+line.cmd: line.text+"."+line.name||msg.Option("index"), option: line}, function(sub, meta) { - sub.run = function(event, cmds, cb) { var msg = can.request(event, line) - can.run(event, ["action", "command", "run", meta.index].concat(cmds), function(msg) { - can.base.isFunc(cb) && cb(msg) - }) - } - }, can.ui.preview) - }, - _table: function(can, msg, fields) { can.onmotion.clear(can, can.ui.content) + can.onmotion.clear(can, can.ui.content) var table = can.onappend.table(can, msg, function(value, key, index, line) { can.Status("count", index+1) return {text: [key == "text" && can.base.isFunc(line.text) && line.text.help || value, "td"], onclick: function(event) { - can.type == "*" || event.shiftKey? can.onimport._plugin(can, line): can.onaction.select(event, can, index) + can.onaction[can.type == "*"||event.ctrlKey? "plugin": "select"](event, can, index) }} }, can.ui.content, can.core.List((msg.Option("sort")||"ctx,cmd,type,name,text").split(","), function(item) { - return fields.indexOf(item) + return list.indexOf(item) })); table && can.page.Modify(can, can.ui.display, {style: {width: table.offsetWidth}}) }, _word: function(can, msg, cmds, fields) { can.type = cmds[0] - msg.Option({word: cmds, fields: fields.join(","), sort: msg.Option("sort"), index: msg.Option("index")}) - can.onengine.signal(can, "search", msg) + var sub = can.request({}, {word: cmds, fields: fields.join(","), sort: msg.Option("sort"), index: msg.Option("index")}) + can.onengine.signal(can, "search", sub) - can.run(msg._event, cmds, function(msg) { can.list = msg.Table() - can.onimport._table(can, msg, fields) + can.run(sub._event, cmds, function(sub) { can.list = sub.Table() + can.onimport._init(can, sub, fields) }), can.ui.word.setSelectionRange(0, -1) + + can.onmotion.show(can), can.ui.input.focus() }, select: function(can, msg, cmds, cb) { can.ui.word.value = cmds[1] @@ -53,8 +29,6 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, can.onimport._word(can, msg, cmds, fields) }, can.onimport._word(can, msg, cmds, fields) - can.onmotion.show(can), can.ui.input.focus() - can.search(["Action.onexport.size"], function(msg, top, left, width, height) { can.page.Modify(can, can._output, {style: {"max-width": width, "max-height": height-75}}) can.page.Modify(can, can._target, {style: {top: top, left: left}}) @@ -62,10 +36,24 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, }, }) Volcanos("onaction", {help: "交互操作", list: ["关闭", "清空", "完成"], _init: function(can, msg, list, cb, target) { - can.onimport._init(can, msg, list, cb, can._output) + can.ui = can.page.Append(can, can._output, [ + {input: ["word", function(event) { can.onkeypop.input(event, can) + if (event.key == "Escape") { can.onmotion.hide(can) } + + if (event.key == "Enter") { event.stopPropagation(), event.preventDefault() + if (event.shiftKey) { + var first = can.page.Select(can, can.ui.content, "tr")[1] + return can.onaction[can.type == "*"? "plugin": "select"](event, can, first.dataset.index) + } + if (event.ctrlKey) { return can.onaction["完成"](event, can) } + can.input(event, event.target.value) + } + }]}, + {view: "content"}, {view: ["display", "table"]}, {view: "preview"}, + ]), can.base.isFunc(cb) && cb(msg) }, "关闭": function(event, can) { can.onmotion.hide(can) }, - "清空": function(event, can) { can.onmotion.clear(can, can.ui.display), can.onmotion.clear(can, can.ui.preview) }, + "清空": function(event, can) { can.onmotion.clear(can, can.ui.preview) }, "完成": function(event, can) { can.base.isFunc(can.cb) && can.cb() }, select: function(event, can, index) { @@ -93,6 +81,36 @@ Volcanos("onaction", {help: "交互操作", list: ["关闭", "清空", "完成"] } return false }, + + plugin: function(event, can, index) { var line = can.list[index] + var cmd = line.cmd == "command"? can.core.Keys(line.text, line.name): can.core.Keys(line.ctx, line.cmd) + + can.onappend.plugin(can, {type: "plugin", index: cmd||msg.Option("index"), option: line}, function(sub, meta) { + sub.run = function(event, cmds, cb) { var msg = can.request(event, line) + can.run(event, ["action", "command", "run", meta.index].concat(cmds), function(msg) { + can.base.isFunc(cb) && cb(msg) + }) + } + + sub.page.Modify(sub, sub._legend, { + onmouseenter: function(event) { + Volcanos.meta.data.menu && sub.page.Remove(sub, Volcanos.meta.data.menu.first) + Volcanos.meta.data.menu = sub.user.carte(event, sub, can.ondetail, can.ondetail.list) + + sub.page.Modify(sub, Volcanos.meta.data.menu.first, {style: { + left: event.target.offsetLeft+can.run(event, ["search", "River.onexport.width"])+10, + top: event.target.offsetTop-(can.user.isMobile? can._target.parentNode.parentNode.scrollTop: can._output.scrollTop)+event.target.offsetHeight+can.run(event, ["search", "Header.onexport.height"])+32, + }}) + }, + }) + }, can.ui.preview) + }, +}) +Volcanos("ondetail", {help: "交互操作", list: ["删除"], _init: function(can, msg, list, cb, target) { + }, + "删除": function(event, sub) { + sub.page.Remove(sub, sub._target) + }, }) Volcanos("onexport", {help: "导出数据", list: ["selected", "count"], select: function(can) { diff --git a/plugin/local/code/inner.css b/plugin/local/code/inner.css index d62a1c00..20bb35ca 100644 --- a/plugin/local/code/inner.css +++ b/plugin/local/code/inner.css @@ -76,6 +76,9 @@ fieldset.editor>div.output div.search td>div { overflow:hidden; } +body.white fieldset.editor>div.output div.project { + color:#a2dad2; +} body.white fieldset.editor>div.output div.content { background-color:#013b675c; } diff --git a/plugin/local/wiki/feel.js b/plugin/local/wiki/feel.js index ebf9f913..a4d742a4 100644 --- a/plugin/local/wiki/feel.js +++ b/plugin/local/wiki/feel.js @@ -104,10 +104,10 @@ Volcanos("ondetail", {help: "组件菜单", list: ["关闭", "下载", "上一 "上一个": function(event, can) { can.order > 0? can.show(--can.order): can.user.toast(can, "已经是第一张啦!") }, "下一个": function(event, can) { can.order < can.list.length-1? can.show(++can.order): can.user.toast(can, "已经是最后一张啦!") }, "设置头像": function(event, can) { var msg = can.request(event, {url: can.onimport._file(can, can.list[can.order].path)}) - can.run(event, ["search", "Header.onimport.avatar"]) + can.run(event, ["search", "Header.onimport.avatar"], null, true) }, "设置背景": function(event, can) { var msg = can.request(event, {url: can.onimport._file(can, can.list[can.order].path)}) - can.run(event, ["search", "Header.onimport.background"]) + can.run(event, ["search", "Header.onimport.background"], null, true) }, "复制链接": function(event, can) { can.user.copy(event, can, can.user.MergeURL(can, {_path: can.onimport._file(can, can.list[can.order].path)}, true)) diff --git a/plugin/state.js b/plugin/state.js index a1481bf9..6d6a5946 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -10,9 +10,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, conf, }) return true }, - _hold: function(can, msg) { - return true - }, + _hold: function(can, msg) { return true }, _back: function(can) { can._history.pop(); for (var his = can._history.pop(); his; his = can._history.pop()) { if (his[0] == "action") { continue } @@ -21,9 +19,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, conf, }), can.onappend._output(can, can.Conf(), {}, can.Pack([])) break } - if (!his) { - can.onappend._output(can, can.Conf(), {}, can.Pack([])) - } + !his && can.onappend._output(can, can.Conf(), {}, can.Pack([])) return true }, diff --git a/proto.js b/proto.js index c124076c..0e71cf7a 100644 --- a/proto.js +++ b/proto.js @@ -84,7 +84,8 @@ var Volcanos = shy("火山架", {args: {}, data: {}, pack: {}, libs: [], cache: }, search: function(cmds, cb) { can.run({}, ["search"].concat(cmds), cb, true) }, Conf: function(key, value) { return can.core.Value(can._conf, key, value) }, _conf: {}, - }; can = can || {}; for (var k in proto) { can.hasOwnProperty(k) || (can[k] = proto[k]) } + // }; can = can || {}; for (var k in proto) { can.hasOwnProperty(k) || (can[k] = proto[k]) } + }; can = can || {}; can.__proto__ = proto if (_can_name) { meta.cache[_can_name] = meta.cache[_can_name] || []