@bexis2/bexis2-core-ui 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,9 @@
1
1
  # bexis-core-ui
2
+ ## v0.2.1
3
+ > refactoring based on naming conventions (https://bexis2.github.io/bexis2-core-ui/code/naming/)
4
+
5
+ - fix issue in index.ts file for export components
6
+
2
7
  ## v0.2.0
3
8
  > refactoring based on naming conventions (https://bexis2.github.io/bexis2-core-ui/code/naming/)
4
9
 
@@ -10,26 +10,23 @@ function onMouseOver() {
10
10
  }
11
11
  }
12
12
  function onMouseOut() {
13
- if (help) {
14
- helpStore.hide();
15
- }
16
13
  }
17
- </script>
18
- <div {id} on:mouseover={onMouseOver} on:mouseout={onMouseOut}>
19
- <label class="label">
20
- <span
21
- >{label}
22
- {#if required} <span class="text-sm text-red-600">*</span> {/if}
23
- </span>
24
- <slot />
25
- {#if feedback}
26
- <span class="text-sm text-error-600">
27
- <ul>
28
- {#each feedback as message}
29
- <li>{message}</li>
30
- {/each}
31
- </ul>
32
- </span>
33
- {/if}
34
- </label>
35
- </div>
14
+ </script>
15
+ <div {id} on:mouseover={onMouseOver} on:mouseout={onMouseOut}>
16
+ <label class="label">
17
+ <span
18
+ >{label}
19
+ {#if required} <span class="text-sm text-red-600">*</span> {/if}
20
+ </span>
21
+ <slot />
22
+ {#if feedback}
23
+ <span class="text-sm text-error-600">
24
+ <ul>
25
+ {#each feedback as message}
26
+ <li>{message}</li>
27
+ {/each}
28
+ </ul>
29
+ </span>
30
+ {/if}
31
+ </label>
32
+ </div>
@@ -0,0 +1,33 @@
1
+ <script>import Fa from "svelte-fa/src/fa.svelte";
2
+ import { faQuestion } from "@fortawesome/free-solid-svg-icons";
3
+ import { goTo } from "../../services/BaseCaller";
4
+ export let links = [];
5
+ import { popup } from "@skeletonlabs/skeleton";
6
+ import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floating-ui/dom";
7
+ import { storePopup } from "@skeletonlabs/skeleton";
8
+ storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
9
+ export let note;
10
+ const noteSettings = {
11
+ event: "click",
12
+ target: "noteTarget",
13
+ placement: "bottom"
14
+ };
15
+ </script>
16
+ <div class="text-right p-2">
17
+ {#if note}
18
+ <span class="chip variant-soft hover:variant-filled" use:popup={noteSettings} >
19
+ <span><Fa icon={faQuestion}/></span>
20
+ </span>
21
+
22
+ <div class="card p-4 variant-filled-primary w-60 z-50" data-popup="noteTarget">
23
+ {note}
24
+ </div>
25
+ {/if}
26
+
27
+ {#each links as link}
28
+ <span class="chip variant-soft hover:variant-filled" on:click={()=>goTo(link.url,false)}>
29
+ <span>{link.label}</span>
30
+ </span>
31
+ {/each}
32
+ </div>
33
+
@@ -0,0 +1,18 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { linkType } from "../../models/Models";
3
+ declare const __propDef: {
4
+ props: {
5
+ links?: linkType[] | undefined;
6
+ note: string;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export type DocsProps = typeof __propDef.props;
14
+ export type DocsEvents = typeof __propDef.events;
15
+ export type DocsSlots = typeof __propDef.slots;
16
+ export default class Docs extends SvelteComponentTyped<DocsProps, DocsEvents, DocsSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1,15 @@
1
+ <script>import { onMount } from "svelte";
2
+ import { getFooter } from "./PageCaller";
3
+ let content = "";
4
+ $:
5
+ content;
6
+ onMount(async () => {
7
+ console.log("footer");
8
+ content = await getFooter();
9
+ console.log(content);
10
+ });
11
+ </script>
12
+
13
+ {#if content!=undefined}
14
+ {@html content}
15
+ {/if}
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type FooterProps = typeof __propDef.props;
10
+ export type FooterEvents = typeof __propDef.events;
11
+ export type FooterSlots = typeof __propDef.slots;
12
+ export default class Footer extends SvelteComponentTyped<FooterProps, FooterEvents, FooterSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,14 @@
1
+ <script>import { onMount } from "svelte";
2
+ import { getHeader } from "./PageCaller";
3
+ let content = "";
4
+ $:
5
+ content;
6
+ onMount(async () => {
7
+ console.log("header");
8
+ content = await getHeader();
9
+ console.log(content);
10
+ });
11
+ </script>
12
+ {#if content!=undefined}
13
+ {@html content}
14
+ {/if}
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type HeaderProps = typeof __propDef.props;
10
+ export type HeaderEvents = typeof __propDef.events;
11
+ export type HeaderSlots = typeof __propDef.slots;
12
+ export default class Header extends SvelteComponentTyped<HeaderProps, HeaderEvents, HeaderSlots> {
13
+ }
14
+ export {};
@@ -1,38 +1,52 @@
1
1
  <script lang=ts>import { helpStore } from "../../stores/pageStores";
2
- let Value;
2
+ import Fa from "svelte-fa/src/fa.svelte";
3
+ import { faQuestion } from "@fortawesome/free-solid-svg-icons";
4
+ import { popup } from "@skeletonlabs/skeleton";
5
+ import delay from "delay";
6
+ export let active = false;
7
+ let hs;
3
8
  $:
4
9
  helpStore.subscribe((value) => {
5
- Value = value;
10
+ hs = value;
6
11
  });
7
- let helpItem;
12
+ let helpItem = { id: void 0, name: "", description: "" };
8
13
  $:
9
- helpItem = getHelpItem(Value);
10
- function getHelpItem(value) {
11
- if (value != void 0 && value.helpItems != void 0 && value.itemId != void 0) {
12
- return value.itemId == "" ? { id: void 0, name: "", description: "" } : value.helpItems.find((h) => h.id === value.itemId);
14
+ helpItem = active === true ? hs.itemId == "" ? { id: void 0, name: "", description: "" } : hs.helpItems.find((h) => h.id === hs.itemId) : { id: void 0, name: "", description: "" };
15
+ const helpClick = {
16
+ event: "click",
17
+ target: "helpTarget",
18
+ placement: "top",
19
+ state: (s) => {
20
+ if (s != true) {
21
+ resetItemId();
22
+ }
13
23
  }
14
- return { id: void 0, name: "", description: "" };
24
+ };
25
+ async function resetItemId() {
26
+ await delay(100);
27
+ helpStore.resetItemId();
15
28
  }
16
- window.origin;
17
29
  </script>
18
- {#if helpItem && helpItem.id}
19
- <div class="p-5 w-96 space-y-4" id={helpItem.id}>
20
- <h3 class="h3">{ helpItem.name }</h3>
21
- <p>{@html helpItem.description }</p>
22
- {#if helpItem.link}
23
- <p><a href="{helpItem.link}">... read more</a></p>
24
- {/if}
25
- </div>
26
- {:else}
27
- <div class="p-5 w-96 space-y-4">
28
- <h3 class="h3">Help</h3>
29
- <div class="space-y-4">
30
- <div class="grid grid-cols-3 gap-8">
31
- <div class="placeholder animate-pulse" />
32
- <div class="placeholder animate-pulse" />
33
- <div class="placeholder animate-pulse" />
34
- </div>
35
- <div class="placeholder w-28 animate-pulse" />
36
- </div>
37
- </div>
38
- {/if}
30
+
31
+ {#if active}
32
+ <button id="helpButton"class="chip variant-filled-warning fixed bottom-5 right-10 shadow-md" use:popup={helpClick}><Fa icon={faQuestion}/></button>
33
+
34
+ <div class="card bg-primary-300 border-solid border-2 border-primary-500 shadow-md" data-popup="helpTarget">
35
+ {#if helpItem && helpItem.id}
36
+ <div class="p-5 w-96 space-y-4" id={"helpPopup." + helpItem.id}>
37
+ <h3 class="h3">{ helpItem.name }</h3>
38
+ <p>{@html helpItem.description }</p>
39
+ {#if helpItem.link}
40
+ <p><a class="anchor" href="{helpItem.link}">... read more</a></p>
41
+ {/if}
42
+ </div>
43
+ {:else}
44
+ <div class="p-5 w-96 space-y-4" id="helpPopup">
45
+ <h3 class="h3">Help</h3>
46
+ <p>Hover over the Element, you like to know more about.</p>
47
+ </div>
48
+ {/if}
49
+ <div class="arrow variant-filled-primary" />
50
+ </div>
51
+ {/if}
52
+
@@ -2,7 +2,7 @@
2
2
  /** @typedef {typeof __propDef.events} HelpEvents */
3
3
  /** @typedef {typeof __propDef.slots} HelpSlots */
4
4
  export default class Help extends SvelteComponentTyped<{
5
- [x: string]: never;
5
+ active?: boolean | undefined;
6
6
  }, {
7
7
  [evt: string]: CustomEvent<any>;
8
8
  }, {}> {
@@ -13,7 +13,7 @@ export type HelpSlots = typeof __propDef.slots;
13
13
  import { SvelteComponentTyped } from "svelte";
14
14
  declare const __propDef: {
15
15
  props: {
16
- [x: string]: never;
16
+ active?: boolean | undefined;
17
17
  };
18
18
  events: {
19
19
  [evt: string]: CustomEvent<any>;
@@ -1,14 +1,16 @@
1
1
  <script>import { onMount } from "svelte";
2
+ import { AppShell, AppBar } from "@skeletonlabs/skeleton";
2
3
  import Menu from "./menu/Menu.svelte";
4
+ import Footer from "./Footer.svelte";
5
+ import Header from "./Header.svelte";
3
6
  import Help from "./Help.svelte";
4
7
  import Breadcrumb from "./breadcrumb/Breadcrumb.svelte";
5
- import { popup } from "@skeletonlabs/skeleton";
6
8
  import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floating-ui/dom";
7
9
  import { storePopup } from "@skeletonlabs/skeleton";
8
10
  import { breadcrumbStore } from "../../stores/pageStores";
9
11
  storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
10
- import { AppShell } from "@skeletonlabs/skeleton";
11
12
  import { helpStore } from "../../stores/pageStores";
13
+ import Docs from "./Docs.svelte";
12
14
  export let title = "";
13
15
  export let note = "";
14
16
  export let links = [];
@@ -16,28 +18,40 @@ export let menu = true;
16
18
  export let footer = true;
17
19
  export let help = false;
18
20
  onMount(async () => {
19
- console.log("on mount page ");
21
+ console.log("page");
20
22
  breadcrumbStore.clean();
21
23
  breadcrumbStore.addItem({ label: title, link: window.location.pathname });
22
24
  });
23
- const popupClick = {
24
- event: "click",
25
- target: "popupClick",
26
- placement: "top"
27
- };
28
25
  </script>
29
26
 
30
- {#if true}
31
- <Menu/>
32
- {/if}
33
- <Breadcrumb {title}/>
27
+ <AppShell>
28
+
29
+ <!--header-->
30
+ <svelte:fragment slot="header">
31
+ <AppBar padding="0" spacing="space-y-0" background="white">
32
+ <svelte:fragment slot="headline">
33
+ <Header/>
34
+ {#if true}
35
+ <Menu/>
36
+ {/if}
37
+
38
+ <div class="grid grid-cols-2">
39
+ <Breadcrumb {title}/>
40
+ <Docs {links} {note}/>
41
+ </div>
42
+ </svelte:fragment>
43
+ </AppBar>
44
+ </svelte:fragment>
45
+
46
+
47
+ <svelte:fragment slot="footer">
48
+ <Footer/>
49
+ </svelte:fragment>
50
+
51
+
34
52
 
35
53
  <div class="px-5 grid gap-5 content-center" >
36
54
 
37
- <!-- <h3 class="h3">{title}</h3>
38
- {#if note}
39
- <blockquote class="blockquote">{note}</blockquote>
40
- {/if} -->
41
55
 
42
56
  <slot name="description" />
43
57
 
@@ -49,42 +63,35 @@ const popupClick = {
49
63
  </div>
50
64
  {/if}
51
65
 
52
- <div class="w-full flex-initial items-center justify-center pt-1 px-3">
53
- <slot name="middle" />
54
- {#if links.length>0}
55
- <div class="py-5">
56
- {#each links as link}
57
- <a class="chip variant-ringed" href={link.url}>{link.label}</a>
58
- {/each}
59
- </div>
60
- {/if}
61
- <slot/>
62
- </div>
63
- {#if $$slots.right || help}
64
- <div class="w-fixed w-full max-w-min flex-shrink flex-grow-0 px-2" class:w-96:={help}>
65
- <!--if help is active show Help-->
66
- <!--if help is active and slot is set -->
67
- <!-- help is deactiveated -->
68
- <slot name="right"/>
69
-
66
+ <div class="w-full flex-initial items-center justify-center pt-1 px-3 max-w-screen-lg">
67
+ <slot name="middle" />
68
+ {#if links.length>0}
69
+ <div class="py-5">
70
+ {#each links as link}
71
+ <a class="chip variant-ringed" href={link.url}>{link.label}</a>
72
+ {/each}
70
73
  </div>
71
74
  {/if}
72
-
73
-
75
+ <slot/>
74
76
  </div>
77
+
78
+
79
+ {#if $$slots.right}
80
+ <div class="w-fixed w-full max-w-min flex-shrink flex-grow-0 px-2">
81
+ <slot name="right"/>
75
82
  </div>
76
-
77
- {#if help}
78
- <button class="btn btn-sm variant-filled-warning fixed bottom-5 right-10" use:popup={popupClick}>?</button>
83
+ {/if}
79
84
 
80
- <div class="card p-4 variant-filled-primary" data-popup="popupClick">
81
- <Help />
82
- <div class="arrow variant-filled-primary" />
85
+
83
86
  </div>
84
- {/if}
87
+ </div>
88
+
89
+
90
+
91
+ <Help active={help}/>
92
+
93
+
94
+
85
95
 
86
96
 
87
- {#if menu}
88
- <!-- footer -->
89
- {/if}
90
-
97
+ </AppShell>
@@ -0,0 +1,2 @@
1
+ export function getFooter(): Promise<any>;
2
+ export function getHeader(): Promise<any>;
@@ -0,0 +1,21 @@
1
+ import {Api} from "../../services/Api";
2
+
3
+
4
+ export const getFooter = async () => {
5
+ try {
6
+ const response = await Api.get('/footer');
7
+ return response.data;
8
+ } catch (error) {
9
+ console.error(error);
10
+ }
11
+ };
12
+
13
+
14
+ export const getHeader = async () => {
15
+ try {
16
+ const response = await Api.get('/header');
17
+ return response.data;
18
+ } catch (error) {
19
+ console.error(error);
20
+ }
21
+ };
@@ -6,11 +6,9 @@ import MenuBar from "./MenuBar.svelte";
6
6
  import SettingsBar from "./SettingsBar.svelte";
7
7
  let menu;
8
8
  onMount(async () => {
9
- menu = get(menuStore);
10
- if (menu === void 0) {
11
- menu = await getMenuItems();
12
- menuStore.set(menu);
13
- }
9
+ console.log("menu");
10
+ menu = await getMenuItems();
11
+ menuStore.set(menu);
14
12
  });
15
13
  </script>
16
14
 
package/dist/index.d.ts CHANGED
@@ -23,8 +23,8 @@ export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DropdownKVP, MultiS
23
23
  export { FileInfo, FileIcon, FileUploader };
24
24
  export { ListView, TableView, Spinner, Page, Alert };
25
25
  export { Api } from './services/Api.js';
26
- export { host, username, password, setApiConfig } from './stores/apiStores.ts';
27
- export type { user, inputType, fileUploaderModel, linkType, listItemType, keyValuePairType } from './models/Models.ts';
26
+ export { host, username, password, setApiConfig } from './stores/apiStores.js';
27
+ export type { userType, inputType, fileUploaderModel, linkType, listItemType, keyValuePairType } from './models/Models.js';
28
28
  export { positionType } from './models/Enums';
29
29
  export { Table, TableFilter, columnFilter, searchFilter };
30
30
  export type { TableConfig, Columns, Column };
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ export { FileInfo, FileIcon, FileUploader };
29
29
  export { ListView, TableView, Spinner, Page, Alert };
30
30
  //Api
31
31
  export { Api } from './services/Api.js';
32
- export { host, username, password, setApiConfig } from './stores/apiStores.ts';
32
+ export { host, username, password, setApiConfig } from './stores/apiStores.js';
33
33
  //enum
34
34
  export { positionType } from './models/Enums';
35
35
  // Table
@@ -1 +1 @@
1
- export function goTo(url: any): Promise<void>;
1
+ export function goTo(url: any, intern?: boolean): Promise<void>;
@@ -3,10 +3,19 @@
3
3
  import { host } from "../stores/apiStores";
4
4
 
5
5
  // go to a internal action
6
- export const goTo = async (url) => {
7
- if(window!=null && host != null && url!=null){
8
- window.open(host+url,"_self")?.focus()
6
+ export const goTo = async (url,intern=true) => {
7
+ if(intern == true) // go to inside bexis2
8
+ {
9
+ if(window!=null && host != null && url!=null){
10
+ window.open(host+url,"_self")?.focus()
11
+ }
12
+ }
13
+ else // go to a external page
14
+ {
15
+ window.open(url,"_blank")?.focus()
9
16
  }
10
17
  };
11
18
 
12
19
 
20
+
21
+
@@ -3,6 +3,9 @@ import { writable } from 'svelte/store';
3
3
  function createHelpStore() {
4
4
  // set Store Type
5
5
  const { subscribe, set, update } = writable();
6
+ const h = [];
7
+ let v;
8
+ set({ itemId: undefined, helpItems: h });
6
9
  return {
7
10
  //pass Store default functions
8
11
  subscribe,
@@ -14,8 +17,6 @@ function createHelpStore() {
14
17
  },
15
18
  //set the ID of the help item and display it
16
19
  setItemId: (itemId) => {
17
- let v;
18
- const h = [];
19
20
  helpStore.subscribe(value => {
20
21
  value = (value === undefined) ? { itemId: undefined, helpItems: h } : value;
21
22
  value.helpItems = (value.helpItems === undefined) ? h : value.helpItems;
@@ -25,8 +26,6 @@ function createHelpStore() {
25
26
  },
26
27
  //reset the ID of the help item and hide it
27
28
  resetItemId: () => {
28
- let v;
29
- const h = [];
30
29
  helpStore.subscribe(value => {
31
30
  value = (value === undefined) ? { itemId: undefined, helpItems: h } : value;
32
31
  value.helpItems = (value.helpItems === undefined) ? h : value.helpItems;
@@ -49,22 +48,14 @@ function createHelpStore() {
49
48
  },
50
49
  //reset the ID of the help item and hide it
51
50
  toggle: (itemId) => {
52
- let v;
53
- const h = [];
54
51
  helpStore.subscribe(value => {
55
52
  value = (value === undefined) ? { itemId: undefined, helpItems: h } : value;
56
53
  value.helpItems = (value.helpItems === undefined) ? h : value.helpItems;
57
- if (itemId != value.itemId) {
58
- v = { itemId: itemId, helpItems: value.helpItems };
59
- }
60
- else {
61
- v = { itemId: undefined, helpItems: value.helpItems };
62
- }
54
+ v = { itemId: itemId, helpItems: value.helpItems };
63
55
  });
64
56
  update(u => u = v);
65
57
  },
66
58
  reset: () => {
67
- const h = [];
68
59
  helpStore.set({ itemId: undefined, helpItems: h });
69
60
  },
70
61
  clear: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -64,6 +64,7 @@
64
64
  "@fortawesome/free-regular-svg-icons": "^6.2.1",
65
65
  "@fortawesome/free-solid-svg-icons": "^6.2.1",
66
66
  "axios": "^1.2.1",
67
+ "delay": "^6.0.0",
67
68
  "highlight.js": "^11.8.0",
68
69
  "highlightjs-svelte": "^1.0.6",
69
70
  "svelte": "^3.54.0",
@@ -1,47 +1,44 @@
1
- <script lang="ts">
2
- import { helpStore } from '$store/pageStores'
3
-
4
- export let id: string = '';
5
- export let label: string = '';
6
- export let required: boolean;
7
- export let feedback: string[];
8
- export let help:boolean=false;
9
-
10
- function onMouseOver()
11
- {
12
-
13
- if(help)
14
- {
15
- helpStore.show(id);
16
- }
17
-
18
- }
19
-
20
-
21
- function onMouseOut()
22
- {
23
- if(help)
24
- {
25
- helpStore.hide();
26
- }
27
- }
28
-
29
- </script>
30
- <div {id} on:mouseover={onMouseOver} on:mouseout={onMouseOut}>
31
- <label class="label">
32
- <span
33
- >{label}
34
- {#if required} <span class="text-sm text-red-600">*</span> {/if}
35
- </span>
36
- <slot />
37
- {#if feedback}
38
- <span class="text-sm text-error-600">
39
- <ul>
40
- {#each feedback as message}
41
- <li>{message}</li>
42
- {/each}
43
- </ul>
44
- </span>
45
- {/if}
46
- </label>
47
- </div>
1
+ <script lang="ts">
2
+ import { helpStore } from '$store/pageStores'
3
+
4
+ export let id: string = '';
5
+ export let label: string = '';
6
+ export let required: boolean;
7
+ export let feedback: string[];
8
+ export let help:boolean=false;
9
+
10
+ function onMouseOver()
11
+ {
12
+
13
+ if(help)
14
+ {
15
+ helpStore.show(id);
16
+ }
17
+
18
+ }
19
+
20
+
21
+ function onMouseOut()
22
+ {
23
+
24
+ }
25
+
26
+ </script>
27
+ <div {id} on:mouseover={onMouseOver} on:mouseout={onMouseOut}>
28
+ <label class="label">
29
+ <span
30
+ >{label}
31
+ {#if required} <span class="text-sm text-red-600">*</span> {/if}
32
+ </span>
33
+ <slot />
34
+ {#if feedback}
35
+ <span class="text-sm text-error-600">
36
+ <ul>
37
+ {#each feedback as message}
38
+ <li>{message}</li>
39
+ {/each}
40
+ </ul>
41
+ </span>
42
+ {/if}
43
+ </label>
44
+ </div>
@@ -0,0 +1,44 @@
1
+ <script lang="ts">
2
+ import Fa from "svelte-fa/src/fa.svelte";
3
+ import { faQuestion } from '@fortawesome/free-solid-svg-icons'
4
+ import { goTo } from '$services/BaseCaller'
5
+
6
+ // links
7
+ import type { linkType } from "$lib/models/Models";
8
+ export let links:linkType[]=[];
9
+
10
+ // popup for note
11
+ import { popup } from '@skeletonlabs/skeleton';
12
+ import type { PopupSettings } from '@skeletonlabs/skeleton';
13
+ import { computePosition, autoUpdate, offset, shift, flip, arrow } from '@floating-ui/dom';
14
+ import { storePopup } from '@skeletonlabs/skeleton';
15
+ storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
16
+
17
+ export let note:string;
18
+
19
+ //popup
20
+ const noteSettings: PopupSettings = {
21
+ event: 'click',
22
+ target: 'noteTarget',
23
+ placement: 'bottom'
24
+ };
25
+
26
+ </script>
27
+ <div class="text-right p-2">
28
+ {#if note}
29
+ <span class="chip variant-soft hover:variant-filled" use:popup={noteSettings} >
30
+ <span><Fa icon={faQuestion}/></span>
31
+ </span>
32
+
33
+ <div class="card p-4 variant-filled-primary w-60 z-50" data-popup="noteTarget">
34
+ {note}
35
+ </div>
36
+ {/if}
37
+
38
+ {#each links as link}
39
+ <span class="chip variant-soft hover:variant-filled" on:click={()=>goTo(link.url,false)}>
40
+ <span>{link.label}</span>
41
+ </span>
42
+ {/each}
43
+ </div>
44
+
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+
3
+ import { onMount } from 'svelte';
4
+ import {getFooter} from './PageCaller'
5
+
6
+ let content:string = "";
7
+ $:content;
8
+
9
+ onMount(async () => {
10
+ console.log("footer");
11
+
12
+ content = await getFooter();
13
+ console.log(content);
14
+
15
+
16
+ })
17
+
18
+ </script>
19
+
20
+ {#if content!=undefined}
21
+ {@html content}
22
+ {/if}
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+
3
+ import { onMount } from 'svelte';
4
+ import {getHeader} from './PageCaller'
5
+
6
+ let content:string = "";
7
+ $:content;
8
+
9
+ onMount(async () => {
10
+ console.log("header");
11
+
12
+ content = await getHeader();
13
+ console.log(content);
14
+
15
+
16
+ })
17
+
18
+ </script>
19
+ {#if content!=undefined}
20
+ {@html content}
21
+ {/if}
@@ -1,43 +1,66 @@
1
1
  <script lang=ts>
2
2
  import { helpStore } from '$store/pageStores'
3
3
  import type { helpItemType, helpStoreType } from "$models/Models";
4
+ import Fa from "svelte-fa/src/fa.svelte";
5
+ import { faQuestion } from '@fortawesome/free-solid-svg-icons'
4
6
 
5
- let Value:helpStoreType;
7
+ //popup
8
+ import { popup } from '@skeletonlabs/skeleton';
9
+ import type { PopupSettings } from '@skeletonlabs/skeleton';
10
+ //import { computePosition, autoUpdate, offset, shift, flip, arrow } from '@floating-ui/dom';
11
+ //import { storePopup } from '@skeletonlabs/skeleton';
12
+ import delay from 'delay';
13
+
14
+ export let active:boolean = false
15
+
16
+ let hs:helpStoreType;
6
17
  $:helpStore.subscribe(value => {
7
- Value = value;
18
+ hs = value;
8
19
  });
9
- let helpItem:helpItemType;
10
- $:helpItem = getHelpItem(Value);
20
+ let helpItem:helpItemType = {id:undefined,name:'',description:''};
21
+ $:helpItem = (active === true)
22
+ ? (hs.itemId == "") ? {id:undefined,name:'',description:''}:hs.helpItems.find(h => h.id === hs.itemId)!
23
+ : {id:undefined,name:'',description:''};
11
24
 
12
- function getHelpItem(value:helpStoreType):helpItemType
13
- {
14
- if(value != undefined && value.helpItems != undefined && value.itemId != undefined)
15
- {
16
- return (value.itemId == "") ? {id:undefined,name:'',description:''}:value.helpItems.find(h => h.id === value.itemId)!;
25
+ const helpClick: PopupSettings = {
26
+ event: 'click',
27
+ target: 'helpTarget',
28
+ placement: 'top',
29
+ state: (s) => {
30
+ if(s != true)
31
+ {
32
+ resetItemId();
33
+ }
17
34
  }
18
- return {id:undefined,name:'',description:''};
35
+ };
36
+
37
+ async function resetItemId()
38
+ {
39
+ await delay(100);
40
+ helpStore.resetItemId();
19
41
  }
20
- window.origin
21
42
 
22
43
  </script>
23
- {#if helpItem && helpItem.id}
24
- <div class="p-5 w-96 space-y-4" id={helpItem.id}>
25
- <h3 class="h3">{ helpItem.name }</h3>
26
- <p>{@html helpItem.description }</p>
27
- {#if helpItem.link}
28
- <p><a href="{helpItem.link}">... read more</a></p>
29
- {/if}
30
- </div>
31
- {:else}
32
- <div class="p-5 w-96 space-y-4">
33
- <h3 class="h3">Help</h3>
34
- <div class="space-y-4">
35
- <div class="grid grid-cols-3 gap-8">
36
- <div class="placeholder animate-pulse" />
37
- <div class="placeholder animate-pulse" />
38
- <div class="placeholder animate-pulse" />
39
- </div>
40
- <div class="placeholder w-28 animate-pulse" />
41
- </div>
42
- </div>
43
- {/if}
44
+
45
+ {#if active}
46
+ <button id="helpButton"class="chip variant-filled-warning fixed bottom-5 right-10 shadow-md" use:popup={helpClick}><Fa icon={faQuestion}/></button>
47
+
48
+ <div class="card bg-primary-300 border-solid border-2 border-primary-500 shadow-md" data-popup="helpTarget">
49
+ {#if helpItem && helpItem.id}
50
+ <div class="p-5 w-96 space-y-4" id={"helpPopup." + helpItem.id}>
51
+ <h3 class="h3">{ helpItem.name }</h3>
52
+ <p>{@html helpItem.description }</p>
53
+ {#if helpItem.link}
54
+ <p><a class="anchor" href="{helpItem.link}">... read more</a></p>
55
+ {/if}
56
+ </div>
57
+ {:else}
58
+ <div class="p-5 w-96 space-y-4" id="helpPopup">
59
+ <h3 class="h3">Help</h3>
60
+ <p>Hover over the Element, you like to know more about.</p>
61
+ </div>
62
+ {/if}
63
+ <div class="arrow variant-filled-primary" />
64
+ </div>
65
+ {/if}
66
+
@@ -4,23 +4,24 @@
4
4
  import type { linkType } from "$lib/models/Models";
5
5
 
6
6
  // ui components
7
+ import { AppShell, AppBar } from '@skeletonlabs/skeleton';
7
8
  import Menu from './menu/Menu.svelte'
9
+ import Footer from './Footer.svelte'
10
+ import Header from './Header.svelte'
8
11
  import Help from "./Help.svelte";
9
12
  import Breadcrumb from './breadcrumb/Breadcrumb.svelte';
10
13
 
11
14
  //popup
12
- import { popup } from '@skeletonlabs/skeleton';
13
- import type { PopupSettings } from '@skeletonlabs/skeleton';
14
15
  import { computePosition, autoUpdate, offset, shift, flip, arrow } from '@floating-ui/dom';
15
16
  import { storePopup } from '@skeletonlabs/skeleton';
16
17
  import { breadcrumbStore } from '$store/pageStores';
17
18
 
18
19
  storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
19
20
 
20
- import { AppShell } from '@skeletonlabs/skeleton';
21
21
 
22
22
  // stores
23
23
  import { helpStore } from '$store/pageStores';
24
+ import Docs from './Docs.svelte';
24
25
 
25
26
  export let title = "";
26
27
  export let note = "";
@@ -32,34 +33,41 @@
32
33
  export let help:boolean = false;
33
34
 
34
35
  onMount(async () => {
35
- console.log("on mount page ")
36
+ console.log("page")
36
37
  breadcrumbStore.clean();
37
38
  breadcrumbStore.addItem({label:title,link:window.location.pathname})
38
-
39
- // clean help when is not active
40
- //if(!help){ helpStore.clear() }
41
39
  });
42
40
 
43
- //popup
44
- const popupClick: PopupSettings = {
45
- event: 'click',
46
- target: 'popupClick',
47
- placement: 'top'
48
- };
49
-
50
41
  </script>
51
42
 
52
- {#if true}
53
- <Menu/>
54
- {/if}
55
- <Breadcrumb {title}/>
43
+ <AppShell>
44
+
45
+ <!--header-->
46
+ <svelte:fragment slot="header">
47
+ <AppBar padding="0" spacing="space-y-0" background="white">
48
+ <svelte:fragment slot="headline">
49
+ <Header/>
50
+ {#if true}
51
+ <Menu/>
52
+ {/if}
53
+
54
+ <div class="grid grid-cols-2">
55
+ <Breadcrumb {title}/>
56
+ <Docs {links} {note}/>
57
+ </div>
58
+ </svelte:fragment>
59
+ </AppBar>
60
+ </svelte:fragment>
61
+
62
+
63
+ <svelte:fragment slot="footer">
64
+ <Footer/>
65
+ </svelte:fragment>
66
+
67
+
56
68
 
57
69
  <div class="px-5 grid gap-5 content-center" >
58
70
 
59
- <!-- <h3 class="h3">{title}</h3>
60
- {#if note}
61
- <blockquote class="blockquote">{note}</blockquote>
62
- {/if} -->
63
71
 
64
72
  <slot name="description" />
65
73
 
@@ -71,42 +79,35 @@
71
79
  </div>
72
80
  {/if}
73
81
 
74
- <div class="w-full flex-initial items-center justify-center pt-1 px-3">
75
- <slot name="middle" />
76
- {#if links.length>0}
77
- <div class="py-5">
78
- {#each links as link}
79
- <a class="chip variant-ringed" href={link.url}>{link.label}</a>
80
- {/each}
81
- </div>
82
- {/if}
83
- <slot/>
84
- </div>
85
- {#if $$slots.right || help}
86
- <div class="w-fixed w-full max-w-min flex-shrink flex-grow-0 px-2" class:w-96:={help}>
87
- <!--if help is active show Help-->
88
- <!--if help is active and slot is set -->
89
- <!-- help is deactiveated -->
90
- <slot name="right"/>
91
-
82
+ <div class="w-full flex-initial items-center justify-center pt-1 px-3 max-w-screen-lg">
83
+ <slot name="middle" />
84
+ {#if links.length>0}
85
+ <div class="py-5">
86
+ {#each links as link}
87
+ <a class="chip variant-ringed" href={link.url}>{link.label}</a>
88
+ {/each}
92
89
  </div>
93
90
  {/if}
94
-
95
-
91
+ <slot/>
96
92
  </div>
93
+
94
+
95
+ {#if $$slots.right}
96
+ <div class="w-fixed w-full max-w-min flex-shrink flex-grow-0 px-2">
97
+ <slot name="right"/>
97
98
  </div>
98
-
99
- {#if help}
100
- <button class="btn btn-sm variant-filled-warning fixed bottom-5 right-10" use:popup={popupClick}>?</button>
99
+ {/if}
101
100
 
102
- <div class="card p-4 variant-filled-primary" data-popup="popupClick">
103
- <Help />
104
- <div class="arrow variant-filled-primary" />
101
+
105
102
  </div>
106
- {/if}
103
+ </div>
104
+
105
+
106
+
107
+ <Help active={help}/>
108
+
109
+
110
+
107
111
 
108
112
 
109
- {#if menu}
110
- <!-- footer -->
111
- {/if}
112
-
113
+ </AppShell>
@@ -0,0 +1,21 @@
1
+ import {Api} from "$lib/services/Api";
2
+
3
+
4
+ export const getFooter = async () => {
5
+ try {
6
+ const response = await Api.get('/footer');
7
+ return response.data;
8
+ } catch (error) {
9
+ console.error(error);
10
+ }
11
+ };
12
+
13
+
14
+ export const getHeader = async () => {
15
+ try {
16
+ const response = await Api.get('/header');
17
+ return response.data;
18
+ } catch (error) {
19
+ console.error(error);
20
+ }
21
+ };
@@ -14,14 +14,13 @@
14
14
 
15
15
 
16
16
  onMount(async () => {
17
-
18
- menu = get(menuStore);
19
- if(menu === undefined)
20
- {
21
- menu = await getMenuItems();
22
- menuStore.set(menu);
23
- //console.log("menu loaded",menu);
24
- }
17
+ console.log("menu");
18
+
19
+ //menu = get(menuStore);
20
+
21
+ menu = await getMenuItems();
22
+ menuStore.set(menu);
23
+
25
24
  })
26
25
 
27
26
 
package/src/lib/index.ts CHANGED
@@ -48,17 +48,17 @@ export { ListView, TableView, Spinner, Page, Alert };
48
48
 
49
49
  //Api
50
50
  export { Api } from './services/Api.js';
51
- export { host, username, password, setApiConfig } from './stores/apiStores.ts';
51
+ export { host, username, password, setApiConfig } from './stores/apiStores.js';
52
52
 
53
53
  //Type
54
54
  export type {
55
- user,
55
+ userType,
56
56
  inputType,
57
57
  fileUploaderModel,
58
58
  linkType,
59
59
  listItemType,
60
60
  keyValuePairType
61
- } from './models/Models.ts';
61
+ } from './models/Models.js';
62
62
 
63
63
  //enum
64
64
  export { positionType } from './models/Enums';
@@ -3,10 +3,19 @@
3
3
  import { host } from "$store/apiStores";
4
4
 
5
5
  // go to a internal action
6
- export const goTo = async (url) => {
7
- if(window!=null && host != null && url!=null){
8
- window.open(host+url,"_self")?.focus()
6
+ export const goTo = async (url,intern=true) => {
7
+ if(intern == true) // go to inside bexis2
8
+ {
9
+ if(window!=null && host != null && url!=null){
10
+ window.open(host+url,"_self")?.focus()
11
+ }
12
+ }
13
+ else // go to a external page
14
+ {
15
+ window.open(url,"_blank")?.focus()
9
16
  }
10
17
  };
11
18
 
12
19
 
20
+
21
+
@@ -9,6 +9,11 @@ function createHelpStore()
9
9
  // set Store Type
10
10
  const { subscribe, set, update } = writable<helpStoreType>();
11
11
 
12
+ const h:helpItemType[] = [];
13
+ let v:helpStoreType;
14
+
15
+ set({itemId:undefined, helpItems:h});
16
+
12
17
  return {
13
18
  //pass Store default functions
14
19
  subscribe,
@@ -20,8 +25,6 @@ function createHelpStore()
20
25
  },
21
26
  //set the ID of the help item and display it
22
27
  setItemId: (itemId:string) => {
23
- let v:helpStoreType;
24
- const h:helpItemType[] = [];
25
28
  helpStore.subscribe(value => {
26
29
  value = (value === undefined) ? {itemId:undefined,helpItems:h}:value;
27
30
  value.helpItems = (value.helpItems === undefined) ? h:value.helpItems;
@@ -31,8 +34,6 @@ function createHelpStore()
31
34
  },
32
35
  //reset the ID of the help item and hide it
33
36
  resetItemId: () =>{
34
- let v:helpStoreType;
35
- const h:helpItemType[] = [];
36
37
  helpStore.subscribe(value => {
37
38
  value = (value === undefined) ? {itemId:undefined,helpItems:h}:value;
38
39
  value.helpItems = (value.helpItems === undefined) ? h:value.helpItems;
@@ -54,25 +55,15 @@ function createHelpStore()
54
55
  helpStore.resetItemId();
55
56
  },
56
57
  //reset the ID of the help item and hide it
57
- toggle: (itemId:string) =>{
58
- let v:helpStoreType;
59
- const h:helpItemType[] = [];
58
+ toggle: (itemId:string) =>{
60
59
  helpStore.subscribe(value => {
61
60
  value = (value === undefined) ? {itemId:undefined,helpItems:h}:value;
62
61
  value.helpItems = (value.helpItems === undefined) ? h:value.helpItems;
63
- if(itemId != value.itemId)
64
- {
65
- v = {itemId:itemId, helpItems:value.helpItems};
66
- }
67
- else
68
- {
69
- v = {itemId:undefined, helpItems:value.helpItems};
70
- }
62
+ v = {itemId:itemId, helpItems:value.helpItems};
71
63
  });
72
64
  update(u => u = v)
73
65
  },
74
66
  reset:() =>{
75
- const h:helpItemType[] = [];
76
67
  helpStore.set({itemId:undefined, helpItems:h})
77
68
  },
78
69
  clear:() =>{
@@ -103,7 +94,7 @@ function createBreadcrumbStore()
103
94
 
104
95
  //set the ID of the help item and display it
105
96
  addItem: (item:breadcrumbItemType) => {
106
- let b:breadcrumbModel;
97
+ let b:BreadcrumbModel;
107
98
  breadcrumbStore.subscribe(value => {
108
99
 
109
100
  value = (value === undefined) ? new BreadcrumbModel():value;
@@ -120,7 +111,7 @@ function createBreadcrumbStore()
120
111
  },
121
112
 
122
113
  clean: () => {
123
- let b:Breadcrumb;
114
+ let b:BreadcrumbModel;
124
115
  breadcrumbStore.subscribe(value => {
125
116
  value = new BreadcrumbModel();
126
117
  b = value;