vuetify 1.0.6

This commit is contained in:
Andy Bunce 2018-03-13 22:30:00 +00:00
parent b7604ddcfa
commit a1e9da77ed
26 changed files with 906 additions and 232 deletions

View file

@ -168,18 +168,25 @@
{href: '/map',text: 'Map',icon: 'place'},
{href: '/images/report',text: 'Reports',icon: 'report'}
]},
{
icon: 'format_list_bulleted',
text: 'Forms' ,
model: false,
children: [
{href: '/form',text: 'Forms',icon: 'format_list_bulleted' },
{href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' }
]},
{
icon: 'more_horiz',
text: 'More' ,
model: false,
children: [
{href: '/tabs',text: 'Tabs',icon: 'switch_camera'},
{href: '/session',text: 'Session',icon: 'person'},
{href: '/select',text: 'Select',icon: 'extension'},
{href: '/puzzle',text: 'Puzzle',icon: 'extension'},
{href: '/svg',text: 'SVG',icon: 'extension'},
{href: '/form',text: 'Forms',icon: 'format_list_bulleted' },
{href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' },
{href: '/tabs',text: 'Tabs',icon: 'switch_camera'}
{href: '/svg',text: 'SVG',icon: 'extension'}
]},
{href: '/settings',text: 'Settings',icon: 'settings' },

View file

@ -47,13 +47,24 @@ declare function vue-poc:get-file($file)
{
let $path := resolve-uri( 'static/' || $file,static-base-uri())
let $path:=if(file:exists($path))then $path else $vue-poc:index
return (
web:response-header(map { 'media-type': web:content-type($path) }),
web:response-header(map { 'media-type': vue-poc:content-type($path) }),
file:read-binary($path)
)
};
(:~
: content type for path
:)
declare function vue-poc:content-type($path as xs:string)
as xs:string
{
let $ct:=web:content-type($path)
return if($ct = "text/ecmascript") then "text/javascript" else $ct
};
(:~ unused
:)
declare function vue-poc:get-filex($file)
{
let $path := resolve-uri( 'static/' || $file,static-base-uri())

View file

@ -3,7 +3,10 @@
simple link test component
-->
<template id="qd-link">
<a :href="href" :target="href" > {{href}}<v-icon>link</v-icon></a>
<a :href="href" :target="href" >
<v-icon>link</v-icon>
<slot>{{href}}</slot>
</a>
</template>
<script>{

View file

@ -114,6 +114,7 @@ var settings = {
if (this.debug) console.log('getItem',key);
return localforage.getItem(key)
.then(value => {
value=value?value:this.defaults[key];
//console.log('GET setting', key,value);
return value;

File diff suppressed because one or more lines are too long

View file

@ -38,12 +38,12 @@ function vue-api:response($r,$query)
<job>{ $r }</job>
<dateTime>{ current-dateTime() }</dateTime>
</json>
let $task:=<task id="{$id}">{ $out }
let $jobrun:=<jobrun id="{$id}" >{ $out }
<query>{$query}</query>
</task>
</jobrun>
return (
replace value of node $vue-api:id with $id,
db:replace($vue-api:db,"/tasks/" || $id || ".xml",$task),
db:replace($vue-api:db,"/jobruns/" || $id || ".xml",$jobrun),
db:output($out)
)
};

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<template id="evalid">
<v-container fluid>
todo {{id}}
</v-container>
</template>
<script>{
props:["id"],
data: function(){
return {
xq: '(: type your XQuery :)\n'
}
}
}
</script>

View file

@ -2,8 +2,22 @@
<template id="brutusin">
<v-container fluid>
<v-card>
<v-card-title>vue-form-generator</v-card-title>
<v-card-title><qd-link href="https://github.com/vue-generators/vue-form-generator">vue-form-generator@2.2.1</qd-link> </v-card-title>
<v-card-text>
<v-container grid-list-md text-xs-center>
<v-layout row wrap>
<v-flex xs8>
<v-form>
<vue-form-generator :schema="schema" :model="model" :options="formOptions"></vue-form-generator>
</v-form>
</v-flex>
<v-flex xs4>
<pre style="text-align:left">{{ model | pretty }}</pre>
</v-flex>
</v-layout>
</v-container>
</v-card-text>
</v-card>
</v-container>
</template>
@ -103,6 +117,11 @@
el.style.height=h +"px"
}
},
filters: {
pretty: function(value) {
return JSON.stringify(value, null, 2);
}
},
created:function(){
console.log("form")
}

View file

@ -2,10 +2,12 @@
<template id="formsjson">
<v-container fluid>
<v-card>
<v-card-title>vue-json-schema@1.1.0 https://github.com/formschema/native</v-card-title>
<form-schema ref="formSchema" :schema="schema" v-model="model" >
<v-btn color="success" @click.stop="submit">Subscribe</v-btn>
<v-card-title><qd-link href="https://github.com/formschema/native">vue-json-schema@1.1.0</qd-link> </v-card-title>
<form-schema ref="formSchema" :schema="schema" v-model="model" input-wrapping-class="fooclass">
<v-btn color="success" @click.stop="submit">Send</v-btn>
</form-schema>
</v-card>
</v-container>
</template>
@ -20,10 +22,11 @@
schema: {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "Newsletter Subscription",
"title": "Sample form title",
"properties": {
"name": {
"type": "string",
"type": "string",
"title": "Name ",
"minLength": 8,
"maxLength": 80,
"attrs": {
@ -32,7 +35,8 @@
}
},
"email": {
"type": "string",
"type": "string",
"title": "Email label ",
"maxLength": 120,
"attrs": {
"type": "email",
@ -41,10 +45,12 @@
},
"lists": {
"type": "string",
"enum": ["Daily New", "Promotion"]
"title": "List label ",
"enum": ["Daily New", "Promotion", "Another"]
},
"arrayInput": {
"type": "array",
"title": "Array label ",
"items": {
"type": "string"
}

View file

@ -32,7 +32,7 @@
md4
lg3
>
<v-card hover="true" active-class="default-class qd-active" >
<v-card :hover="true" active-class="default-class qd-active" >
<v-toolbar color="amber">
<v-card-title >

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<template id="entity1">
<v-card>
<v-toolbar >
<v-toolbar-title> Entity: {{ entity }}</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="getItem"
:loading="loading"
:disabled="loading"
>Refresh</v-btn>
</v-toolbar>
<v-container fluid grid-list-md>
hello
</v-container>
</v-card>
</template>
<script>{
props: ['entity'],
data: function(){
return {
q: 'filter',
item: {},
loading: false
}
},
methods:{
getItem(){
this.loading=true
HTTP.get("data/entity",{params:this.q})
.then(r=>{
this.loading=false
//console.log(r.data)
//var items=r.data.items.filter(item=>{return item.text!="[GET] http://localhost:8984/vue-poc/api/log"})
this.item=r.data.items
})
}
},
created:function(){
this.getItem()
},
}
</script>

View file

@ -29,7 +29,7 @@
md4
lg3
>
<v-card hover="true" active-class="default-class qd-active" height="200px">
<v-card :hover="true" active-class="default-class qd-active" height="200px">
<v-toolbar color="amber">
<v-card-title >
@ -59,7 +59,12 @@
items: [],
loading: false,
q: "",
message: 'bad route!'
message: 'bad route!',
rowsPerPageItems: [4, 8, 20],
pagination: {
rowsPerPage: 20
},
selected:[]
}
},
methods: {

View file

@ -151,8 +151,15 @@
this.$forceUpdate()
}
},
computed: {
beforeRouteLeave(to, from, next){
var on=this.repeat.get || this.repeat.post
if (on) {
alert("running!") //<--undefined
return next(false)
} else {
return next()
}
}
}
</script>

View file

@ -22,7 +22,7 @@
:key="i"
:href="'#tab-' + i"
>
<v-avatar :tile="tile"
<v-avatar
size="20px">
<v-icon>favorite</v-icon>
</v-avatar>

View file

@ -11,12 +11,17 @@
</params>
</task>
<task name="tasks/import">
<title>Load files into database</title>
<description>Load files into database</description>
</task>
<task name="tasks/xqdoc">
<title>XQdoc</title>
<description>Generate XQdoc as html</description>
</task>
<task name="tasks/xqdoc">
<task name="tasks/xqdocdb">
<title>XQdoc to db</title>
<description>Generate XQdoc to save</description>
</task>

View file

@ -0,0 +1,73 @@
<!DOCTYPE html>
<template id="xqdoc2">
<v-container fluid v-resize="onResize">
<v-card>
<v-toolbar class="orange">
<v-btn @click="validate" :loading="loading"
:disabled="loading"
><v-icon>play_circle_outline</v-icon>xqdoc</v-btn>
<span v-text="elapsed"></span>ms. Height:
<span v-text="height"></span>
<v-spacer></v-spacer>
<v-menu offset-y left>
<v-btn icon dark slot="activator"><v-icon>settings</v-icon></v-btn>
<v-card >
<v-toolbar class="green">
<v-card-title >Settings................</v-card-title>
</v-toolbar>
<v-card-text>
stuff
</v-card-text>
</v-card>
</v-menu>
</v-toolbar>
<v-card-text >
here
</v-card-text>
</v-card>
</v-container>
</template>
<script>{
data: function(){
return {
loading: false,
elapsed: null,
height: null,
result: null,
doc: "c:/test.xml",
schema: "c:/schema.xsd"
}
},
methods:{
onResize(){
this.height = window.innerHeight
},
validate(){
this.loading=true
this.start = performance.now();
HTTPNE.get("validate",Qs.stringify({doc: this.doc, schema: this.schema}))
.then(r=>{
console.log(r)
this.elapsed=Math.floor(performance.now() - this.start);
this.loading=false
if(r.data.rc==0){
this.result=r.data.result
}else{
this.result=r.data.info
}
})
.catch(r=> {
console.log("error",r)
this.result=r.message + ": "+ r.config.url + "\n"+ r.response.data
this.loading=false
});
},
},
created:function(){
console.log("notfound",this.$route.query.q)
}
}
</script>

View file

@ -30,7 +30,10 @@ return $zip
: @param $dbname name of database
: @param $path file path contain files
:)
declare %updating function dbtools:sync-from-path($dbname as xs:string,$path as xs:string){
declare %updating function dbtools:sync-from-path(
$dbname as xs:string,
$path as xs:string)
{
dbtools:sync-from-files($dbname,
$path,
file:list($path,fn:true()),

View file

@ -1,4 +1,6 @@
(:~
: wrapper for https://github.com/digitalfondue/jfiveparse A java html5 compliant parser
:)
module namespace html5="text.html5";
declare namespace Document="java:ch.digitalfondue.jfiveparse.Document";
@ -36,6 +38,23 @@ declare function html5:getElementFirstByTagName($doc,$tag as xs:string)
=>list:get(xs:int(0))
};
(:~
: get attribute from node
:)
declare function html5:getAttribute($node,$atname as xs:string)
as xs:string
{
Element:getAttribute($node,$atname)
};
(:~
: get html from node
:)
declare function html5:getInnerHTML($node)
as xs:string
{
Node:getInnerHTML($node)
};
(:~
: @return matcher for given element and attribute with value
:)

View file

@ -6,9 +6,7 @@ module namespace vue = 'quodatum:vue.compile';
import module namespace html5="text.html5" at "html5parse.xqm";
import module namespace fw="quodatum:file.walker";
declare namespace c="http://www.w3.org/ns/xproc-step";
declare namespace Document="java:ch.digitalfondue.jfiveparse.Document";
declare namespace Element="java:ch.digitalfondue.jfiveparse.Element";
declare namespace Node="java:ch.digitalfondue.jfiveparse.Node";
declare namespace functx = "http://www.functx.com";
@ -56,11 +54,11 @@ declare function vue:parse($doc)
as map(*)
{
let $tempNode:= html5:getElementFirstByTagName($doc,"template")
let $template:= Node:getInnerHTML($tempNode)
let $id := Element:getAttribute($tempNode,"id")=>trace("ID")
let $template:= html5:getInnerHTML($tempNode)
let $id := html5:getAttribute($tempNode,"id")=>trace("ID")
let $script:= html5:getElementFirstByTagName($doc,"script")
let $script:= Node:getInnerHTML($script)
let $script:= html5:getInnerHTML($script)
return map{"id":$id,"template":$template,"script":$script}
};

View file

@ -1,5 +1,5 @@
(: entity access maps
: auto generated from xml files in entities folder at: 2018-03-01T21:54:58.72Z
: auto generated from xml files in entities folder at: 2018-03-12T22:33:57.01Z
:)
module namespace entity = 'quodatum.models.generated';
@ -219,6 +219,50 @@ declare variable $entity:list:=map {
"views": map{
}
},
"jobrun": map{
"name": "jobrun",
"description": "About the running of a job",
"access": map{
"created": function($_ as element()) as xs:string {$_/json/dateTime },
"id": function($_ as element()) as xs:string {$_/@id },
"query": function($_ as element()) as xs:string {$_/query },
"result": function($_ as element()) as xs:string {$_/substring(result,0,1000) },
"resultlength": function($_ as element()) as xs:integer {$_/string-length(result) } },
"filter": function($item,$q) as xs:boolean{
some $e in ( ) satisfies
fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive')
},
"json": map{
"created": function($_ as element()) as element(created)? {
(: xs:string :)
fn:data($_/json/dateTime)!element created { .}
},
"id": function($_ as element()) as element(id)? {
(: xs:string :)
fn:data($_/@id)!element id { .}
},
"query": function($_ as element()) as element(query)? {
(: xs:string :)
fn:data($_/query)!element query { .}
},
"result": function($_ as element()) as element(result)? {
(: xs:string :)
fn:data($_/substring(result,0,1000))!element result { .}
},
"resultlength": function($_ as element()) as element(resultlength)? {
(: xs:integer :)
fn:data($_/string-length(result))!element resultlength { attribute type {'number'}, .}
} },
"data": function() as element(jobrun)*
{ collection("vue-poc/jobrun")/jobrun
},
"views": map{
'filter': 'name description'
}
},
"namespace": map{
@ -335,50 +379,6 @@ declare variable $entity:list:=map {
"views": map{
}
},
"task": map{
"name": "task",
"description": "A task",
"access": map{
"created": function($_ as element()) as xs:string {$_/json/dateTime },
"id": function($_ as element()) as xs:string {$_/@id },
"query": function($_ as element()) as xs:string {$_/query },
"result": function($_ as element()) as xs:string {$_/substring(result,0,1000) },
"resultlength": function($_ as element()) as xs:integer {$_/string-length(result) } },
"filter": function($item,$q) as xs:boolean{
some $e in ( ) satisfies
fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive')
},
"json": map{
"created": function($_ as element()) as element(created)? {
(: xs:string :)
fn:data($_/json/dateTime)!element created { .}
},
"id": function($_ as element()) as element(id)? {
(: xs:string :)
fn:data($_/@id)!element id { .}
},
"query": function($_ as element()) as element(query)? {
(: xs:string :)
fn:data($_/query)!element query { .}
},
"result": function($_ as element()) as element(result)? {
(: xs:string :)
fn:data($_/substring(result,0,1000))!element result { .}
},
"resultlength": function($_ as element()) as element(resultlength)? {
(: xs:integer :)
fn:data($_/string-length(result))!element resultlength { attribute type {'number'}, .}
} },
"data": function() as element(task)*
{ collection("vue-poc/tasks")/task
},
"views": map{
'filter': 'name description'
}
},
"thumbnail": map{
@ -437,6 +437,34 @@ declare variable $entity:list:=map {
"views": map{
'filter': 'name'
}
},
"user": map{
"name": "user",
"description": "users ",
"access": map{
"name": function($_ as element()) as xs:string {$_/@name },
"permission": function($_ as element()) as xs:string {$_/@permission } },
"filter": function($item,$q) as xs:boolean{
some $e in ( ) satisfies
fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive')
},
"json": map{
"name": function($_ as element()) as element(name)? {
(: xs:string :)
fn:data($_/@name)!element name { .}
},
"permission": function($_ as element()) as element(permission)? {
(: xs:string :)
fn:data($_/@permission)!element permission { .}
} },
"data": function() as element(user)*
{ user:list-details() },
"views": map{
}
},
"xqdoc": map{

View file

@ -1,5 +1,5 @@
<entity name="task" xmlns="https://github.com/Quodatum/app-doc/entity">
<description>A task</description>
<entity name="jobrun" xmlns="https://github.com/Quodatum/app-doc/entity">
<description>About the running of a job</description>
<namespace prefix="xqdoc" uri="http://www.xqdoc.org/1.0"/>
<fields>
@ -28,6 +28,6 @@
<view name="filter">name description</view>
</views>
<iconclass>fa fa-file-code-o</iconclass>
<data type="element(task)">collection("vue-poc/tasks")/task
<data type="element(jobrun)">collection("vue-poc/jobrun")/jobrun
</data>
</entity>

View file

@ -0,0 +1,18 @@
<entity name="user" xmlns="https://github.com/Quodatum/app-doc/entity">
<description>users </description>
<fields>
<field name="name" type="xs:string">
<description>user name</description>
<xpath>@name</xpath>
</field>
<field name="permission" type="xs:string">
<description>user permission</description>
<xpath>@permission</xpath>
</field>
</fields>
<views>
</views>
<iconclass>fa fa-calendar</iconclass>
<data type="element(user)">user:list-details()</data>
</entity>

View file

@ -27,7 +27,10 @@ const router = new VueRouter({
{ path: '/images/people', component: People, meta:{title:"Image people"} },
{ path: '/documentation', component: Documentation, meta:{title:"documentation"} },
{ path: '/entity', component: Entity, meta:{title:"Entities"} },
{ path: '/entity/:entity', name:"entity1", component: Entity1, props: true, meta:{title:"Entity"} },
{ path: '/namespace', component: Namespace, meta:{title:"Namespaces"} },
{ path: '/select', component: Select, meta:{title:"Select"} },
{ path: '/search', component: Search, meta:{title:"Search"} },
@ -47,15 +50,21 @@ const router = new VueRouter({
/* { path: '/svg2', component: Svg2, meta:{title:"SVG2"} }, */
{ path: '/transform', component: Transform, meta:{title:"XSLT2 Transform"} },
{ path: '/validate', component: Validate, meta:{title:"Validate"} },
{ path: '/eval', component: Eval, meta:{title:"Evaluate XQuery"} },
{ path: '/eval/:id', component: Evalid, props: true, meta:{title:"Run details"} },
{ path: '/logs', component: Log, meta:{title:"Server logs"} },
{ path: '/tasks', component: Task, meta:{title:"Runnable tasks"} },
{ path: '/tasks/model', component: Model, meta:{title:"build model"} },
{ path: '/tasks/xqdoc', component: Xqdoc, meta:{title:"build xqdoc"} },
{ path: '/tasks/vuecompile', component: Vuecompile, meta:{title:"vue compile"} },
{ path: '/tasks/:task', component: Runtask, props: true, meta:{title:"Run task"} },
{ path: '/jobs', component: Jobs, meta:{title:"Jobs running"} },
{ path: '/jobs/:job', name:"jobShow", component: Job, props: true, meta:{title:"Job Status"} },
{ path: '/timeline', component: Timeline,meta:{title:"timeline"} },
{ path: '/map', component: Map,meta:{title:"map"} },
{ path: '/form', component: Brutusin, meta:{title:"Form demo"} },

View file

@ -1,4 +1,4 @@
// generated 2018-03-04T18:03:42.736Z
// generated 2018-03-13T22:19:53.996Z
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-confirm.vue
Vue.component('qd-confirm',{template:`
@ -50,7 +50,10 @@ Vue.component('qd-fullscreen',{template:`
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-link.vue
Vue.component('qd-link',{template:`
<a :href="href" :target="href"> {{href}}<v-icon>link</v-icon></a>
<a :href="href" :target="href">
<v-icon>link</v-icon>
<slot>{{href}}</slot>
</a>
`,
props: ['href'],
@ -767,117 +770,6 @@ const Log=Vue.extend({template:`
);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/brutusin.vue
const Brutusin=Vue.extend({template:`
<v-container fluid="">
<v-card>
<v-card-title>vue-form-generator</v-card-title>
<vue-form-generator :schema="schema" :model="model" :options="formOptions"></vue-form-generator>
</v-card>
</v-container>
`,
components: {
"vue-form-generator": VueFormGenerator.component
},
data() {
return {
model: {
id: 1,
name: "John Doe",
password: "J0hnD03!x4",
age: 35,
skills: ["Javascript", "VueJS"],
email: "john.doe@gmail.com",
status: true
},
schema: {
fields: [{
type: "input",
inputType: "text",
label: "ID",
model: "id",
readonly: true,
featured: false,
disabled: true
}, {
type: "input",
inputType: "text",
label: "Name",
model: "name",
readonly: false,
featured: true,
required: true,
disabled: false,
placeholder: "User's name",
validator: VueFormGenerator.validators.string
}, {
type: "input",
inputType: "password",
label: "Password",
model: "password",
min: 6,
required: true,
hint: "Minimum 6 characters",
validator: VueFormGenerator.validators.string
}, {
type: "input",
inputType: "number",
label: "Age",
model: "age",
min: 18,
validator: VueFormGenerator.validators.number
}, {
type: "input",
inputType: "email",
label: "E-mail",
model: "email",
placeholder: "User's e-mail address",
validator: VueFormGenerator.validators.email
}, {
type: "checklist",
label: "Skills",
model: "skills",
multi: true,
required: true,
multiSelect: true,
values: ["HTML5", "Javascript", "CSS3", "CoffeeScript", "AngularJS", "ReactJS", "VueJS"]
}, {
type: "switch",
label: "Status",
model: "status",
multi: true,
readonly: false,
featured: false,
disabled: false,
default: true,
textOn: "Active",
textOff: "Inactive"
}]
},
formOptions: {
validateAfterLoad: true,
validateAfterChanged: true
}
};
},
methods:{
onResize(){
var el=this.$refs["page"]
console.log("top",el.offsetTop)
var h=Math.max(1,window.innerHeight - el.offsetTop)-60
console.log("h",h)
el.style.height=h +"px"
}
},
created:function(){
console.log("form")
}
}
);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/collection/files.vue
const Files=Vue.extend({template:`
<v-container fluid="">
@ -1748,14 +1640,165 @@ const Eval=Vue.extend({template:`
);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/eval/evalid.vue
const Evalid=Vue.extend({template:`
<v-container fluid="">
todo {{id}}
</v-container>
`,
props:["id"],
data: function(){
return {
xq: '(: type your XQuery :)\n'
}
}
}
);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/form/brutusin.vue
const Brutusin=Vue.extend({template:`
<v-container fluid="">
<v-card>
<v-card-title><qd-link href="https://github.com/vue-generators/vue-form-generator">vue-form-generator@2.2.1</qd-link> </v-card-title>
<v-card-text>
<v-container grid-list-md="" text-xs-center="">
<v-layout row="" wrap="">
<v-flex xs8="">
<v-form>
<vue-form-generator :schema="schema" :model="model" :options="formOptions"></vue-form-generator>
</v-form>
</v-flex>
<v-flex xs4="">
<pre style="text-align:left">{{ model | pretty }}</pre>
</v-flex>
</v-layout>
</v-container>
</v-card-text>
</v-card>
</v-container>
`,
components: {
"vue-form-generator": VueFormGenerator.component
},
data() {
return {
model: {
id: 1,
name: "John Doe",
password: "J0hnD03!x4",
age: 35,
skills: ["Javascript", "VueJS"],
email: "john.doe@gmail.com",
status: true
},
schema: {
fields: [{
type: "input",
inputType: "text",
label: "ID",
model: "id",
readonly: true,
featured: false,
disabled: true
}, {
type: "input",
inputType: "text",
label: "Name",
model: "name",
readonly: false,
featured: true,
required: true,
disabled: false,
placeholder: "User's name",
validator: VueFormGenerator.validators.string
}, {
type: "input",
inputType: "password",
label: "Password",
model: "password",
min: 6,
required: true,
hint: "Minimum 6 characters",
validator: VueFormGenerator.validators.string
}, {
type: "input",
inputType: "number",
label: "Age",
model: "age",
min: 18,
validator: VueFormGenerator.validators.number
}, {
type: "input",
inputType: "email",
label: "E-mail",
model: "email",
placeholder: "User's e-mail address",
validator: VueFormGenerator.validators.email
}, {
type: "checklist",
label: "Skills",
model: "skills",
multi: true,
required: true,
multiSelect: true,
values: ["HTML5", "Javascript", "CSS3", "CoffeeScript", "AngularJS", "ReactJS", "VueJS"]
}, {
type: "switch",
label: "Status",
model: "status",
multi: true,
readonly: false,
featured: false,
disabled: false,
default: true,
textOn: "Active",
textOff: "Inactive"
}]
},
formOptions: {
validateAfterLoad: true,
validateAfterChanged: true
}
};
},
methods:{
onResize(){
var el=this.$refs["page"]
console.log("top",el.offsetTop)
var h=Math.max(1,window.innerHeight - el.offsetTop)-60
console.log("h",h)
el.style.height=h +"px"
}
},
filters: {
pretty: function(value) {
return JSON.stringify(value, null, 2);
}
},
created:function(){
console.log("form")
}
}
);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/form/formschema.vue
const Formsjson=Vue.extend({template:`
<v-container fluid="">
<v-card>
<v-card-title>vue-json-schema@1.1.0 https://github.com/formschema/native</v-card-title>
<form-schema ref="formSchema" :schema="schema" v-model="model">
<v-btn color="success" @click.stop="submit">Subscribe</v-btn>
<v-card-title><qd-link href="https://github.com/formschema/native">vue-json-schema@1.1.0</qd-link> </v-card-title>
<form-schema ref="formSchema" :schema="schema" v-model="model" input-wrapping-class="fooclass">
<v-btn color="success" @click.stop="submit">Send</v-btn>
</form-schema>
</v-card>
</v-container>
`,
@ -1769,10 +1812,11 @@ const Formsjson=Vue.extend({template:`
schema: {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "Newsletter Subscription",
"title": "Sample form title",
"properties": {
"name": {
"type": "string",
"type": "string",
"title": "Name ",
"minLength": 8,
"maxLength": 80,
"attrs": {
@ -1781,7 +1825,8 @@ const Formsjson=Vue.extend({template:`
}
},
"email": {
"type": "string",
"type": "string",
"title": "Email label ",
"maxLength": 120,
"attrs": {
"type": "email",
@ -1790,10 +1835,12 @@ const Formsjson=Vue.extend({template:`
},
"lists": {
"type": "string",
"enum": ["Daily New", "Promotion"]
"title": "List label ",
"enum": ["Daily New", "Promotion", "Another"]
},
"arrayInput": {
"type": "array",
"title": "Array label ",
"items": {
"type": "string"
}
@ -2733,7 +2780,7 @@ const Entity=Vue.extend({template:`
<v-data-iterator content-tag="v-layout" row="" wrap="" :loading="loading" :items="items" :rows-per-page-items="rowsPerPageItems" :pagination.sync="pagination" select-all="" :value="selected">
<v-flex slot="item" slot-scope="props" xs12="" sm6="" md4="" lg3="">
<v-card hover="true" active-class="default-class qd-active">
<v-card :hover="true" active-class="default-class qd-active">
<v-toolbar color="amber">
<v-card-title>
@ -2789,6 +2836,50 @@ const Entity=Vue.extend({template:`
);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/model/entity1.vue
const Entity1=Vue.extend({template:`
<v-card>
<v-toolbar>
<v-toolbar-title> Entity: {{ entity }}</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="getItem" :loading="loading" :disabled="loading">Refresh</v-btn>
</v-toolbar>
<v-container fluid="" grid-list-md="">
hello
</v-container>
</v-card>
`,
props: ['entity'],
data: function(){
return {
q: 'filter',
item: {},
loading: false
}
},
methods:{
getItem(){
this.loading=true
HTTP.get("data/entity",{params:this.q})
.then(r=>{
this.loading=false
//console.log(r.data)
//var items=r.data.items.filter(item=>{return item.text!="[GET] http://localhost:8984/vue-poc/api/log"})
this.item=r.data.items
})
}
},
created:function(){
this.getItem()
},
}
);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/namespace.vue
const Namespace=Vue.extend({template:`
<v-container fluid="" grid-list-md="">
@ -2800,7 +2891,7 @@ const Namespace=Vue.extend({template:`
</v-toolbar>
<v-data-iterator content-tag="v-layout" row="" wrap="" :loading="loading" :items="items" :rows-per-page-items="rowsPerPageItems" :pagination.sync="pagination" select-all="" :value="selected">
<v-flex slot="item" slot-scope="props" xs12="" sm6="" md4="" lg3="">
<v-card hover="true" active-class="default-class qd-active" height="200px">
<v-card :hover="true" active-class="default-class qd-active" height="200px">
<v-toolbar color="amber">
<v-card-title>
@ -2829,7 +2920,12 @@ const Namespace=Vue.extend({template:`
items: [],
loading: false,
q: "",
message: 'bad route!'
message: 'bad route!',
rowsPerPageItems: [4, 8, 20],
pagination: {
rowsPerPage: 20
},
selected:[]
}
},
methods: {
@ -3011,8 +3107,15 @@ const Ping=Vue.extend({template:`
this.$forceUpdate()
}
},
computed: {
beforeRouteLeave(to, from, next){
var on=this.repeat.get || this.repeat.post
if (on) {
alert("running!") //<--undefined
return next(false)
} else {
return next()
}
}
}
@ -3619,7 +3722,7 @@ const Tabs=Vue.extend({template:`
<v-tabs fixed-tabs="" v-model="currentItem" slot="extension">
<v-tab v-for="i in items" :key="i" :href="'#tab-' + i">
<v-avatar :tile="tile" size="20px">
<v-avatar size="20px">
<v-icon>favorite</v-icon>
</v-avatar>
<span>{{ i }}</span>
@ -4252,6 +4355,78 @@ const Validate=Vue.extend({template:`
);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/xqdoc/xqdoc.vue
const Xqdoc2=Vue.extend({template:`
<v-container fluid="" v-resize="onResize">
<v-card>
<v-toolbar class="orange">
<v-btn @click="validate" :loading="loading" :disabled="loading"><v-icon>play_circle_outline</v-icon>xqdoc</v-btn>
<span v-text="elapsed"></span>ms. Height:
<span v-text="height"></span>
<v-spacer></v-spacer>
<v-menu offset-y="" left="">
<v-btn icon="" dark="" slot="activator"><v-icon>settings</v-icon></v-btn>
<v-card>
<v-toolbar class="green">
<v-card-title>Settings................</v-card-title>
</v-toolbar>
<v-card-text>
stuff
</v-card-text>
</v-card>
</v-menu>
</v-toolbar>
<v-card-text>
here
</v-card-text>
</v-card>
</v-container>
`,
data: function(){
return {
loading: false,
elapsed: null,
height: null,
result: null,
doc: "c:/test.xml",
schema: "c:/schema.xsd"
}
},
methods:{
onResize(){
this.height = window.innerHeight
},
validate(){
this.loading=true
this.start = performance.now();
HTTPNE.get("validate",Qs.stringify({doc: this.doc, schema: this.schema}))
.then(r=>{
console.log(r)
this.elapsed=Math.floor(performance.now() - this.start);
this.loading=false
if(r.data.rc==0){
this.result=r.data.result
}else{
this.result=r.data.info
}
})
.catch(r=> {
console.log("error",r)
this.result=r.message + ": "+ r.config.url + "\n"+ r.response.data
this.loading=false
});
},
},
created:function(){
console.log("notfound",this.$route.query.q)
}
}
);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/xslt/transform.vue
const Transform=Vue.extend({template:`
<v-container fluid="">
@ -4409,7 +4584,10 @@ const router = new VueRouter({
{ path: '/images/people', component: People, meta:{title:"Image people"} },
{ path: '/documentation', component: Documentation, meta:{title:"documentation"} },
{ path: '/entity', component: Entity, meta:{title:"Entities"} },
{ path: '/entity/:entity', name:"entity1", component: Entity1, props: true, meta:{title:"Entity"} },
{ path: '/namespace', component: Namespace, meta:{title:"Namespaces"} },
{ path: '/select', component: Select, meta:{title:"Select"} },
{ path: '/search', component: Search, meta:{title:"Search"} },
@ -4429,15 +4607,21 @@ const router = new VueRouter({
/* { path: '/svg2', component: Svg2, meta:{title:"SVG2"} }, */
{ path: '/transform', component: Transform, meta:{title:"XSLT2 Transform"} },
{ path: '/validate', component: Validate, meta:{title:"Validate"} },
{ path: '/eval', component: Eval, meta:{title:"Evaluate XQuery"} },
{ path: '/eval/:id', component: Evalid, props: true, meta:{title:"Run details"} },
{ path: '/logs', component: Log, meta:{title:"Server logs"} },
{ path: '/tasks', component: Task, meta:{title:"Runnable tasks"} },
{ path: '/tasks/model', component: Model, meta:{title:"build model"} },
{ path: '/tasks/xqdoc', component: Xqdoc, meta:{title:"build xqdoc"} },
{ path: '/tasks/vuecompile', component: Vuecompile, meta:{title:"vue compile"} },
{ path: '/tasks/:task', component: Runtask, props: true, meta:{title:"Run task"} },
{ path: '/jobs', component: Jobs, meta:{title:"Jobs running"} },
{ path: '/jobs/:job', name:"jobShow", component: Job, props: true, meta:{title:"Job Status"} },
{ path: '/timeline', component: Timeline,meta:{title:"timeline"} },
{ path: '/map', component: Map,meta:{title:"map"} },
{ path: '/form', component: Brutusin, meta:{title:"Form demo"} },
@ -4628,18 +4812,25 @@ const Vuepoc=Vue.extend({template:`
{href: '/map',text: 'Map',icon: 'place'},
{href: '/images/report',text: 'Reports',icon: 'report'}
]},
{
icon: 'format_list_bulleted',
text: 'Forms' ,
model: false,
children: [
{href: '/form',text: 'Forms',icon: 'format_list_bulleted' },
{href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' }
]},
{
icon: 'more_horiz',
text: 'More' ,
model: false,
children: [
{href: '/tabs',text: 'Tabs',icon: 'switch_camera'},
{href: '/session',text: 'Session',icon: 'person'},
{href: '/select',text: 'Select',icon: 'extension'},
{href: '/puzzle',text: 'Puzzle',icon: 'extension'},
{href: '/svg',text: 'SVG',icon: 'extension'},
{href: '/form',text: 'Forms',icon: 'format_list_bulleted' },
{href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' },
{href: '/tabs',text: 'Tabs',icon: 'switch_camera'}
{href: '/svg',text: 'SVG',icon: 'extension'}
]},
{href: '/settings',text: 'Settings',icon: 'settings' },
@ -4834,6 +5025,7 @@ var settings = {
if (this.debug) console.log('getItem',key);
return localforage.getItem(key)
.then(value => {
value=value?value:this.defaults[key];
//console.log('GET setting', key,value);
return value;

View file

@ -9,19 +9,19 @@
<title>Vue Router Test</title>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic"/>
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="https://unpkg.com/vuetify@1.0.4/dist/vuetify.min.css" rel="stylesheet" type="text/css"/>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="//unpkg.com/vuetify@1.0.6/dist/vuetify.min.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="https://unpkg.com/vue-form-generator@2.1.0/dist/vfg.css"/>
<link rel="stylesheet" href="//unpkg.com/vue-form-generator@2.2.1/dist/vfg-core.css"/>
<link href="/vue-poc/ui/app.css" rel="stylesheet" type="text/css"/>
<link href="/vue-poc/ui/svg-pan-zoom.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/vue-poc/ui/icon.png"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.20.1/vis-timeline-graph2d.min.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/vis/4.20.1/vis-timeline-graph2d.min.css" />
</head>
<body>
<div id="app">
<h3><code>vue-poc</code> <small>(v0.3.1)</small> </h3>
<h3><code>vue-poc</code> <small>(v0.3.2)</small> </h3>
<div class="spinner">
<div class="rect1"></div>
@ -33,26 +33,32 @@
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.1/vue-router.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qs/6.4.0/qs.js"></script>
<script src="https://unpkg.com/vuetify@1.0.4/dist/vuetify.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.1/ace.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.1/ext-language_tools.js"></script>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.12/beautify.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.12/beautify-css.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.12/beautify-html.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.5.1/localforage.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.20.1/vis-timeline-graph2d.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.1/vue-router.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/qs/6.4.0/qs.js"></script>
<script src="//unpkg.com/vuetify@1.0.6/dist/vuetify.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.3.1/ace.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.3.1/ext-language_tools.js"></script>
<script src="//d3js.org/d3.v4.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.12/beautify.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.12/beautify-css.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.12/beautify-html.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/localforage/1.5.1/localforage.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/vis/4.20.1/vis-timeline-graph2d.min.js"></script>
<script src="https://unpkg.com/vue-form-generator@2.1.1/dist/vfg.js"></script>
<script src="https://unpkg.com/vue-json-schema@1.1.0/dist/vue-json-schema.js"></script>
<script src="//unpkg.com/vue-form-generator@2.2.1/dist/vfg-core.js"></script>
<script src="//unpkg.com/vue-json-schema@1.1.0/dist/vue-json-schema.js"></script>
<script src="/vue-poc/ui/svg-pan-zoom.js"></script>
<script src="/vue-poc/ui/perf-stat.js"></script>
<script src="/vue-poc/ui/app-gen.js"></script>
<script>if('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/vue-poc/ui/serviceworker.js')
.then(function() { console.log("Service Worker Registered"); });
}
</script>
</body>
</html>

View file

@ -0,0 +1,199 @@
"use strict";
console.log('WORKER: executing.');
/* A version number is useful when updating the worker logic,
allowing you to remove outdated cache entries during the update.
*/
var version = 'v1::';
/* These resources will be downloaded and cached by the service worker
during the installation process. If any resource fails to be downloaded,
then the service worker won't be installed either.
*/
var offlineFundamentals = [
'',
'prof-stat.js',
'//cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js'
];
/* The install event fires when the service worker is first installed.
You can use this event to prepare the service worker to be able to serve
files while visitors are offline.
*/
self.addEventListener("install", function(event) {
console.log('WORKER: install event in progress.');
/* Using event.waitUntil(p) blocks the installation process on the provided
promise. If the promise is rejected, the service worker won't be installed.
*/
event.waitUntil(
/* The caches built-in is a promise-based API that helps you cache responses,
as well as finding and deleting them.
*/
caches
/* You can open a cache by name, and this method returns a promise. We use
a versioned cache name here so that we can remove old cache entries in
one fell swoop later, when phasing out an older service worker.
*/
.open(version + 'fundamentals')
.then(function(cache) {
/* After the cache is opened, we can fill it with the offline fundamentals.
The method below will add all resources in `offlineFundamentals` to the
cache, after making requests for them.
*/
return cache.addAll(offlineFundamentals);
})
.then(function() {
console.log('WORKER: install completed');
})
);
});
/* The fetch event fires whenever a page controlled by this service worker requests
a resource. This isn't limited to `fetch` or even XMLHttpRequest. Instead, it
comprehends even the request for the HTML page on first load, as well as JS and
CSS resources, fonts, any images, etc.
*/
self.addEventListener("fetch", function(event) {
console.log('WORKER: fetch event in progress.');
/* We should only cache GET requests, and deal with the rest of method in the
client-side, by handling failed POST,PUT,PATCH,etc. requests.
*/
if (event.request.method !== 'GET') {
/* If we don't block the event as shown below, then the request will go to
the network as usual.
*/
console.log('WORKER: fetch event ignored.', event.request.method, event.request.url);
return;
}
/* Similar to event.waitUntil in that it blocks the fetch event on a promise.
Fulfillment result will be used as the response, and rejection will end in a
HTTP response indicating failure.
*/
event.respondWith(
caches
/* This method returns a promise that resolves to a cache entry matching
the request. Once the promise is settled, we can then provide a response
to the fetch request.
*/
.match(event.request)
.then(function(cached) {
/* Even if the response is in our cache, we go to the network as well.
This pattern is known for producing "eventually fresh" responses,
where we return cached responses immediately, and meanwhile pull
a network response and store that in the cache.
Read more:
https://ponyfoo.com/articles/progressive-networking-serviceworker
*/
var networked = fetch(event.request)
// We handle the network request with success and failure scenarios.
.then(fetchedFromNetwork, unableToResolve)
// We should catch errors on the fetchedFromNetwork handler as well.
.catch(unableToResolve);
/* We return the cached response immediately if there is one, and fall
back to waiting on the network as usual.
*/
console.log('WORKER: fetch event', cached ? '(cached)' : '(network)', event.request.url);
return cached || networked;
function fetchedFromNetwork(response) {
/* We copy the response before replying to the network request.
This is the response that will be stored on the ServiceWorker cache.
*/
var cacheCopy = response.clone();
console.log('WORKER: fetch response from network.', event.request.url);
caches
// We open a cache to store the response for this request.
.open(version + 'pages')
.then(function add(cache) {
/* We store the response for this request. It'll later become
available to caches.match(event.request) calls, when looking
for cached responses.
*/
return cache.put(event.request, cacheCopy);
})
.then(function() {
console.log('WORKER: fetch response stored in cache.', event.request.url);
});
// Return the response so that the promise is settled in fulfillment.
return response;
}
/* When this method is called, it means we were unable to produce a response
from either the cache or the network. This is our opportunity to produce
a meaningful response even when all else fails. It's the last chance, so
you probably want to display a "Service Unavailable" view or a generic
error response.
*/
function unableToResolve () {
/* There's a couple of things we can do here.
- Test the Accept header and then return one of the `offlineFundamentals`
e.g: `return caches.match('/some/cached/image.png')`
- You should also consider the origin. It's easier to decide what
"unavailable" means for requests against your origins than for requests
against a third party, such as an ad provider.
- Generate a Response programmaticaly, as shown below, and return that.
*/
console.log('WORKER: fetch request failed in both cache and network.');
/* Here we're creating a response programmatically. The first parameter is the
response body, and the second one defines the options for the response.
*/
return new Response('<h1>Service Unavailable</h1>', {
status: 503,
statusText: 'Service Unavailable',
headers: new Headers({
'Content-Type': 'text/html'
})
});
}
})
);
});
/* The activate event fires after a service worker has been successfully installed.
It is most useful when phasing out an older version of a service worker, as at
this point you know that the new worker was installed correctly. In this example,
we delete old caches that don't match the version in the worker we just finished
installing.
*/
self.addEventListener("activate", function(event) {
/* Just like with the install event, event.waitUntil blocks activate on a promise.
Activation will fail unless the promise is fulfilled.
*/
console.log('WORKER: activate event in progress.');
event.waitUntil(
caches
/* This method returns a promise which will resolve to an array of available
cache keys.
*/
.keys()
.then(function (keys) {
// We return a promise that settles when all outdated caches are deleted.
return Promise.all(
keys
.filter(function (key) {
// Filter by keys that don't start with the latest version prefix.
return !key.startsWith(version);
})
.map(function (key) {
/* Return a promise that's fulfilled
when each outdated cache is deleted.
*/
return caches.delete(key);
})
);
})
.then(function() {
console.log('WORKER: activate completed.');
})
);
});