vuetify@2.4.2

This commit is contained in:
Andy Bunce 2021-01-08 17:20:58 +00:00
parent 482834b75c
commit dd56fecd3f
49 changed files with 547 additions and 72123 deletions

View file

@ -19,11 +19,4 @@
<natures>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
<linkedResources>
<link>
<name>_MasterFiles_</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
</linkedResources>
</projectDescription>

View file

@ -33,7 +33,7 @@ RESTXQERRORS = false
GZIP = true
```
### Other
Global `settings` provides `getItem(name)` and `setItem(name.value)`
Global `settings` provides `getItem(name)` and `setItem(name,value)`
Example usage
```
created: function () {

View file

@ -268,7 +268,7 @@
})
},
showAlert(msg){
this.alert.msg=moment().format()+" "+ msg
this.alert.msg=format(new Date())+" "+ msg
this.alert.show=true
}
},
@ -317,15 +317,17 @@
HTTP.get("status")
.then(r=>{
//console.log("status",r)
this.$auth=Object.assign(this.$auth,r.data);
this.$auth.update(r.data);
console.log("AFTER: ",this.$auth);
//this.$forceUpdate()
})
EditTabs.restore();
},
beforeCreate() {
this.$store.commit('initialiseStore');
},
beforeDestroy(){
console.log("destory-----------")
console.log("destroy-----------")
}
}

View file

