From 29d2a5556dbe8ad9660082a6df0ac6edadf30174 Mon Sep 17 00:00:00 2001 From: andy Date: Sun, 17 Sep 2017 22:11:04 +0100 Subject: [PATCH] start clipboard --- src/vue-poc/features/collection/files.vue | 70 +++++++++++----------- src/vue-poc/static/app-gen.js | 71 ++++++++++++----------- 2 files changed, 74 insertions(+), 67 deletions(-) diff --git a/src/vue-poc/features/collection/files.vue b/src/vue-poc/features/collection/files.vue index 08d0e61..753daa1 100644 --- a/src/vue-poc/features/collection/files.vue +++ b/src/vue-poc/features/collection/files.vue @@ -15,12 +15,12 @@ - + content_paste - Sel:{{selCount}} - S: {{selection.length}} + - + @@ -29,13 +29,13 @@ - + - + more_vert @@ -61,8 +61,9 @@ Folders ({{ xfolders.length }}) - - + + {{ itemIcon(item) }} @@ -102,7 +103,7 @@ - {{ selected && selected.name }} + {{ selection[0] && selection[0].name }} highlight_off @@ -128,22 +129,22 @@ q: "", busy: false, showInfo: false, - selected: [], - buttons: [ - {method: this.todo, icon: "view_quilt"}, - {method: this.add, icon: "add"}, - {method: this.load, icon: "refresh"}, - {method: this.todo, icon: "sort"}, - {method: this.selectAll, icon: "select_all"} -], -selopts: [ - {method: this.todo, icon: "delete"}, - {method: this.todo, icon: "content_copy"}, - {method: this.todo, icon: "content_cut"}, - {method: this.todo, icon: "text_format"}, - {method: this.todo, icon: "info"}, - {method: this.todo, icon: "share"} -] + clipboard: null, + buttons: [ + {method: this.todo, icon: "view_quilt"}, + {method: this.add, icon: "add"}, + {method: this.load, icon: "refresh"}, + {method: this.todo, icon: "sort"}, + {method: this.selectAll, icon: "select_all"} + ], + selopts: [ + {method: this.todo, icon: "delete"}, + {method: this.clip, icon: "content_copy"}, + {method: this.clip, icon: "content_cut"}, + {method: this.todo, icon: "text_format"}, + {method: this.todo, icon: "info"}, + {method: this.todo, icon: "share"} + ] } }, methods:{ @@ -169,9 +170,12 @@ selopts: [ }); }, - action(b){ - b.method(b.icon) - }, + action(b){ + b.method(b.icon) + }, + clip(icon){ + this.clipboard=icon + }, add(){ alert("add") }, @@ -180,11 +184,10 @@ selopts: [ this.$router.push({ query: {url:this.url,q:this.q }}) }, info(item){ - this.selected=item this.showInfo=true }, invoke(){ - HTTP.post("eval/invoke",Qs.stringify({path:this.url+this.selected.name})) + HTTP.post("eval/invoke",Qs.stringify({path:this.url+this.selection[0].name})) .then(r=>{ var job=r.data.job console.log(r.data) @@ -195,7 +198,8 @@ selopts: [ alert("todo: " + icon) }, itemIcon(item){ - return item.selected?"check_circle":"folder" + if(item.selected) return "check_circle" + else return (item.type=="folder")?"folder":"insert_drive_file" }, selectAll(){ this.items.forEach(item=>{item.selected=true}) @@ -222,8 +226,8 @@ selopts: [ ) return a }, - selCount(){ - return this.items.reduce((acc,item)=>{return acc+(item.selected?1:0)},0) + selection(){ + return this.items.filter(item=>{return item.selected} ) } }, watch:{ diff --git a/src/vue-poc/static/app-gen.js b/src/vue-poc/static/app-gen.js index 096c060..8d7ee46 100644 --- a/src/vue-poc/static/app-gen.js +++ b/src/vue-poc/static/app-gen.js @@ -1,4 +1,4 @@ -// generated 2017-09-17T17:24:08.963+01:00 +// generated 2017-09-17T22:10:03.752+01:00 Vue.component('qd-fullscreen',{template:` {{ fullscreenIcon }} @@ -442,11 +442,11 @@ Vue.filter('round', function(value, decimals) { - + content_paste - Sel:{{selCount}} - - + S: {{selection.length}} + + @@ -455,13 +455,13 @@ Vue.filter('round', function(value, decimals) { - + - + more_vert @@ -487,8 +487,8 @@ Vue.filter('round', function(value, decimals) { Folders ({{ xfolders.length }}) - - + + {{ itemIcon(item) }} @@ -528,7 +528,7 @@ Vue.filter('round', function(value, decimals) { - {{ selected && selected.name }} + {{ selection[0] && selection[0].name }} highlight_off @@ -553,22 +553,22 @@ Vue.filter('round', function(value, decimals) { q: "", busy: false, showInfo: false, - selected: [], - buttons: [ - {method: this.todo, icon: "view_quilt"}, - {method: this.add, icon: "add"}, - {method: this.load, icon: "refresh"}, - {method: this.todo, icon: "sort"}, - {method: this.selectAll, icon: "select_all"} -], -selopts: [ - {method: this.todo, icon: "delete"}, - {method: this.todo, icon: "content_copy"}, - {method: this.todo, icon: "content_cut"}, - {method: this.todo, icon: "text_format"}, - {method: this.todo, icon: "info"}, - {method: this.todo, icon: "share"} -] + clipboard: null, + buttons: [ + {method: this.todo, icon: "view_quilt"}, + {method: this.add, icon: "add"}, + {method: this.load, icon: "refresh"}, + {method: this.todo, icon: "sort"}, + {method: this.selectAll, icon: "select_all"} + ], + selopts: [ + {method: this.todo, icon: "delete"}, + {method: this.clip, icon: "content_copy"}, + {method: this.clip, icon: "content_cut"}, + {method: this.todo, icon: "text_format"}, + {method: this.todo, icon: "info"}, + {method: this.todo, icon: "share"} + ] } }, methods:{ @@ -594,9 +594,12 @@ selopts: [ }); }, - action(b){ - b.method(b.icon) - }, + action(b){ + b.method(b.icon) + }, + clip(icon){ + this.clipboard=icon + }, add(){ alert("add") }, @@ -605,11 +608,10 @@ selopts: [ this.$router.push({ query: {url:this.url,q:this.q }}) }, info(item){ - this.selected=item this.showInfo=true }, invoke(){ - HTTP.post("eval/invoke",Qs.stringify({path:this.url+this.selected.name})) + HTTP.post("eval/invoke",Qs.stringify({path:this.url+this.selection[0].name})) .then(r=>{ var job=r.data.job console.log(r.data) @@ -620,7 +622,8 @@ selopts: [ alert("todo: " + icon) }, itemIcon(item){ - return item.selected?"check_circle":"folder" + if(item.selected) return "check_circle" + else return (item.type=="folder")?"folder":"insert_drive_file" }, selectAll(){ this.items.forEach(item=>{item.selected=true}) @@ -647,8 +650,8 @@ selopts: [ ) return a }, - selCount(){ - return this.items.reduce((acc,item)=>{return acc+(item.selected?1:0)},0) + selection(){ + return this.items.filter(item=>{return item.selected} ) } }, watch:{