diff --git a/assets/js/common.ts b/assets/js/common.ts index 3faf883..3d85570 100644 --- a/assets/js/common.ts +++ b/assets/js/common.ts @@ -58,7 +58,9 @@ function Data(name, action, domain: string): object { action: action, // (default) action of outgoing message domain: domain, // domain of incoming/outgoing message data: {}, // model (2-way data store) - exec // default function to execute upon button click + mode: 'view', + exec, // default function to execute upon button click + chmode } this.components[name] = comp return comp @@ -66,6 +68,10 @@ function Data(name, action, domain: string): object { // appdata and component method definitions +function chmode(action: string) { + this.mode = action +} + function exec(action: string) { action = action || this.action const data = this.data diff --git a/assets/js/main-xp-bootstrap.ts b/assets/js/main-xp-bootstrap.ts new file mode 100644 index 0000000..aaddb0d --- /dev/null +++ b/assets/js/main-xp-bootstrap.ts @@ -0,0 +1,7 @@ +import * as bootstrap from 'bootstrap' +export { bootstrap } +import { api, polling } from './settings' +import { config, pvapp } from './common' + +pvapp.run(config(api, polling)) + diff --git a/assets/js/main-xp-mermaid.ts b/assets/js/main-xp-mermaid.ts new file mode 100644 index 0000000..2bafbc3 --- /dev/null +++ b/assets/js/main-xp-mermaid.ts @@ -0,0 +1,7 @@ +import mermaid from 'mermaid' +import { api, polling } from './settings' +import { config, pvapp } from './common' + +mermaid.initialize({ startOnLoad: true }) +pvapp.run(config(api, polling)) + diff --git a/exampleSite/content/app/login.md b/exampleSite/content/app/login.md index 9089fb0..a5a0f7b 100644 --- a/exampleSite/content/app/login.md +++ b/exampleSite/content/app/login.md @@ -19,7 +19,7 @@ cyberscopes example site - Login Form Login: {{< pv/input-textline name="login" attrs="autofocus" >}} Password: {{< pv/input-textline type="password" name="password" >}} - {{< pv/button label="Login" >}} + {{< pv/button label="Login" action="login" >}} {{< /pv/fieldset >}} diff --git a/exampleSite/content/app/person.md b/exampleSite/content/app/person.md index e1ab58b..b534d7a 100644 --- a/exampleSite/content/app/person.md +++ b/exampleSite/content/app/person.md @@ -5,7 +5,7 @@ img: pageid: app_form_person domains: [App] topics: [Examples] -date: 2023-03-16 +date: 2023-03-19 author: helmutm draft: false weight: 100 @@ -13,14 +13,17 @@ weight: 100 cyberscopes example site - view / edit person (user) data. -{{< pv/fieldset >}} +{{< pv/fieldset name="person" >}} + {{< pv/tabs-mode >}} Id: {{< pv/input-textline name="id" defexpr="conf.itemid" >}} First Name: {{< pv/input-textline name="firstname" attrs="autofocus" >}} Last Name: {{< pv/input-textline name="lastname" >}} Email: {{< pv/input-textline name="email" default="hm@cy55.de" >}} - {{< pv/button action="save" >}} + {{< pv/button mode="edit" >}} + {{< pv/button mode="query" action="query" label="Query" >}} +
{{< pv/display linkto="data.id" expr="`${data.firstname} ${data.lastname}`.trim() || '???'" >}}
diff --git a/layouts/shortcodes/pv/button.html b/layouts/shortcodes/pv/button.html index e86c3a4..2b9e670 100644 --- a/layouts/shortcodes/pv/button.html +++ b/layouts/shortcodes/pv/button.html @@ -3,8 +3,10 @@ {{- $label := .Get "label" | default (title $name) -}} {{- $exec := .Get "exec" | default "exec" -}} {{- $action := .Get "action" | default "" -}} -
- -
+{{- $mode := .Get "mode" | default "view" -}} + diff --git a/layouts/shortcodes/pv/input-textline.html b/layouts/shortcodes/pv/input-textline.html index 01398ce..a5d1346 100644 --- a/layouts/shortcodes/pv/input-textline.html +++ b/layouts/shortcodes/pv/input-textline.html @@ -5,6 +5,7 @@
diff --git a/layouts/shortcodes/pv/tabs-mode.md b/layouts/shortcodes/pv/tabs-mode.md new file mode 100644 index 0000000..c9b46ac --- /dev/null +++ b/layouts/shortcodes/pv/tabs-mode.md @@ -0,0 +1,15 @@ + +