diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..627448e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..8d06030 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,437 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `, - data () { - return { - options: { - url: '/vue-poc/api/upload', - paramName: 'file', - maxFilesize: { - limit: 1, - message: '{{ filesize }} is greater than the {{ maxFilesize }}' - }, - maxFiles: { - limit: 5, - message: 'You can only upload a max of 5 files' - } - } - } - } - - } - + props: ['url' + ], + data() { + return { + formData: new FormData() + } + }, + methods: { + openFileDialog() { + this.$refs['file-upload'].click(); + }, + onFileChange(e) { + var self = this; + var files = e.target.files || e.dataTransfer.files; + if(files.length > 0){ + for(var i = 0; i< files.length; i++){ + self.formData.append("files", files[i], files[i].name); + } + + } + }, + uploadFile() { + var self = this; + HTTP.post( this.url, self.formData).then(function (response) { + console.log(response); + self.$emit("complete",response) + }).catch(function (error) { + console.log(error); + }); + } + } +} ); // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-fullscreen.vue @@ -373,6 +382,62 @@ Vue.component('qd-table',{template:` ); +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-tablist.vue +Vue.component('qd-tablist',{template:` + + + + {{ EditTabs.length }} + + arrow_drop_down + + + + + + + + + + + + check_circle + insert_drive_file + + + + {{ edittabs.items[index].name }} + + + + {{ edittabs.items[index].id }} [{{ index }}] + + + + + + current : {{ current }} + + + + `, + + props: ['edittabs', + 'current' + ], + data () { + return { + search:null + } + }, + methods: { + setItem(index){ + this.$emit('selected', index) + }, + } +} + ); + // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/vis-time-line.vue Vue.component('vis-time-line',{template:`
@@ -804,6 +869,8 @@ Vue.component('vue-ace',{template:` 'events', // event bus if set handles "eventFired",cmd 'settings', 'minLines', + 'completer', + 'snippets' ], data () { return { @@ -817,9 +884,10 @@ Vue.component('vue-ace',{template:` enableBasicAutocompletion:true, enableLiveAutocompletion:true }, + annots:{ error:0,warning:0,info:0 - } + } } }, @@ -832,6 +900,8 @@ Vue.component('vue-ace',{template:` 'mode' (value) { var session=this.editor.getSession() session.setMode(`ace/mode/${value}`) + + }, 'wrap' (value) { var session=this.editor.getSession() @@ -934,7 +1004,7 @@ Vue.component('vue-ace',{template:` this.editor.getSession().selection.on('changeCursor', (e) => { var position = this.editor.selection.cursor; var token = this.editor.getSession().getTokenAt(position.row, position.column); - console.log("token",token); + //console.log("token",token); this.$emit('token', token); }); @@ -945,10 +1015,83 @@ Vue.component('vue-ace',{template:` }else this.command(cmd); }); } + + if(this.completer){ + var langTools = ace.require("ace/ext/language_tools"); + langTools.addCompleter(this.completer); + } + + if(this.snippets){ + var snippetManager = ace.require("ace/snippets").snippetManager; + snippetManager.register(this.snippets, "xquery"); + } } } ); +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/aceextras.js +// ace customisations +const AceExtras={ + rhymeCompleter: { + // test completer + getCompletions: function(editor, session, pos, prefix, callback) { + if (prefix.length === 0) { callback(null, []); return } + axios.get("http://rhymebrain.com/talk",{params:{function:"getRhymes",word:prefix}}) + .then( + function(wordList) { + // wordList like [{"word":"flow","freq":24,"score":300,"flags":"bc","syllables":"1"}] + var r=wordList.data.map(function(ea) { + return {name: ea.word, value: ea.word, score: ea.score, meta: "rhyme"} + }) + callback(null,r) + }) + + } + }, + + //basex functions + basexCompleter: { + getCompletions: function(editor, session, pos, prefix, callback) { + if (prefix.length === 0) { callback(null, []); return } + console.log("dd",prefix) + callback(null, [{ + caption: "archive:create#2", + snippet: "archive:create(${1:entries}, ${2:contents})", + score: 100, + meta: "archive", + completer: this + }, { + caption: "archive:create#3", + snippet: "archive:create(${1:entries}, ${2:contents}, ${3:options})", + score: 100, + meta: "archive", + completer: this + }]) + } + }, + + + snippets:[ + { + name: "test", + content: "something", + tabTrigger: "test:" + }, + { + name: "test2", + content: "some2", + tabTrigger: "he" + } + ], + install: function(Vue){ + Object.defineProperty(Vue.prototype, '$aceExtras', { + get () { return AceExtras } + }) + } +}; +Vue.use(AceExtras); + + // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/auth.js // Authorization Object const Auth={ @@ -975,21 +1118,24 @@ Vue.use(Auth); // name: // contentType: // text: -// id: +// id: ids have the form "Tn" // url: +// requires: Settings,HTTP // -const EditTabs=new Vue({ +const GEditTabs={ data(){ return { items:[], + length: 0, nextId: 1, - currentId: null + currentId: null, + restored: null } }, methods: { addItem(tab){ - console.log("new: ",tab); + //console.log("new: ",tab); var def={name: "AA"+this.nextId, contentType: "text/xml", mode: "xml", @@ -997,20 +1143,17 @@ const EditTabs=new Vue({ url: null }; var etab = Object.assign(def,tab); - etab.id= ""+this.nextId + etab.id= "T" + this.nextId this.items.push (etab); + this.length++ this.nextId++; return etab; }, closeItem(item){ - var index=this.items.indexOf(item); - if (index > -1) { - alert("index: "+index) - this.items.splice(index, 1); - index=(index==0)?0:index-1; - this.currentId=(this.items.length)?"T"+this.items[index].id : null; - } + //https://github.com/vuejs/vue/issues/5855 + this.items=this.items.filter(t => t.id !== item.id) + this.length--; }, // fetch content from server and create tab @@ -1037,7 +1180,7 @@ const EditTabs=new Vue({ restore(){ that=this - Settings.getItem('edit/items') + this.restored=Settings.getItem('edit/items') .then(function (v){ console.log("items ",v) v.forEach(v =>that.addItem(v)) @@ -1048,11 +1191,18 @@ const EditTabs=new Vue({ }); }, - sorted(){ - return this.items.slice(0).sort((a,b) => a.name.localeCompare(b.name)) + sorted(){ /* sorted indices */ + var len=this.items.length + var indices = new Array(len); + for (var i = 0; i < len; ++i) indices[i] = i; + var list=this.items + return indices.sort((a,b) =>list[a].name.localeCompare(list[b].name)) } + }, + created(){ + console.log("EditTabs created") } -}); +}; @@ -1206,7 +1356,6 @@ const Notification={ elapsed: null }, opts); - console.log("opt",opts); this.messages.unshift(data); this.messages.length = Math.min(this.messages.length, 30); ++this.unseen; @@ -1400,7 +1549,7 @@ const Log=Vue.extend({template:` @@ -4228,11 +4376,12 @@ const Jobs=Vue.extend({template:` value: 'id' }, { text: 'State', value: 'state' }, + { text: 'Registered', value: 'registered' }, + { text: 'Start', value: 'start' }, { text: 'Duration', value: 'duration' }, { text: 'WriteL', value: 'writes' }, { text: 'ReadL', value: 'reads' }, - { text: 'User', value: 'user' }, - { text: 'Query', value: 'text' } + { text: 'User', value: 'user' } ], items:[ ], @@ -4284,7 +4433,7 @@ const Login=Vue.extend({template:` - The current credentials do the give access this page, please login again + The current credentials do the give access this page, please login. @@ -4306,7 +4455,7 @@ const Login=Vue.extend({template:` - Continue + Login @@ -4535,7 +4684,7 @@ const Entity1=Vue.extend({template:` -
Description:
+
{{ item.iconclass }} {{ item.name }}
{{item.description}}
{{ xml }}
@@ -4902,27 +5051,142 @@ created:function(){ // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/scratch.vue const Scratch=Vue.extend({template:` - up load - - - + + Tab index {{ curIndex }} + {{ active.mode }} + {{ active.name }}, id: {{ active.id }} + + + Add + set + tab list + + + + + insert_drive_file + + {{ (item.dirty?"*":"") }} + {{ item.name }} + + + close + + + + + + + + + +
+ + + +
+
+ +
+
`, data: function(){ return { - message: 'bad route!', - ace:"here" + curIndex: null, //index of current + active: null, + showInfo: false, // showing info + wrap: true, + events: new Vue({}), + aceSettings: {}, + annotations: null, + folded: false, + EditTabs: EditTabs } }, methods:{ - upit:function(s){ - alert("up") + add(){ + var a=this.EditTabs.addItem({text:"hi "+ new Date()}) + this.curIndex=this.EditTabs.items.indexOf(a) + }, + + tabClose(item,index){ + if(item.dirty){ + if (!confirm("Not saved continue? "+ index))return; + }else{ + this.EditTabs.closeItem(item) + this.curIndex=0 + } + }, + setItem(v){ + this.curIndex=v; + }, + annotation(counts){ + this.annotations=counts + //console.log("annotations: ",counts) + }, + changeContent(val){ + var item=this.active; + //console.log("change",val); + + if (item.text !== val) { + item.text = val; + item.dirty=true; + } + }, + onResize(){ + var el=this.$refs["ace"]; + for (e of el){ + //console.log("top",e.offsetTop) + var h=Math.max(1,window.innerHeight - e.offsetTop -200) + // console.log("h",h) + e.style.height=h +"px"; + } + } + + }, + + computed:{ + count(){ + console.log("LEN:",this.EditTabs.length) + return this.EditTabs.length + } + }, + + watch:{ + curIndex (val) { + this.active = EditTabs.items[val]; + console.log("curIndex: ",val) + if(this.active) this.$router.push({ query: { id: this.active.id }}); } }, - mounted:function(){ - console.log("scratch",this.$route.path) - } + + beforeRouteEnter (to, from, next) { + Promise.all([Settings.getItem('settings/ace') + ]) + .then(function(values) { + next(vm => { + vm.aceSettings = values[0]; + console.log("SSS",JSON.parse(JSON.stringify(EditTabs.items))) + }) + }) + }, + created:function(){ + var url=this.$route.query.url; + if(url){ + EditTabs.loadItem(url); + }else{ + var tid=this.$route.query.id; + var id=EditTabs.items.findIndex(i=>i.id ==tid) + console.log("set tab",tid,id) + EditTabs.restored.then(()=>{ + var id=EditTabs.items.findIndex(i=>i.id ==tid) + console.log("set tab",tid,id) + this.curIndex= id; + }); + } + } } ); @@ -5348,20 +5612,30 @@ const Ping=Vue.extend({template:` // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/server/upload.vue const Upload=Vue.extend({template:` - - Upload - - up.. - - - `, + + File upload complete + + File transfers + + up load + + + + `, data: function(){ - return { - fab: false - } + return { + snack: false + } + }, + methods:{ + upit:function(s){ + this.snack=true; + }, + } } + ); // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/session.vue @@ -6672,11 +6946,19 @@ const router = new VueRouter({ { path: 'tasks', name: 'taskhistory', component: Taskhistory, meta:{title: "Task History"} }, ] }, - + { path: '/labs', component: { template: '' } + ,children: [ + { path: 'scratch', component: Scratch, meta:{title:"scratch"} }, + { path: 'svg', component: Svg, meta:{title:"SVG"} }, + { path: 'svg2', component: Svg2, meta:{title:"SVG2"} }, + { path: 'timeline', component: Timeline,meta:{title:"timeline"} }, + { path: 'tree', component: Tree, meta:{title:"tree"} }, + { path: 'tree2', component: Tree2, meta:{title:"tree2"} }, + ] + }, { path: '/puzzle', component: Puzzle, meta:{title:"Jigsaw"} }, - { path: '/svg', component: Svg, meta:{title:"SVG"} }, - { path: '/svg2', component: Svg2, meta:{title:"SVG2"} }, + { path: '/transform', component: Transform, meta:{title:"XSLT2 Transform"} }, { path: '/validate', component: Validate, meta:{title:"Validate"} }, @@ -6691,16 +6973,15 @@ const router = new VueRouter({ { path: '/tasks/vuecompile', component: Vuecompile, meta:{title:"vue compile"} }, { path: '/tasks/:task', component: Runtask, props: true, meta:{title:"Run task"} }, - { path: '/timeline', component: Timeline,meta:{title:"timeline"} }, - { path: '/tree', component: Tree, meta:{title:"tree"} }, - { path: '/tree2', component: Tree2, meta:{title:"tree2"} }, + + { path: '/map', component: Leaflet,meta:{title:"map"} }, { path: '/form', component: Brutusin, meta:{title:"Form demo"} }, { path: '/form2', component: Formsjson, meta:{title:"Form schema"} }, { path: '/form3', component: Formsschema, meta:{title:"vue-form-json-schema"} }, - { path: '/scratch', component: Scratch, meta:{title:"scratch"} }, + { path: '/about', component: About, meta:{title:"About Vue-poc"} }, { path: '*', component: Notfound, meta:{title:"Page not found"} } ], @@ -6710,7 +6991,7 @@ router.afterEach(function(route) { }); router.beforeEach((to, from, next) => { - console.log("before: ",to) + //console.log("before: ",to) if (to.matched.some(record => record.meta.requiresAuth)) { // this route requires auth, check if logged in // if not, redirect to login page. @@ -6804,7 +7085,8 @@ const Vuepoc=Vue.extend({template:` Full screen - + Dark theme + @@ -6925,7 +7207,18 @@ const Vuepoc=Vue.extend({template:` {href: '/tree',text: 'Tree',icon: 'nature'}, {href: '/tree2',text: 'Tree 2',icon: 'nature'} ]}, - + { + icon: 'toys', + text: 'Labs' , + model: false, + children: [ + {href: '/labs/scratch',text: 'Scratch pad',icon: 'filter_frames'}, + {href: '/labs/timeline',text: 'Time line',icon: 'timelapse'}, + {href: '/labs/svg',text: 'SVG',icon: 'extension'}, + {href: '/labs/svg2',text: 'SVG2',icon: 'extension'}, + {href: '/labs/tree',text: 'Tree',icon: 'nature'}, + {href: '/labs/tree2',text: 'Tree 2',icon: 'nature'} + ]}, {href: '/settings',text: 'Settings',icon: 'settings' }, {href: '/about',text: 'About (v0.3.2)' , icon: 'help' }, ] @@ -7215,6 +7508,7 @@ Vue.component('l-marker', Vue2Leaflet.LMarker); // Vue.component('form-schema', window["vue-json-schema"].default); //}; //Vue.use({ install: install }); +var EditTabs=new Vue(GEditTabs) Vue.use(Vuetify); new Vuepoc().$mount('#app') diff --git a/src/vue-poc/static/app.html b/src/vue-poc/static/app.html index 010d3a6..e05d05e 100644 --- a/src/vue-poc/static/app.html +++ b/src/vue-poc/static/app.html @@ -10,7 +10,7 @@ - + @@ -21,7 +21,7 @@
-

vue-poc (v0.3.135)

+

vue-poc (v0.3.150)

@@ -33,14 +33,14 @@
- + - - - - + + + + diff --git a/vue-poc.iml b/vue-poc.iml new file mode 100644 index 0000000..8021953 --- /dev/null +++ b/vue-poc.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file