@ -71,7 +71,7 @@ const GEditTabs={
},
restore(){
that=this
var that=this
this.restored=Settings.getItem('edit/items')
.then(function (v){
//console.log("items ",v)

View file

@ -4,14 +4,26 @@ const Auth={
role: null,
session: null,
created: null,
remember: null,
update(data){
Auth.user=data.user;
Auth.role=data.role
Auth.session=data.session
Auth.created=data.created
Auth.remember=data.login
},
logout(){
Auth.user="guest";
Auth.role=null;
},
install: function(Vue){
Object.defineProperty(Vue.prototype, '$auth', {
get () { return Auth }
})
},
logout(){
Auth.user="guest";
Auth.role=null;
}
};
Vue.use(Auth);

View file

@ -1,5 +1,5 @@
/**
* some vue filters, requires moment
* some vue filters, requires date-fns
* formatDate
* fromNow
* readablizeBytes
@ -8,11 +8,13 @@
//Define the date time format filter
Vue.filter("formatDate", function(date) {
return moment(date).format("MMMM D, YYYY")
var d=(date instanceof Date)?date:parseISO(date)
return format(d, "MMM d, yyyy")
});
Vue.filter("fromNow", function(date) {
return moment(date).fromNow()
var d=(date instanceof Date)?date:parseISO(date)
return formatDistanceToNow(d)
});
Vue.filter('readablizeBytes', function (bytes,decimals) {

View file

@ -8,9 +8,10 @@
<template id="qd-table">
<v-card >
<v-toolbar color="blue lighten-4">
<vp-entitylink v-if="entity" :entity="entity"></vp-entitylink>
<v-toolbar-title>{{ title }}</v-toolbar-title>
<slot name="title">
<vp-entitylink v-if="entity" :entity="entity"></vp-entitylink>
<v-toolbar-title>{{ title }}</v-toolbar-title>
</slot>
<v-spacer></v-spacer>
<v-text-field
prepend-icon="filter_list"

View file

@ -64,7 +64,7 @@ display button that invokes a save favorite form
},
favorite(){
this.$store.commit('increment')
console.log(this.$store.state.count)
console.log("vp-inc: ",this.$store.state.count)
this.exists= !this.exists
alert("save");
}

View file

@ -20,7 +20,7 @@
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>{{ msg.created | fromNow("from") }}</v-list-item-title>
<v-list-item-title>{{ msg.created | fromNow }}</v-list-item-title>
<v-list-item-subtitle v-html="msg.html">msg</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action-text>

View file

@ -16,7 +16,7 @@
>console</v-btn>
</v-toolbar>
<v-card-text>
<v-form ref="form" lazy-validation>
<v-form ref="form" v-model="valid" lazy-validation>
<v-layout row>
@ -29,6 +29,12 @@
append-outer-icon="send" @click:append-outer="source(field)"
></v-text-field>
<v-text-field v-else-if="field.type === 'xs:integer'"
type="number"
v-model.number="params[field.model]" :label="field.label && field.model"
clearable :rules="fieldrules(field)" filled
></v-text-field>
<v-switch v-else-if="field.type === 'xs:boolean'"
:label="field.label" v-model="params[field.model]">
</v-switch>
@ -40,7 +46,7 @@
</v-flex>
</v-layout>
<v-layout column >TODO
<v-layout column >TODO <span>{{valid}}</span>
</v-layout>
</v-layout>
</v-form>
@ -58,6 +64,7 @@
params: null,
description: null,
updating: false,
valid: true,
url: null,
rules: {
required: value => !!value || 'Required.'
@ -88,10 +95,9 @@
return [this.rules.required];
},
submit(){
return HTTP.post(this.endpoint, Qs.stringify(this.params));
},
valid(){
return this.$refs.form.validate()
if(this.$refs.form.validate()){
return HTTP.post(this.endpoint, Qs.stringify(this.params));
}
}
},
computed: {

View file

@ -79,7 +79,7 @@ display button that invokes a select path form
this.$emit('selectpath', {
type:this.protocols[this.type],
uri: this.xmldb,
name: "doc" + moment().format("YYYY-MM-DDThh:mm:ss") ,
name: "doc" + format(new Date(),"yyyy-MM-DDThh:mm:ss") ,
text:"Some text"
})
}

View file

@ -1,6 +1,7 @@
<package xmlns="http://expath.org/ns/pkg" name="http://expkg-zone58.github.io/ex-dotml"
abbrev="vue-poc" version="0.0.4" spec="1.0">
<package xmlns="http://expath.org/ns/pkg" name="https://github.com/apb2006/vue-poc"
abbrev="vue-poc" version=" 0.5.4" spec="1.0">
<title>vue-poc test of vue.js.</title>
<dependency name="file-walker" version="0.5.2" />
<dependency name="ex-thumbnailator" version="6.0.2" />
<dependency name="qd-resolve" version="0.0.9" />
</package>

View file

@ -115,7 +115,7 @@
pack: null,
fab: false,
links:[
{text:"3rd party components",icon:"mdi-clock",to:"about/package"},
{text:"3rd party components (package.json)",icon:"mdi-clock",to:"about/package"},
{text:"components",icon:"mdi-flag",to:"about/vue-cmps"},
{text:"routes",icon:"mdi-plus",to:"about/routes"},
{text:"routes2",icon:"mdi-plus",to:"about/routes2"}

View file

@ -97,7 +97,7 @@
</v-container>
</template>
<script>{
<script>{
data:function(){
return {

View file

@ -12,19 +12,6 @@ import module namespace dice = 'quodatum.web.dice/v4' at "../../lib/dice.xqm";
import module namespace web = 'quodatum.web.utils4' at "../../lib/webutils.xqm";
declare namespace c="http://www.w3.org/ns/xproc-step";
(:~
: history list
:)
declare
%rest:GET %rest:path("/vue-poc/api/history")
%rest:produces("application/json")
%output:method("json")
function vue-api:history( )
{
let $entity:=$entity:list("filehistory")
let $items:= $entity("data")()
return dice:response($items,$entity,web:dice())
};
(:~
: xqdoc list

View file

@ -7,7 +7,7 @@ module namespace vue-api = 'quodatum:vue.api';
import module namespace rest = "http://exquery.org/ns/restxq";
import module namespace session = "http://basex.org/modules/session";
import module namespace ufile = 'vue-poc/file' at "../../lib/file.xqm";
import module namespace resolve = 'urn:quodatum:resolve' at "../../lib/resolve.xqm";
import module namespace resolve = 'urn:quodatum:resolve' (: at "../../lib/resolve.xqm" :) ;
import module namespace mt = 'urn:quodatum:data:mimetype' at "../../lib/mimetype.xqm";
declare namespace c="http://www.w3.org/ns/xproc-step";
@ -23,10 +23,10 @@ declare
%output:method("json")
function vue-api:edit-get($url as xs:string)
{
let $u:=resolve:uri($url)=>trace("RESOLVE: ")
let $u:=resolve:parse($url)=>trace("RESOLVE: ")
return <json type="object">{
element protocol{ $u?protocol},
element uri { $u?uri },
element path { $u?path },
element mimetype { $u?fnMime() },
element data { $u?fnGet() =>serialize()}
}</json>

View file

@ -267,7 +267,7 @@
onResize(){
var el=this.$refs["ace"];
for (e of el){
for (let e of el){
//console.log("top",e.offsetTop)
var h=Math.max(1,window.innerHeight - e.offsetTop -200)
// console.log("h",h)

View file

@ -0,0 +1,30 @@
(:~
: vue-poc history api.
:
: @author Andy Bunce july-2020
:)
module namespace vue-api = 'quodatum:vue.api.history';
import module namespace entity = 'quodatum.models.generated' at "../../models.gen.xqm";
import module namespace dice = 'quodatum.web.dice/v4' at "../../lib/dice.xqm";
import module namespace web = 'quodatum.web.utils4' at "../../lib/webutils.xqm";
(:~
: history list for $type
:)
declare
%rest:GET %rest:path("/vue-poc/api/history/{$type}")
%rest:query-param("search", "{$search}")
%rest:produces("application/json")
%output:method("json")
function vue-api:history( $type as xs:string, $search )
{
let $entity:= switch ($type)
case "file" return $entity:list("history.file")
case "task" return $entity:list("history.task")
default return error()
let $items:= $entity("data")()
return dice:response($items,$entity,web:dice())
};

View file

@ -59,6 +59,7 @@
data(){
return {
items: [],
task: null,
loading: false,
q: null,
headers: [
@ -73,7 +74,8 @@
methods:{
getTasks(){
this.loading= true;
HTTP.get("data/history.task")
let params= this.task ?{params:{task: this.task}}:{}
HTTP.get("data/history.task",params)
.then(r=>{
this.items=r.data.items;
this.loading= false;
@ -81,6 +83,8 @@
}
},
created(){
this.task= this.$route.query.task
console.log("TASK: ", this.task)
this.getTasks()
}
}

View file

@ -38,7 +38,7 @@ let $user:=session:get("id","")
let $role:=if($user and user:exists($user)) then user:list-details($user)/@permission/string() else ""
return <json type="object" >
<user>{ if($user) then $user else "guest" }</user>
<permission>{$role}</permission>
<role>{$role}</role>
<session>{session:id()}</session>
<created>{session:created()}</created>
<login>{ $remember }</login>

View file

@ -2,6 +2,7 @@
<template id="namespace">
<v-container fluid>
<qd-table :headers="headers" data-uri="data/namespace" entity="namespace" item-key="xmlns">
<template v-slot:title >AAA</template>
<template v-slot:item.xmlns="{ item }" >
<router-link :to="{name:'namespace1', query:{ id: item.xmlns}}">
{{ item.xmlns }}

View file

@ -2,19 +2,13 @@
<template id="namespace1">
<v-card>
<v-toolbar >
<v-toolbar-title>
<v-breadcrumbs >
<v-breadcrumbs-item :to="{name: 'namespace'}" :exact="true">
Namespaces
</v-breadcrumbs-item>
<v-breadcrumbs-item >
{{ xmlns }}
</v-breadcrumbs-item>
</v-breadcrumbs>
</v-toolbar-title>
<v-toolbar-title>
<v-breadcrumbs-item :to="{name: 'namespace'}" :exact="true">Namespaces</v-breadcrumbs-item>
<v-breadcrumbs-divider >/</v-breadcrumbs-divider>
<v-breadcrumbs-item ><v-toolbar-title>{{ xmlns }}</v-toolbar-title></v-breadcrumbs-item>
</v-breadcrumbs>
<v-spacer></v-spacer>
<v-btn @click="getItem" icon
:loading="loading"
@ -47,7 +41,7 @@
HTTP.get("data/namespace/item",{params: {id: this.xmlns}})
.then(r=>{
this.loading=false;
console.log(r.data)
//console.log(r.data)
this.item= r.data
})
}

View file

@ -25,7 +25,7 @@
<td>session</td><td>{{ $auth.session }}</td>
</tr>
<tr>
<td>permision</td><td>{{ $auth.permission }}</td>
<td>permision</td><td>{{ $auth.role }}</td>
</tr>
</tbody>
</table>
@ -54,7 +54,7 @@
HTTP.get("status")
.then(r=>{
console.log("status",r)
this.$auth=Object.assign(this.$auth,r.data);
this.$auth.update(r.data);
//this.$forceUpdate()
})
},

View file

@ -3,6 +3,67 @@ Tasks
* Server code `rxq-tasks.xqm`
* Are defined in `taskdef.xml`
* Each run is logged to `ggg`
* Each run is logged to `vue-poc/history.xml`
* UI vp-paramform
##Process
Get task
```
{
"values": {
"string1": "default string",
"boolean1": false,
"integer1": 42
}
}
```
Post run
```
<hist:event xmlns:hist="urn:quodatum:vue-poc.history" id="ev-16" when="2020-12-02T20:34:28.475Z" user="admin">
<task task="test" url="file:///C:/Users/andy/basex.home/webapp/vue-poc/features/tasks/task/test.xq">
<param name="string1">default string</param>
<param name="boolean1">false</param>
<param name="integer1">42</param>
</task>
</hist:event>
```
Get run
##query-a
###inspect()
```
<json type="object">
<description>test of parameter type handling</description>
<updating type="boolean">true</updating>
<url>C:\Users\andy\git\vue-poc\src\vue-poc\features\tasks\task\test.xq</url>
<fields type="array">
<_ type="object">
<model>string1</model>
<label>A simple string</label>
<type>xs:string</type>
</_>
<_ type="object">
<model>boolean1</model>
<label>a boolean</label>
<type>xs:boolean</type>
</_>
<_ type="object">
<model>integer1</model>
<label>an integer</label>
<type>xs:integer</type>
</_>
</fields>
<values type="object">
<string1>default string</string1>
<boolean1 type="boolean">false</boolean1>
<integer1 type="number">42</integer1>
</values>
</json>
```

View file

@ -60,10 +60,11 @@
}
},
methods:{
submit(){
submit(){
var p=this.$refs.params.submit()
if(!p)return
this.loading=true;
this.$refs.params.submit()
.then(r=>{
p.then(r=>{
this.loading= false
this.id=r.data.id;
this.snackbar= {show:true,

View file

@ -4,7 +4,7 @@
module namespace vue-rest = 'quodatum:vue.tasks';
import module namespace query-a = 'vue-poc/query-a' at "../../lib/query-a.xqm";
import module namespace hlog = 'quodatum.data.history' at '../../lib/history.xqm';
import module namespace resolve = 'urn:quodatum:resolve' at '../../lib/resolve.xqm';
import module namespace resolve = 'urn:quodatum:resolve' (: at '../../lib/resolve.xqm' :);
declare namespace hist="urn:quodatum:vue-poc.history";
@ -40,17 +40,17 @@ declare
function vue-rest:task($task,$id)
{
let $taskdef:=doc("taskdef.xml")/tasks/task[@name=$task]
let $url:=resolve-uri($taskdef/@url)
let $h:=if($id) then hlog:get($id) else ()
let $info:= query-a:inspect($url)
let $info:= if($h) then (: use old values :)
let $v:=<values type="object">{
$h/hist:task/hist:param!element{@name}{string(.)}
}</values> =>trace("O/P")
return $info transform with {replace node ./values with $v}
else
$info
return $info transform with { insert node <url2>{ resolve:special($url) }</url2> into . }
let $url:=resolve-uri($taskdef/@url,base-uri($taskdef))
let $info:= query-a:inspect($url)
let $url2:=resolve:local($url) =>trace("resolve: ")
return $info transform with {if($id) then
let $parms:=hlog:get($id)/hist:task/hist:param
for $v in ./values/*,$p in $parms
where name($v)=$p/@name
return replace value of node $v with $p
else (),
insert node <url2>{ $url2 }</url2> into . }
};
@ -66,9 +66,11 @@ function vue-rest:runtask($task)
{
let $taskdef:=doc("taskdef.xml")/tasks/task[@name=$task]
let $url:=resolve-uri($taskdef/@url)=>trace("RUNTASK")
let $params:=query-a:params($url)
let $params:= query-a:request-bindings($url)
let $log:=<task task="{ $task }" url="{ $url }">
{ map:keys($params)!<param name="{.}">{map:get($params,.)}</param> }
{ map:for-each($params,function($k,$v){<param name="{ $k }">{ $v }</param> }) }
</task>
return (
query-a:run($url, $params, map{}),

View file

@ -0,0 +1,22 @@
(:~
: test of parameter type handling
: @author andy bunce
:)
(:~ A simple string
@default default string
:)
declare variable $string1 as xs:string external :="my test string";
(:~ a boolean
@default false
:)
declare variable $boolean1 as xs:boolean external :=false();
(:~ an integer
@default 42
:)
declare variable $integer1 as xs:integer external := 99;
update:output("done")

View file

@ -17,8 +17,8 @@ declare variable $srcpath as xs:string external :="C:\Users\andy\git\vue-poc\sr
declare variable $targetpath as xs:string external :="/vuepoc-test";
(:~ delete from database if not if import files list
@default true
@default false
:)
declare variable $deleteMissing as xs:boolean external :=true();
declare variable $deleteMissing as xs:boolean external :=false();
dbtools:sync-from-path($targetpath, $srcpath,$deleteMissing )

View file

@ -1,4 +1,8 @@
<tasks >
<task name="test" url="task/test.xq">
<title>Parameter handling test</title>
<description>Contains all parameter types</description>
</task>
<task name="model" url="model.build/tx-model.xq">
<title>Generate model.gen.xqm</title>
<description> Generate <code>model.gen.xqm</code> from files in entity folder

View file

@ -20,7 +20,7 @@
</v-btn>
<v-btn value="edit" v-if="data">
<router-link :to="{name: 'edit', query:{url: data.url} }" > <v-icon>edit</v-icon>Edit</router-link>
<router-link :to="{name: 'edit', query:{url: data.url2} }" > <v-icon>edit</v-icon>Edit</router-link>
</v-btn>
<v-btn value="history">

View file

@ -20,7 +20,7 @@ declare
function tx:run( )
{
let $url:= resolve-uri("tx-validate.xq")
return query-a:run-json($url,query-a:params($url))
return query-a:run-json($url,query-a:request-bindings($url))
};
(:~ validation settings

View file

@ -97,7 +97,8 @@ declare function dice:response($items,
: sort, slice, return json
:)
declare function dice:response($items,$entity as map(*))
{
as element(json)
{
dice:response($items,$entity,map{})
};

156
src/vue-poc/lib/map2.xqm Normal file
View file

@ -0,0 +1,156 @@
xquery version "3.0";
(:~
: Additional functions for XQuery 3.0 maps.
:
: @author Leo Woerteler &lt;leo@woerteler.de&gt;
: @version 0.1
: @version 0.2 Andy Bunce map:new -> map:merge
: @license BSD 2-Clause License
:)
module namespace map2='http://www.woerteler.de/xquery/modules/map-extras';
declare namespace map = 'http://www.w3.org/2005/xpath-functions/map';
(:~
: Inserts with a combining function. <code>insert-with($f, $key, $value, $map)</code>
: will insert <code>map:entry($key, $value)</code> into <code>$map</code> if
: <code>$key</code> does not exist in the map. If the key does exist, the function
: will insert <code>$f($new-value, $old-value)</code>.
:
: @param $f combining function
: @param $key key to insert
: @param $value value to insert
: @param $map map to insert into
: @return new map where the entry is inserted
:)
declare function map2:insert-with(
$f as function(item()*, item()*) as item()*,
$key as item(),
$value as item()*,
$map as map(*)
) as map(*) {
map:merge(
(
$map,
map:entry(
$key,
if(map:contains($map, $key)) then $f($value, $map($key))
else $value
)
)
)
};
(:~
: Inserts a key-value pair into a map. If an entry with the key <code>$key</code>
: already exists in the map, it is replaced by the new one.
:
: @param $key key to insert
: @param $value value to insert
: @param $map map to insert into
: @return map where the key-value pair was inserted
:)
declare %public function map2:insert(
$key as item(),
$value as item()*,
$map as map(*)
) as map(*) {
map:merge(
(
$map,
map:entry($key, $value)
)
)
};
(:~
: Folds the keys and values in the map using the given combining function <code>$f</code>.
: Let <code>{ $k1:$v1, ..., $kn:$vn }</code> be the key-value pairs in the
: given map <code>$map</code>, then the result is calculated by:
: <code>$f(... $f($f($start, $k1, $v1), $k2, $v2), ...), $kn, $vn)</code>
:
: @param $map map to be folded
: @param $start start value
: @param $f left-associative combining function
: @return resulting value
:)
declare %public function map2:fold(
$map as map(*),
$start as item()*,
$f as function(item()*, item(), item()*) as item()*
) as item()* {
fold-left(
map:keys($map),
$start,
function($val, $key) { $f($val, $key, $map($key)) }
)
};
(:~
: Extracts all values from the map <code>$map</code>, returning
: them in a sequence in arbitrary order.
:
: @param $map map to extract the values from
: @return sequence of values
:)
declare %public function map2:values(
$map as map(*)
) as item()* {
for-each(map:keys($map), $map)
};
(:~
: Applies the function <code>$f</code> to all values in the map.
: The keys are not touched.
:
: @param $f function to be applies to all values
: @param $map input map
: @return copy of <code>$map</code> where all values <code>$value</code>
: are replaced by <code>$f($value)</code>
:)
declare %public function map2:map(
$f as function(item()*) as item()*,
$map as map(*)
) as map(*) {
map:merge(
for $key in map:keys($map)
return map:entry($key, $f($map($key)))
)
};
(:~
: Maps a function over all entries of the map <code>$map</code>.
: Each entry <code>($key, $value)</code> in the map is replaced by a new
: entry <code>($key, $f($key, $value))</code>, the keys are not touched.
:
: @param $f function to be applies to all entries
: @param $map input map
: @return copy of <code>$map</code> where all values <code>$value</code>
: are replaced by <code>$f($key, $value)</code>
:)
declare %public function map2:map-with-key(
$f as function(item(), item()*) as item()*,
$map as map(*)
) as map(*) {
map:merge(
for $key in map:keys($map)
return map:entry($key, $f($key, $map($key)))
)
};
(:~
: Iterates over the entries of the given map and calls the given function
: with their key and bound value.
:
: @param $map the map to iterate over
: @param $f the two-argument function to call with the key and value
: @return the results of all calls to <code>$f</code> concatenated
:)
declare %public function map2:for-each-entry(
$map as map(*),
$f as function(item(), item()*) as item()*
) as item()* {
for $k in map:keys($map)
return $f($k, $map($k))
};

View file

@ -1,7 +1,7 @@
(:~
: XQuery evaluation of uri helper library
: query-a:inspect($mod as xs:anyURI) return {description:.., updating:.., url:.., fields:[{model:..,label:..,type:..}]}
: query-a:params($mod as xs:anyURI)
: request-bindings($mod as xs:anyURI)
: query-a:run($query as xs:anyURI,$params as map(*))
:
: @author Andy Bunce, 2018
@ -36,37 +36,49 @@ return <json type="object">
</_>
}</fields>
<values type="object">{
$vars!element{@name}{default_tag/string()}
$vars!element{@name}{ query-a:param-json( @type ), default_tag/string()}
}</values>
</json>
};
(:~
:convert type
:convert value to XQuery for given type
:)
declare function query-a:cast($val as item(),$type as xs:string)
as item()
{
switch($type)
case "xs:boolean" return $val="true"
case "xs:integer" return xs:int($val)
case "xs:anyURI" return xs:anyURI($val)
default return $val
};
(:~
:json type for xs type
:)
declare function query-a:param-json($type as xs:string)
as attribute(type)?
{
switch($type)
case "xs:boolean" return attribute type {"boolean"}
case "xs:integer" return attribute type {"number"}
default return ()
};
(:~
: @return map of request parameter names typed
: @return map of request parameter names that are external variables, map{name:..,value}
:)
declare
function query-a:params($mod as xs:anyURI)
function query-a:request-bindings($mod as xs:anyURI)
as map(*)
{
let $vars:=inspect:module($mod=>trace("params"))/variable[@external="true"]
return map:merge(
$vars[@name=request:parameter-names()]!
map:entry(@name,query-a:cast(request:parameter(@name/string()),@type))
)
let $vars:=inspect:module($mod)/variable[@external="true"]
let $f:=function($name, $type){ map:entry($name,
query-a:cast(request:parameter($name/string()),$type)
)}
return
$vars[@name=request:parameter-names()]! $f(@name,@type)=>map:merge()
};
(:~

View file

@ -1,89 +0,0 @@
(:~
: resolve uri tools supports protocols: "xmldb" "webfile"
result map{
"protocol": one of "file", "xmldb"
"uri":
"fnGet": function#0 to get
}
@since Sept 2020
@author Andy Bunce
@copyright Quodatum Ltd
@version 0.0.4
:)
module namespace resolve = 'urn:quodatum:resolve';
import module namespace web = 'http://basex.org/modules/web';
(:~
:
:)
declare function resolve:uri($uri as xs:string)
as map(*){
let $t:=tokenize($uri,':')
let $protocol:= if(count($t) gt 1 ) then head($t) else ()
let $isDrive:= matches($protocol,"^[A-Za-z]$")
let $path:= tail($t)=>string-join(":")
let $uri:=switch ($protocol)
case "webfile"
return let $webroot:=db:system()/globaloptions/webpath/string()
return concat($webroot,$path)
case "xmldb"
return $path
case "file"
return web:decode-url($path)=>replace("^//*","")=>replace("/","\" || file:dir-separator())
default
return if ($isDrive) then $uri else $path
let $protocol:= switch (true())
case $isDrive
return "file"
case $protocol = "webfile"
return "file"
default
return $protocol
let $_:=trace($protocol,"protocol: ")
let $getfn:= switch ($protocol)
case "xmldb"
return function(){ doc($uri)}
default
return function(){ fetch:text($uri)}
let $getct:= switch ($protocol)
case "xmldb"
return function(){ "text/xml" }
default
return function(){ fetch:content-type($uri)}
return map{
"protocol": $protocol,
"uri": $uri,
"isDrive": $isDrive,
"fnGet": $getfn,
"fnMime": $getct
}
};
declare function resolve:meta($uri )
as map(*){
let $uri:=resolve:analyse($uri)
let $size:=50
return map:merge(($uri,map{"size": $size}))
};
declare function resolve:analyse($uri)
as map(*){
typeswitch($uri)
case map(*) return $uri
case xs:string return resolve:uri($uri)
default return error(xs:QName("resolve:analyse"),"type not supported")
};
declare function resolve:special($uri as xs:string)
as xs:string{
let $webroot:=db:system()/globaloptions/webpath/string()
let $_:=trace(($uri,$webroot),"special")
return $uri
};

View file

@ -105,8 +105,10 @@ let $feats:=$files!vue:feature-build(.,false())
let $files:= fw:directory-list($COMPONENTS,map{"include-filter":".*\.vue"})
//c:file/@name/resolve-uri(.,base-uri(.))
let $comps:=$files!vue:feature-build(.,true())
let $comment:="// generated " || current-dateTime() || "&#xA;&#xD;"
let $extra:="import { parseISO, formatDistanceToNow, format } from 'https://cdn.jsdelivr.net/npm/date-fns@2.16.1/+esm';
console.log(formatDistanceToNow(new Date(2014, 1, 11), {}))
"
let $comment:="// generated " || current-dateTime() || "&#xA;&#xD;" || $extra
return file:write-text($DEST,string-join(($comment,
$comps,
$js!vue:js-test(.),

View file

@ -1,5 +1,5 @@
(: entity access maps
: auto generated from xml files in entities folder at: 2020-10-26T12:23:41.567Z
: auto generated from xml files in entities folder at: 2020-11-27T21:35:19.672Z
:)
module namespace entity = 'quodatum.models.generated';

View file

@ -1,6 +1,6 @@
{
"name": "vue-poc",
"version": "0.5.3@2020-10-08",
"version": "0.5.4@2021-01-04",
"description": "App framework experiments, Frontend vuetify, backend: basex",
"dependencies": {
"ace-builds": "1.4.12",
@ -11,10 +11,11 @@
"vue-treeselect": "0.0.29",
"google-material": "0.0.0",
"js-beautify": "1.9.0",
"axios": "0.19.2",
"axios": "0.21.1",
"qs": "6.4.0",
"localforage": "1.7.1",
"momentjs": "2.24.0",
"date-fns": "2.16.1",
"@koumoul/vjsf": "1.14.0",
"prism": "1.15.0",
"vue-prism-component": "1.1.1",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,7 @@
// generated 2020-11-13T11:31:22.679Z
// generated 2021-01-04T22:50:16.06Z
import { parseISO, formatDistanceToNow, format } from 'https://cdn.jsdelivr.net/npm/date-fns@2.16.1/+esm';
console.log(formatDistanceToNow(new Date(2014, 1, 11), {}))
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-autoheight.vue
Vue.component('qd-autoheight',{template:`
<v-layout style="height:200px;overflow:hidden;" row wrap ref="auto" v-resize="onResize" class="green">
@ -534,9 +536,10 @@ Vue.component('qd-search',{template:`
Vue.component('qd-table',{template:`
<v-card>
<v-toolbar color="blue lighten-4">
<vp-entitylink v-if="entity" :entity="entity"></vp-entitylink>
<v-toolbar-title>{{ title }}</v-toolbar-title>
<slot name="title">
<vp-entitylink v-if="entity" :entity="entity"></vp-entitylink>
<v-toolbar-title>{{ title }}</v-toolbar-title>
</slot>
<v-spacer></v-spacer>
<v-text-field prepend-icon="filter_list" label="Filter..." single-line hide-details v-model="query.filter" clearable></v-text-field>
@ -860,7 +863,7 @@ Vue.component('vp-favorite',{template:`
},
favorite(){
this.$store.commit('increment')
console.log(this.$store.state.count)
console.log("vp-inc: ",this.$store.state.count)
this.exists= !this.exists
alert("save");
}
@ -949,7 +952,7 @@ Vue.component('vp-notifications',{template:`
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>{{ msg.created | fromNow("from") }}</v-list-item-title>
<v-list-item-title>{{ msg.created | fromNow }}</v-list-item-title>
<v-list-item-subtitle v-html="msg.html">msg</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action-text>
@ -1006,7 +1009,7 @@ Vue.component('vp-paramform',{template:`
<v-btn @click="zlog()">console</v-btn>
</v-toolbar>
<v-card-text>
<v-form ref="form" lazy-validation>
<v-form ref="form" v-model="valid" lazy-validation>
<v-layout row>
@ -1015,6 +1018,8 @@ Vue.component('vp-paramform',{template:`
<v-text-field v-if="field.type === 'xs:anyURI'" v-model="params[field.model]" :label="field.label &amp;&amp; field.model" clearable :rules="fieldrules(field)" filled append-outer-icon="send" @click:append-outer="source(field)"></v-text-field>
<v-text-field v-else-if="field.type === 'xs:integer'" type="number" v-model.number="params[field.model]" :label="field.label &amp;&amp; field.model" clearable :rules="fieldrules(field)" filled></v-text-field>
<v-switch v-else-if="field.type === 'xs:boolean'" :label="field.label" v-model="params[field.model]">
</v-switch>
@ -1023,7 +1028,7 @@ Vue.component('vp-paramform',{template:`
</v-flex>
</v-layout>
<v-layout column>TODO
<v-layout column>TODO <span>{{valid}}</span>
</v-layout>
</v-layout>
</v-form>
@ -1040,6 +1045,7 @@ Vue.component('vp-paramform',{template:`
params: null,
description: null,
updating: false,
valid: true,
url: null,
rules: {
required: value => !!value || 'Required.'
@ -1070,10 +1076,9 @@ Vue.component('vp-paramform',{template:`
return [this.rules.required];
},
submit(){
return HTTP.post(this.endpoint, Qs.stringify(this.params));
},
valid(){
return this.$refs.form.validate()
if(this.$refs.form.validate()){
return HTTP.post(this.endpoint, Qs.stringify(this.params));
}
}
},
computed: {
@ -1164,7 +1169,7 @@ Vue.component('vp-selectpath',{template:`
this.$emit('selectpath', {
type:this.protocols[this.type],
uri: this.xmldb,
name: "doc" + moment().format("YYYY-MM-DDThh:mm:ss") ,
name: "doc" + format(new Date(),"yyyy-MM-DDThh:mm:ss") ,
text:"Some text"
})
}
@ -1448,14 +1453,26 @@ const Auth={
role: null,
session: null,
created: null,
remember: null,
update(data){
Auth.user=data.user;
Auth.role=data.role
Auth.session=data.session
Auth.created=data.created
Auth.remember=data.login
},
logout(){
Auth.user="guest";
Auth.role=null;
},
install: function(Vue){
Object.defineProperty(Vue.prototype, '$auth', {
get () { return Auth }
})
},
logout(){
Auth.user="guest";
Auth.role=null;
}
};
Vue.use(Auth);
@ -1535,7 +1552,7 @@ const GEditTabs={
},
restore(){
that=this
var that=this
this.restored=Settings.getItem('edit/items')
.then(function (v){
//console.log("items ",v)
@ -1566,7 +1583,7 @@ const GEditTabs={
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/filters.js
/**
* some vue filters, requires moment
* some vue filters, requires date-fns
* formatDate
* fromNow
* readablizeBytes
@ -1575,11 +1592,13 @@ const GEditTabs={
//Define the date time format filter
Vue.filter("formatDate", function(date) {
return moment(date).format("MMMM D, YYYY")
var d=(date instanceof Date)?date:parseISO(date)
return format(d, "MMM d, yyyy")
});
Vue.filter("fromNow", function(date) {
return moment(date).fromNow()
var d=(date instanceof Date)?date:parseISO(date)
return formatDistanceToNow(d)
});
Vue.filter('readablizeBytes', function (bytes,decimals) {
@ -2371,7 +2390,7 @@ const Basexlogdate1=Vue.extend({template:`
</v-card>
</v-container>
`,
data:function(){
return {
@ -4072,7 +4091,7 @@ const Tabs=Vue.extend({template:`
onResize(){
var el=this.$refs["ace"];
for (e of el){
for (let e of el){
//console.log("top",e.offsetTop)
var h=Math.max(1,window.innerHeight - e.offsetTop -200)
// console.log("h",h)
@ -4596,6 +4615,7 @@ const Taskhistory=Vue.extend({template:`
data(){
return {
items: [],
task: null,
loading: false,
q: null,
headers: [
@ -4610,7 +4630,8 @@ const Taskhistory=Vue.extend({template:`
methods:{
getTasks(){
this.loading= true;
HTTP.get("data/history.task")
let params= this.task ?{params:{task: this.task}}:{}
HTTP.get("data/history.task",params)
.then(r=>{
this.items=r.data.items;
this.loading= false;
@ -4618,6 +4639,8 @@ const Taskhistory=Vue.extend({template:`
}
},
created(){
this.task= this.$route.query.task
console.log("TASK: ", this.task)
this.getTasks()
}
}
@ -6469,6 +6492,7 @@ const Taxonomy=Vue.extend({template:`
const Namespace=Vue.extend({template:`
<v-container fluid>
<qd-table :headers="headers" data-uri="data/namespace" entity="namespace" item-key="xmlns">
<template v-slot:title>AAA</template>
<template v-slot:item.xmlns="{ item }">
<router-link :to="{name:'namespace1', query:{ id: item.xmlns}}">
{{ item.xmlns }}
@ -6503,22 +6527,16 @@ const Namespace=Vue.extend({template:`
const Namespace1=Vue.extend({template:`
<v-card>
<v-toolbar>
<v-toolbar-title>
<v-breadcrumbs>
<v-breadcrumbs-item :to="{name: 'namespace'}" :exact="true">
Namespaces
</v-breadcrumbs-item>
<v-breadcrumbs-item>
{{ xmlns }}
</v-breadcrumbs-item>
</v-breadcrumbs>
</v-toolbar-title>
<v-toolbar-title>
<v-breadcrumbs-item :to="{name: 'namespace'}" :exact="true">Namespaces</v-breadcrumbs-item>
<v-breadcrumbs-divider>/</v-breadcrumbs-divider>
<v-breadcrumbs-item><v-toolbar-title>{{ xmlns }}</v-toolbar-title></v-breadcrumbs-item>
</v-breadcrumbs>
<v-spacer></v-spacer>
<v-btn @click="getItem" icon :loading="loading" :disabled="loading"><v-icon>refresh</v-icon></v-btn>
</v-toolbar-title></v-toolbar>
</v-toolbar>
<v-container fluid grid-list-md>
@ -6544,7 +6562,7 @@ const Namespace1=Vue.extend({template:`
HTTP.get("data/namespace/item",{params: {id: this.xmlns}})
.then(r=>{
this.loading=false;
console.log(r.data)
//console.log(r.data)
this.item= r.data
})
}
@ -7502,7 +7520,7 @@ const Session=Vue.extend({template:`
<td>session</td><td>{{ $auth.session }}</td>
</tr>
<tr>
<td>permision</td><td>{{ $auth.permission }}</td>
<td>permision</td><td>{{ $auth.role }}</td>
</tr>
</tbody>
</table>
@ -7529,7 +7547,7 @@ const Session=Vue.extend({template:`
HTTP.get("status")
.then(r=>{
console.log("status",r)
this.$auth=Object.assign(this.$auth,r.data);
this.$auth.update(r.data);
//this.$forceUpdate()
})
},
@ -7948,10 +7966,11 @@ const Runtask=Vue.extend({template:`
}
},
methods:{
submit(){
submit(){
var p=this.$refs.params.submit()
if(!p)return
this.loading=true;
this.$refs.params.submit()
.then(r=>{
p.then(r=>{
this.loading= false
this.id=r.data.id;
this.snackbar= {show:true,
@ -8078,7 +8097,7 @@ const Tasks1=Vue.extend({template:`
</v-btn>
<v-btn value="edit" v-if="data">
<router-link :to="{name: 'edit', query:{url: data.url} }"> <v-icon>edit</v-icon>Edit</router-link>
<router-link :to="{name: 'edit', query:{url: data.url2} }"> <v-icon>edit</v-icon>Edit</router-link>
</v-btn>
<v-btn value="history">
@ -9149,7 +9168,7 @@ const Vuepoc=Vue.extend({template:`
})
},
showAlert(msg){
this.alert.msg=moment().format()+" "+ msg
this.alert.msg=format(new Date())+" "+ msg
this.alert.show=true
}
},
@ -9198,15 +9217,17 @@ const Vuepoc=Vue.extend({template:`
HTTP.get("status")
.then(r=>{
//console.log("status",r)
this.$auth=Object.assign(this.$auth,r.data);
this.$auth.update(r.data);
console.log("AFTER: ",this.$auth);
//this.$forceUpdate()
})
EditTabs.restore();
},
beforeCreate() {
this.$store.commit('initialiseStore');
},
beforeDestroy(){
console.log("destory-----------")
console.log("destroy-----------")
}
}

View file

@ -10,7 +10,7 @@
<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 rel="stylesheet" href="//cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" >
<link rel="stylesheet" href="//unpkg.com/vuetify@2.3.16/dist/vuetify.min.css" type="text/css"/>
<link rel="stylesheet" href="//unpkg.com/vuetify@2.4.2/dist/vuetify.min.css" type="text/css"/>
<link rel="stylesheet" href="//unpkg.com/@riophae/vue-treeselect@0.0.29/dist/vue-treeselect.min.css"/>
<link rel="stylesheet" href="/vue-poc/ui/prism/prism.css" type="text/css"/>
<link rel="stylesheet" href="//unpkg.com/leaflet@1.6.0/dist/leaflet.css"/>
@ -36,10 +36,10 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.js" crossorigin="anonymous"></script>
<script src="//unpkg.com/vue-router@3.1.6/dist/vue-router.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.21.1/axios.js" crossorigin="anonymous"></script>
<script src="//unpkg.com/vuex@3.1.0/dist/vuex.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/qs/6.4.0/qs.js" crossorigin="anonymous" ></script>
<script src="//unpkg.com/vuetify@2.3.16/dist/vuetify.min.js" crossorigin="anonymous"></script>
<script src="//unpkg.com/vuetify@2.4.2/dist/vuetify.min.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-language_tools.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-linking.js" crossorigin="anonymous" charset="utf-8"></script>
@ -65,7 +65,7 @@
<script src="//unpkg.com/vue-native-websocket@2.0.8/dist/build.js" crossorigin="anonymous"></script>
<script src="/vue-poc/ui/svg/d3-svg.js"></script>
<script src="/vue-poc/ui/state.js"></script>
<script src="/vue-poc/ui/app-gen.js"></script>
<script src="/vue-poc/ui/app-gen.js" type="module" ></script>
<script>
if('serviceWorker' in navigator && false) {

View file

@ -1,11 +1,56 @@
//
const store = new Vuex.Store({
state: {
count: 0
count: 92,
"edit/currentId": "?",
"edit/query": "todo edit/query",
"features/serviceworker": false,
"images/thumbtask":`
<thumbnail>
<size width="200" height="200"/>
<filters>
<colorize color="green" alpha=".5"/>
<caption position="CENTER">Some Text here</caption>
<rotate angle="15"/>
<canvas height="300" width="300" position="TOP_LEFT" color="yellow"/>
</filters>
<output format="gif"/>
</thumbnail>
`,
"settings/ace": {
theme: "github",
themeDark: "chaos",
keybinding: "ace",
fontsize: 16,
enableSnippets:true,
enableBasicAutocompletion:true,
enableLiveAutocompletion:true
},
"settings/dark": false
},
mutations: {
increment (state) {
state.count++
}
},
initialiseStore(state) {
// Check if the ID exists
var s=localStorage.getItem('store')
if(s) {
// Replace the state object with the stored item
this.replaceState(
Object.assign(state, JSON.parse(s))
);
}
console.log("initialiseStore: ",s)
}
}
})
})
store.subscribe((mutation, state) => {
// Store the state object as a JSON string
localStorage.setItem('store', JSON.stringify(state));
console.log("store subscribe")
});

View file

@ -0,0 +1,14 @@
declare base-uri "../../../../src/vue-poc/";
(: test query-a.xqm with task :)
import module namespace query-a = 'vue-poc/query-a' at "lib/query-a.xqm";
declare variable $url:= "features/tasks/taskdef.xml";
declare variable $taskdef:= doc($url)/tasks/task[@name='import2'];
(: let $url:=resolve-uri($taskdef/@url,base-uri($taskdef)) :)
let $url:="C:\Users\andy\git\vue-poc\src\vue-poc\features\validate\tx-validate.xq"
let $url:="C:\Users\andy\git\vue-poc\src\vue-poc\features\tasks\task\test.xq"
let $info:= query-a:inspect($url)
let $v:= $info/values/*
let $f:=function($v){element {name($v)}{query-a:param-json($v/@type),string($v)}}
return $info