diff --git a/src/vue-poc/app.vue b/src/vue-poc/app.vue index c6f22bb..f493f4a 100644 --- a/src/vue-poc/app.vue +++ b/src/vue-poc/app.vue @@ -175,8 +175,8 @@ model: false, children: [ - {href: '/form',text: 'Forms',icon: 'format_list_bulleted' }, - {href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' }, + {href: '/form',text: 'vue-form-generator',icon: 'format_list_bulleted' }, + {href: '/form2',text: 'vue-json-schema',icon: 'format_list_bulleted' }, {href: '/form3',text: 'vue-form-json-schema',icon: 'format_list_bulleted' } ]}, { diff --git a/src/vue-poc/components/fullscreen.js b/src/vue-poc/components/fullscreen.js new file mode 100644 index 0000000..7c60a12 --- /dev/null +++ b/src/vue-poc/components/fullscreen.js @@ -0,0 +1,39 @@ +// https://stackoverflow.com/questions/36672561/how-to-exit-fullscreen-onclick-using-javascript +const Fullscreen={ + isInFullScreen(){ + return (document.fullscreenElement && document.fullscreenElement !== null) || + (document.webkitFullscreenElement && document.webkitFullscreenElement !== null) || + (document.mozFullScreenElement && document.mozFullScreenElement !== null) || + (document.msFullscreenElement && document.msFullscreenElement !== null); + }, + toggle(){ + var docElm = document.documentElement; + if (!this.isInFullScreen()) { + if (docElm.requestFullscreen) { + docElm.requestFullscreen(); + } else if (docElm.mozRequestFullScreen) { + docElm.mozRequestFullScreen(); + } else if (docElm.webkitRequestFullScreen) { + docElm.webkitRequestFullScreen(); + } else if (docElm.msRequestFullscreen) { + docElm.msRequestFullscreen(); + } + } else { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } + } + }, + install: function(Vue){ + Object.defineProperty(Vue.prototype, '$fullscreen', { + get () { return Fullscreen } + }) } +}; +Vue.use(Fullscreen); + diff --git a/src/vue-poc/components/mimetypes.js b/src/vue-poc/components/mimetypes.js index 408fc57..8afe3ab 100644 --- a/src/vue-poc/components/mimetypes.js +++ b/src/vue-poc/components/mimetypes.js @@ -1,6 +1,7 @@ // Mimetype info -const MimeTypes={ - toMode:[ +// +const MimeTypes=new function(){ + this.toMode=[ {name: "text/plain", mode: "text"}, {name: "text/xml", mode: "xml"}, {name: "application/xml", mode:"xml"}, @@ -12,17 +13,21 @@ const MimeTypes={ {name: "text/css", mode:"css"}, {name: "image/svg+xml", mode:"svg"} ], - mode:{ + this.formatdom= t=>html_beautify(t, { indent_size: 3 ,indent_inner_html:true}); + this.formatjs= t=>js_beautify(t, { indent_size: 2 }); + + this.mode={ "text": {}, "javascript": { - format(t){ return js_beautify(t, { indent_size: 2 })} + "format":this.formatjs }, - "xml": { - format(t){ return html_beautify(t, { indent_size: 3 ,indent_inner_html:true})} + "xml": { + "format":this.formatdom }, "css": {} - }, - install(Vue){ + }; + + this.install=function(Vue){ Object.defineProperty(Vue.prototype, '$MimeTypes', { get () { return MimeTypes } }) } diff --git a/src/vue-poc/components/notification.js b/src/vue-poc/components/notification.js new file mode 100644 index 0000000..edc6673 --- /dev/null +++ b/src/vue-poc/components/notification.js @@ -0,0 +1,22 @@ +//Notification Object +const Notification={ + messages:[], + nextId: 0, + unseen:0, + add(msg){ + var data={ + text: msg, + index: ++this.nextId, + created: new Date() + }; + this.messages.unshift(data); + this.messages.length = Math.min(this.messages.length, 30); + ++this.unseen; + + }, + install(Vue){ + Object.defineProperty(Vue.prototype, '$notification', { + get () { return Notification } + }) } +}; +Vue.use(Notification); diff --git a/src/vue-poc/core.js b/src/vue-poc/core.js index e59ae31..e840eb5 100644 --- a/src/vue-poc/core.js +++ b/src/vue-poc/core.js @@ -58,28 +58,6 @@ const Auth={ }; Vue.use(Auth); -//Notification Object -const Notification={ - messages:[], - nextId: 0, - unseen:0, - add(msg){ - var data={ - text: msg, - index: ++this.nextId, - created: new Date() - }; - this.messages.unshift(data); - this.messages.length = Math.min(this.messages.length, 30); - ++this.unseen; - - }, - install(Vue){ - Object.defineProperty(Vue.prototype, '$notification', { - get () { return Notification } - }) } -}; -Vue.use(Notification); // Settings read and write list clear @@ -112,13 +90,25 @@ ut aliquip ex ea commodo consequat.`}, text:`let $a:=1 to 5 return $a `}, - {name:"videos.xml", id:"3", mode:"xml",dirty: false, location: "/aaa/bca/", + {name:"videos.xml", id:"3", mode:"xml",dirty: false, location: "xmldb:/vue-poc/aaa/bca/videos.xml", text:` hello `} ], "edit/currentId": "?", - "system/serviceworker": true + "system/serviceworker": true, + "images/thumbtask":` + + + + + Some Text here + + + + + +` }, @@ -190,45 +180,6 @@ function debounce(func, wait, immediate) { }; }; -// https://stackoverflow.com/questions/36672561/how-to-exit-fullscreen-onclick-using-javascript -const Fullscreen={ - isInFullScreen(){ - return (document.fullscreenElement && document.fullscreenElement !== null) || - (document.webkitFullscreenElement && document.webkitFullscreenElement !== null) || - (document.mozFullScreenElement && document.mozFullScreenElement !== null) || - (document.msFullscreenElement && document.msFullscreenElement !== null); - }, - toggle(){ - var docElm = document.documentElement; - if (!this.isInFullScreen()) { - if (docElm.requestFullscreen) { - docElm.requestFullscreen(); - } else if (docElm.mozRequestFullScreen) { - docElm.mozRequestFullScreen(); - } else if (docElm.webkitRequestFullScreen) { - docElm.webkitRequestFullScreen(); - } else if (docElm.msRequestFullscreen) { - docElm.msRequestFullscreen(); - } - } else { - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.webkitExitFullscreen) { - document.webkitExitFullscreen(); - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } else if (document.msExitFullscreen) { - document.msExitFullscreen(); - } - } - }, - install: function(Vue){ - Object.defineProperty(Vue.prototype, '$fullscreen', { - get () { return Fullscreen } - }) } -}; -Vue.use(Fullscreen); - Vue.component('treeselect', VueTreeselect.Treeselect); //Vue.use( VueFormJsonSchema); diff --git a/src/vue-poc/features/about.vue b/src/vue-poc/features/about.vue index 8a4c1c4..dd245ad 100644 --- a/src/vue-poc/features/about.vue +++ b/src/vue-poc/features/about.vue @@ -1,36 +1,66 @@ - - - - - + + + + account_circle + close + + + edit + + + add + + + delete + + + + + + Vue-poc + + + A development environment for managing XML sources and processes. + + + + Links + + + + vue.js + vuetifyjs + + js-beautify + workbox + + + + + doc + DBA app + DB + + + + + - - This is a experiment in using - vue.js - . - - - vuetifyjs - vue-multiselect - vue-select - js-beautify - doc - DBA app - DB - - add REPLACED - - - + + + - + } +} diff --git a/src/vue-poc/features/collection/history.vue b/src/vue-poc/features/collection/history.vue index 881136d..c4c440d 100644 --- a/src/vue-poc/features/collection/history.vue +++ b/src/vue-poc/features/collection/history.vue @@ -10,8 +10,18 @@ Example Chip - + + + + info + + + + + info + + @@ -37,6 +47,9 @@ doEdit(item){ console.log("history: ",item) router.push({ path: 'edit', query: { url:item.url, protocol:item.protocol }}) + }, + doEdit2(item){ + alert("dd") } }, created:function(){ diff --git a/src/vue-poc/features/components/balisage-taxonomy.xml b/src/vue-poc/features/components/balisage-taxonomy.xml new file mode 100644 index 0000000..b24b968 --- /dev/null +++ b/src/vue-poc/features/components/balisage-taxonomy.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/vue-poc/features/components/components.xqm b/src/vue-poc/features/components/components.xqm new file mode 100644 index 0000000..541ae9e --- /dev/null +++ b/src/vue-poc/features/components/components.xqm @@ -0,0 +1,32 @@ +module namespace j = 'quodatum.test.components'; + + +declare function j:tax($items){ + for $a in $items +return <_ type="object"> +{$a/@id/string()} +{$a/@label/string()} +{if($a/item)then + {j:tax($a/item)} + else ()} + +}; + + + +(:~ + : tree + :) +declare +%rest:GET %rest:path("/vue-poc/api/components/tree") +%output:method("json") +function j:tree() +as element(json) +{ +let $d:=doc(resolve-uri("balisage-taxonomy.xml",static-base-uri()))/tax/item +return + +{j:tax($d)} + +}; + diff --git a/src/vue-poc/features/svg.vue b/src/vue-poc/features/components/svg.vue similarity index 100% rename from src/vue-poc/features/svg.vue rename to src/vue-poc/features/components/svg.vue diff --git a/src/vue-poc/features/svg2.vue b/src/vue-poc/features/components/svg2.vue similarity index 100% rename from src/vue-poc/features/svg2.vue rename to src/vue-poc/features/components/svg2.vue diff --git a/src/vue-poc/features/timeline.vue b/src/vue-poc/features/components/timeline.vue similarity index 100% rename from src/vue-poc/features/timeline.vue rename to src/vue-poc/features/components/timeline.vue diff --git a/src/vue-poc/features/tree.vue b/src/vue-poc/features/components/tree.vue similarity index 100% rename from src/vue-poc/features/tree.vue rename to src/vue-poc/features/components/tree.vue diff --git a/src/vue-poc/features/components/tree2.vue b/src/vue-poc/features/components/tree2.vue new file mode 100644 index 0000000..2b088c5 --- /dev/null +++ b/src/vue-poc/features/components/tree2.vue @@ -0,0 +1,70 @@ + + + + + + vue-treeselect@0.0.29 + + todo + + + + + Select some things: + + + + + + + {{ value }} + + + + + + + + + diff --git a/src/vue-poc/features/edit/tabs.vue b/src/vue-poc/features/edit/tabs.vue index 80a1d9a..fca7f75 100644 --- a/src/vue-poc/features/edit/tabs.vue +++ b/src/vue-poc/features/edit/tabs.vue @@ -1,6 +1,6 @@ - + add_circle @@ -18,15 +18,73 @@ - lightbulb_outline + subscriptions - - - + Actions + + Format + + + Validate + + + + + + {{annotations && annotations.error}} + {{annotations && annotations.warning}} + {{annotations && annotations.info}} + + + navigate_next + + + Annotations: Errors,Warning and Info + + + + + playlist_play + + + + Display settings + + + + vertical_align_center + + Toggle folds + + + + + wrap_text + + Soft wrap + + + Help + + + settings + + Show ACE settings + + + + + keyboard + + Show ACE keyboard shortcuts + + + + info mode_edit @@ -59,8 +117,8 @@ insert_drive_file - {{ item.name }} {{ (item.dirty?"*":"") }} + {{ item.name }} close @@ -84,7 +142,7 @@ - + {{ x}} @@ -103,8 +161,8 @@ - + @@ -125,7 +183,10 @@ active: null, items: [], wrap: true, - aceSettings: {} + aceSettings: {}, + events: new Vue({}), + annotations: null, + folded:false } }, @@ -154,9 +215,37 @@ setMode(type){ this.active.mode=type.mode }, + togglefold(){ + this.folded=!this.folded + this.acecmd(this.folded?"foldall":"unfoldall") + }, + acecmd(cmd){ + //alert("acecmd: "+cmd) + this.events.$emit('eventFired',cmd); + }, + fold(){ + this.events.$emit('eventFired',"foldall"); + }, - lightbulb(d){ - alert("lightbulb TODO: " + d) + format(d){ + var d=this.active.mode; + var f=this.$MimeTypes.mode[d]; + var f=f && f.format; + if(f){ + this.active.text=f(this.active.text); + } + }, + + annotation(counts){ + this.annotations=counts + //console.log("annotations: ",counts) + }, + + validate(){ + var d=this.active.mode; + var f=this.$MimeTypes.mode[d]; + var f=f && f.validate; + alert("no validate yet"); }, addItem(tab){ diff --git a/src/vue-poc/features/thumbnail/thumbnail.vue b/src/vue-poc/features/thumbnail/thumbnail.vue index ab6d5eb..970bc1a 100644 --- a/src/vue-poc/features/thumbnail/thumbnail.vue +++ b/src/vue-poc/features/thumbnail/thumbnail.vue @@ -73,7 +73,24 @@ alert("not yet:"+r); }) } - } + }, + beforeRouteEnter (to, from, next) { + Promise.all([settings.getItem('images/thumbtask') + ]) + .then(function(values) { + next(vm => { + vm.taskxml = values[0]; + }) + }) + }, + + beforeRouteLeave (to, from, next) { + // called when the route that renders this component is about to + // be navigated away from. + // has access to `this` component instance. + settings.setItem('images/thumbtask',this.taskxml); + next(true); + }, } diff --git a/src/vue-poc/features/tree2.vue b/src/vue-poc/features/tree2.vue deleted file mode 100644 index aa50ce9..0000000 --- a/src/vue-poc/features/tree2.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - vue-treeselect@0.0.28 - - todo - - - - - Select some things - - - - - - - - - - - diff --git a/src/vue-poc/static/app-gen.js b/src/vue-poc/static/app-gen.js index d286309..7bf186c 100644 --- a/src/vue-poc/static/app-gen.js +++ b/src/vue-poc/static/app-gen.js @@ -1,4 +1,4 @@ -// generated 2018-06-14T22:56:00.937+01:00 +// generated 2018-06-17T15:48:13.622+01:00 // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-autoheight.vue Vue.component('qd-autoheight',{template:` @@ -762,10 +762,53 @@ Vue.filter('round', function(value, decimals) { return value; }); +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/fullscreen.js +// https://stackoverflow.com/questions/36672561/how-to-exit-fullscreen-onclick-using-javascript +const Fullscreen={ + isInFullScreen(){ + return (document.fullscreenElement && document.fullscreenElement !== null) || + (document.webkitFullscreenElement && document.webkitFullscreenElement !== null) || + (document.mozFullScreenElement && document.mozFullScreenElement !== null) || + (document.msFullscreenElement && document.msFullscreenElement !== null); + }, + toggle(){ + var docElm = document.documentElement; + if (!this.isInFullScreen()) { + if (docElm.requestFullscreen) { + docElm.requestFullscreen(); + } else if (docElm.mozRequestFullScreen) { + docElm.mozRequestFullScreen(); + } else if (docElm.webkitRequestFullScreen) { + docElm.webkitRequestFullScreen(); + } else if (docElm.msRequestFullscreen) { + docElm.msRequestFullscreen(); + } + } else { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } + } + }, + install: function(Vue){ + Object.defineProperty(Vue.prototype, '$fullscreen', { + get () { return Fullscreen } + }) } +}; +Vue.use(Fullscreen); + + + // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/mimetypes.js // Mimetype info -const MimeTypes={ - toMode:[ +// +const MimeTypes=new function(){ + this.toMode=[ {name: "text/plain", mode: "text"}, {name: "text/xml", mode: "xml"}, {name: "application/xml", mode:"xml"}, @@ -777,17 +820,21 @@ const MimeTypes={ {name: "text/css", mode:"css"}, {name: "image/svg+xml", mode:"svg"} ], - mode:{ + this.formatdom= t=>html_beautify(t, { indent_size: 3 ,indent_inner_html:true}); + this.formatjs= t=>js_beautify(t, { indent_size: 2 }); + + this.mode={ "text": {}, "javascript": { - format(t){ return js_beautify(t, { indent_size: 2 })} + "format":this.formatjs }, - "xml": { - format(t){ return html_beautify(t, { indent_size: 3 ,indent_inner_html:true})} + "xml": { + "format":this.formatdom }, "css": {} - }, - install(Vue){ + }; + + this.install=function(Vue){ Object.defineProperty(Vue.prototype, '$MimeTypes', { get () { return MimeTypes } }) } @@ -795,6 +842,31 @@ const MimeTypes={ }; Vue.use(MimeTypes); +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/notification.js +//Notification Object +const Notification={ + messages:[], + nextId: 0, + unseen:0, + add(msg){ + var data={ + text: msg, + index: ++this.nextId, + created: new Date() + }; + this.messages.unshift(data); + this.messages.length = Math.min(this.messages.length, 30); + ++this.unseen; + + }, + install(Vue){ + Object.defineProperty(Vue.prototype, '$notification', { + get () { return Notification } + }) } +}; +Vue.use(Notification); + + // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/404.vue const Notfound=Vue.extend({template:` @@ -816,35 +888,66 @@ const Notfound=Vue.extend({template:` // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/about.vue const About=Vue.extend({template:` - - - - - + + + + account_circle + close + + + edit + + + add + + + delete + + + + + + Vue-poc + + + A development environment for managing XML sources and processes. + + + + Links + + + + vue.js + vuetifyjs + + js-beautify + workbox + + + + + doc + DBA app + DB + + + + + - - This is a experiment in using - vue.js - . - - - vuetifyjs - vue-multiselect - vue-select - js-beautify - doc - DBA app - DB - - add REPLACED - - - + + + `, + data: function(){ + return { + fab: false } - + } +} ); // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/adminlog/logs.vue @@ -1212,8 +1315,18 @@ const History=Vue.extend({template:` Example Chip - + + + + info + + + + + info + + @@ -1238,6 +1351,9 @@ const History=Vue.extend({template:` doEdit(item){ console.log("history: ",item) router.push({ path: 'edit', query: { url:item.url, protocol:item.protocol }}) + }, + doEdit2(item){ + alert("dd") } }, created:function(){ @@ -1248,6 +1364,356 @@ const History=Vue.extend({template:` ); +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/components/svg.vue +const Svg=Vue.extend({template:` + + +Reset + + + + + + + `, + + data: function(){ + return { + message: 'bad route!', + circleSize: 50 + } + }, + created:function(){ + console.log("notfound",this.$route.query.q) + }, + mounted: function(createElement) { + var svg = d3.select(this.$el).select('svg'); + this.circle = svg + .append('circle') + .attr('cx', '250') + .attr('cy', '150') + .attr('r', this.circleSize) + }, + watch: { + circleSize: function(newValue) { + this.circle + .attr('r', newValue) + } + } + +} + + ); + +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/components/svg2.vue +const Svg2=Vue.extend({template:` + + + Reset + Size + + + set + + + + + `, + + data: function() { + return { + canvasd3:null, + view:null, + url:"/vue-poc/ui/resources/svg/butterfly.svg", + svgs:["/vue-poc/ui/resources/svg/butterfly.svg", + "/vue-poc/ui/resources/svg/tiger.svg"] + }; + }, + methods:{ + size(){ + this.view.width(200).height(200).render(); + }, + + load(){ + var that=this; + d3.xml(this.url, + function(error, xml) { + if (error) { + //alert("load err"); + throw error; + } + var d=d3.select(xml.documentElement) + that.view.setItem(d); + }); + }, + + onResize(){ + var el=this.$refs["panel"]; + + //console.log("top",e.offsetTop) + var h=Math.max(1,window.innerHeight - el.offsetTop -10); + var w=Math.max(1,window.innerWidth- el.offsetLeft ) + console.log("resize:",w,h) + el.style.height=h +"px"; + if(this.view ){ + this.view.height(h-20); + this.view.render(); + } + } + + }, + + watch:{ + url(v){ + this.$router.push({ query: { url: this.url }}) + }, + $route(vnew,vold){ + //console.log("ROUTE",vnew,vold) + var url=this.$route.query.url + this.url=url?url:"/vue-poc/ui/resources/svg/butterfly.svg"; + if(vnew.query.url != vold.query.url) this.load() + } + }, + + mounted: function() { + var url=this.$route.query.url + this.url=url?url:"/vue-poc/ui/resources/svg/butterfly.svg"; + this.canvasd3 = d3.select(this.$refs.svgcanvas); + /** RUN SCRIPT **/ + var canvasWidth = 800; + + var canvas = d3.demo.canvas().width(canvasWidth).height(400); + this.view=canvas; + this.canvasd3.call(canvas); + + this.load(); + + + } + +} + + ); + +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/components/timeline.vue +const Timeline=Vue.extend({template:` + + + + Line 1 + + fit + + + + + + + + + {{msg}} + + + + `, + + data(){ + return { + vueState: { + data1: [ + { id: 1, content: 'item 1', start: '2013-04-20 23:06:15.304' }, + { id: 2, content: 'iso date time', start: '2013-04-14T11:11:15.304' }, + { id: 3, content: '[GET] http://localhost:8984/vue-poc/ui/icon.png', start: '2013-04-18', end: '2013-04-19' }, + { id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19', className: 'green' }, + { id: 5, content: '[GET] http://localhost:8984/vue-poc/ui/app.css', start: '2013-04-25' }, + { id: 6, content: 'item 6', start: '2013-04-27' }] + }, + Events: new Vue({}), + msg:"Item detail" + } +}, +methods:{ + fit(){ + this.Events.$emit('fit'); + }, + select(items){ + this.msg='Selected items: ' + items + } +}, +created(){ + console.log("timeline") +} +} + ); + +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/components/tree.vue +const Tree=Vue.extend({template:` + + + + vue-jstree@1.0.11 + + todo + + + + + + + + `, + + data:function(){ + return { + data: [ + { + "text": "Same but with checkboxes", + "children": [ + { + "text": "initially selected", + "selected": true + }, + { + "text": "custom icon", + "icon": "fa fa-warning icon-state-danger" + }, + { + "text": "initially open", + "icon": "fa fa-folder icon-state-default", + "opened": true, + "children": [ + { + "text": "Another node" + } + ] + }, + { + "text": "custom icon", + "icon": "fa fa-warning icon-state-warning" + }, + { + "text": "disabled node", + "icon": "fa fa-check icon-state-success", + "disabled": true + } + ] + }, + { + "text": "Same but with checkboxes", + "opened": true, + "children": [ + { + "text": "initially selected", + "selected": true + }, + { + "text": "custom icon", + "icon": "fa fa-warning icon-state-danger" + }, + { + "text": "initially open", + "icon": "fa fa-folder icon-state-default", + "opened": true, + "children": [ + { + "text": "Another node" + } + ] + }, + { + "text": "custom icon", + "icon": "fa fa-warning icon-state-warning" + }, + { + "text": "disabled node", + "icon": "fa fa-check icon-state-success", + "disabled": true + } + ] + }, + { + "text": "And wholerow selection" + } + ] +} + }, +methods: { + itemClick (node) { + console.log(node.model.text + ' clicked !') + } +} + +} + + ); + +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/components/tree2.vue +const Tree2=Vue.extend({template:` + + + + vue-treeselect@0.0.29 + + todo + + + + + Select some things: + + + + + + + {{ value }} + + + + + + + `, + + //components: { Treeselect }, + + data:function(){ + return { + value: [ + "DITA", + "CSS", + "Linking", + "Hardware-basedProcessing" + ], + source: [] + } + }, +methods: { + itemClick (node) { + console.log(node.model.text + ' clicked !') + }, + load(){ + HTTP.get("components/tree") + .then(r=>{ + console.log(r); + this.source=r.data + }) + .catch(error=> { + console.log(error); + + alert("Get query error"+url) + }); + + }, +}, +created:function(){ + this.load() +} + +} + + ); + // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/edit/edit.vue const Edit=Vue.extend({template:` @@ -1554,7 +2020,7 @@ const Edit=Vue.extend({template:` // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/edit/tabs.vue const Tabs=Vue.extend({template:` - + add_circle @@ -1572,15 +2038,73 @@ const Tabs=Vue.extend({template:` - lightbulb_outline + subscriptions - - - + Actions + + Format + + + Validate + + + + + + {{annotations && annotations.error}} + {{annotations && annotations.warning}} + {{annotations && annotations.info}} + + + navigate_next + + + Annotations: Errors,Warning and Info + + + + + playlist_play + + + + Display settings + + + + vertical_align_center + + Toggle folds + + + + + wrap_text + + Soft wrap + + + Help + + + settings + + Show ACE settings + + + + + keyboard + + Show ACE keyboard shortcuts + + + + info mode_edit @@ -1603,8 +2127,8 @@ const Tabs=Vue.extend({template:` insert_drive_file - {{ item.name }} {{ (item.dirty?"*":"") }} + {{ item.name }} close @@ -1624,7 +2148,7 @@ const Tabs=Vue.extend({template:` - + {{ x}} @@ -1638,7 +2162,7 @@ const Tabs=Vue.extend({template:` - + @@ -1658,7 +2182,10 @@ const Tabs=Vue.extend({template:` active: null, items: [], wrap: true, - aceSettings: {} + aceSettings: {}, + events: new Vue({}), + annotations: null, + folded:false } }, @@ -1687,9 +2214,37 @@ const Tabs=Vue.extend({template:` setMode(type){ this.active.mode=type.mode }, + togglefold(){ + this.folded=!this.folded + this.acecmd(this.folded?"foldall":"unfoldall") + }, + acecmd(cmd){ + //alert("acecmd: "+cmd) + this.events.$emit('eventFired',cmd); + }, + fold(){ + this.events.$emit('eventFired',"foldall"); + }, - lightbulb(d){ - alert("lightbulb TODO: " + d) + format(d){ + var d=this.active.mode; + var f=this.$MimeTypes.mode[d]; + var f=f && f.format; + if(f){ + this.active.text=f(this.active.text); + } + }, + + annotation(counts){ + this.annotations=counts + //console.log("annotations: ",counts) + }, + + validate(){ + var d=this.active.mode; + var f=this.$MimeTypes.mode[d]; + var f=f && f.validate; + alert("no validate yet"); }, addItem(tab){ @@ -4227,137 +4782,6 @@ const Settings=Vue.extend({template:` ); -// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/svg.vue -const Svg=Vue.extend({template:` - - -Reset - - - - - - - `, - - data: function(){ - return { - message: 'bad route!', - circleSize: 50 - } - }, - created:function(){ - console.log("notfound",this.$route.query.q) - }, - mounted: function(createElement) { - var svg = d3.select(this.$el).select('svg'); - this.circle = svg - .append('circle') - .attr('cx', '250') - .attr('cy', '150') - .attr('r', this.circleSize) - }, - watch: { - circleSize: function(newValue) { - this.circle - .attr('r', newValue) - } - } - -} - - ); - -// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/svg2.vue -const Svg2=Vue.extend({template:` - - - Reset - Size - - - set - - - - - `, - - data: function() { - return { - canvasd3:null, - view:null, - url:"/vue-poc/ui/resources/svg/butterfly.svg", - svgs:["/vue-poc/ui/resources/svg/butterfly.svg", - "/vue-poc/ui/resources/svg/tiger.svg"] - }; - }, - methods:{ - size(){ - this.view.width(200).height(200).render(); - }, - - load(){ - var that=this; - d3.xml(this.url, - function(error, xml) { - if (error) { - //alert("load err"); - throw error; - } - var d=d3.select(xml.documentElement) - that.view.setItem(d); - }); - }, - - onResize(){ - var el=this.$refs["panel"]; - - //console.log("top",e.offsetTop) - var h=Math.max(1,window.innerHeight - el.offsetTop -10); - var w=Math.max(1,window.innerWidth- el.offsetLeft ) - console.log("resize:",w,h) - el.style.height=h +"px"; - if(this.view ){ - this.view.height(h-20); - this.view.render(); - } - } - - }, - - watch:{ - url(v){ - this.$router.push({ query: { url: this.url }}) - }, - $route(vnew,vold){ - //console.log("ROUTE",vnew,vold) - var url=this.$route.query.url - this.url=url?url:"/vue-poc/ui/resources/svg/butterfly.svg"; - if(vnew.query.url != vold.query.url) this.load() - } - }, - - mounted: function() { - var url=this.$route.query.url - this.url=url?url:"/vue-poc/ui/resources/svg/butterfly.svg"; - this.canvasd3 = d3.select(this.$refs.svgcanvas); - /** RUN SCRIPT **/ - var canvasWidth = 800; - - var canvas = d3.demo.canvas().width(canvasWidth).height(400); - this.view=canvas; - this.canvasd3.call(canvas); - - this.load(); - - - } - -} - - ); - // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/tasks/model.build/model.vue const Model=Vue.extend({template:` @@ -4778,215 +5202,24 @@ const Thumbnail=Vue.extend({template:` alert("not yet:"+r); }) } - } - -} - - ); - -// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/timeline.vue -const Timeline=Vue.extend({template:` - - - - Line 1 - - fit - - - - - - - - - {{msg}} - - - - `, - - data(){ - return { - vueState: { - data1: [ - { id: 1, content: 'item 1', start: '2013-04-20 23:06:15.304' }, - { id: 2, content: 'iso date time', start: '2013-04-14T11:11:15.304' }, - { id: 3, content: '[GET] http://localhost:8984/vue-poc/ui/icon.png', start: '2013-04-18', end: '2013-04-19' }, - { id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19', className: 'green' }, - { id: 5, content: '[GET] http://localhost:8984/vue-poc/ui/app.css', start: '2013-04-25' }, - { id: 6, content: 'item 6', start: '2013-04-27' }] - }, - Events: new Vue({}), - msg:"Item detail" - } -}, -methods:{ - fit(){ - this.Events.$emit('fit'); }, - select(items){ - this.msg='Selected items: ' + items - } -}, -created(){ - console.log("timeline") -} -} - ); - -// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/tree.vue -const Tree=Vue.extend({template:` - - - - vue-jstree@1.0.11 - - todo - - - - - - - - `, - - data:function(){ - return { - data: [ - { - "text": "Same but with checkboxes", - "children": [ - { - "text": "initially selected", - "selected": true - }, - { - "text": "custom icon", - "icon": "fa fa-warning icon-state-danger" - }, - { - "text": "initially open", - "icon": "fa fa-folder icon-state-default", - "opened": true, - "children": [ - { - "text": "Another node" - } - ] - }, - { - "text": "custom icon", - "icon": "fa fa-warning icon-state-warning" - }, - { - "text": "disabled node", - "icon": "fa fa-check icon-state-success", - "disabled": true - } - ] + beforeRouteEnter (to, from, next) { + Promise.all([settings.getItem('images/thumbtask') + ]) + .then(function(values) { + next(vm => { + vm.taskxml = values[0]; + }) + }) }, - { - "text": "Same but with checkboxes", - "opened": true, - "children": [ - { - "text": "initially selected", - "selected": true - }, - { - "text": "custom icon", - "icon": "fa fa-warning icon-state-danger" - }, - { - "text": "initially open", - "icon": "fa fa-folder icon-state-default", - "opened": true, - "children": [ - { - "text": "Another node" - } - ] - }, - { - "text": "custom icon", - "icon": "fa fa-warning icon-state-warning" - }, - { - "text": "disabled node", - "icon": "fa fa-check icon-state-success", - "disabled": true - } - ] - }, - { - "text": "And wholerow selection" - } - ] -} + + beforeRouteLeave (to, from, next) { + // called when the route that renders this component is about to + // be navigated away from. + // has access to `this` component instance. + settings.setItem('images/thumbtask',this.taskxml); + next(true); }, -methods: { - itemClick (node) { - console.log(node.model.text + ' clicked !') - } -} - -} - - ); - -// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/tree2.vue -const Tree2=Vue.extend({template:` - - - - vue-treeselect@0.0.28 - - todo - - - - - Select some things - - - - - - - - - `, - - //components: { Treeselect }, - - data:function(){ - return { - value: null, - source: [ - { - id: 'node-1', - label: 'Node 1', - children: [ - { - id: 'node-1-a', - label: 'Node 1-A', - } - ], - }, - { - id: 'node-2', - label: 'Node 2', - } - ] - } - }, -methods: { - itemClick (node) { - console.log(node.model.text + ' clicked !') - } -} } @@ -5575,8 +5808,8 @@ const Vuepoc=Vue.extend({template:` model: false, children: [ - {href: '/form',text: 'Forms',icon: 'format_list_bulleted' }, - {href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' }, + {href: '/form',text: 'vue-form-generator',icon: 'format_list_bulleted' }, + {href: '/form2',text: 'vue-json-schema',icon: 'format_list_bulleted' }, {href: '/form3',text: 'vue-form-json-schema',icon: 'format_list_bulleted' } ]}, { @@ -5737,28 +5970,6 @@ const Auth={ }; Vue.use(Auth); -//Notification Object -const Notification={ - messages:[], - nextId: 0, - unseen:0, - add(msg){ - var data={ - text: msg, - index: ++this.nextId, - created: new Date() - }; - this.messages.unshift(data); - this.messages.length = Math.min(this.messages.length, 30); - ++this.unseen; - - }, - install(Vue){ - Object.defineProperty(Vue.prototype, '$notification', { - get () { return Notification } - }) } -}; -Vue.use(Notification); // Settings read and write list clear @@ -5791,13 +6002,25 @@ ut aliquip ex ea commodo consequat.`}, text:`let $a:=1 to 5 return $a `}, - {name:"videos.xml", id:"3", mode:"xml",dirty: false, location: "/aaa/bca/", + {name:"videos.xml", id:"3", mode:"xml",dirty: false, location: "xmldb:/vue-poc/aaa/bca/videos.xml", text:` hello `} ], "edit/currentId": "?", - "system/serviceworker": true + "system/serviceworker": true, + "images/thumbtask":` + + + + + Some Text here + + + + + +` }, @@ -5869,45 +6092,6 @@ function debounce(func, wait, immediate) { }; }; -// https://stackoverflow.com/questions/36672561/how-to-exit-fullscreen-onclick-using-javascript -const Fullscreen={ - isInFullScreen(){ - return (document.fullscreenElement && document.fullscreenElement !== null) || - (document.webkitFullscreenElement && document.webkitFullscreenElement !== null) || - (document.mozFullScreenElement && document.mozFullScreenElement !== null) || - (document.msFullscreenElement && document.msFullscreenElement !== null); - }, - toggle(){ - var docElm = document.documentElement; - if (!this.isInFullScreen()) { - if (docElm.requestFullscreen) { - docElm.requestFullscreen(); - } else if (docElm.mozRequestFullScreen) { - docElm.mozRequestFullScreen(); - } else if (docElm.webkitRequestFullScreen) { - docElm.webkitRequestFullScreen(); - } else if (docElm.msRequestFullscreen) { - docElm.msRequestFullscreen(); - } - } else { - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.webkitExitFullscreen) { - document.webkitExitFullscreen(); - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } else if (document.msExitFullscreen) { - document.msExitFullscreen(); - } - } - }, - install: function(Vue){ - Object.defineProperty(Vue.prototype, '$fullscreen', { - get () { return Fullscreen } - }) } -}; -Vue.use(Fullscreen); - Vue.component('treeselect', VueTreeselect.Treeselect); //Vue.use( VueFormJsonSchema); diff --git a/src/vue-poc/static/app.html b/src/vue-poc/static/app.html index 303ba33..68a1ac5 100644 --- a/src/vue-poc/static/app.html +++ b/src/vue-poc/static/app.html @@ -11,8 +11,8 @@ - - + + @@ -38,7 +38,7 @@ - + @@ -51,7 +51,7 @@ - +
- This is a experiment in using - vue.js - . -
vue.js
{{ value }}